SMassBattleAssemblyPanel
Source/MassBattleEditor/Public/UnitAssembly/SMassBattleAssemblyPanel.h
概述Overview
Assembly 工具窗口——多部件拼合单位的配置界面,配一个在关卡视口里实时显示的预览 Actor。窗口里做的每件事都作用于一份工作状态(UMassBattleAssemblyState),需要长期保留时按 Save 写进一份 assembly 模板蓝图。窗口本身不烘焙、不生成资产,它只负责把配置编辑好并存下来。
The Assembly tool window — the configuration UI for multi-part composite units, with a preview actor shown live in the level viewport. Everything done in the window edits a working state (UMassBattleAssemblyState); to keep it, press Save to write it into an assembly template Blueprint. The window does not bake or generate assets — it edits a configuration and stores it.
窗口分三个模块,自上而下排在一条滚动列里,底部是常驻日志区:Body Parts(部件卡、版本、类型与挂接)、Combinations(具名显隐组合)、Agent Template(模板蓝图的存取与骨架)。日志区顶部有两行绿色状态(预览是否已生成、配置摘要)。所有破坏性操作(清空部件、清空组合、清空模板区、关闭有未保存改动的标签页)都会先弹一个居中的 Yes/No(关闭时是 Yes/No/Cancel)确认框。
The window has three modules stacked in one scrolling column with a permanent log dock at the bottom: Body Parts (part cards, versions, type and mounting), Combinations (named visibility presets), and Agent Template (template Blueprint save/load plus skeleton). Two green status lines sit at the top of the log dock (whether the preview is live, and a configuration summary). Every destructive action (clearing parts, clearing combinations, clearing the template section, closing the tab with unsaved changes) asks first in a centred Yes/No dialog (Yes/No/Cancel for closing).
继承Inheritance
打开方式Opening the Window
两条入口,打开的是同一个可停靠标签页(Nomad tab):
Two entry points, both opening the same dockable tab (a Nomad tab):
| 入口Entry | 路径Path |
|---|---|
| 从 Agent Creator 打开From the Agent Creator | 把 Tool Mode 切到 VAT Advanced,工作流入口行会出现 Open Assembly... 按钮,点击即打开。该按钮只在 VAT Advanced 下可见——VAT Standard 与 Sprite Atlas 模式下这一行整体折叠。Set Tool Mode to VAT Advanced; the workflow row then shows an Open Assembly... button. That button is visible in VAT Advanced only — in VAT Standard and Sprite Atlas the whole row collapses. |
| 从主菜单打开From the main menu | Window → Tools → MassBattle Assembly。标签页可拖入主窗口的任意 tab 井停靠,停靠位置跨会话记忆。Window → Tools → MassBattle Assembly. The tab can be dragged into any tab well of the main frame, and its dock position is remembered across sessions. |
| 拖入模板资产Drop a template asset | 把一份 assembly 模板蓝图从内容浏览器拖到窗口上:绑定该蓝图并立刻载入它的配置。把关卡里已放置的 assembly 模板 Actor 拖进来同样会回填面板,并按它的类绑定。Drag an assembly template Blueprint from the Content Browser onto the window: it is bound and its configuration is loaded immediately. Dropping a placed assembly template actor from the level likewise fills the panel and binds its class. |
| 关闭Closing | 有未保存改动时先问 Save / Discard / Cancel;选 Save 会先执行一次保存再关闭,Cancel 取消关闭。没有改动则直接关。With unsaved changes it asks Save / Discard / Cancel; Save performs a save and then closes, Cancel aborts the close. With no changes it closes immediately. |
模块布局Module Layout
| 模块Module | 内容Contents |
|---|---|
| Body PartsBody Parts | 模块标题 + 一行控制键:Focus(把活动关卡视口相机对准预览 Actor)、Anim Preview ▾(面板级预览动画选择)、播放/暂停闩锁、Reset(清掉动画、回到绑定姿势)、Clear(清空全部部件,需确认)。其下是 + Add Body Part 虚线槽与部件卡堆。Module header plus one control row: Focus (aim the active level viewport camera at the preview actor), Anim Preview ▾ (panel-level preview animation picker), the play/pause latch, Reset (drop the animation, return to the bind pose), and Clear (remove every part, with confirmation). Below sit the + Add Body Part dashed slot and the stack of part cards. |
| 部件卡Part cards | 一张卡 = 一个部件:标题条(三角、名字、版本数、放置区、子件徽章、关系芯片、类型徽章 = 选项按钮、删除 ×)、+ Add Version 虚线槽、版本行列表。存在挂接关系时卡会按层级缩进,并画出挂接轨线。One card per part: the header bar (triangle, name, version count, drop zone, children badge, relation chip, type badge = options button, delete ×), the + Add Version dashed slot, and the version rows. Cards indent according to the hierarchy and draw mount rails when a mount exists. |
| CombinationsCombinations | 控制行(Capture Combination、Clear)、+ Add Combination 虚线槽、草稿条与组合卡网格。A control row (Capture Combination, Clear), the + Add Combination dashed slot, the draft bars and the grid of combination cards. |
| Agent TemplateAgent Template | 动作行 New / Load / Save / Clear,下接详情行:Template Class(绑定哪份模板蓝图)与 Skeleton(权威骨架覆写)。保存状态显示在 Save 按钮上——有未保存改动时文字转橙黄并带黄色星标,一致时为绿色。The action row New / Load / Save / Clear, followed by details rows: Template Class (which template Blueprint is bound) and Skeleton (the authoritative skeleton override). Save state is shown on the Save button — amber text with a yellow star while there are unsaved changes, green when everything is in sync. |
| 日志区Log dock | 底部常驻,拖上方分隔条可改高度。顶部两行绿色状态(预览 Actor 是否已生成 / 配置摘要,如“N 个部件 → N 个 renderer;M 个版本,其中 K 个已设网格”),其后是日志正文,始终滚到最新一行,可向上回看。Permanent at the bottom; drag the splitter above it to resize. Two green status lines come first (whether the preview actor is live, and a summary such as “N body parts → N renderers; M versions, K with a mesh”), followed by the log body, which keeps the newest line in view and can be scrolled back. |
部件与版本Parts and Versions
部件是配置的单位,版本是该部件可替换的网格。一个部件的全部版本共享同一个占位符(位置/旋转/缩放),版本之间的差异由各自的版本变换表达——因此“换版本”只是翻可见性,整体位置不会跳。
A part is the unit of configuration; versions are the meshes it can swap between. All versions of a part share one placeholder (location/rotation/scale), and differences between versions are expressed by their own version transforms — so swapping a version only flips visibility and the part does not jump.
| 操作Action | 行为Behaviour |
|---|---|
| + Add Body Part+ Add Body Part | 点击新建一个空部件(名字 Part N)。把网格拖到这个槽上则每个网格各建一个部件,网格即该部件的首个版本。Click to append one empty part (named Part N). Dropping meshes onto this slot creates one part per mesh, with that mesh as the part's first version. |
| + Add Version+ Add Version | 点击追加一个空版本。把网格拖到该槽上则按拖入顺序追加为多个版本;这个顺序就是最终网格元素的顺序。若该部件此前没有可见版本,新增的第一个版本会自动成为可见版本。Click to append an empty version. Dropping meshes onto it appends them as multiple versions in drop order; that order is the final mesh-element order. When the part had no visible version yet, the first newly added version becomes the visible one. |
| 标题条放置区Header drop zone | 把骨骼或静态网格拖到卡片的标题条上,同样是给该部件追加版本(支持多选拖入)。Dropping skeletal or static meshes on a card's header bar also appends versions to that part (multi-select is supported). |
| 折叠Fold | 点三角折叠/展开该部件的版本列表;Shift+点三角让所有部件跟随同一次状态(全折或全展)。双击标题条同样切换。折叠是零重建操作,不丢当前选择。The triangle collapses/expands that part's version list; Shift+click makes every part follow the same new state (all folded or all unfolded). Double-clicking the header bar toggles too. Folding rebuilds nothing and keeps the current selection. |
| 重命名Rename | 双击名字进入内联编辑,回车 / 点别处 / ESC 都会提交。空名与重名会被拒绝并保留原名,日志说明原因;成功改名后所有指向旧名的子件父级会自动改指新名(socket 选择原样保留)。Double-click the name for inline editing; Enter, clicking elsewhere or ESC all commit. Empty and duplicate names are refused, the old name is kept, and the log explains why. On a successful rename every child that referenced the old name is re-pointed (its socket pick is preserved). |
| 类型与挂接(⋯)Type and mount (⋯) | 标题条尾部的类型徽章就是选项按钮,弹出:Chain(本件整条挂接链与解析方式)、Type(BodyPart / Attached)、以及仅挂件可见的 Parent 与 Socket。Socket 列表取自父件解析版本的网格(无选中则首个版本),所以下拉里不会出现目标网格上不存在的 socket;父件没有网格或没有 socket 时明确提示“先加版本”。The type badge at the bar's tail is the options button. It opens: Chain (this part's whole mount path and how it resolves), Type (BodyPart / Attached), and Parent / Socket, visible for attachments only. The socket list comes from the parent's resolved version mesh (its first version when nothing is selected), so the dropdown never offers a socket the target mesh does not have; when the parent has no mesh or no sockets it says “assign versions first”. |
| 删除Delete | 标题条尾部的红色 × 立即删除该部件及其全部版本(不弹确认,只有 Clear 类操作才确认)。The red × at the bar's tail deletes the part and all its versions immediately (no confirmation; only the Clear actions ask). |
| 版本行:眼睛Version row: eye | 每个部件至多一个版本可见;点开某行的眼睛即显示它并同时隐藏同件其它版本。关掉当前可见版本 = 该部件整体隐藏(合法状态)。双击行的空白处效果相同。At most one version per part is visible; clicking a row's eye shows it and hides the part's other versions. Closing the eye on the visible version hides the whole part (a legal state). Double-clicking a row's blank area does the same. |
| 版本行:网格Version row: mesh | 行内的资产选择器只接受骨骼网格与静态网格(贴图等其它资产被过滤掉),可清空——清空即解绑,该版本在预览里自然隐藏。旁边的 Browse 在内容浏览器里定位、Use Selected 取内容浏览器当前选中的网格;也可直接把网格拖到选择器上(一行一个版本,取第一个拖入的网格)。The row's asset picker accepts skeletal and static meshes only (textures and other assets are filtered out) and can be cleared — clearing unbinds the mesh and the version simply hides in the preview. Browse locates it in the Content Browser, Use Selected takes the Content Browser's current mesh selection, and a mesh can also be dropped straight onto the picker (one row is one version; the first dropped mesh wins). |
| 版本行:预览方块Version row: preview square | 64px 缩略图,双击在对应的资产编辑器里打开网格。可见版本的行整条带高亮,预览方块换成鲜艳绿描边。A 64px thumbnail; double-clicking opens the mesh in its asset editor. The visible version's row is highlighted end to end and its preview square carries a vivid green outline. |
| 版本行:重排Version row: reorder | 悬停行首会出现把手,拖把手移动该版本;蓝色插入条标出落点,同部件内上下拖动与跨部件拖动都支持。版本顺序即网格元素顺序,所以重排是有实际意义的编辑。Hovering the row start reveals a grip; drag it to move the version. A blue insert bar marks where it lands, both within a part and across parts. Version order is mesh-element order, so reordering is a meaningful edit. |
| 版本行:分隔手柄Version row: split handle | 名字与选择器之间的手柄可拖动改宽度;Shift 拖同步该部件的所有行,Ctrl+Shift 拖同步所有部件的所有行。占比只是界面记忆,不写进模板。The handle between the name and the picker changes their widths; Shift-dragging syncs every row of that part and Ctrl+Shift syncs every row of every part. The fraction is UI memory only and never enters the template. |
| 骨架告警Skeleton alarm | Body 版本的骨骼网格与权威骨架不一致时,行右上角出现红色 Skeleton mismatch;悬停说明发生了什么、为什么重要、烘焙后果与修复方式,并给出两个骨架的名字。挂件与静态网格永不告警(挂件会被冻结为静态几何并刚体绑到父骨架)。When a Body version's skeletal mesh disagrees with the authoritative skeleton, a red Skeleton mismatch appears at the row's top right; hovering explains what happened, why it matters, the bake consequence and the fix, naming both skeletons. Attachments and static meshes never alarm (attachments are frozen to static geometry and rigid-bound onto the parent skeleton). |
Body 与 Attachment 的取舍:Body 版本必须是骨骼网格且共享同一骨架——这是“一套烘焙动画驱动全部部件、版本可在组合间互换”的前提。挂件不参与动画,因此可用静态网格,也可用骨骼网格(会被当作刚体处理)。
Body vs Attachment: body versions must be skeletal and share one skeleton — that is what lets a single baked animation stream drive every part and keeps versions interchangeable inside combinations. Attachments are not animated, so they may use static meshes (or skeletal meshes treated as rigid).
层级连线Hierarchy Links
挂接关系用拖线建立:从某个部件标题条上的色块端口按下,拖到另一个部件的端口上松开。拖拽的起点是子件,落点是父件——把 A 的口拖到 B 的口上,即 A 挂到 B 上。成功后 A 变为 Attachment、父级写成 B,A 会被立即排到 B 的正下方,并在松手位置弹出 socket 菜单供选择。
Mounts are created by dragging a link: press on one part's colour port and release on another's. The drag's source is the child and the drop target is the parent — dragging A's port onto B's port mounts A on B. On success A becomes an Attachment whose parent is B, A is moved directly under B, and a socket menu opens at the release point.
| 情况Case | 结果Result |
|---|---|
| 合法目标Legal target | 线转蓝并吸附到目标端口,松开即建立挂接,随后弹 socket 菜单。旧 socket 选择会被清空(换了父件就是换了 socket 空间)。The line turns blue and snaps to the target port; releasing creates the mount and opens the socket menu. The previous socket is cleared (a new parent means a new socket space). |
| 拖到空白处Released in empty space | 什么都不发生,已存在的关系不变。Nothing happens; existing relations stay as they are. |
| 自我连接Self-link | 拒绝(端口在拖拽中不会吸附到源件自身),日志不记新关系。Refused (the far end never snaps to the source port itself) and no new relation is logged. |
| 父件不是 BodyParent is not a Body | 拒绝。只有 Body 部件能拥有子件,这就是“最多两层”的硬约束——挂件永远不能当父件,因此也不可能出现“子件下面再挂子件”。Refused. Only Body parts may own children, which is the hard two-level constraint — an attachment can never be a parent, so a child under a child cannot be created at all. |
| 直接反向Direct reverse | 如果目标当前正挂在源件之下(唯一闭环边就是这条反向边),新连线不会被拒,而是顶替旧关系:被顶替的部件回归为根 Body 部件,新方向生效,日志写明这次翻转。If the target currently hangs under the source (that reverse edge is the only thing closing the loop), the new link is not refused — it displaces the old relation: the displaced part returns to being a root Body part, the new direction applies, and the log records the flip. |
| 更深的环Deeper loop | 拒绝:悬线保持松散、不吸附,日志报出被拒的连线与它将要闭合的那条链。源码刻意不去猜该断哪条不相干的边。Refused: the line stays loose and does not snap, and the log reports the refused link plus the chain it would close. Guessing which unrelated edge to cut is deliberately not attempted. |
| 从 ⋯ 菜单选父件Picking a parent in ⋯ | 与拖线走同一套判定:合法则改挂,直接反向则顶替,更深的环则拒绝且什么都不改。换父件会清空 socket 并刷新 socket 下拉。Runs the same judgement as the drag: legal mounts apply, a direct reverse displaces, a deeper loop is refused with nothing changed. Changing the parent clears the socket and refreshes its dropdown. |
| 链断掉之后After a broken chain | 父件被删、父名写错或成环时,卡上关系芯片与 ⋯ 里的 Chain 行会以告警色报出断点;预览侧该挂件回落到 Actor 根,不会悬空消失。When the parent is deleted, misnamed or cyclic, the card's relation chip and the Chain row in ⋯ report the break in a warning colour; in the preview that attachment falls back to the actor root instead of dangling. |
层级一旦成立,卡片会按“父件在上、子件紧跟其下”的强制顺序排列;父件之间、同父的兄弟之间仍可自由调整。这个顺序在每次连线与每次手动重排后都会重新施加,所以两种方式都无法把它弄乱。
Once a mount exists, cards are kept in a forced order — parent above, its children directly beneath it — while parents remain freely orderable among themselves and siblings freely orderable within their group. The order is re-applied after every link and every manual reorder, so neither route can break it.
组合Combinations
组合是“每个部件各显示哪个版本”的具名快照。点组合上的眼睛即一键切换全部部件;判定“某组合是否已生效”用的是逐部件比对,因此手动改过任一部件后,原组合会自动读作未生效。
A combination is a named snapshot of “which version each part shows”. Clicking a combination's eye switches every part at once; the “is this combination applied” test compares part by part, so manually changing any part makes the original card read as not applied.
| 操作Action | 行为Behaviour |
|---|---|
| Capture CombinationCapture Combination | 把当前逐部件显隐状态录成一个新组合,自动取一个不与现有重名的 Combination N。部件数与组合数组长度不一致时,下一次重建会自动补齐(新槽 = 隐藏),所以增删部件不会让旧组合错行。Records the current per-part visibility state as a new combination, named Combination N (non-colliding). When the part count and the selection array disagree, the next rebuild pads the array (new slots = hidden), so adding or removing parts never shifts old combinations. |
| + Add Combination+ Add Combination | 每按一次新开一条草稿条,可多条并存。条上先选 Mode(Fixed / Random,当前模式绿色),再填文本;Indices / Set 输入框下方实时显示解析结果(部件=版本 或 部件=any/off/v0,v2,v5-7),解析不了就地提示。Name 留空则自动取名。Add 落成一个组合并只关闭本条;Cancel 与标题 × 丢弃本条。Each press opens a new draft bar; several can coexist. Pick a Mode (Fixed / Random, the active one in green), then type. The live resolution sits under the Indices / Set box (Part=Version or Part=any/off/v0,v2,v5-7) and unparseable input says so in place. A blank Name auto-names it. Add commits it as a combination and closes only that bar; Cancel and the header × discard it. |
| Fixed 模式Fixed mode | 逗号分隔的逐部件版本下标,顺序与部件列表一致;-1 或留空 = 该部件隐藏。全角逗号与空格被容忍;出现非数字片段即拒绝提交,日志提示“下标须为逗号分隔的数字”,草稿保持打开待修正。Comma-separated per-part version indices in part-list order; -1 or blank hides that part. Full-width commas and spaces are tolerated. A non-numeric token refuses the commit — the log asks for comma-separated numbers and the draft stays open for a fix. |
| Random 模式Random mode | 逐部件参与文本,分号分隔(语法见 FAssemblyCombinationDef):0,2,5-7 单值/区间、all 或空 = 全部版本、none = 恒隐藏。切到 Random 时若当前文本还是固定式,会预填 all;all;…(最快路径是做减法);切回 Fixed 则恢复当前状态的下标。任一部件解析失败即拒绝提交、日志指名该部件,草稿保持打开。Per-part membership text separated by semicolons (syntax in FAssemblyCombinationDef): 0,2,5-7 singles/ranges, all or empty for every version, none for always hidden. Switching to Random with fixed-style text prefills all;all;… (the fastest path is trimming); switching back restores the current-state indices. Any unparseable part refuses the commit, the log names that part, and the draft stays open. |
| 卡片:眼睛Card: eye | 眼睛是唯一的应用入口(点标题条普通区域不应用)。睁 = 已生效,再点即关闭——所有部件隐藏(全隐藏是合法状态)。随机卡的眼睛是一枚掷骰按钮:每次点击从卡的积族里掷出一个具体样本并应用,再点再掷,日志写出这次掷到了什么。The eye is the only apply entry (clicking the header normally does nothing). Open = applied; clicking again turns it off — every part hidden (a legal state). On a random card the eye is a shuffle button: each click rolls one concrete sample out of the card's family and applies it, clicking again re-rolls, and the log records what was rolled. |
| 卡片:标题条Card: header | 三角折叠/展开组成体(整行同步——折一张卡即折同一行的全部卡片,避免高行里孤零零一张收起卡);Shift+点三角折叠/展开全部组合;双击名字就地重命名;生效中的卡名字转绿、卡框换成鲜绿描边。标题条上还有 覆写(用当前逐部件状态覆盖该组合)与红色的移除 ×。The triangle folds/expands the makeup body (row-synced — folding one card folds its whole row, so a tall row never holds a lone collapsed card); Shift+click folds/unfolds all combinations; double-clicking the name renames in place; an applied card turns its name green and its frame vivid green. The header also carries overwrite (replace the combination with the current per-part state) and a red remove ×. |
| 卡片:组成行Card: makeup rows | 每个部件一行:40px 缩略图 + 版本名 + 行尾暗化的部件名。固定卡里单击版本名会在光标处弹出该部件的版本列表,选中即改写组合内该部件的选择(None = 隐藏);随机卡的文本是参与描述,缩略图只显示最近一次掷出的样本(若它仍属于该集合,否则显示横杠)。双击缩略图打开对应网格资产。One row per part: a 40px thumbnail, the version name, and the dimmed part name at the tail. On a fixed card, clicking the version name opens that part's version list at the cursor; picking one rewrites that part's selection inside the combination (None = hidden). A random card shows the membership description as text, and its thumbnail shows only the last rolled sample (a dash when that sample is no longer a member). Double-clicking the thumbnail opens the mesh asset. |
| ClearClear | 确认后删除全部组合并关闭所有打开的草稿条。没有可清的内容时不弹窗。After confirmation, removes all combinations and closes every open draft bar. With nothing to clear it skips the dialog. |
两个来自烘焙侧的上限,直接决定你能录多少组合:① 模板里至少要有一个组合,否则烘焙会拒绝执行并提示先在 Unit Assembly 面板里录制;② 组合卡最多 255 张,超出的模板会被拒绝,日志提示拆分模板。随机卡按“一张卡”计入这个上限,不会因为它代表很多种组合而多占名额。
Two limits from the bake side decide how many combinations you can capture: ① the template needs at least one combination, otherwise the bake refuses to run and asks you to capture one in the Unit Assembly panel first; ② a template may hold at most 255 combination cards — beyond that it is rejected with a hint to split the template. A random card counts as one card toward this cap, no matter how many combinations it stands for.
烘焙组Bake Groups
选中两张以上部件卡(Ctrl 点选或圈选)后右键 Group Selected Parts 即把它们并成一组,自动起名 Group1、Group2……;同一菜单可把选中部件移出组。部件条左侧的组徽章显示组名与组色,双击徽章可就地改组名,整组一起改(空名或与已有组同名会被拒绝,并在日志说明原因)。
Select two or more part cards (Ctrl+click or marquee), then right-click Group Selected Parts to join them into a group, auto-named Group1, Group2, … The same menu removes the selection from its group. The badge on the part bar shows the group name and colour; double-click it to rename the whole group in place (an empty or already-used name is rejected, with the reason in the log).
烘焙时一组产出一个 emitter:组内每个在组合里出现过的版本元组各合并成一份网格、占一个 renderer;合并只合几何,材质槽不合并,每个源 section 仍保留自己的材质与骨骼参数。面板日志里的烘焙预演会先报出这个布局(每条槽道几个 renderer)。
At bake time a group produces one emitter: every version-tuple that appears in a combination is merged into one mesh occupying one renderer. Only geometry is merged — material slots are not, so every source section keeps its own material and bone params. The panel's bake preview reports this layout first (renderers per lane).
预览Preview
窗口一打开就在当前编辑器世界里生成一个瞬态预览 Actor(对象标签 MB Assembly Preview,位于世界原点),你在面板里做的每次编辑都会立刻反映到关卡视口里。它由面板持有、不进关卡存档;切换关卡时引用被主动断开,新世界就绪后自动重建(PIE 世界不参与)。日志区第一行绿色状态会显示它是否已经生成。
The window spawns a transient preview actor in the current editor world as soon as it opens (actor label MB Assembly Preview, at the world origin), and every panel edit shows up in the level viewport immediately. It is owned by the panel and is not part of the saved level; on a level switch the reference is dropped and the preview is rebuilt once the new world is up (PIE worlds are not involved). The first green status line in the log dock reports whether it is live.
| 项目Item | 行为Behaviour |
|---|---|
| 显示什么What it shows | 与部件列表完全一致:每个部件显示其当前可见版本,隐藏版本不渲染;挂件按父件选中版本的 socket 定位。因为可见性就是组合状态,在面板里点眼睛或在组合卡上应用,视口里立刻切换。Exactly what the part list says: each part shows its currently visible version, hidden versions are not rendered, and attachments sit on the socket of the parent's selected version. Because visibility IS the combination state, clicking an eye or applying a combination switches the viewport immediately. |
| FocusFocus | 把活动关卡视口的相机对准预览 Actor,用于在大场景里快速找回它。Aims the active level viewport camera at the preview actor, handy for finding it again in a large level. |
| 在关卡里改位置Moving things in the level | 预览 Actor 上的部件占位符与版本组件可以直接在视口里拖动——这些编辑会在下一次面板刷新时被收采回配置(并按厘米 / 十分位量化参与“是否有未保存改动”的判定),因此不会白改。用 Load 换入另一份配置时,收采会被压制一次,让载入的数据获胜。Part placeholders and version components on the preview actor can be dragged in the viewport — those edits are harvested back into the configuration on the next panel refresh (quantized to centimetres/tenths for the dirty test), so they are not lost. When Load swaps in another configuration the harvest is suppressed once so the loaded data wins. |
| Anim PreviewAnim Preview | 点按钮即在光标处推出动画菜单:None + 所有与任一 Body 部件选中版本网格编辑器兼容的 AnimSequence(按引擎的资产兼容性判定,重定向动画也能列出)。条目点击的瞬间即施加并开始播放,菜单随即关闭。Clicking the button pushes an animation menu at the cursor: None plus every AnimSequence the editor considers compatible with any Body part's selected-version mesh (the engine's asset-compatibility test, so retargeted animations are listed too). Picking an entry applies and starts it immediately, and the menu closes. |
| 播放范围What plays | 唯一一条面板级动画,在所有骨架接受它且当前可见的 Body 组件上循环播放;挂件保持刚体,永不参与动画。未选中任何动画时,播放过动画的组件会被清回绑定姿势(而不是定格在最后一帧)。One panel-level animation, looping on every visible Body component whose skeleton accepts it; attachments stay rigid and never animate. With no animation picked, components that were playing are cleared back to the bind pose (not frozen on the last frame). |
| 播放/暂停闩锁Play/pause latch | 图标按钮即状态:按下(绿三角)= 播放中,弹起(红双杠)= 已暂停。暂停/继续不重启动画,当前姿势时间保留;组件因选择变化而重建后,暂停状态仍然保持。The icon button is the state: latched down (green triangle) = playing, released (red bars) = paused. Pausing/resuming does not restart the animation — the current pose time is kept — and the paused state survives component rebuilds caused by selection changes. |
| ResetReset | 清空所选动画并解除暂停,拼合 Actor 回到绑定姿势。未选动画时该按钮不可用。Clears the picked animation and the pause state, returning the assembled actor to its bind pose. Disabled while no animation is picked. |
编辑器视口必须处于 Realtime 模式,骨架动画的姿势才会推进;非实时视口下动画仍在播放,只是画面不刷新。
The editor viewport must be in Realtime mode for the skeletal pose to advance; in a non-realtime viewport the animation still plays, the picture just does not refresh.
模板存取Template Save / Load
Agent Template 模块负责把窗口里的配置落到一份 assembly 模板蓝图上,或从蓝图读回窗口。它操作的只有模板的 Parts、Combinations、Skeleton 与组件节点,不碰你在蓝图里自己加的任何组件。
The Agent Template module writes the window's configuration into an assembly template Blueprint, or reads it back. It touches only the template's Parts, Combinations, Skeleton and its generated component nodes — never components you added to the Blueprint yourself.
| 按钮Button | 行为Behaviour |
|---|---|
| NewNew | 弹出一个对话框填 Asset Name / Output Path / Skeleton Override(全部预填;文本框留空 = 保持预填,骨架选择器不动 = 采纳预填值,清空 = 明确选择自动识别)。确认后:清空当前配置、取一个空闲名(重名自动加 _1/_2… 后缀,绝不改动既有资产)、落一个空模板蓝图并绑定。取消则什么都不变。A dialog collects Asset Name / Output Path / Skeleton Override (all prefilled; an empty text input keeps its prefill, an untouched skeleton picker accepts the prefill, and clearing it explicitly chooses auto-detect). On confirm: the current configuration is reset, a free name is chosen (taken names get _1/_2… suffixes and existing assets are never touched), and a fresh empty template Blueprint is created and bound. Cancel changes nothing. |
| LoadLoad | 从当前绑定的模板类读取部件、版本、组合与骨架,替换窗口里的配置。载入会先在蓝图组件节点上收采你已经手工微调过的变换,因此类内调整不会白做。载入后界面统一收起(只看到部件条与组合卡标题,要编辑什么再展开);同时把保存目标同步到该资产的实际名称与路径,下一次 Save 会落回源资产。选中的类变更时会自动载入。Reads parts, versions, combinations and the skeleton from the currently bound template class, replacing the window's configuration. It first harvests transforms you tweaked by hand on the Blueprint's component nodes, so in-class edits are not lost. After loading, everything lands folded (part bars and combination headers only — unfold what you want to edit), and the save target is synced to the asset's actual name and path so the next Save lands back on the source asset. Changing the bound class loads automatically. |
| SaveSave | 先把配置映射成模板组件节点(每版本一个 SK_<部件>_V<下标>,每部件一个 PLACE_<部件> 占位符),只在确有结构或数值变化时重编译蓝图,然后把 Parts / Combinations / Skeleton 写进类默认值并存盘。日志会写明新建还是更新、部件数与版本数;写盘失败会明确警告“模板只在内存中”。未绑定蓝图时:名称/路径上已有蓝图则原地更新(引用不受影响),否则新建。First maps the configuration onto the template's component nodes (one SK_<Part>_V<Index> per version, one PLACE_<Part> per part), recompiles the Blueprint only when structure or values actually changed, then writes Parts / Combinations / Skeleton into the class defaults and saves the package. The log says new-vs-updated and how many parts/versions; a failed disk save warns that the template is memory-only. With no Blueprint bound: an existing Blueprint at the name/path is updated in place (references survive), otherwise one is created. |
| ClearClear | 确认后解绑模板类并清空资产名 / 输出路径 / 骨架覆写。部件与组合不受影响(该按钮只管自己的区块);没有可清内容时不弹窗。After confirmation, unbinds the template class and clears the asset name, output path and skeleton override. Parts and combinations are untouched (the button owns only its own section); with nothing to clear it skips the dialog. |
| Template ClassTemplate Class | 目标蓝图的值井:只接受 assembly 模板蓝图(其它资产在选择器与拖放里被过滤;用“Use Selected”选到不兼容的类会被忽略、当前绑定保持不变)。双击值井打开蓝图。原生类视为未绑定。The target Blueprint well: it only accepts assembly template Blueprints (other assets are filtered in both the picker and drag-drop; an incompatible class reached through “Use Selected” is ignored and the current binding survives). Double-clicking the well opens the Blueprint. A native class counts as unbound. |
| SkeletonSkeleton | 权威骨架覆写:留空 = 自动识别(首个 Body 件的首个骨骼版本)。Load 会自资产回填、读不到时按已载入版本识别;New 按当前配置预填;Save 一起持久化;Clear 一并清空。改动只让 Save 按钮亮起橙黄星标,不会自动保存。The authoritative skeleton override: empty = auto-detect (the first Body part's first skeletal version). Load back-fills it from the asset or, failing that, detects it from the loaded versions; New prefills it from the current configuration; Save persists it; Clear wipes it. A change only turns the Save button amber with a star — nothing auto-saves. |
| 未保存改动Unsaved changes | 面板对配置做签名比对(部件名、选中版本、类型、父级与 socket、占位符与版本变换、版本名与网格、全部组合、骨架)。签名与最近一次存/取不一致时 Save 显示为 Save *(橙黄 + 星标);一致则为绿色。未绑定蓝图(或绑定原生类)时,只要还有部件就视为有未保存改动。The panel compares a configuration signature (part names, selected versions, types, parents and sockets, placeholder and version transforms, version names and meshes, all combinations, the skeleton). When it differs from the last save/load, Save reads Save * (amber with a star); in sync it is green. With no Blueprint bound (or a native class bound), any remaining part counts as unsaved work. |
每次保存/载入前都会先跑一遍配置校验,只记警告、不拦截保存:Body 版本用了静态网格、Body 版本骨架与主骨架不一致、挂件没有父件 / 父件不存在 / 父名有歧义 / 父链成环 / 没有 socket / 父件无版本可挂 / socket 不在父件解析版本上 / 挂接链上游断裂——逐条写进日志并给出总数。
Every save and load is preceded by a configuration validation that only logs warnings and never blocks the save: a body version using a static mesh, a body version whose skeleton differs from the master, an attachment with no parent / a missing parent / an ambiguous parent name / a cyclic parent chain / no socket picked / a parent with no versions / a socket missing on the parent's resolved version / a break upstream in the mount chain — each is logged with a total count.
公开方法Public Methods
窗口的构造入口。创建一份瞬态工作状态(UMassBattleAssemblyState)并强引用持根;若构造时带上了 Agent Creator 的状态,则从其资产名与输出路径播种保存目标。随后装配整条界面(部件列表、组合模块、模板模块、日志区),生成预览 Actor,并订阅世界清理/初始化事件以在切关卡时安全地断开并重建预览。
The window's construction entry. It creates one transient working state (UMassBattleAssemblyState) and roots it with a strong reference; when an Agent Creator state is supplied, the save target is seeded from its asset name and output path. It then assembles the whole UI (parts list, combinations module, template module, log dock), spawns the preview actor, and subscribes to world cleanup/init events so the preview is safely dropped and rebuilt across level switches.
Input
| 参数Param | 类型Type | 说明Description |
|---|---|---|
InArgs | const FArguments& | Slate 参数,只有一个可选项 CreatorState(打开窗口的 Agent Creator 的状态;从主菜单打开时为 nullptr)。Slate arguments with a single optional CreatorState (the state of the Agent Creator that opened the window; nullptr when opened from the main menu). |
Output
无返回值。副作用:构建全部子控件与工作状态、生成预览 Actor、注册世界事件回调。
No return value. Side effects: builds all child widgets and the working state, spawns the preview actor, and registers the world-event callbacks.
标签页的关闭闸门:没有未保存改动时直接放行;有改动时弹出居中的 Save / Discard / Cancel,选 Save 会先保存再放行,选 Discard 直接放行,Cancel 阻止关闭。
The tab's close gate: with no unsaved changes it allows the close; with changes it shows a centred Save / Discard / Cancel prompt — Save saves and then allows, Discard allows outright, Cancel blocks the close.
Input
无参数。
No parameters.
Output
返回是否允许关闭。副作用:选 Save 时可能创建/更新模板蓝图并写盘。
Returns whether closing is allowed. Side effect: choosing Save may create/update the template Blueprint and write it to disk.
窗口级拖放。按优先级处理三类落物:① 从关卡拖入的 assembly 模板 Actor——用它当前的部件/组合回填面板并绑定它的类;② 从内容浏览器拖入的 assembly 模板 蓝图——绑定并载入;③ 网格(骨骼或静态)——追加为选中部件的版本(没有选中部件时用最后一个;空面板则先建一个新部件),版本名取网格名,若该部件此前没有可见版本则自动显示首个版本。其它类型的落物不处理。
Window-level drag-drop, handling three kinds of payload in priority order: ① an assembly template actor dragged from the level — the panel is filled from its current parts/combinations and its class is bound; ② an assembly template Blueprint from the Content Browser — bound and loaded; ③ meshes (skeletal or static) — appended as versions of the selected part (the last part when nothing is selected; a fresh part is created on an empty panel), named after the mesh, with the first version becoming visible when the part had none. Any other payload is declined.
Input
| 参数Param | 类型Type | 说明Description |
|---|---|---|
MyGeometry | const FGeometry& | 窗口几何(Slate 传入)。Window geometry (provided by Slate). |
DragDropEvent | const FDragDropEvent& | 拖放事件,其操作类型决定落物种类。The drag-drop event; its operation type decides the payload kind. |
Output
落物被接受返回 FReply::Handled(),否则 Unhandled。副作用:改写工作状态、绑定模板类、重建部件列表并刷新预览。
Returns FReply::Handled() when the payload is accepted, otherwise Unhandled. Side effects: edits the working state, binds the template class, rebuilds the part list and refreshes the preview.
窗口的键盘处理,目前只承载一个手势:ESC 清除部件卡的选择高亮——它是“点背景左键”的键盘孪生。内联重命名持有焦点时 ESC 由编辑框自己消费(提交),因此不会抢走该手势;焦点在面板内任意控件上都能冒泡到这里。
The window's key handling, currently serving one gesture: ESC clears the part-card selection highlight — the keyboard twin of a background left click. While an inline rename owns focus, ESC is consumed by the text box itself (commit), so the gesture is never stolen; key events bubble here from whichever panel widget holds focus.
Input
| 参数Param | 类型Type | 说明Description |
|---|---|---|
MyGeometry | const FGeometry& | 窗口几何(Slate 传入)。Window geometry (provided by Slate). |
InKeyEvent | const FKeyEvent& | 按键事件;非 ESC 不处理。The key event; anything but ESC is declined. |
Output
处理了 ESC 返回 Handled,否则 Unhandled。副作用:仅清除选择并重绘(不重建控件)。
Returns Handled for ESC, otherwise Unhandled. Side effect: clears the selection and repaints only (no widget rebuild).
声明窗口可以持有键盘焦点。任何来自窗口之外的点击都会把焦点拉进面板,因此“在面板里最后一次操作的位置”总能收到按键,ESC 随时可用。
Declares that the window may hold keyboard focus. Any click arriving from outside the window pulls focus in, so key events reach wherever you last worked inside the panel and ESC is always available.
Input
无参数。
No parameters.
Output
恒为 true。无副作用。
Always true. No side effects.
成员变量Members
下面列出的都是与用户可见行为直接相关的成员(其余为实现细节)。工作状态的字段见 MassBattleAssemblyState。
The members below are the ones with directly user-visible meaning (the rest are implementation detail). For the working-state fields see MassBattleAssemblyState.
| 名称Name | 类型Type | 默认值 | 说明Description |
|---|---|---|---|
W | UMassBattleAssemblyState* (private) | nullptr | 工作状态的裸引用别名;真正的持有者是 StateRoot(TStrongObjectPtr)。A raw alias to the working state; the actual owner is StateRoot (TStrongObjectPtr). |
SelectedCategoryIndex | int32 (private) | INDEX_NONE | 面板级拖放的目标部件(未选中时退回最后一个部件)。Target part for panel-level mesh drops (falls back to the last part when nothing is selected). |
ManualDrafts | TArray<FManualCombinationDraft> (private) | 空empty | 打开中的手动组合草稿条(下标文本、名字、Fixed/Random 模式),可多条并存。The open manual combination draft bars (index text, name, Fixed/Random mode); several may coexist. |
CombinationCollapsed | TArray<bool> (private) | 空empty | 仅 UI 的组合折叠态,与组合数组平行;整行同步折叠。UI-only fold state of the combination cards, parallel to the combination array; folding is row-synced. |
bPreviewAnimPaused | bool (private) | false | 面板级预览动画的传输状态(true = 已暂停)。跨组件重建保持,重新选择动画或 Reset 时清零。Transport state of the panel-level preview animation (true = paused). Survives component rebuilds and is cleared by picking a new animation or Reset. |
LastSyncedSignature | uint32 (private) | 0 | 最近一次保存/载入时的配置签名,作为“是否仍有未保存改动”的基线。The configuration signature captured on the last save/load, used as the baseline for “are there unsaved changes”. |
CreatorState | TObjectPtr<UMassBattleAgentCreatorState> (private) | nullptr | 打开窗口的 Agent Creator 状态,仅用于播种资产名与输出路径。The Agent Creator state that opened the window, used only to seed the asset name and output path. |
管线角色Pipeline Role
窗口由 FMassBattleEditorModule::OnSpawnAssemblyTab 创建:标签页注册为 Nomad tab(归在 Window → Tools),内容即本控件,并把关闭闸门接到 AllowTabClose。Agent Creator 的 Open Assembly... 按钮只是 TryInvokeTab 到这个标签页,因此两条入口打开的是同一个实例。运行期它与三个对象打交道:UMassBattleAssemblyState(工作数据)、AMassBattleAssemblyTemplate(预览实例 + 保存目标类)、以及蓝图编辑器的 SCS 同步——保存时在模板蓝图上增删/重挂 SK_*_V<数字> 与 PLACE_* 节点,必要时重编译,最后写类默认值并存盘。模板保存后,复合烘焙从模板类默认值读取部件与已录制的组合,逐部件产出内容;因此组合至少要录一个,否则烘焙会直接报错退出。
The window is created by FMassBattleEditorModule::OnSpawnAssemblyTab: the tab is registered as a Nomad tab (under Window → Tools), its content is this widget, and its close gate is wired to AllowTabClose. The Agent Creator's Open Assembly... button merely calls TryInvokeTab for that tab, so both entry points reach the same instance. At runtime it deals with three things: UMassBattleAssemblyState (the working data), AMassBattleAssemblyTemplate (the preview instance and the save-target class), and the Blueprint editor's SCS sync — on save it adds/removes/re-parents SK_*_V<digits> and PLACE_* nodes on the template Blueprint, recompiles when needed, then writes the class defaults and saves the package. Once the template is saved, the composite bake reads parts and the captured combinations from the template class defaults and produces content per part; that is why at least one combination must be captured — otherwise the bake aborts with an error.
补充说明Notes
① 窗口不生成资产、不烘焙——它只编辑配置并保存模板;产生运行时数据的是 Agent Creator 的 Generate。② 预览 Actor 是瞬态的,不会随关卡保存;切换关卡后它会自动重建,大场景里用 Focus 找回。③ 日志区显示最新若干行并可向上回看,完整历史同时写到引擎输出日志(标签 [MassBattleAssembly]),排查时以那份为准。④ 所有“清空”类按钮只清自己的区块:模板区的 Clear 不动部件与组合,部件的 Clear 不动组合。⑤ 手动组合草稿是易失的——关闭窗口或 Clear 组合都会丢弃未提交的草稿。
① The window generates no assets and bakes nothing — it edits a configuration and saves a template; runtime data comes from the Agent Creator's Generate. ② The preview actor is transient and is not saved with the level; it is rebuilt after a level switch — use Focus to find it in a large level. ③ The log dock shows the newest lines with scrollback while the full history also goes to the engine output log under [MassBattleAssembly]; use that one when diagnosing. ④ Each “clear” only wipes its own section: the template section's Clear leaves parts and combinations alone, and the parts Clear leaves combinations alone. ⑤ Manual combination drafts are volatile — closing the window or clearing the combinations discards uncommitted drafts.