Mass Battle Frameworkv1.20.0

SMassBattleBakeProgressDialog

SCompoundWidget

Source/MassBattleEditor/Public/AgentCreator/SMassBattleBakeProgressDialog.h

概述Overview

烘焙进度窗口:Agent Creator 的 Generate 通过输入检查并真正开始烘焙后,在三种工具模式下都会打开它,用一个稳定的模态窗口显示当前步骤、整体进度、耗时估计和滚动日志。烘焙本身在游戏线程上同步执行,窗口在步骤之间重绘,因此长烘焙期间编辑器仍能看到「在干活」而不是卡死。

The bake progress window: once Generate in the Agent Creator passes its input checks and actually starts baking, this window opens in all three tool modes, presenting the current step, overall progress, a time estimate and a streaming log in one stable modal window. The bake itself runs synchronously on the game thread while the window repaints between steps, so long bakes read as work in progress rather than a frozen editor.

它纯粹是被动报告器:窗口不提供取消或中止按钮,运行期间也不能关闭;唯一需要用户做的决定出现在烘焙开始前——是否覆盖已有资产。成功时窗口自行关闭,失败时保持打开直到手动关闭。它不修改任何资产、不改变烘焙结果,只显示调用方推给它的状态。

It is a purely passive reporter: the window offers no cancel or abort action and cannot be closed while running; the only user decision around it is the overwrite confirmation shown before the bake starts. On success it closes itself; on failure it stays open until dismissed. It changes no assets and does not alter the bake result — it only displays the state pushed to it by the caller.

窗口内容What the Window Shows

区域Region显示Display说明Description
标题行Header 标题文本 + 2px 强调条。Title text plus a 2px accent strip. 由 Generate 按模式传入,例如 Baking agent 'AssetName'、Baking sprite agent 'AssetName'、Baking assembly composite 'AssetName'。Supplied by Generate per mode, e.g. Baking agent 'AssetName', Baking sprite agent 'AssetName' or Baking assembly composite 'AssetName'.
实时状态行Live status line 当前步骤的细节文本,如逐 LOD 的 LOD0 (bone, blend 3)。Detail text for the current step, e.g. LOD0 (bone, blend 3) per LOD. 无内容时整行折叠,不占高度;运行中为灰色,结束后按成败转为绿/红。Collapses entirely when empty; gray while running, then green/red by outcome after finishing.
进度条 + 时间Progress bar + time 14px 高的进度条,下方一行耗时/剩余时间估计。A 14px-tall progress bar with an elapsed/remaining estimate below it. 运行中为蓝色,成功转绿,失败转红。时间文本形如 Elapsed 12s Est. remaining ~8s,结束后为 Total 20s。Blue while running, green on success, red on failure. The time text reads Elapsed 12s Est. remaining ~8s while running and Total 20s when done.
步骤卡Steps card 有序步骤列表,每行带状态前缀。An ordered step list, each row carrying a state prefix. [ OK ] 已完成(绿)、[ >> ] 进行中(白)、[ ] 待执行(灰)。行尾可附实时计数,如 (3/6)。[ OK ] done (green), [ >> ] active (white), [ ] pending (gray). A live counter such as (3/6) may follow the row.
日志卡Log card 等宽字体的滚动日志,自动滚到最新一行。A scrollable monospace log, auto-scrolled to the newest line. 窗口开着时,Agent Creator 的每一行日志都会同步流进这里,所以完整过程可以边烘焙边阅读。While the window is open, every Agent Creator log line also streams in here, so the full process can be read during the bake.
关闭按钮Close button 右下角的 Close。Close at the bottom right. 运行期间隐藏,只在结束(成功或失败)后出现。Hidden while running; appears only after the bake finishes, successfully or not.

步骤列表Step Lists

步骤清单由模式决定,窗口只按调用方给的顺序显示。VAT Standard 的第五步会额外报告逐 LOD 子进度与完成计数;VAT Advanced 只有一个步骤,过程细节全部走日志。

The step list is determined by the mode; the window simply shows the sequence supplied by the caller. VAT Standard's fifth step additionally reports per-LOD sub-progress and a done counter; VAT Advanced has a single step and puts all process detail in the log.

模式Mode步骤Steps进度表现Progress behavior
VAT Standard ① 转换静态网格与材质实例(Convert static mesh & material instances)② 复制 NS 与渲染器并填充槽位(Duplicate NS & renderer (slot fill))③ 创建单位数据资产(Create agent data asset)④ 创建 VAT 纹理(Create VAT textures)⑤ 逐 LOD 执行 AnimToTexture 烘焙(AnimToTexture bake (per LOD))① Convert static mesh & material instances ② Duplicate NS & renderer (slot fill) ③ Create agent data asset ④ Create VAT textures ⑤ AnimToTexture bake (per LOD) 进度条按步骤推进;第五步在 LOD 之间更新子进度与 (已完成/总数) 计数,状态行显示当前 LOD 与其烘焙模式、混合级别。The bar advances per step; step five updates sub-progress and a (done/total) counter between LODs, with the status line showing the current LOD plus its bake mode and blend level.
Sprite (Atlas) ① Sprite 渲染器(Sprite renderer)② Sprite 数据资产(Sprite data asset)③ Sprite 材质实例(Sprite material instance)① Sprite renderer ② Sprite data asset ③ Sprite material instance 三步等权推进。Three equally weighted steps.
VAT Advanced ① 复合烘焙,细节见日志(Composite bake (see log))① Composite bake (see log) 只有一个步骤,因此进度条在结束前不会推进;想知道烘焙进行到哪一阶段,看日志卡。A single step, so the bar does not advance before the end; follow the log card to see how far the bake has progressed.

取消、关闭与留存Cancel, Close and Persistence

窗口不能取消:没有取消/中止按钮,标题栏也没有关闭按钮,且不支持最小化或最大化。运行期间它保持模态,用户只能观察,不能干预。

The window cannot cancel: there is no cancel/abort button, the title bar has no close button, and minimize/maximize are disabled. It stays modal while running — the user can observe but not intervene.

结果Outcome行为Behavior
成功Success 所有步骤标记为完成,进度条转绿,窗口在约 1.5 秒后自动关闭。摘要文本提示成功,并指向 Creator 日志里的细节。All steps are marked done, the bar turns green, and the window closes itself after about 1.5 seconds. The summary reports success and points to the creator log for details.
失败Failure 进度条与状态行转红,窗口保持打开,直到用户点 Close。失败摘要明确写出失败并指向 Creator 日志:标准与 Sprite 模式为 Bake FAILED — details in the creator log,VAT Advanced 为 Composite bake FAILED — details in the creator log。The bar and status line turn red and the window stays open until the user presses Close. The summary states the failure and points to the creator log: Bake FAILED — details in the creator log for Standard and Sprite, Composite bake FAILED — details in the creator log for VAT Advanced.

同一时间只允许存在一个进度窗。已有烘焙在显示时,再次 Generate 不会叠窗,而是失败返回并在 Creator 日志里记一行「Generate 已在进行中」。

Only one progress window may exist at a time. If a bake is already showing, another Generate does not stack a window — it returns without one and writes a "Generate already running" line to the creator log.

某一步失败时怎么办If a Step Fails

单个步骤失败不会弹出中断窗,也不会中途停掉整条序列:该步会把自己的错误写进日志并让对应产物槽位留空,后续步骤照常执行;全部步骤走完后,窗口用红色终态和摘要统一给出失败结论。因此判断失败原因要看日志,而不是看进度条停在哪一步。

A failing step does not raise an interruption dialog or stop the sequence midway: it writes its error to the log and leaves its product slot empty, while the remaining steps still run. When every step has been attempted, the window reports the overall failure through its red terminal state and summary. Diagnose the cause from the log, not from where the bar stopped.

查看位置Where to look能得到什么What you get
进度窗的 Log 卡The window's Log card 本次烘焙的完整日志流:哪一步、哪个 LOD、哪张贴图或哪个资产出了问题。The full log stream for this bake: which step, which LOD, which texture or asset went wrong.
Agent Creator 面板的日志区The Agent Creator panel's log dock 同一条日志在面板关闭进度窗后仍保留(显示最后 20 行),方便对照输入与结果。The same lines survive after the progress window closes (last 20 shown), handy for comparing inputs with results.
编辑器日志The editor log 逐行带有 [MassBattleAgentCreator] 前缀,可回溯更早的完整记录。逐 LOD 烘焙失败的提示会明确指向编辑器日志。Each line carries a [MassBattleAgentCreator] prefix and keeps the fuller history. Per-LOD bake failures explicitly point to the editor log.

修好原因后直接重新 Generate 即可:已有资产会走覆盖确认,确认后原位覆盖,资产名与引用保持不变。窗口没有重试按钮,关闭它不会回滚已经写入的资产。

After fixing the cause, run Generate again: existing assets go through the overwrite confirmation and are then replaced in place, keeping their names and references. The window has no retry button, and closing it does not roll back assets already written.

覆盖确认Overwrite Confirmation

覆盖确认是独立于进度窗的阻塞对话框,在烘焙开始前出现,只在输出路径下已存在本工具生成的资产时弹出。它按资产类型 × 数量分组列出找到的内容(例如静态网格、材质实例、纹理、Niagara 系统、渲染器蓝图;数据资产按原始类名显示),并说明覆盖是原位进行——所有资产名保持不变,场景中的 actor 与单位配置继续有效。Overwrite 继续烘焙;Cancel 中止且不触碰任何资产。没有已存在资产时不开窗,直接烘焙。

The overwrite confirmation is a blocking dialog separate from the progress window. It appears before baking starts and only when the output path already contains assets created by this tool. It lists what was found grouped by asset class and count (for example static meshes, material instances, textures, Niagara systems and renderer Blueprints; data assets appear under their raw class name) and explains that overwriting happens in place — every asset name stays the same, so placed actors and unit configs keep working. Overwrite proceeds; Cancel aborts without touching anything. With no existing assets the dialog is skipped and the bake starts directly.

对外接口Public Surface

这些入口由 Agent Creator 的 Generate 调用;普通用户不需要直接调用它们,但可用于理解窗口在什么时机更新。

These entry points are called by Generate in the Agent Creator; users do not normally call them, but they explain when the window updates.

成员Member类型Type说明Description
Openstatic TSharedPtr<SMassBattleBakeProgressDialog>创建并显示模态窗口,立即返回;已有窗口在显示时返回空。标题与步骤清单由调用方给出。Creates and shows the modal window and returns immediately; returns null while another window is active. The title and step list come from the caller.
SetCurrentStepvoid把之前的步骤标记为完成、当前步骤标记为进行中,更新进度条与状态行,并立即重绘。Marks earlier steps done and the given step active, updates the bar and status line, and repaints immediately.
SetSubProgressvoid在单个步骤内推进子进度(如逐 LOD),并可同时更新状态文本。Advances sub-progress inside one step (e.g. per LOD) and may update the status text with it.
SetStepCountervoid给某一步追加实时 (已完成/总数) 计数;总数不大于 0 时忽略。Appends a live (done/total) counter to a step; ignored when the total is not positive.
LogLinevoid追加一行日志并滚到最新。Agent Creator 的日志会经此流入。Appends a log line and scrolls to it; Agent Creator log lines stream in through this.
Finishvoid写入最终摘要与成败、解锁 Close;成功时安排约 1.5 秒后自动关闭。Writes the final summary and outcome, unlocks Close, and schedules auto-close in about 1.5 seconds on success.
CloseNowvoid立即销毁窗口并清除活动实例。关闭后不会回滚任何已写入的资产。Destroys the window immediately and clears the active instance. Closing does not roll back any assets already written.
ConfirmOverwritestatic bool烘焙前的阻塞覆盖确认;返回 true 表示继续,false 表示用户取消。空清单不开窗并直接返回 true。The blocking pre-bake overwrite confirmation; true means proceed, false means the user cancelled. An empty list opens no dialog and returns true.
Activestatic TWeakPtr<SMassBattleBakeProgressDialog>当前活动的进度窗;日志与逐 LOD 进度都经它找到窗口。The currently active progress window; log routing and per-LOD progress use it to find the window.

管线角色Pipeline Role

窗口由 Agent Creator 的 Generate 在真正开始烘焙时打开(三种模式皆然),并在每个步骤切换时被调用;Agent Creator 的日志函数在窗口活动期间把每一行同时送进窗口的日志卡。烘焙结束后,调用方根据关键产物槽位是否齐全决定成败并调用 Finish。窗口不参与烘焙逻辑,也没有对模拟或资产的直接写入。

The window is opened by Generate in the Agent Creator once baking actually starts (in all three modes) and is driven at each step transition; while it is active, the Agent Creator's logging function also routes every line into the window's log card. When the bake ends, the caller decides success from whether the key product slots were filled and calls Finish. The window takes no part in bake logic and performs no direct writes to the simulation or to assets.

补充说明Notes

① 窗口尺寸固定为 560×480,居中出现在首选工作区。② 重绘在步骤切换时立即发生,其余更新按约 10 Hz 节流,因此进度条与时间可能略有跳步,但不会漏掉步骤切换。③ 成功后的自动关闭只影响窗口,不会删除或修改已生成的资产。④ 关闭失败窗口不会撤销任何步骤,重新 Generate 会按原位覆盖处理。

① The window is a fixed 560×480 and centers in the preferred work area. ② Repaints happen immediately on step changes and are otherwise throttled to about 10 Hz, so the bar and time may step slightly, but no step transition is missed. ③ Auto-close on success affects the window only — generated assets are neither deleted nor modified. ④ Closing a failed window undoes no steps; running Generate again handles them as in-place overwrites.