Mass Battle Frameworkv1.20.0

UMassBattleATTDataAsset

UCLASS PrimaryDataAsset USTRUCT ×10 UENUM ×3

Source/MassBattle/Public/DataAssets/MassBattleATTDataAsset.h

概述Overview

单个单位的 VAT 源资产:模型源、动画片段与采样、烘焙输入,以及烘焙回写的结果表。Details 面板按「输入什么 → 怎么烘焙 → 出了什么」组织,概念上分四块——Source(模型来自哪,两者只填其一)、Animation(片段表、移动曲线、跳跃片段与采样)、Bake(转换 / 映射 / UV / 纹理输入)、Info(烘焙写入的产物,含去重片段池与命名集合)。可手调的属性一律排在 Info 之前,烘焙产物一律在 Info 里。重排属性对既有资产安全,因为 UE 按名字而非偏移保存属性。

One unit's VAT source asset: the model source, the animation clips and sampling, the bake inputs, and the tables the bake writes back. The Details panel follows "what goes in → how it is baked → what came out" and is conceptually four blocks — Source (where the model comes from, exactly one of two), Animation (clip table, locomotion curve, jump clips and sampling), Bake (conversion / mapping / UV / texture inputs) and Info (the bake's output, including the deduped clip pool and named sets). Everything an artist may hand-edit sits above Info; everything the bake produces sits inside it. Reordering these properties is safe for existing assets because UE saves them tagged by name, not by offset.

继承Inheritance

UPrimaryDataAsset → UMassBattleATTDataAsset

派生自 UPrimaryDataAsset,可直接在内容浏览器中创建为蓝图/数据资产;类标记为 Blueprintable 与 BlueprintType,属性可在蓝图中读写。

Derives from UPrimaryDataAsset, so it is created directly in the Content Browser as a blueprint/data asset; the class is Blueprintable and BlueprintType, and its properties are readable/writable from Blueprint.

枚举Enums

EMassBattleATTMode UENUM

存储模式:数据按顶点烘,还是按骨骼烘。这一个选择决定烘焙填充哪些纹理与表,也决定 Info 段显示哪一组字段。它不是作者输入:Creator 在每次烘焙前按渲染模式写入。

Storage mode: whether data is baked per vertex or per bone. This single choice decides which textures and tables the bake fills, and which group of Info fields the panel shows. It is not an author input: the Creator writes it from the render mode before each bake.

值Value说明Description
Vertex逐顶点存储位置与法线。Per-vertex position and normal.
Bone逐骨骼存储位置与旋转,并把蒙皮权重烘进顶点;网格共享同一骨架时是首选模式。Per-bone position and rotation, with skin weights baked into the vertices; the preferred mode when meshes share a skeleton.

EMassBattleATTPrecision UENUM

烘焙姿势纹理的精度。默认 16 位——随包发布的 VAT 材质按 16 位通道解码;8 位把纹理尺寸减半,代价是一些解码精度。它只决定像素格式:蒙皮权重仍是 8 位,骨骼数也不受这一项限制。

Precision of the baked pose textures. Defaults to sixteen bits because the shipped VAT materials decode sixteen-bit channels; eight bits halves the texture size at some cost in decode precision. It picks the pixel format only: skin weights stay 8-bit and the bone count is not limited by this.

值Value说明Description
EightBits8 位通道(1/255,纹理减半)。8-bit channels (1/255, half the texture size).
SixteenBits16 位通道(1/65535;默认)。16-bit channels (1/65535; default).

EMassBattleATTNumBoneInfluences UENUM

变形的骨骼影响数。影响数越多越平滑,GPU 开销也越大;同一取值会被写进材质实例的静态开关,所以烘焙与材质必须一致。

Bone influences used for deformation. More influences mean smoother deformation at higher GPU cost; the same value is written into the material instances' static switches, so the bake and the materials must agree.

值Value说明Description
One单骨骼影响(刚体绑定)。Single bone influence (rigid binding).
Two两根骨骼混合(默认)。Blend between two influences (default).
Four四根骨骼混合。Blend between four influences.

结构体Structs

FMassBattleATTAnimSequenceInfo USTRUCT

一条待烘焙的动画:哪个片段、喂给哪个相位、属于哪条命名集合、是否启用、是否只烘一段自定义帧区间。这是 AnimSequences 数组的元素类型,面板按 bEnabled / bUseCustomRange 逐级收敛显示范围。相位是作者要填的字段;桶不再显示、也不再由作者编辑,只作为旧资产迁移的回退信息。

One clip to bake: which sequence, which phase it feeds, which named set it belongs to, whether it is enabled, and whether only a custom frame range is baked. It is the element type of AnimSequences, and the panel narrows the visible fields progressively through bEnabled / bUseCustomRange. The phase is the field an author fills; the bucket is no longer shown or authored and only survives as fallback information for old assets.

成员变量Members
名称Name类型Type默认值Default说明Description
BucketEMassBattleAnimBucketOther旧资产的遗留桶,不显示、不可编辑。仍停在默认相位的行在烘焙时经桶回退到对应相位。The legacy bucket of old assets, not shown and not editable. A row still on the default phase falls back through this bucket at bake time.
PhaseEMassBattleAnimPhaseLocomotion_Idle本行喂给哪个相位;池由相位决定(Locomotion_* → Locomotion,Jump_* → Jump,Montage_* → Montage)。没被改过的行保持默认值并回退到它的遗留桶。The phase this row feeds; the pool follows from the phase (Locomotion_* → Locomotion, Jump_* → Jump, Montage_* → Montage). An untouched row keeps the default and falls back to its legacy bucket.
SetIndexint320本片段属于哪条命名集合(指向 AnimSets 的下标)。由 Mesh Prep 的 Save 与集合列表一起按同一顺序写入;同一片段挂在两个集合下时这里会出现两行、下标不同——那是两种角色,不是重复,烘焙按片段路径去重。Which named set this clip belongs to (an index into AnimSets). Mesh Prep's Save writes it together with the set list in the same order; a clip listed under two sets appears twice with different indices — two roles, not a duplicate, since the bake dedupes by clip path.
bEnabledbooltrue是否参与烘焙;关闭后其下三组字段在面板中隐藏。Whether the clip participates in the bake; turning it off hides the next three fields in the panel.
AnimSequenceTObjectPtr<UAnimSequence>nullptr源动画片段;仅在 bEnabled 为真时可编辑。Source animation clip; editable only while bEnabled is true.
bUseCustomRangeboolfalse是否只烘焙自定义帧区间;关闭时烘整段动画。Whether to bake only a custom frame range; off bakes the whole clip.
StartFrameint320自定义区间起始帧;仅在 bEnabled && bUseCustomRange 时显示。Custom range start frame; shown only when bEnabled && bUseCustomRange.
EndFrameint320自定义区间结束帧(含该帧);显示条件同上。Custom range end frame (inclusive); same visibility condition.
FMassBattleLocoKeyEd USTRUCT

移动曲线上的一个关键帧,按 ATT 作者化:速度锚点、播放速率倍数,以及本键属于三类片段中的哪一类。同一个类可以在多个速度上重复出现——片段因此能贯穿一段速度、只让速率变化。

One locomotion keyframe authored on the ATT: a speed anchor, a playback-rate multiplier, and which of the three kinds the key belongs to. A kind may repeat at several speeds — that is how a clip is held across a speed band while only its rate changes.

成员变量Members
名称Name类型Type默认值Default说明Description
Speedfloat0.f有符号移动速度(cm/s,范围 -20000…20000);负值 = 向后移动。烘焙发布前会按速度升序排序。Signed movement speed (cm/s, range -20000…20000); negative = travelling backwards. The bake sorts keys ascending by speed before publishing.
PlayRatefloat1.f片段自然播放速率的倍数(范围 -10…10;1 = 烘焙时长);负值让片段倒放。Multiplier on the clip's natural play rate (range -10…10; 1 = the baked length); a negative value plays the clip backwards.
KindEMassBattleLocoKindIdle本关键帧属于哪一类片段(Idle / Walk / Run)。Which of the three kinds this key belongs to (Idle / Walk / Run).
FMassBattleLocoAuthoring USTRUCT

本 ATT 的移动作者数据:三个片段(按资产,而不是按槽——桶内槽号是烘焙分配的,写死槽号等于自引用)与速度键。烘焙把两者发布进 AgentConfig 的动画共享配置;空的键表表示「这里没作者化过」,此时烘焙原样保留配置里已有的块。

Locomotion authoring for this ATT: the three clips (by asset, not by slot — a bucket slot is assigned by the bake, so storing one here would be a self-reference) and the speed keys. The bake publishes both into the AgentConfig's animation shared config; an empty key list means "not authored here", and the bake then leaves the config's existing block untouched.

成员变量Members
名称Name类型Type默认值Default说明Description
IdleClip / WalkClip / RunClipTObjectPtr<UAnimSequence>nullptr对应类别播放的片段。必须是本 ATT 的 AnimSequences 行之一,否则烘焙保留该类在配置里的原引用。The clip the matching kind plays. It must be one of this ATT's AnimSequences rows; otherwise the bake keeps that kind's previous config ref.
KeysTArray<FMassBattleLocoKeyEd>—速度键,由烘焙发布为 AgentConfig 的移动采样表。为空 = 本 ATT 没作者化过,烘焙此时原样保留配置里已有的采样点与片段引用。Speed keys, published by the bake as the AgentConfig's locomotion sample list. Empty = not authored on this ATT, and the bake keeps the config's existing samples and clip refs.
FMassBattleJumpAuthoring USTRUCT

本 ATT 的跳跃作者数据:跳跃机要画的三条片段。它们就是普通的 AnimSequences 行——在这里点选,烘焙把它解析成运行时读的相位与槽。留空表示「这里没作者化过」:烘焙不动该相位在配置里的条目,旧配置因此保持原行为。

Jump authoring for this ATT: the three clips the jump machine draws. They are ordinary AnimSequences rows — pick the row here and the bake resolves it to the phase and slot the runtime reads. An empty entry means "not authored": the bake leaves that phase's config entry alone, so an old config keeps its behavior.

成员变量Members
名称Name类型Type默认值Default说明Description
JumpStartClipTObjectPtr<UAnimSequence>nullptrJumpStart 相位播放的片段。必须是本 ATT 的 AnimSequences 行之一,否则烘焙保留该相位在配置里的原条目。The clip the JumpStart phase draws. It must be one of this ATT's AnimSequences rows; otherwise the bake keeps that phase's previous config entry.
FallingLoopClipTObjectPtr<UAnimSequence>nullptrFallingLoop 相位播放的片段;同样必须是本 ATT 的行。The clip the FallingLoop phase draws; also required to be one of this ATT's rows.
LandClipTObjectPtr<UAnimSequence>nullptrLand 相位播放的片段;同样必须是本 ATT 的行。The clip the Land phase draws; also required to be one of this ATT's rows.
FMassBattleATTAnimInfo USTRUCT

烘焙产出的单条片段帧区间(只读展示)。元素按 AnimSequences 的顺序存进 Animations 数组,供查看每个片段实际解析出的起止帧。

The resolved frame range of one baked clip (read-only display). Entries are stored into Animations in AnimSequences order, showing the start/end frame each clip actually resolved to.

成员变量Members
名称Name类型Type默认值Default说明Description
StartFrameint320解析出的起始帧(烘焙写入,面板只读)。Resolved start frame (bake output, read-only in the panel).
EndFrameint320解析出的结束帧(烘焙写入,面板只读)。Resolved end frame (bake output, read-only in the panel).
FMassBattleATTClipPoolEntry USTRUCT

扁平片段池中的一个不同片段:片段本身加上烘焙为它解析出的帧区间。池以片段的对象路径为键,所以两个集合引用同一片段时共用一条条目、也就只有一个帧区间——这就是作者要的去重。面板在 AnimClipPool 中只读展示。

One distinct clip of the flat clip pool: the clip plus the frame band the bake resolved for it. The pool is keyed by the clip's object path, so two sets referencing one clip share one entry and one frame band — the dedupe an author wants. The panel shows it read-only inside AnimClipPool.

成员变量Members
名称Name类型Type默认值Default说明Description
AnimSequenceTObjectPtr<UAnimSequence>nullptr本池条目代表的那一个不同片段。The distinct clip this pool entry stands for.
ClipPathFString—烘焙时记录的去重键(片段对象路径);未烘焙的资产上为空。The dedupe key captured at bake (clip object path); empty on an un-baked asset.
AnimIndexint32-1原始 AnimSequences 数组的下标,运行时用它做变更检测。Index into the raw AnimSequences array; the runtime uses it for change detection.
PlayLengthfloat0.f源片段时长(秒),即运行时采用的播放速度。Source clip length in seconds — the playback speed the runtime applies.
FramesFMassBattleATTAnimInfo—本片段在已烘纹理中的帧区间。This clip's frame band inside the baked textures.
NotifyEventsTArray<FMassBattleAnimNotifyEvent>—本片段的已烘通知事件(隐藏;唯一写入方是烘焙)。This clip's harvested notify events (hidden; the bake is the only writer).
SyncMarkersTArray<FMassBattleAnimSyncMarker>—本片段的作者同步标记,按片段内时间升序(隐藏)。This clip's authored sync markers, ascending by time inside the clip (hidden).
SocketTracksTArray<FMassBattleClipSocketTrack>—本片段逐 socket、逐帧的组件空间轨迹,由 socket 烘焙在片段烘焙之后写入(隐藏)。Per-socket, per-frame component-space tracks for this clip, written by the socket bake after the clip bake (hidden).
FMassBattleATTAnimSetBucket USTRUCT

一份指向片段池的下标列表。用包装结构是因为 UHT 无法反射「TArray 的定长数组」;序列化形态就是这份列表。它承载两种视图:集合的八条遗留桶列表,以及每个池的逐相位列表。

One list of indices into the clip pool. A wrapper exists because UHT cannot reflect a fixed-size array of TArray; the serialized shape is still just the list. It backs both views: a set's eight legacy bucket lists and each pool's per-phase lists.

成员变量Members
名称Name类型Type默认值Default说明Description
NameFString—本列表的显示名,由烘焙填写:它指代的相位(与池里对应相位行是同一个字符串)。Display name of this list, filled by the bake: the phase it addresses (the same string the pool's matching row carries).
PoolIndicesTArray<int32>—喂给本相位或遗留桶的池下标,按槽序;槽位经 AnimClipPool[PoolIndices[slot]] 解析成片段。Pool indices feeding this phase or legacy bucket, in slot order; a slot resolves through AnimClipPool[PoolIndices[slot]].
FMassBattleATTAnimSetPool USTRUCT

一个池逐相位的片段列表,按其池内的相位顺序。面板以池名 (Locomotion / Jump / Montage) 作行标题。

One pool's per-phase clip lists, in that pool's phase order. The panel titles the row with the pool name (Locomotion / Jump / Montage).

成员变量Members
名称Name类型Type默认值Default说明Description
NameFString—本池的显示名,由烘焙填写:"Locomotion"、"Jump" 或 "Montage"。This pool's name, filled by the bake: "Locomotion", "Jump" or "Montage".
PhasesTArray<FMassBattleATTAnimSetBucket>—烘焙分配给本池各相位的片段列表,按相位顺序。Clip lists the bake assigned to each phase of this pool, in phase order.
FMassBattleATTAnimSet USTRUCT

一条命名动画集合——作者字段加上烘焙产出的池下标,因为同一条记录的两半在不同时刻写入:Mesh Prep 的 Save 写名称与选择器,两种视图保持为空;烘焙原样保留这些作者字段并填入两种视图。这个分工是多集合的基础:一次把记录列表整个替换掉的烘焙,会用一条硬编码集合悄悄覆盖作者的集合。

One named animation set — the author fields plus the bake's pool indices, because the two halves of one record are written at different times: Mesh Prep's Save writes the name and selector and leaves both views empty; the bake preserves those author fields verbatim and fills both views. This split is what makes multi-set work: a bake that replaced the record list wholesale would silently overwrite the author's sets with one hard-coded set.

成员变量Members
名称Name类型Type默认值Default说明Description
NameFString—本集合的唯一作者标签。The unique author label of this set.
SelectorFString—本集合服务哪些风格组合、以及怎么服务。* = 基底:把它声明的每个桶(对作者即相位)供给每个组合(可选);名字 / #N / 名字* = 组合专属:声明非空的桶整体替换基底,其余仍由基底供给。两种规则可并存("*, King")。烘焙时解析,运行时从不解析。Which style combinations this set serves, and how. * = a base supplying every bucket it declares (a phase, for an author) to every combination (optional); name / #N / name* = combination-specific, replacing the base wholesale for every bucket it declares non-empty while the base supplies the rest. Both rules may coexist ("*, King"). Resolved at bake, never at runtime.
PoolsTArray<FMassBattleATTAnimSetPool>—三个池(按 Locomotion / Jump / Montage 顺序),各自带逐相位的片段列表。这是 Details 面板显示的视图。The three pools (in Locomotion / Jump / Montage order), each with its per-phase clip lists. This is the view the Details panel shows.
BucketsTArray<FMassBattleATTAnimSetBucket>—旧烘焙产物,仅为序列化与运行时的遗留寻址保留;面板不再显示。Older bake output kept for serialization and the runtime's legacy addressing; no longer shown in the panel.
bAppendOnlyboolfalse已废弃,刻意不显示:烘焙忽略它,只看 Selector(* 集合供给、点名组合的集合逐相位覆盖)。保留序列化是为了旧资产原样往返。Retired and deliberately hidden: the bake ignores it and only the Selector decides (a * set supplies, a set naming the combination overrides per phase). It stays serialized so old assets round-trip unchanged.
FAimBakeData USTRUCT

一个单位瞄准关节的逐骨烘焙蒙版:每根参考骨一个组号,外加关节旋转所绕的两个枢轴下标。组 0 是车体、1 是偏航子树、2 是俯仰子树(两者重叠处由俯仰覆盖)。它挂在 ATT 上,与布娃娃表并排,只用于查询;作者参数在 AgentConfig 的瞄准配置里,解析出的骨下标在其骨骼共享片段上。

The baked per-bone aim-joint mask of one unit: a group id for every reference bone plus the two pivot indices the joint rotates about. Group 0 is the body, 1 the yaw subtree and 2 the pitch subtree (pitch overrides yaw where they overlap). It rides on the ATT beside the ragdoll tables and is used only for queries; the authored knobs live on the AgentConfig's aim config and the resolved bone indices on its bone shared fragment.

成员变量Members
名称Name类型Type默认值Default说明Description
BoneGroupTArray<uint32>—每根参考骨一个组号,按骨下标索引:0 车体、1 偏航子树、2 俯仰子树。偏航骨未填写或未解析时为空。One group id per reference bone, indexed by bone index: 0 body, 1 yaw subtree, 2 pitch subtree. Empty when the yaw bone is unset or unresolved.
YawPivotBoneint32-1偏航蒙版根的骨下标,整棵子树绕它旋转;-1 = 没有瞄准关节。Bone index of the yaw mask root the whole subtree rotates about; -1 = no aim joint.
PitchPivotBoneint32-1俯仰蒙版根的骨下标,在偏航结果之上再旋转;-1 = 不做俯仰。Bone index of the pitch mask root, rotated on top of the yaw result; -1 = no pitch.
bBakedboolfalse蒙版是否已逐根填好、可供消费。Whether the mask is filled per bone and can be consumed.

公开方法Public Methods

GetIndexFromAnimSequence int32 (BlueprintCallable)

在 Animations 数组中查找某个动画片段对应的条目下标,蓝图可直接调用。用于把「片段资产」映射回烘焙产出的帧区间表;只返回已启用的元素,找不到时返回 -1,调用方应据此跳过。

Finds the index of a clip's entry inside the Animations array; callable from Blueprint. Used to map a sequence asset back to its baked frame-range row; only enabled elements are returned, and -1 means not found, which callers should treat as "skip".

Input
参数Param类型Type说明Description
Sequenceconst UAnimSequence*要查找的动画片段。The clip to look up.
Output

返回该片段在 Animations 中的下标;未找到返回 -1。无副作用。

Returns the clip's index in Animations, or -1 when not found. No side effects.

ResetInfo void (UFUNCTION)

Info 段的重置入口(UFUNCTION,未标记 BlueprintCallable)。头文件未附带行为注释,因此这里不描述其具体重置范围。

Reset entry for the Info block (a UFUNCTION, not marked BlueprintCallable). The header carries no behavioral comment, so the exact scope is not described here.

Input

无参数。

No parameters.

Output

无返回值。头文件未说明副作用。

No return value. The header does not specify side effects.

GetAsset<AssetType> static template AssetType*

软引用属性的通用解析助手:路径有效时先取已加载对象,未加载则同步 TryLoad();加载失败触发 ensureMsgf 并返回 nullptr。六个 GetXxx() 访问器都由它生成,因此它们共用同一套解析与加载语义。

Generic resolver for the soft-reference properties: when the path is valid it returns the already-loaded object, otherwise loads it synchronously via TryLoad(); a failed load raises ensureMsgf and returns nullptr. The six GetXxx() accessors are generated from it, so they all share this resolution/load behavior.

Input
参数Param类型Type说明Description
AssetPointerconst TSoftObjectPtr<AssetType>&要解析的软引用(如 StaticMesh / SkeletalMesh 或某张贴图属性)。Soft reference to resolve (for example StaticMesh / SkeletalMesh or a texture property).
Output

返回解析到的对象;路径无效或加载失败时返回 nullptr。副作用:可能发生同步加载。

Returns the resolved object, or nullptr when the path is invalid or the load fails. Side effects: may load synchronously.

GetStaticMesh / GetSkeletalMesh / GetVertexPositionTexture / GetVertexNormalTexture / GetBonePositionTexture / GetBoneRotationTexture FORCEINLINE UStaticMesh* / USkeletalMesh* / UTexture2D*

六个薄访问器,各自把对应的软引用属性交给 GetAsset 解析后返回。C++ 侧读烘焙产物(生成的静态网格、四张贴图、源骨骼网格)时直接用它们,无需自己写 ToSoftObjectPath / TryLoad。

Six thin accessors, each resolving its soft-reference property through GetAsset. C++ code reading the bake outputs (the generated static mesh, the four textures, the source skeletal mesh) can use them instead of hand-writing ToSoftObjectPath / TryLoad.

Input

无参数(属性名决定读取哪一项)。

No parameters (the accessor name selects the property).

Output

返回对应资产指针;属性为空或加载失败时返回 nullptr。副作用:可能发生同步加载。

Returns the matching asset pointer, or nullptr when the property is empty or the load fails. Side effects: may load synchronously.

成员变量Members

Source — 模型来源Source — the mesh it was baked from

模型来自哪里。SkeletalMesh 与 AssemblyTemplate 是同一个概念的两种填法:本资产只填其中之一。

Where the model comes from. SkeletalMesh and AssemblyTemplate express the same concept two ways: exactly one of them is filled per asset.

名称Name类型Type默认值Default说明Description
SkeletalMeshTSoftObjectPtr<USkeletalMesh>—烘焙所用的源骨骼网格——单网格管线的模型源。与 AssemblyTemplate 互斥。Skeletal mesh to bake from — the single-mesh model source. Mutually exclusive with AssemblyTemplate.
AssemblyTemplateTSoftObjectPtr<UBlueprint>—Advanced(装配复合)路径的模型源——几何在模板的各部件里。仅编辑器数据:模板是作者输入,运行时从不读取,且蓝图不是 cook 资产,该值在 cook 时被丢弃。Model source for the Advanced (assembly composite) path — the geometry lives in the template's parts. Editor-only data: the template is authoring input, never read at runtime, and a blueprint is not a cooked asset, so the value is dropped at cook.
PhysicsAssetTSoftObjectPtr<UPhysicsAsset>—布娃娃与姿势表烘焙使用的物理资产。Mesh Prep 会从所选网格自动填入,作者也可直接覆盖;留空时烘焙期回退到网格自带的资产。仅编辑器数据。Physics asset used by the ragdoll and pose-table bakes. Mesh Prep auto-fills it from the assigned mesh; overwrite it to bake from a different asset. An empty value falls back at bake time to the mesh's own asset. Editor-only data.

Animation — 片段、曲线与采样Animation — clips, curves and samples

这一段是动画作者面:片段表逐行选相位,移动曲线与跳跃片段按资产点选,SampleRate 决定采样密度。所有片段引用都必须指向本 ATT 的行。Locomotion 与 Jump 两个子块的分类标记是 Default,在 Details 里会单独成段,而不是并入 Animation 段。

This block is the animation author face: the clip table assigns a phase per row, the locomotion curve and jump clips are picked by asset, and SampleRate sets sampling density. Every clip reference must point at one of this ATT's rows. The Locomotion and Jump sub-blocks carry the Default category, so they appear as their own section in Details rather than inside the Animation section.

名称Name类型Type默认值Default说明Description
RootTransformFTransform—烘焙空间变换:乘进两条路线已烘的动画采样(VatVert 顶点采样与 BoneCS 骨姿势采样,骨骼路线在蒙皮之后、于分量空间施加)。改它必须重烘——运行期没有任何东西读这个字段。它不是运行期渲染器偏移,磁盘上的模型也不会转向。A bake-space transform multiplied into the baked samples of both lanes (VatVert vertex samples and BoneCS bone-pose samples; the bone lane applies it in component space after skinning). Changing it requires a re-bake — nothing at runtime reads this field. It is not a runtime renderer offset, and the model is not re-oriented on disk.
AttachToSocketFName—刚体绑定所用的骨骼。必须是原始骨骼——不支持插槽与虚拟骨骼。仅在 Mode == Bone 时显示。Bone used for rigid binding. Must be a raw bone — sockets and virtual bones are not supported. Shown only when Mode == Bone.
bBakeBoneScalebooltrue把均匀骨骼缩放烘进骨骼位置纹理的 A 通道。存的是与绑定姿势的比值(当前 ÷ 绑定,取 XYZ 几何平均),所以动画不碰缩放的骨架编码为 1.0、按刚体变形;关闭则输出 A = 1。仅在 Mode == Bone 时显示。Bakes uniform bone scale into the bone-position texture's A channel. The stored value is relative to the bind pose (current ÷ bind, geometric mean of XYZ), so a rig that never animates scale encodes 1.0 and deforms rigidly; off writes A = 1. Shown only when Mode == Bone.
SampleRatefloat30.0f烘焙采样率(Hz,范围 1–120)。帧数 = 动画长度 × 该值。Bake sampling rate in Hz (range 1–120). Frame count = animation length × this value.
AnimSequencesTArray<FMassBattleATTAnimSequenceInfo>—本资产烘焙的片段,逐片段一条:相位、所属集合、启用状态与可选的自定义帧区间。相位决定了它落入哪个池与哪一段槽。The clips this asset bakes, one entry per clip: phase, owning set, enable state and optional custom frame range. The phase decides which pool and which slot band the clip lands in.
LocomotionFMassBattleLocoAuthoring—移动曲线的作者面:Idle / Walk / Run 三个片段与速度键。烘焙把它发布进清单里每份配置的动画共享块;键表为空表示这里没作者化过,烘焙此时不动配置里的块。The author face of the locomotion curve: the Idle / Walk / Run clips and the speed keys. The bake publishes it into every listed config's animation shared block; an empty key list means "not authored here" and the bake then leaves the config's block untouched.
JumpFMassBattleJumpAuthoring—跳跃片段:JumpStart / FallingLoop / Land 三条,由烘焙发布进清单里每份配置;留空的项不动该相位在配置里的条目。Jump clips: the JumpStart / FallingLoop / Land sequences, published into every listed config by the bake; an empty entry leaves that phase's config entry untouched.

Bake — 转换、映射、UV 与纹理输入Bake — conversion, mapping, UVs and texture inputs

这一段几乎全部是美术可改的输入;同一组开关的产物落在下方 Info 段。唯一例外是 Mode——它是由 Creator 写入的内部值。

Almost everything here is an artist-editable input; the outputs of the same knobs land in the Info block below. The one exception is Mode, an internal value the Creator writes.

名称Name类型Type默认值Default说明Description
ModeEMassBattleATTModeBone存储模式(内部值,不在 Details 中显示)。Creator 在每次烘焙前按渲染模式写入,烘焙据此决定写哪一对纹理。Storage mode (an internal value, not shown in Details). The Creator writes it from the render mode before each bake, and the bake uses it to decide which texture pair to write.
NumBoneInfluencesEMassBattleATTNumBoneInfluencesTwo变形的骨骼影响数,同时用于设置材质实例的静态开关。默认 Two,与烘焙侧材质的默认一致;Four 属非默认的更高 GPU 开销。仅在 Mode == Bone 时显示。Bone influences for deformation; also sets the material instances' static switches. Defaults to Two, matching the bake-side material default; Four is a non-default, higher GPU cost. Shown only when Mode == Bone.
MaxHeightint328192烘焙纹理的高度上限(像素,范围 256–16384);数据装得下时使用更小的尺寸。Max baked texture height in pixels (range 256–16384); a smaller size is used when the data fits.
MaxWidthint328192烘焙纹理的宽度上限(像素,范围 256–16384)。Max baked texture width in pixels (range 256–16384).
bEnforcePowerOfTwoboolfalse把烘焙纹理的宽高向上取整到 2 的幂(空白填充)。Rounds baked texture width/height up to powers of two (blank padding).
PrecisionEMassBattleATTPrecisionSixteenBits烘焙姿势纹理精度。16 位与随包发布的材质一致;8 位把纹理减半、牺牲一些解码精度。只影响像素格式。Baked pose-texture precision. Sixteen bits matches the shipped materials; eight halves the texture at some decode precision. Pixel format only.
UVChannelint321VAT 烘焙写入顶点/骨骼数据的 UV 通道(0–3)。要避开 UV0、lightmap 通道与骨骼索引通道。UV channel the VAT bake writes vertex/bone data into (0–3). Keep it off UV0, the lightmap channel and the bone-index channel.
LightMapUVChannelint322骨骼网格→静态网格转换写入 lightmap 坐标的 UV 通道(0–7)。必须不同于 UVChannel 与 BoneIndexUVChannel。UV channel the skeletal-to-static conversion writes lightmap coordinates into (0–7). Must differ from UVChannel and BoneIndexUVChannel.
BoneIndexUVChannelint323承载全部四个骨骼索引的单条 UV 通道(0–6,每分量打包两个索引:.x = (i0 + i1*N)/N²,.y = (i2 + i3*N)/N²,N = 骨骼数)。必须是单条通道且下标 ≤ 3——GPU 蒙皮顶点工厂最多接受 4 套纹理坐标,第二条索引通道会让该材质的骨骼网格变体编译失败。UV2 因此留给 lightmap。The single UV channel carrying all four bone indices (0–6, two indices packed per component: .x = (i0 + i1*N)/N², .y = (i2 + i3*N)/N², N = bone count). It must stay a single channel at index ≤ 3 — the GPU-skin vertex factory accepts at most 4 texture-coordinate sets, so a second index channel would fail to compile every skeletal-mesh permutation of the material. UV2 therefore stays free for the lightmap.
NumDriverTrianglesint3210每个静态网格顶点受多少个源三角形影响(最小值 1)。1 = 绑定到最近三角形的刚体绑定;越高映射越好、烘焙越慢。How many source triangles influence each static-mesh vertex (minimum 1). 1 = rigid bind to the closest triangle; higher means better mapping and a slower bake.
Sigmafloat1.f驱动三角形权重的反距离指数;越大权重对比越强。Inverse-distance exponent for the driver-triangle weights; larger values give more contrasted weighting.
MaterialSlotNamesTArray<FString>—烘焙时写回源骨骼网格的材质槽名。烘焙在转换之前把网格的槽重命名成这些字符串,转换再把它们抄进生成的静态网格、材质实例与下游 section 参数。数量必须与网格槽数一致——不一致时还原槽名的步骤记警告并跳过。Material slot names applied to the source skeletal mesh at bake time. The bake renames the mesh's slots to these strings before the conversion copies them into the generated static mesh, its material instances and every downstream section parameter. The count must match the mesh's slot count — on a mismatch the slot-name restore step logs a warning and is skipped.

Info — 烘焙写入Info — what the bake writes

这一段由烘焙写入。产出的资源引用在面板中可直接编辑(EditAnywhere),计数、行数、包围盒与表为只读展示(VisibleAnywhere / BlueprintReadOnly),隐藏字段没有面板行。重烘会重建它们,作者不要手改。

This block is written by the bake. The produced asset references remain editable in the panel (EditAnywhere), while counters, row counts, bounding boxes and tables are read-only displays (VisibleAnywhere / BlueprintReadOnly); hidden fields have no panel row. A re-bake rebuilds them — never hand-edit them.

名称Name类型Type默认值Default说明Description
StaticMeshTSoftObjectPtr<UStaticMesh>—骨骼网格转静态网格的产物。Static mesh produced by the skeletal-to-static conversion.
VertexPositionTextureTSoftObjectPtr<UTexture2D>—顶点位置纹理;仅 Vertex 模式生成。Vertex-position texture; produced in Vertex mode only.
VertexNormalTextureTSoftObjectPtr<UTexture2D>—顶点法线纹理;仅 Vertex 模式生成。Vertex-normal texture; produced in Vertex mode only.
BonePositionTextureTSoftObjectPtr<UTexture2D>—骨骼位置纹理;仅 Bone 模式生成(A 通道承载均匀骨骼缩放,见 bBakeBoneScale)。Bone-position texture; produced in Bone mode only (the A channel carries uniform bone scale, see bBakeBoneScale).
BoneRotationTextureTSoftObjectPtr<UTexture2D>—骨骼旋转纹理;仅 Bone 模式生成。Bone-rotation texture; produced in Bone mode only.
NumFramesint320所有动画的总帧数(烘焙写入,只读)。Total frame count across all animations (bake output, read-only).
NumBonesint320总骨骼数;仅 Bone 模式显示。Total bone count; shown in Bone mode only.
VertexRowsPerFrameint321每帧顶点行数;仅 Vertex 模式显示。Vertex rows per frame; shown in Vertex mode only.
VertexMinBBox / VertexSizeBBoxFVector3f—顶点包围盒的最小点与尺寸(面板显示名 MinBBox / SizeBBox);仅 Vertex 模式显示。Vertex bounding-box minimum and size (shown as MinBBox / SizeBBox); Vertex mode only.
BoneWeightRowsPerFrame / BoneRowsPerFrameint321权重与骨骼的每帧行数;仅 Bone 模式显示。Weight and bone rows per frame; Bone mode only.
BoneMinBBox / BoneSizeBBoxFVector3f—骨骼包围盒的最小点与尺寸(面板显示名 MinBBox / SizeBBox);仅 Bone 模式显示。Bone bounding-box minimum and size (shown as MinBBox / SizeBBox); Bone mode only.
RagdollFRagdollBakeData—从源网格物理资产烘出的布娃娃刚体与关节;网格没有物理资产时为空。只用于查询时摆姿。Ragdoll bodies and joints baked from the source mesh's physics asset; empty when the mesh has none. Used only to pose bodies at query time.
RagdollPoseFRagdollPoseTable—同一次烘焙的逐帧分量空间姿势镜像,每根拥有刚体的骨一个槽;仅用于查询时摆姿,运行时不做逐帧更新。A per-frame component-space pose mirror of the same bake, one slot per body-owning bone; used only to pose the ragdoll at query time, never updated per frame at runtime.
AimBakeFAimBakeData—烘出的逐骨瞄准关节蒙版与两个枢轴骨;单位没有作者化瞄准关节时为空。The baked per-bone aim-joint mask and the two pivot bones; empty when the unit authors no aim joint.
AnimationsTArray<FMassBattleATTAnimInfo>—逐烘焙片段的已解析帧区间,与 AnimSequences 同序。Resolved frame range of each baked clip, in AnimSequences order.
AnimSetsSchemaint320下方扁平(池 + 集合)数据的 schema 版本;0 = 尚未烘焙,或作者编辑已让产物失效。非 0 表示池与两种视图都是本 schema 的烘焙产物、且是有效的池下标。Schema version of the flat (pool + sets) data below; 0 = not baked yet, or an authoring edit has invalidated the artifact. A non-zero value means the pool and both views were produced by a bake of this schema and are valid pool indices.
AnimClipPoolTArray<FMassBattleATTClipPoolEntry>—去重后的片段池:每个不同片段一条,各占一个帧区间。被多个集合共用的片段只在这里出现一次。The deduped clip pool: one entry per distinct clip, one frame band each. A clip shared by several sets appears here exactly once.
AnimSetsTArray<FMassBattleATTAnimSet>—池之上的命名集合,每个带选择器与逐池、逐相位的片段列表。资产没有集合记录时烘焙会产出一条合成的 "Default" 集合(选择器 "*")。Named sets over the pool, each with a selector and per-pool, per-phase clip lists. An asset with no set records bakes one synthesized "Default" set (selector "*").

管线角色Pipeline Role

制作期:资产是烘焙的输入与输出载体——Source / Animation / Bake 由作者填写,Mesh Prep 面板编辑的也是同一批字段。烘焙把生成的静态网格、纹理、计数、帧区间、去重片段池、命名集合、布娃娃与瞄准蒙版写进 Info 段,并把移动曲线与跳跃片段发布进清单里每份 AgentConfig 的动画共享块。
运行时:本资产不直接被模拟读取;运行时读的是 AgentConfig。烘焙出的片段池、通知、同步标记与 socket 轨迹经由配置随单位走,渲染侧再按 FBoneBatchPipeline 的骨骼流读取纹理。六个 GetXxx() 访问器是 C++ 调用方解析软引用的统一途径。
材质侧:NumBoneInfluences 等属性同时用于设置材质实例的静态开关,所以烘焙用的数据布局与材质读的开关必须来自同一份资产。

Authoring: the asset is both the bake's input and its output carrier — Source / Animation / Bake are authored, and the Mesh Prep panel edits the same fields. The bake writes the generated static mesh, textures, counters, frame bands, deduped clip pool, named sets, ragdoll and aim mask into Info, and publishes the locomotion curve and jump clips into every listed AgentConfig's animation shared block.
Runtime: the simulation does not read this asset directly; it reads the AgentConfig. The baked clip pool, notifies, sync markers and socket tracks travel with the unit through the config, and the render side reads the textures through the bone stream of FBoneBatchPipeline. The six GetXxx() accessors are the shared way C++ callers resolve the soft references.
Material side: properties such as NumBoneInfluences also set the material instances' static switches, so the baked data layout and the switches the materials read must come from the same asset.

补充说明Notes

① 两个模型源互斥:SkeletalMesh 喂单网格管线,AssemblyTemplate 喂逐版本复合;只填一个。后者仅编辑器可见,cook 后不存在,因此运行时逻辑不得依赖它。
② UV 通道的三条硬约束:VAT 通道(UVChannel)、lightmap 通道(LightMapUVChannel)、骨骼索引通道(BoneIndexUVChannel)必须互不相同;VAT 与索引通道都不得占用 UV0;索引通道必须是单条且下标 ≤ 3。
③ 相位是片段地址:AnimSequences 每行选一个相位,槽号由烘焙分配。桶不再显示、也不再由作者编辑——旧行的相位停在默认值时,烘焙才经桶回退。
④ 空 = 没作者化过:移动键表为空时烘焙不动配置里的移动块;跳跃片段某项留空时该相位在配置里的条目保持不变。这样老配置重烘不会被清空。
⑤ 集合与去重:同一片段被多个集合引用时只烘一次(一条池条目、一个帧区间);Selector 决定集合是基底还是组合专属;两个集合点名同一组合且声明同一个桶会被烘焙拒绝。
⑥ 烘焙数据只读:Info 段与隐藏字段都是产物,重烘整表重建。容量超限(纹理尺寸、采样预算等)会让烘焙失败并报出原因,绝不截断。
⑦ 材质参数名:烘焙把布局数字与纹理引用写成带 MB_ 前缀的材质参数——MB_SampleRate、MB_MinBBox、MB_SizeBBox、MB_NumBones、MB_RowsPerFrame、MB_BoneWeightsRowsPerFrame、MB_PositionTexture、MB_NormalTexture、MB_BonePositionTexture、MB_BoneRotationTexture,以及 UV 开关 MB_UseUV0…MB_UseUV3 与影响数开关 MB_UseTwoInfluences / MB_UseFourInfluences。四模式开关 MB_SpriteMode / MB_BoneMode / MB_ISKMMode / MB_VertMode 恰好一个为真,其中 MB_SpriteMode 不由 VAT 烘焙置位。适配器开关 MB_isMasked 由创建材质实例的一方按源材质的混合模式写入:真 → 溶解乘进 OpacityMask,假 → 乘进 Opacity。
⑧ 面板顺序即数据流:Source → Animation → Bake 是作者输入,Info 是产物。重排属性不会破坏已有资产(UE 按名字保存),但会让「输入 / 输出」的阅读顺序失效。

① The two model sources are exclusive: SkeletalMesh feeds the single-mesh pipeline, AssemblyTemplate feeds the per-version composite; fill only one. The latter exists only in editor builds and is gone after cook, so runtime logic must never depend on it.
② Three hard UV constraints: the VAT channel (UVChannel), the lightmap channel (LightMapUVChannel) and the bone-index channel (BoneIndexUVChannel) must all differ; neither the VAT nor the index channel may use UV0; the index channel must be a single channel at index ≤ 3.
③ The phase is the clip address: each AnimSequences row picks a phase and the bake assigns the slot. The bucket is no longer shown or authored — a bake falls back through it only when an old row still sits on the default phase.
④ Empty means "not authored": an empty locomotion key list leaves the config's locomotion block untouched, and an empty jump entry leaves that phase's config entry unchanged. A re-bake therefore never clears an older config.
⑤ Sets and dedupe: a clip referenced by several sets is baked once (one pool entry, one frame band); Selector decides whether a set is a base or combination-specific; two sets naming one combination and declaring the same bucket are refused at bake.
⑥ Baked data is read-only: the Info block and the hidden fields are output, rebuilt wholesale by a re-bake. Exceeding a capacity (texture size, sample budget, …) fails the bake with a reason; it never truncates.
⑦ Material parameter names: the bake writes layout numbers and texture references as MB_-prefixed material parameters — MB_SampleRate, MB_MinBBox, MB_SizeBBox, MB_NumBones, MB_RowsPerFrame, MB_BoneWeightsRowsPerFrame, MB_PositionTexture, MB_NormalTexture, MB_BonePositionTexture, MB_BoneRotationTexture — plus the UV switches MB_UseUV0…MB_UseUV3 and the influence switches MB_UseTwoInfluences / MB_UseFourInfluences. Of the four mode switches MB_SpriteMode / MB_BoneMode / MB_ISKMMode / MB_VertMode exactly one is true; MB_SpriteMode is not set by the VAT bake. The adapter switch MB_isMasked is written by whoever builds the material instance, from the source material's blend mode: true multiplies the dissolve into OpacityMask, false into Opacity.
⑧ Panel order is the data flow: Source → Animation → Bake are author inputs and Info is the output. Reordering the properties will not break existing assets (UE saves by name), but it destroys the "input / output" reading order.

内部结构Internal Structs

本头文件还定义了 2 个仅供内部数据流转的结构体,它们不是作者面配置,因此不单独成节:FMassBattleBoneMaskAuthoring、FMassBattlePhaseBoneMask。

This header also defines 2 structs that only carry internal data; they are not authoring surface, so they get no section of their own: FMassBattleBoneMaskAuthoring, FMassBattlePhaseBoneMask.

FAimOffsetBakeData struct

一个单位的烘焙逐骨瞄准网格:对每个采样到的偏航/俯仰组合,每根 **raw 参考骨**一个相对该采样 参考姿势的分量空间增量,按 [PitchRow * YawCount + YawCol] * NumBones + BoneIndex 行主序存放。 它与布娃娃表并排挂在 ATT 上——bulk 数据,不进快照、不进哈希。作者参数留在单位配置的 FAim 里, 网格的启用计数住在 FBoneShared 的 AimGridYawCount / AimGridPitchCount 上。

The baked per-bone aim grid of one unit: for every sampled yaw/pitch pair, every RAW reference bone's component-space delta relative to that sample's reference pose, stored row-major as [PitchRow * YawCount + YawCol] * NumBones + BoneIndex. It rides on the ATT beside the ragdoll tables - bulk data, never in a snapshot, never hashed. The authored knobs stay on the agent config's FAim and the grid's enable counts live on FBoneShared (AimGridYawCount / AimGridPitchCount).

成员变量Members

名称Name类型Type默认值Default说明Description
YawCountint320网格沿偏航的列数,取自瞄准偏置资产的偏航轴。0 = 尚未烘焙。Grid columns along yaw, read from the aim offset asset's yaw axis. 0 = not baked.
PitchCountint320网格沿俯仰的行数,取自瞄准偏置资产的俯仰轴。0 = 尚未烘焙。Grid rows along pitch, read from the aim offset asset's pitch axis. 0 = not baked.
YawMinfloat0.f偏航轴下限(度)——资产的真实坐标。Yaw axis minimum in degrees - the asset's real coordinate.
YawMaxfloat0.f偏航轴上限(度)。Yaw axis maximum in degrees.
PitchMinfloat0.f俯仰轴下限(度)——资产的真实坐标。Pitch axis minimum in degrees - the asset's real coordinate.
PitchMaxfloat0.f俯仰轴上限(度)。Pitch axis maximum in degrees.
bYawWrapsboolfalse偏航轴覆盖一整圈时为真:采样跨接缝环绕,而不是在首末列之间插值。True when the yaw axis covers a full turn, so sampling wraps across the seam instead of interpolating between the first and last column.
bYawSeamDuplicateboolfalse首末两列姿态相同时为真——作者在 ±180 各放了一格,环形周期因此是 YawCount - 1 而不是 YawCount。True when the first and last yaw columns hold the same pose — the author placed the ±180 pose at both ends, so the circular cycle is YawCount - 1 rather than YawCount.
bBakedboolfalse下方每个数组是否都已按采样姿势与骨骼逐项填好、可供消费。True when every array below holds one entry per sampled pose and bone, so the grid can be consumed.
DeltaRotTArray<FVector4f>——逐采样、逐 raw 骨的分量空间旋转增量(四元数 xyzw)。Component-space rotation delta (quaternion xyzw) per sample and raw bone.
DeltaPosTArray<FVector4f>——逐采样、逐 raw 骨的分量空间位置增量(xyz;w=1 表示该骨有增量)。Component-space position delta per sample and raw bone (xyz; w=1 marks a bone with a delta).
CarrierBoneTArray<int32>——逐骨载体:沿父链上溯,最近的、增量不为零的祖先(自身有增量则是自己)。 INDEX_NONE = 该骨不受瞄准偏置影响。Per-bone carrier: the nearest ancestor (or the bone itself) whose delta is non-zero, along the parent chain. INDEX_NONE = the bone is not moved by the aim offset.
RefRotTArray<FVector4f>——参考姿态下逐骨的分量空间旋转;运行期据此重算载体的 M = CarrierCurrent * CarrierRef^-1。Per-bone component-space rotation in the reference pose; the runtime recomputes the carrier's M = CarrierCurrent * CarrierRef^-1 from it.
RefPosTArray<FVector4f>——参考姿态下逐骨的分量空间位置。Per-bone component-space position in the reference pose.