修复了在UE5.8下执行Puerts.Gen命令会重复生成UE编辑器侧动态类型的bug - #2351
Open
easonwzs wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
我在UE5.8下当项目根目录中已存在 Typing/ue/ue_bp.d.ts 类型声明文件时,再次执行
Puerts.Gen命令会重复生成编辑器侧的动态类型,如下:大概率是因为 UE5.8 引入/暴露的编辑器侧动态类型有关,Puerts 自己做的“非法 TS 标识符转义”。
主要可能是 UE5.8 里多了更容易被资产注册表枚举到这些
Engine.TedsDynamicColumns相关的动态类型,比如:为此,我做了两件事:修复 ue_bp.d.ts 第二次生成重复声明的根因,并过滤不需要的 UE5.8 编辑器动态类型。
根因修复放在
DeclarationGenerator.cpp的恢复缓存逻辑中。过滤逻辑放在资产注册表枚举阶段,优先跳过
/Engine/TedsDynamicColumns,减少无用声明。关键修改
修复
RestoreBlueprintTypeDeclInfos:从
.d.ts恢复 namespace 时,对每个 namespace 片段调用PUERTS_NAMESPACE::TypeScriptVariableNameToFilename,再组装真实 package path。class/enum 名称正则增加
$支持,完整捕获$58$、$32$这类转义名。恢复出的类型名也调用
TypeScriptVariableNameToFilename,确保NameToDecl的 key 和WriteOutput的Obj->GetFName()一致。增加资产过滤:
LoadAllWidgetBlueprint遍历AssetList时跳过AssetData.PackagePath或AssetData.PackageName以/Engine/TedsDynamicColumns开头的资产。ue_bp.d.ts恢复出的/Engine/TedsDynamicColumns缓存项也跳过输出或标记为不存在,避免历史污染继续保留。保持
FFileHelper::SaveStringToFile覆盖写行为不变。实现细节
增加一个小函数,例如
RestoreEscapedPackageNameFromNamespace:Engine.TedsDynamicColumns.EditorDataStorageTableDynamicTag_Alerts$32$chain/Engine/TedsDynamicColumns/EditorDataStorageTableDynamicTag_Alerts chain增加一个小函数,例如
ShouldSkipBlueprintDeclarationAsset:/Engine/TedsDynamicColumns对过滤命中项不生成、不保留旧声明;业务项目 /Game 和项目插件内容不受影响。