MassBattle Docsv1.19.20

UMassBattleFuncLibEd

UCLASS

Source/MassBattleEditor/Public/MassBattleFuncLibEd.h

概述 Overview

MassBattle 编辑器的蓝图函数库(UBlueprintFunctionLibrary),全部为静态函数,可在蓝图(Editor Utility Widget 等)中直接调用,分类 MassBattleEditor。覆盖一条完整的角色资产转换流水线:复制类资产(DuplicateClassAsset)、设置类默认属性(SetClassDefaultProperties)、骨骼网格转静态网格(ConvertSkeletalMeshToStaticMeshWithLODs)、按关键词自动查找贴图/动画/LOD 配置(FindAndFill*)、生成材质实例(CreateMaterialInstanceForStaticMeshWithLODs)、生成动画数据纹理与运行时数据(CreateAnimDataTexture / CreateAnimsDataFromSequences / ConvertLODSettingsToLODsData)、校验(ValidateAnimSequences)、按命名规范重命名资产(Rename*)与路径清理(SanitizeForPath)。

MassBattle editor Blueprint function library (UBlueprintFunctionLibrary), all static and Blueprint-callable (e.g. from Editor Utility Widgets), category MassBattleEditor. It covers a full character asset conversion pipeline: duplicate class assets (DuplicateClassAsset), set class defaults (SetClassDefaultProperties), skeletal→static mesh conversion (ConvertSkeletalMeshToStaticMeshWithLODs), keyword-based auto-find of textures/animations/LOD settings (FindAndFill*), material-instance generation (CreateMaterialInstanceForStaticMeshWithLODs), animation-data texture and runtime data generation (CreateAnimDataTexture / CreateAnimsDataFromSequences / ConvertLODSettingsToLODsData), validation (ValidateAnimSequences), convention-based asset renaming (Rename*), and path sanitization (SanitizeForPath).

继承 Inheritance

UBlueprintFunctionLibrary → UMassBattleFuncLibEd

公开方法 Public Methods

SanitizeForPath static FString

路径清理工具:从输入字符串中删除空白字符(换行/回车/制表/空格)与非法路径字符(\ : * ? " < > | ' , & ! ~ @ #)。其余字符按序保留。几乎所有本类函数的路径/名称参数都先经此清理。

Path sanitizer: removes whitespace (newline/carriage-return/tab/space) and illegal path characters (\ : * ? " < > | ' , & ! ~ @ #) from the input. All other characters are kept in order. Nearly every path/name parameter of this class is sanitized first.

Input
参数 Param类型 Type说明 Description
InStringconst FString&待清理的字符串。The string to sanitize.
Output

返回清理后的字符串;输入全为非法字符时返回空串。

Returns the sanitized string; empty when the input was all illegal characters.

DuplicateClassAsset static UClass*

复制一个类资产(蓝图)生成新蓝图并编译,返回新生成的类。流程:校验输入(源类非空、新名非空,否则报错返回 nullptr)→ 检查游戏主线程(非主线程警告返回)→ 路径与名称经 SanitizeForPath 清理 → 拼接完整包路径并检查已存在(存在则警告返回 nullptr)→ 经 FAssetToolsModule::DuplicateAsset 复制(源为 SourceClass->ClassGeneratedBy,即源蓝图)→ 结果若为蓝图则 FKismetEditorUtilities::CompileBlueprint 强制编译,返回 GeneratedClass。

Duplicates a class asset (Blueprint), compiles it, and returns the newly generated class. Flow: input validation (non-null source class, non-empty new name; errors log and return nullptr) → game-thread check (warning and return off the main thread) → path and name sanitized via SanitizeForPath → full package path built and existence-checked (warning and return if it exists) → FAssetToolsModule::DuplicateAsset copies the source (SourceClass->ClassGeneratedBy, i.e. the source Blueprint) → if the result is a Blueprint, FKismetEditorUtilities::CompileBlueprint forces a compile and GeneratedClass is returned.

Input
参数 Param类型 Type说明 Description
WorldContextUObject*世界上下文(DefaultToSelf),当前实现不使用。World context (DefaultToSelf); unused by the current implementation.
SourceClassTSubclassOf<UObject>源类(通常是蓝图的生成类)。Source class (usually a Blueprint's generated class).
NewClassNameFString新蓝图的名称(会被清理并用作资产名)。Name for the new Blueprint (sanitized and used as the asset name).
PackagePathFString目标包路径,默认 /Game/Blueprints/Duplicated(会被清理)。Target package path, default /Game/Blueprints/Duplicated (sanitized).
Output

成功返回新蓝图的 UClass*(GeneratedClass);参数无效、非主线程、目标已存在或复制结果非蓝图时返回 nullptr。副作用:创建并编译新蓝图资产。

Returns the new Blueprint's UClass* (GeneratedClass) on success; nullptr on invalid input, off-main-thread, existing target, or non-Blueprint duplicate. Side effect: creates and compiles a new Blueprint asset.

SetClassDefaultProperties static void

修改 AMassBattleAgentRenderer 派生类的默认对象(CDO)属性并重新编译蓝图:非空的 AgentMesh 写入 CDO->AgentMesh;非空的 NewNiagaraSystem 写入 CDO->NiagaraSystemAsset 并把 SubType 写入 CDO->SubType.Index(注意:SubType 仅在 Niagara 非空时写入);随后 MarkPackageDirty,若目标类是蓝图生成类则 CompileBlueprint(..., SkipGarbageCollection) 重新编译。

Mutates the class default object (CDO) of an AMassBattleAgentRenderer subclass and recompiles the Blueprint: a non-null AgentMesh writes CDO->AgentMesh; a non-null NewNiagaraSystem writes CDO->NiagaraSystemAsset and writes SubType into CDO->SubType.Index (note: SubType is written only when the Niagara system is non-null); then MarkPackageDirty, and if the target class is a Blueprint-generated class, CompileBlueprint(..., SkipGarbageCollection) recompiles it.

Input
参数 Param类型 Type说明 Description
WorldContextUObject*世界上下文(DefaultToSelf),当前实现不使用。World context (DefaultToSelf); unused by the current implementation.
TargetClassTSubclassOf<AMassBattleAgentRenderer>目标渲染器类;为空时报错返回。Target renderer class; null logs an error and returns.
AgentMeshUStaticMesh*新静态网格(可选,为空则不修改)。New static mesh (optional; skipped when null).
NewNiagaraSystemUNiagaraSystem*新 Niagara 系统(可选,为空则不修改)。New Niagara system (optional; skipped when null).
SubTypeint32写入 CDO->SubType.Index 的子类型值;仅在 NewNiagaraSystem 非空时生效。Subtype value written to CDO->SubType.Index; effective only when NewNiagaraSystem is non-null.
Output

无返回值。副作用:修改 CDO 属性、标记包脏、重新编译目标蓝图。

No return value. Side effects: mutates CDO properties, marks the package dirty, recompiles the target Blueprint.

ConvertSkeletalMeshToStaticMeshWithLODs static UStaticMesh*

把骨骼网格转换为带 LOD 的静态网格资产。流程:路径/名称清理并校验合法性(空或非法包路径报错返回 nullptr)→ 在编辑器世界生成临时 AActor + USkeletalMeshComponent(挂载源骨骼网格)→ 经 IMeshUtilities::ConvertMeshesToStaticMesh 直接生成到目标包(存在则覆盖)→ 按 LOD 逐级重建:设置 lightmap 生成开关与目标索引(LightmapIndex)、为每个 section 创建唯一材质槽(命名 {SkeletalSlotName}_LOD{LodIndex}_{SectionIndex}__{SkelMatIndex},双下划线后缀便于后续解析骨骼材质索引)、重建 section map 的材质索引 → Build() 重建网格、PostEditChange、MarkPackageDirty → 清理临时 Actor。

Converts a skeletal mesh into a static mesh asset with LODs. Flow: path/name sanitization and validation (empty or invalid package path logs and returns nullptr) → a temporary AActor + USkeletalMeshComponent (mounting the source skeletal mesh) is spawned in the editor world → IMeshUtilities::ConvertMeshesToStaticMesh generates directly into the target package (overwriting if present) → per-LOD rebuild: lightmap generation and target index (LightmapIndex) applied, a unique material slot created per section (named {SkeletalSlotName}_LOD{LodIndex}_{SectionIndex}__{SkelMatIndex}, the double-underscore suffix kept for later skeletal-material-index parsing), section-map material indices remapped → Build(), PostEditChange, MarkPackageDirty → the temporary actor is cleaned up.

Input
参数 Param类型 Type说明 Description
SkeletalMeshUSkeletalMesh*源骨骼网格(check 非空)。Source skeletal mesh (check non-null).
PackagePathconst FString&目标包路径(会被清理)。Target package path (sanitized).
AssetNameconst FString&目标资产名(会被清理)。Target asset name (sanitized).
LightmapIndexconst int32lightmap UV 通道索引,默认 0;仅在 bGenerateLightmapUVs 为 true 时生效。Lightmap UV channel index, default 0; effective only when bGenerateLightmapUVs is true.
bGenerateLightmapUVsbool是否生成 lightmap UV,默认 true。Whether to generate lightmap UVs, default true.
Output

成功返回生成的 UStaticMesh*;路径非法或转换失败返回 nullptr。副作用:创建/覆盖静态网格资产、重建材质槽与 section map、构建网格。

Returns the generated UStaticMesh* on success; nullptr on invalid path or conversion failure. Side effects: creates/overwrites the static mesh asset, rebuilds material slots and the section map, builds the mesh.

CreateMaterialInstanceForStaticMeshWithLODs static void

为转换后的静态网格的每个材质槽创建材质实例并应用原始贴图。流程:解析每个槽名 {Base}__{Index} 的双下划线后缀得到骨骼材质索引;按 Mat_{AssetName}_{BaseNamePart}(AssetName 为空或 "None" 时为 Mat_{BaseNamePart})创建 UMaterialInstanceConstant(父材质 ParentMaterial);用 OriginalTexturesArray[Index] 按参数映射设置贴图参数——AOTex/UseAOTex、ARMTex/UseARMTex、BaseColorTex/UseColorTex、SpecularTex/UseSpecularTex、EmissiveTex/UseEmissiveTex、NormalTex/UseNormalTex、OpacityTex/UseOpacityTex、RoughnessTex/UseRoughnessTex、MetallicTex/UseMetallicTex(贴图非空时同步开启对应静态开关);设置 PreviewMesh、注册资产、把实例赋回网格对应槽;最后清理槽名中的 __ 解析后缀并重建网格。

Creates a material instance per material slot of the converted static mesh and applies the original textures. Flow: each slot name {Base}__{Index} is parsed on the double-underscore suffix for the skeletal material index; a UMaterialInstanceConstant is created as Mat_{AssetName}_{BaseNamePart} (or Mat_{BaseNamePart} when AssetName is empty/"None") with parent ParentMaterial; textures from OriginalTexturesArray[Index] are applied through the parameter mapping — AOTex/UseAOTex, ARMTex/UseARMTex, BaseColorTex/UseColorTex, SpecularTex/UseSpecularTex, EmissiveTex/UseEmissiveTex, NormalTex/UseNormalTex, OpacityTex/UseOpacityTex, RoughnessTex/UseRoughnessTex, MetallicTex/UseMetallicTex (each non-null texture also enables its static switch); PreviewMesh is set, the asset registered, and the instance assigned back to the mesh slot; finally the __ parsing suffixes are stripped from slot names and the mesh is rebuilt.

Input
参数 Param类型 Type说明 Description
InStaticMeshUStaticMesh*转换后的静态网格;为空或父材质为空时报错返回。The converted static mesh; null mesh or null parent logs an error and returns.
PackagePathconst FString&材质实例的目标包路径(会被清理)。Target package path for the material instances (sanitized).
AssetNameconst FString&资产名,参与实例命名。Asset name, part of the instance naming.
ParentMaterialUMaterialInterface*材质实例的父材质。Parent material of the instances.
OriginalTexturesArrayconst TArray<FOriginalTextures>&按骨骼材质索引排列的原始贴图组数组。Original texture groups indexed by skeletal material index.
Output

无返回值。副作用:创建若干材质实例资产、修改网格材质槽与槽名、重建网格。

No return value. Side effects: creates material-instance assets, mutates mesh material slots and slot names, rebuilds the mesh.

FindAndFillOriginalTextures static TArray<FOriginalTextures>

按命名关键词自动查找骨骼网格各材质槽的原始贴图。流程:清空并重建输入数组;经 AssetRegistry 递归搜索 SearchPath 下的 UTexture2D;对每个材质槽,以槽名(M_/MI_/Inst_ 前缀被剥除)为搜索键,遍历资产列表按「含 AssetName 过滤 + 含类型关键词 + 含槽名键」三条件匹配——_BaseColor/_BC/_Albedo/_Diffuse/_D/_Color → BaseColor,_Normal/_N/_Nor → Normal,_Roughness/_R/_Rough → Roughness,_Metallic/_M/_Metal → Metallic,_Specular/_S/_Spec → Specular,_Emissive/_E/_Emiss → Emissive,_Opacity/_O/_Mask/_Trans → Opacity,_AO/_AmbientOcclusion/_Occlusion → AO,_ARM/_ORM/_MRA → ARM(命中时 bUseARM=true)。结果按槽索引顺序返回。

Auto-finds each skeletal-mesh material slot's original textures by naming keywords. Flow: the input array is cleared and rebuilt; AssetRegistry recursively searches UTexture2D assets under SearchPath; for each material slot, the slot name (prefixes M_/MI_/Inst_ stripped) becomes the search key, and assets are matched on three conditions — "contains AssetName filter + contains type keyword + contains the slot-name key": _BaseColor/_BC/_Albedo/_Diffuse/_D/_Color → BaseColor, _Normal/_N/_Nor → Normal, _Roughness/_R/_Rough → Roughness, _Metallic/_M/_Metal → Metallic, _Specular/_S/_Spec → Specular, _Emissive/_E/_Emiss → Emissive, _Opacity/_O/_Mask/_Trans → Opacity, _AO/_AmbientOcclusion/_Occlusion → AO, _ARM/_ORM/_MRA → ARM (sets bUseARM=true when hit). Results are returned in slot-index order.

Input
参数 Param类型 Type说明 Description
MeshUSkeletalMesh*源骨骼网格;为空或路径为空时返回空结果。Source skeletal mesh; null mesh or empty path returns an empty result.
OriginalTexturesTArray<FOriginalTextures>输出容器(传入值被清空重建)。Output container (the passed-in value is cleared and rebuilt).
SearchPathconst FString&递归搜索的资产目录(会被清理)。Asset directory searched recursively (sanitized).
AssetNameconst FString&资产名过滤子串(为空则不按名字过滤)。Asset-name substring filter (no filtering when empty).
Output

返回填充后的数组(每个材质槽一个条目);输入无效时返回空数组。无资产创建副作用。

Returns the filled array (one entry per material slot); empty on invalid input. No asset-creation side effects.

FindAndFillAnimSequences static FFoundAnimSequences

按命名关键词自动查找并分类动画序列。流程:校验网格与骨架(无骨架或路径为空返回输入原样);经 AssetRegistry 递归搜索 UAnimSequence;逐资产过滤——名称含 FileName(非空时)、加载后 GetSkeleton() 与目标骨架指针相等、再按关键词归类(Idle/Idling → Idle,Move/Walk/Run/Crawl/Fly/Swim/Dash/Sprint → Move,Fall/Falling/Jump/Land → Fall,Appear/Birth/Spawn/Born/Wake/Rise → Appear,Attack/Fire/Firing/Shoot/Cast/Strike/Bash/Slash/Punch/Kick → Attack,Hit/BeingHit/Reaction/Damage/Hurt → Hit,Death/Die/Dying/Dead/Kill → Death,Other/Skill/Ability/Special/Block/Dodge/Evade/Stun/Taunt → Other)。每类最多 5 个(AddUnique)。

Auto-finds and categorizes animation sequences by naming keywords. Flow: mesh and skeleton validation (no skeleton or empty path returns the input as-is); AssetRegistry recursively searches UAnimSequence; each asset is filtered — name contains FileName (when non-empty), the loaded asset's GetSkeleton() is pointer-equal to the target skeleton, then classified by keywords (Idle/Idling → Idle, Move/Walk/Run/Crawl/Fly/Swim/Dash/Sprint → Move, Fall/Falling/Jump/Land → Fall, Appear/Birth/Spawn/Born/Wake/Rise → Appear, Attack/Fire/Firing/Shoot/Cast/Strike/Bash/Slash/Punch/Kick → Attack, Hit/BeingHit/Reaction/Damage/Hurt → Hit, Death/Die/Dying/Dead/Kill → Death, Other/Skill/Ability/Special/Block/Dodge/Evade/Stun/Taunt → Other). Max 5 per category (AddUnique).

Input
参数 Param类型 Type说明 Description
TargetMeshUSkeletalMesh*目标骨骼网格(其骨架用于匹配)。Target skeletal mesh (its skeleton is used for matching).
FoundAnimsFFoundAnimSequences输出容器(传入值保留,结果追加到各分类)。Output container (the passed-in value is kept; results append to each category).
SearchPathconst FString&递归搜索的资产目录(会被清理)。Asset directory searched recursively (sanitized).
FileNameconst FString&文件名过滤子串(为空则不按名字过滤)。File-name substring filter (no filtering when empty).
Output

返回追加后的分类数组;网格/骨架/路径无效时返回输入原样。

Returns the categorized arrays appended to; the input as-is when the mesh/skeleton/path is invalid.

FindAndFillLODSettings static TArray<FLODDataEd>

从骨骼网格的 LOD 信息生成编辑器侧 LOD 配置数组。流程:清空输入数组;取 GetLODNum(),超过 5 个 LOD 时弹提示框(仅保留前 5);对前 min(Num, 5) 个 LOD——LODIndex 记为 i;最后一个 LOD 的 ScreenSize 恒为 0.0(承接所有更小屏幕占比);其余取 LODInfo[i+1].ScreenSize.Default(注释说明:MassBattle 语义是「屏幕尺寸超过此值使用该 LOD」的下界,而 UE 是上界,因此取下一级阈值),LODInfo 缺失时回退 0.25^(i+1)。

Generates the editor-side LOD configuration array from a skeletal mesh's LOD info. Flow: the input array is cleared; GetLODNum() is read and more than 5 LODs pop a dialog (only the top 5 kept); for the first min(Num, 5) LODs — LODIndex set to i; the last LOD's ScreenSize is always 0.0 (catching everything smaller); the others take LODInfo[i+1].ScreenSize.Default (comments explain MassBattle's "use this LOD when screen size EXCEEDS this value" lower-bound semantics vs UE's upper bound, hence the next LOD's threshold), falling back to 0.25^(i+1) when LOD info is missing.

Input
参数 Param类型 Type说明 Description
MeshUSkeletalMesh*源骨骼网格;为空时返回输入原样。Source skeletal mesh; null returns the input as-is.
LODSettingsTArray<FLODDataEd>输出容器(传入值被清空重建)。Output container (the passed-in value is cleared and rebuilt).
Output

返回填充后的数组(0–5 个条目);网格为空时返回输入原样。副作用:LOD 数超过 5 时弹出提示对话框。

Returns the filled array (0–5 entries); the input as-is when the mesh is null. Side effect: a dialog pops when the mesh has more than 5 LODs.

CreateAnimDataTexture static UTexture2D*

创建存储动画帧数据(StartFrame/EndFrame)的纹理资产:尺寸 40×1、格式 RGBA16F。布局:R = StartFrame、G = EndFrame(B/A 为 0);最多 40 个动画,每个对应一列像素,越界的输入索引写 0。纹理设置:SRGB=false、TC_HDR、TF_Nearest、无 mipmap、TEXTUREGROUP_Pixels2D。创建后 PostEditChange + MarkPackageDirty + 注册资产,并输出读取该纹理的 HLSL 片段日志。

Creates a texture asset storing animation frame data (StartFrame/EndFrame): size 40×1, format RGBA16F. Layout: R = StartFrame, G = EndFrame (B/A zero); up to 40 animations, one column each; out-of-range input indices write 0. Texture settings: SRGB=false, TC_HDR, TF_Nearest, no mipmaps, TEXTUREGROUP_Pixels2D. After creation: PostEditChange + MarkPackageDirty + asset registration, plus HLSL sample snippets logged for reading the texture.

Input
参数 Param类型 Type说明 Description
Animsconst TArray<FAnimToTextureAnimInfo>&动画帧信息数组(取每项 StartFrame/EndFrame),最多使用前 40 项。Animation frame info array (each item's StartFrame/EndFrame used), at most the first 40 items.
PackagePathconst FString&目标包路径(会被清理);为空报错返回 nullptr。Target package path (sanitized); empty logs an error and returns nullptr.
AssetNameconst FString&目标资产名(会被清理);为空报错返回 nullptr。Target asset name (sanitized); empty logs an error and returns nullptr.
Output

成功返回创建的 UTexture2D*;路径/名称为空返回 nullptr。副作用:创建纹理资产并注册。

Returns the created UTexture2D* on success; nullptr on empty path/name. Side effect: creates and registers the texture asset.

CreateAnimsDataFromSequences static FAnimsData

把分类的软动画序列列表转换为运行时 FAnimsData。对每个分类,把前 5 个序列(超过 5 的部分忽略)经 DataAsset->GetIndexFromAnimSequence 解析其在 VAT Data Asset 中的烘焙索引(INDEX_NONE 或越界时警告跳过),构造 FVector4f:X=烘焙索引、Y=播放时长(GetPlayLength)、Z=StartFrame、W=EndFrame,填入对应 FAnimData 的 Anim0–Anim4 槽。

Converts the categorized soft anim-sequence lists into runtime FAnimsData. For each category, the first 5 sequences (beyond 5 ignored) are resolved to their baked index in the VAT Data Asset via DataAsset->GetIndexFromAnimSequence (warned and skipped on INDEX_NONE or out-of-range), building an FVector4f: X=baked index, Y=play length (GetPlayLength), Z=StartFrame, W=EndFrame, filled into the Anim0–Anim4 slots of the corresponding FAnimData.

Input
参数 Param类型 Type说明 Description
DataAssetUAnimToTextureDataAsset*VAT Data Asset,提供烘焙帧信息与索引解析;为空报错并返回默认构造结果。VAT Data Asset providing baked frame info and index resolution; null logs an error and returns a default-constructed result.
FoundAnimsconst FFoundAnimSequences&分类动画序列集合。The categorized anim-sequence collection.
Output

返回填充后的 FAnimsData;Data Asset 为空时返回默认构造结果(全 0)。

Returns the filled FAnimsData; a default-constructed result (all zero) when the Data Asset is null.

ConvertLODSettingsToLODsData static FLODsData

把编辑器侧 FLODDataEd 数组转换为运行时 FLODsData:按 LODIndex(0–4)把 ScreenSize 与 AnimBlendLevel 分别写入 Data0–Data4 对应槽;索引越界的条目被忽略。

Converts the editor-side FLODDataEd array into runtime FLODsData: by LODIndex (0–4), ScreenSize and AnimBlendLevel are written into the matching Data0–Data4 slot; out-of-range indices are ignored.

Input
参数 Param类型 Type说明 Description
LODSettingsconst TArray<FLODDataEd>&编辑器侧 LOD 配置数组。Editor-side LOD configuration array.
Output

返回转换后的 FLODsData;数组为空时返回默认构造结果。

Returns the converted FLODsData; default-constructed when the array is empty.

ValidateAnimSequences static FFoundAnimSequences

校验动画序列集合:每个分类超过 5 个时截断到 5 并记录消息;累加所有动画的采样帧数(GetNumberOfSampledKeys),总帧数超过 8192 时记录溢出警告。存在任何消息时弹出对话框展示。返回修改后的集合。

Validates the anim-sequence collection: categories larger than 5 are truncated to 5 with a message recorded; all animations' sampled key counts (GetNumberOfSampledKeys) accumulate, and a total above 8192 records an overflow warning. Any messages pop a dialog. Returns the modified collection.

Input
参数 Param类型 Type说明 Description
FoundAnimsFFoundAnimSequences待校验的集合(按值传入,超限分类被就地截断)。The collection to validate (passed by value; oversized categories are truncated in place).
Output

返回截断/校验后的集合。副作用:存在问题时弹出消息对话框。

Returns the truncated/validated collection. Side effect: a message dialog pops when issues exist.

RenameSkeletalMesh static void

按规范重命名骨骼网格并同步材质槽名:网格资产重命名为 SKM_{AssetName}(保持原包路径),成功后保存包;随后用 OriginalTextures[i].SlotName 作为材质槽的新名称逐槽重命名(数量不匹配时警告返回),有变化时 PostEditChange + MarkPackageDirty + 保存。

Renames the skeletal mesh by convention and syncs material slot names: the mesh asset is renamed to SKM_{AssetName} (keeping its package path) and saved on success; then each material slot is renamed to OriginalTextures[i].SlotName (a count mismatch warns and returns), with PostEditChange + MarkPackageDirty + save when anything changed.

Input
参数 Param类型 Type说明 Description
SkeletalMeshUSkeletalMesh*目标骨骼网格;为空或 AssetName 为空时警告返回。Target skeletal mesh; null mesh or empty AssetName warns and returns.
OriginalTexturesconst TArray<FOriginalTextures>&贴图组数组,其 SlotName 用作新材质槽名。Texture-group array whose SlotName values become the new material slot names.
AssetNameconst FString&用于 SKM_{AssetName} 命名。Used in the SKM_{AssetName} naming.
Output

无返回值。副作用:重命名资产、重命名材质槽、保存包。

No return value. Side effects: renames the asset and material slots, saves packages.

RenameOriginalTextures static void

按规范重命名原始贴图:每个非空贴图重命名为 Tex_{AssetName}_{SlotName}{类型后缀}(保持原包路径)——_Color/_Normal/_Roughness/_Metallic/_Specular/_Emissive/_Opacity/_AO/_ARM 对应各字段;空 SlotName 的条目跳过(警告);成功后保存涉及的包。

Renames the original textures by convention: each non-null texture becomes Tex_{AssetName}_{SlotName}{type suffix} (keeping its package path) — _Color/_Normal/_Roughness/_Metallic/_Specular/_Emissive/_Opacity/_AO/_ARM per field; entries with an empty SlotName are skipped with a warning; affected packages are saved on success.

Input
参数 Param类型 Type说明 Description
OriginalTexturesconst TArray<FOriginalTextures>&贴图组数组。The texture-group array.
AssetNameconst FString&资产名,参与命名;为空时警告返回。Asset name, part of the naming; empty warns and returns.
Output

无返回值。副作用:重命名贴图资产、保存包。

No return value. Side effects: renames texture assets, saves packages.

RenameAnimSequences static void

按规范重命名动画序列:每个非空序列重命名为 Anim_{AssetName}_{类型}_{序号}(保持原包路径),类型为 Idle/Move/Fall/Appear/Attack/Hit/Death/Other,序号为分类内索引;成功后保存涉及的包。

Renames animation sequences by convention: each non-null sequence becomes Anim_{AssetName}_{type}_{index} (keeping its package path), with type one of Idle/Move/Fall/Appear/Attack/Hit/Death/Other and index the position within the category; affected packages are saved on success.

Input
参数 Param类型 Type说明 Description
FoundAnimsconst FFoundAnimSequences&分类动画集合。The categorized anim collection.
AssetNameconst FString&资产名,参与命名;为空时警告返回。Asset name, part of the naming; empty warns and returns.
Output

无返回值。副作用:重命名动画资产、保存包。

No return value. Side effects: renames anim assets, saves packages.

管线角色 Pipeline Role

角色资产转换流水线的调用顺序(各函数为 BlueprintCallable,可从编辑器工具蓝图按需编排,源码未规定固定顺序):FindAndFillLODSettings / FindAndFillOriginalTextures / FindAndFillAnimSequences 收集源数据 → ValidateAnimSequences 校验 → ConvertSkeletalMeshToStaticMeshWithLODs 生成静态网格 → CreateMaterialInstanceForStaticMeshWithLODs 生成材质实例 → CreateAnimsDataFromSequences / ConvertLODSettingsToLODsData 生成运行时数据 → CreateAnimDataTexture 生成动画帧纹理 → RenameSkeletalMesh / RenameOriginalTextures / RenameAnimSequences 按规范重命名 → SetClassDefaultProperties / DuplicateClassAsset 配置与复制渲染器类。SanitizeForPath 是路径参数的公共前置处理。

Call order of the character asset conversion pipeline (each function is BlueprintCallable and can be orchestrated from editor tool Blueprints at will; the source defines no fixed order): FindAndFillLODSettings / FindAndFillOriginalTextures / FindAndFillAnimSequences collect source data → ValidateAnimSequences validates → ConvertSkeletalMeshToStaticMeshWithLODs produces the static mesh → CreateMaterialInstanceForStaticMeshWithLODs produces material instances → CreateAnimsDataFromSequences / ConvertLODSettingsToLODsData produce runtime data → CreateAnimDataTexture produces the animation frame texture → RenameSkeletalMesh / RenameOriginalTextures / RenameAnimSequences rename by convention → SetClassDefaultProperties / DuplicateClassAsset configure and duplicate renderer classes. SanitizeForPath is the common pre-processing for path parameters.

补充说明 Notes

本类全部为编辑器专用函数(MassBattleEditor 模块),依赖 AssetTools / AssetRegistry / MeshUtilities / MaterialEditingLibrary 等编辑器模块,运行时不可调用。多数函数会创建或修改资产并直接保存包——调用前请确认目标包路径。

All functions of this class are editor-only (the MassBattleEditor module depends on AssetTools / AssetRegistry / MeshUtilities / MaterialEditingLibrary etc.); they cannot run at runtime. Most functions create or mutate assets and save packages directly — verify the target package path before calling.