MassBattleEditorStructs.h
Source/MassBattleEditor/Public/MassBattleEditorStructs.h
概述Overview
MassBattle 编辑器模块的数据承载结构体集合,全部为 BlueprintType 纯数据 USTRUCT(无方法),外加一个决定烘焙分支的枚举。覆盖五类用途:EBakeToolMode —— 两个工具模式(Standard / Advanced),由模型源推导,Sprite 只是逐档渲染模式之一;FSpriteAnimSlotEd 与 FSpriteAnimsEd —— 图集管线的帧区间(按八个动画桶组织);FLODDataEd —— VAT LOD 配置(编辑器侧编辑用,运行时由 FLODsData 承载);FVATTexArray —— VAT 纹理数组;FOriginalTextures —— 原始材质贴图槽位记录(转换流程中临时保存;Roughness / Metallic / AO 在启用 ARM 贴图时隐藏);FFoundAnimSequences —— 按动画类型分类的序列集合(每类最多 8 个,对应 FAnimData 的 Anim0–Anim7 槽位)。这些结构体主要被 MassBattleFuncLibEd.h 的编辑器函数与烘焙面板作为参数/返回值使用。
Data-carrying struct collection of the MassBattle editor module — all pure-data BlueprintType USTRUCTs (no methods), plus one enum that selects the bake branch. Five use cases: EBakeToolMode — the two tool modes (Standard / Advanced), derived from the model source, with Sprite as one of the per-band render modes; FSpriteAnimSlotEd and FSpriteAnimsEd — the atlas pipeline's frame ranges (organized into eight animation buckets); FLODDataEd — VAT LOD configuration (edited editor-side; carried at runtime by FLODsData); FVATTexArray — VAT texture array; FOriginalTextures — original material texture-slot records (temporarily kept during conversion; Roughness / Metallic / AO are hidden when an ARM texture is used); FFoundAnimSequences — anim sequences grouped by animation type (max 8 per category, matching the Anim0–Anim7 slots of FAnimData). These structs serve mainly as parameters/returns of the editor functions in MassBattleFuncLibEd.h and of the bake panel.
EBakeToolMode UENUM
顶层烘焙模式,决定走哪条分支(Standard / Advanced)。它由模型源推导,不是用户在面板上的选择;渲染模式则是逐 LOD 档的选择(FLODDataEd::RenderMode),与它正交。Sprite 是渲染模式之一,不是顶层模式。
The top-level bake mode selects which branch runs — Standard or Advanced. It is derived from the model source, not picked by the user on the panel; the render mode is a per-LOD-band choice (FLODDataEd::RenderMode), orthogonal to it. Sprite is one of the render modes, not a top-level mode.
| 值Value | 显示名Display name | 说明Description |
|---|---|---|
Standard | Standard | 单单位快速路径:一份骨骼网格 / 一张图集 / 一个 actor 类,逐 LOD 档选择渲染模式;网格档烘静态网格 + VAT 纹理,Sprite 档只装配不烘像素。Single unit: one skeletal mesh / one atlas / one actor class, with a render mode chosen per LOD band; mesh bands bake a static mesh + VAT textures, sprite bands assemble only. |
Advanced | Advanced | Assembly 模板 → 逐版本 VAT 烘焙 + 多部件渲染结构 + 组合配方。An Assembly template → per-version VAT bakes + the multi-part render structure + combination recipes. |
FLODDataEd USTRUCT
VAT(顶点动画纹理)LOD 配置的编辑器侧表示。与运行时 FLODsData 的固定 5 槽不同,本结构体以数组形式存在,由 ConvertLODSettingsToLODsData 转为运行时结构。
Editor-side representation of VAT (vertex-animated-texture) LOD configuration. Unlike the runtime FLODsData with its fixed 5 slots, this struct lives in an array and is converted to the runtime form by ConvertLODSettingsToLODsData.
成员变量Members
| 名称Name | 类型Type | 默认值 | 说明Description |
|---|---|---|---|
ScreenSize | float | 0 | 屏幕尺寸阈值(0–1,Clamp)。含义为「超过此值使用该 LOD」的下界语义——FindAndFillLODSettings 用下一级 LOD 的阈值填充。Screen-size threshold (0–1, clamped). Uses the "use this LOD when screen size EXCEEDS this value" lower-bound semantics — FindAndFillLODSettings fills it from the next LOD's threshold. |
LODIndex | int32 | 0 | VAT Mesh 的 LOD 层级(0–4,Clamp)。VAT Mesh LOD index (0–4, clamped). |
AnimBlendLevel | int32 | 3 | 该 VAT 使用的动画融合层级(1–3,Clamp)。默认 3:第 2/3 层只在顶点模式下生效,骨骼模式忽略它们,所以高默认值在骨骼模式下零成本。Animation blend level this VAT uses (1–3, clamped). Defaults to 3: levels 2 and 3 only take effect in vertex mode and are ignored in bone mode, so the high default costs nothing there. |
RenderMode | EVATRenderMode | BoneCS | 本 LOD 带的渲染模式:Actor / Bone CS / VAT Vertex / Sprite / None,一档一种。它与顶层工具模式正交,允许逐档混排。Render mode of this LOD band: Actor / Bone CS / VAT Vertex / Sprite / None, one per band. It is orthogonal to the top-level tool mode, so bands can mix. |
FSpriteAnimSlotEd USTRUCT
图集管线上一个动画槽的帧区间。格子按行主序自左上角线性编号(均匀图集的通行做法,例如 Aseprite 导出);StartFrame 与 FrameCount 合起来界定这一段动画占用的连续格号。
One animation slot's frame range on the atlas pipeline. Cells are numbered linearly, row-major from the top-left (the usual convention for uniform sheets, e.g. Aseprite exports); StartFrame and FrameCount together delimit the contiguous cells this clip occupies.
成员变量Members
| 名称Name | 类型Type | 默认值 | 说明Description |
|---|---|---|---|
StartFrame | int32 | 0 | 首帧格号(行主序,自左上角),最小 0。First cell index (row-major from the top-left), minimum 0. |
FrameCount | int32 | 0 | 帧数;0 表示该槽未使用。Frame count; 0 means this slot is unused. |
FSpriteAnimsEd USTRUCT
图集管线的八桶帧区间集合,桶的语义与 FFoundAnimSequences 一致(Idle/Move 为循环底轨,其余为一次性片段),所以同一套动画分类在两条管线上通用。每个桶最多 8 个槽。
The atlas pipeline's eight-bucket frame-range set. The buckets carry the same meaning as in FFoundAnimSequences (Idle/Move are the looping base tracks, the rest play once), so the same animation taxonomy works on both pipelines. Each bucket holds up to eight slots.
成员变量Members
| 名称Name | 类型Type | 默认值 | 说明Description |
|---|---|---|---|
Idle | TArray<FSpriteAnimSlotEd> | 空empty | 待机帧区间(最多 8 槽)。Idle frame ranges (up to eight slots). |
Move | TArray<FSpriteAnimSlotEd> | 空empty | 移动帧区间(最多 8 槽)。Move frame ranges (up to eight slots). |
Fall | TArray<FSpriteAnimSlotEd> | 空empty | 坠落帧区间(最多 8 槽)。Fall frame ranges (up to eight slots). |
Appear | TArray<FSpriteAnimSlotEd> | 空empty | 出现帧区间(最多 8 槽)。Appear frame ranges (up to eight slots). |
Attack | TArray<FSpriteAnimSlotEd> | 空empty | 攻击帧区间(最多 8 槽)。Attack frame ranges (up to eight slots). |
Hit | TArray<FSpriteAnimSlotEd> | 空empty | 受击帧区间(最多 8 槽)。Hit frame ranges (up to eight slots). |
Death | TArray<FSpriteAnimSlotEd> | 空empty | 死亡帧区间(最多 8 槽)。Death frame ranges (up to eight slots). |
Other | TArray<FSpriteAnimSlotEd> | 空empty | 其它/蒙太奇帧区间(最多 8 槽)。Other / montage frame ranges (up to eight slots). |
FVATTexArray USTRUCT
VAT 纹理的数组容器。
Array container for VAT textures.
成员变量Members
| 名称Name | 类型Type | 默认值 | 说明Description |
|---|---|---|---|
VATTextures | TArray<TObjectPtr<UTexture2D>> | 空empty | VAT 纹理列表。List of VAT textures. |
FOriginalTextures USTRUCT
一个材质槽的原始贴图组记录:骨骼网格的每个材质槽对应一个实例,保存转换前/整理后的各贴图引用与槽名。编辑流程中 FindAndFillOriginalTextures 按命名关键词自动填充,CreateMaterialInstanceForStaticMeshWithLODs 按纹理参数映射应用到生成的材质实例,RenameOriginalTextures 按 Tex_{AssetName}_{SlotName}{后缀} 规范重命名。
The original texture group record for one material slot: one instance per skeletal-mesh slot, holding the texture references and slot name before/after organization. In the editor flow FindAndFillOriginalTextures auto-fills by naming keywords, CreateMaterialInstanceForStaticMeshWithLODs applies them to the generated material instance via the texture-parameter mapping, and RenameOriginalTextures renames them to the Tex_{AssetName}_{SlotName}{suffix} convention.
成员变量Members
| 名称Name | 类型Type | 默认值 | 说明Description |
|---|---|---|---|
SlotName | FString | — | 材质槽名称。Name of the material slot. |
bUseARM | bool | false | 是否使用 ARM(粗糙度/环境光遮蔽/金属度)合一贴图。为 true 时,Roughness / Metallic / AO 字段在编辑器中隐藏(EditConditionHides)。FindAndFillOriginalTextures 找到 ARM 贴图时自动置 true。Whether an ARM (roughness/ambient-occlusion/metallic) combined texture is used. When true, the Roughness / Metallic / AO fields are hidden in the editor (EditConditionHides). FindAndFillOriginalTextures sets it automatically when an ARM texture is found. |
ARM | TObjectPtr<UTexture2D> | — | ARM 合一贴图。ARM combined texture. |
BaseColor | TObjectPtr<UTexture2D> | — | 基础颜色贴图。Base color texture. |
Specular | TObjectPtr<UTexture2D> | — | 高光贴图。Specular texture. |
Roughness | TObjectPtr<UTexture2D> | — | 粗糙度贴图。EditCondition = "bUseARM == false" 且 EditConditionHides。Roughness texture. EditCondition = "bUseARM == false" with EditConditionHides. |
Normal | TObjectPtr<UTexture2D> | — | 法线贴图。Normal map texture. |
Metallic | TObjectPtr<UTexture2D> | — | 金属度贴图。EditCondition = "bUseARM == false" 且 EditConditionHides。Metallic texture. EditCondition = "bUseARM == false" with EditConditionHides. |
Emissive | TObjectPtr<UTexture2D> | — | 自发光贴图。Emissive texture. |
Opacity | TObjectPtr<UTexture2D> | — | 不透明度贴图。Opacity texture. |
AO | TObjectPtr<UTexture2D> | — | 环境光遮蔽贴图。EditCondition = "bUseARM == false" 且 EditConditionHides。Ambient-occlusion texture. EditCondition = "bUseARM == false" with EditConditionHides. |
FFoundAnimSequences USTRUCT
按动画类型分类的动画序列集合。各分类数组由 FindAndFillAnimSequences 按命名关键词填充(每类最多 8 个),ValidateAnimSequences 校验并截断;CreateAnimsDataFromSequences 把每类的序列映射到 FAnimData 的 Anim0–Anim7 槽位。
Anim-sequence collection grouped by animation type. Each category array is filled by FindAndFillAnimSequences using naming keywords (max 8 per category), validated/truncated by ValidateAnimSequences; CreateAnimsDataFromSequences maps each category's sequences into the Anim0–Anim7 slots of FAnimData.
成员变量Members
| 名称Name | 类型Type | 默认值 | 说明Description |
|---|---|---|---|
Idle | TArray<TObjectPtr<UAnimSequence>> | 空empty | 待机动画(关键词 Idle/Idling)。Idle animations (keywords Idle/Idling). |
Move | TArray<TObjectPtr<UAnimSequence>> | 空empty | 移动动画(关键词 Move/Walk/Run/Crawl/Fly/Swim/Dash/Sprint)。Move animations (keywords Move/Walk/Run/Crawl/Fly/Swim/Dash/Sprint). |
Fall | TArray<TObjectPtr<UAnimSequence>> | 空empty | 坠落动画(关键词 Fall/Falling/Jump/Land)。Fall animations (keywords Fall/Falling/Jump/Land). |
Appear | TArray<TObjectPtr<UAnimSequence>> | 空empty | 出场动画(关键词 Appear/Birth/Spawn/Born/Wake/Rise)。Appear animations (keywords Appear/Birth/Spawn/Born/Wake/Rise). |
Attack | TArray<TObjectPtr<UAnimSequence>> | 空empty | 攻击动画(关键词 Attack/Fire/Firing/Shoot/Cast/Strike/Bash/Slash/Punch/Kick)。Attack animations (keywords Attack/Fire/Firing/Shoot/Cast/Strike/Bash/Slash/Punch/Kick). |
Hit | TArray<TObjectPtr<UAnimSequence>> | 空empty | 受击动画(关键词 Hit/BeingHit/Reaction/Damage/Hurt)。Hit animations (keywords Hit/BeingHit/Reaction/Damage/Hurt). |
Death | TArray<TObjectPtr<UAnimSequence>> | 空empty | 死亡动画(关键词 Death/Die/Dying/Dead/Kill)。Death animations (keywords Death/Die/Dying/Dead/Kill). |
Other | TArray<TObjectPtr<UAnimSequence>> | 空empty | 其它动画(关键词 Other/Skill/Ability/Special/Block/Dodge/Evade/Stun/Taunt)。Other animations (keywords Other/Skill/Ability/Special/Block/Dodge/Evade/Stun/Taunt). |
管线角色Pipeline Role
这些结构体是编辑器资产转换流程的数据载体:FLODDataEd / FFoundAnimSequences / FOriginalTextures 作为 UMassBattleFuncLibEd 静态函数的输入/输出(查找、校验、转换、重命名各环节),最终转化为运行时数据——LOD 配置经 ConvertLODSettingsToLODsData 写入 FLODsData;动画经 CreateAnimsDataFromSequences 写入 FAnimsData(定义于 Fragments/Animation.h)。EBakeToolMode 与 FSpriteAnimsEd 由烘焙面板持有:前者决定跑哪条管线,后者在图集管线里被翻译成 FAnimData 的帧区间。
These structs are the data carriers of the editor asset-conversion flow: FLODDataEd / FFoundAnimSequences / FOriginalTextures serve as inputs/outputs of the UMassBattleFuncLibEd static functions (find, validate, convert, rename stages), eventually becoming runtime data — LOD settings into FLODsData via ConvertLODSettingsToLODsData; animations into FAnimsData (defined in Fragments/Animation.h) via CreateAnimsDataFromSequences. EBakeToolMode and FSpriteAnimsEd belong to the bake panel: the former selects the pipeline, the latter is translated into FAnimData frame ranges on the atlas pipeline.
内部结构Internal Structs
本头文件还定义了 4 个仅供内部数据流转的结构体,它们不是作者面配置,因此不单独成节:FMassBattleMeshSlotInfo、FMassBattleSpriteNotifyEd、FRenderLODSettingsEd、FSpriteAnimVariantEd。
This header also defines 4 structs that only carry internal data; they are not authoring surface, so they get no section of their own: FMassBattleMeshSlotInfo, FMassBattleSpriteNotifyEd, FRenderLODSettingsEd, FSpriteAnimVariantEd.