@babylonjs-toolkit/agent 1.2.10 → 1.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Babylon Toolkit Desktop Agent (1.2.10)
1
+ # Babylon Toolkit Desktop Agent (1.2.11)
2
2
 
3
3
  The desktop agent owns the entire pipeline end to end — frontend and UI design, gameplay code, shaders, generated art and audio, 3D models in headless Blender, whole game levels and prefabs in a terminal-driven Unity Editor, the interactive glTF export, the web build, the dev server, and visual QA by screenshotting both Unity and the running browser.
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs-toolkit/agent",
3
- "version": "1.2.10",
3
+ "version": "1.2.11",
4
4
  "description": "Installs the Babylon Toolkit Desktop Agent for Claude Code, Codex, GitHub Copilot, Gemini CLI and Antigravity.",
5
5
  "keywords": [
6
6
  "babylonjs",
@@ -14,7 +14,7 @@ Use the user's message after the skill name as the `arguments`.
14
14
 
15
15
  ```
16
16
  /bt-optimize [<scene asset path>] [--out:<asset path>] [--analyze] [--reset]
17
- [--no-combine | --combine-only] [--no-tune:unskin,lights,static,lightmaps,post] [--instance-from:4]
17
+ [--no-combine | --combine-only] [--no-tune:unskin,lights,static,lightmaps,post] [--instance-from:4] [--keep-gi]
18
18
  [--keep-lights:Name1,Prefix*] [--bake-shadowed-lights] [--exclude:Name1,Prefix*] [--only:Path/A,Path/B]
19
19
  [--cell:15] [--spread:3] [--atlas-share:0.45] [--no-shadergraphs] [--no-lods] [--shaders:Name1,Name2]
20
20
  [--textures:ktx2] [--resolution:css] [--no-bake] [--no-export] [--no-browser] [--pins:40,60] [--times:10,20,30,45,60,90]
@@ -27,7 +27,8 @@ Use the user's message after the skill name as the `arguments`.
27
27
  - **`--no-combine`** — every optimization except merging meshes.
28
28
  - **`--combine-only`** — only merge static meshes and LOD groups (no light, static, lightmap or post changes).
29
29
  - **`--no-tune:`** — skip individual tune steps: `unskin` (rigid skinned meshes → plain meshes), `lights` (bake practical lights / drop point-spot shadows), `static` (mark non-moving props static), `lightmaps` (probe-lit → lightmapped), `post` (no-op post effects).
30
- - **`--instance-from:`** — a mesh drawn this many times or more (same mesh and materials) stays light-probe lit so its copies share one instanced draw instead of each getting its own lightmapped mesh (default `4`; `0` turns it off).
30
+ - **`--instance-from:`** — a mesh drawn this many times or more (same mesh and materials) is never lightmapped, and its copies get Light Probes Off so they share one instanced draw instead of each getting its own mesh (default `4`; `0` turns it off).
31
+ - **`--keep-gi`** — keep Contribute GI exactly as the source has it: no tune step adds it to an object that did not contribute GI in the source, so the re-bake keeps the source's indirect light (default off: merging needs the newly lightmapped props).
31
32
  - **`--keep-lights:`** — light names (or prefixes ending in `*`) that stay realtime / Mixed.
32
33
  - **`--bake-shadowed-lights`** — also bake point / spot lights that cast realtime shadows (default: they stay realtime with their shadows turned off).
33
34
  - **`--exclude:`** — object names (or prefixes) whose subtrees are never tuned or merged. **`--only:`** limits merging to these hierarchy paths.
@@ -65,7 +66,7 @@ Learned on a 2,400-renderer URP garden that ran 8–26 FPS (1–5 FPS in hitches
65
66
  - **Zero-intensity post effects may still run.** URP's pipeline-default Volume Profile ships Motion Blur at intensity 0 (off in Unity); older toolkit runtimes still built a motion-blur pass for it.
66
67
  - **Light binding is NOT range-aware.** BabylonJS's `Light.canAffectMesh` checks only include / exclude lists and layer masks, so every mesh binds up to its cap of runtime lights wherever they are (verified on Mario Circuit: 5 × 5 m item boxes bound 8 lights, 7 out of range). Tighter mesh bounds never lower the bindings — only baking the lights does. The profiler's `lightAudit` clamps each light into the mesh's box, so scene-sized bounds (skinned or track-wide meshes) hide the waste: a low out-of-range share on such a scene is understated.
67
68
  - **Skinned meshes never instance.** Copies of a skinned mesh that animate separately each cost their own draw in every pass, and are skinned every frame. DAE and FBX imports routinely make rigid props one-bone skinned meshes: on Mario Circuit, 118 of 135 skinned renderers (coins, item-box parts, trees, track pieces) had one bone moving with the object and 129 of 202 main-pass draws came from 8 such repeated shapes. As plain meshes the exporter writes the copies as glTF instances (`ExportMeshInstances`, default on) — one draw per shape.
68
- - **Lightmapping a repeated prop costs its instancing.** A lightmapped renderer never shares a cached mesh (each copy gets its own lightmap UVs), so 16 lightmapped trees are 16 draws while 16 probe-lit trees are one. Repeated props stay probe-lit (`instanceRepeatsFrom`); unique geometry gets the lightmaps.
69
+ - **Lightmapping a repeated prop costs its instancing — and so does light-probe lighting.** A lightmapped renderer never shares a cached mesh (each copy gets its own lightmap UVs), and the toolkit also loads every light-probe-lit node as its own mesh (`SceneManager.DeinstanceProbeLitNodes`, default on): copies instance only with Light Probes **Off**. On Mario Circuit, trees, item boxes and coins went from 14 / 18 / 6 draws to 3 / 3 / 1 once their probes were off. Repeated props get neither (`instanceRepeatsFrom`); unique geometry gets the lightmaps.
69
70
  - **Materials are cloned per renderer** for each reflection probe / lightmap combination and per LOD cross-fade level. Fewer renderers → fewer clones → fewer first-view shader compiles (hitches).
70
71
  - **Lightmapped renderers never share a cached mesh** (reference §4): repeated lightmapped props are one draw each — merging is the only way to cut them. Probe-lit repeated props stay glTF instances.
71
72
 
@@ -75,8 +76,9 @@ Enforced by `scripts/BtOptimize.cs` (`Tune`). A **browser driver** is anything t
75
76
 
76
77
  | Step | Rule | Why |
77
78
  |---|---|---|
78
- | Unskin rigid meshes | A SkinnedMeshRenderer with **one weighted bone** that moves with the object (no clip, Timeline, script, constraint or physics body moves the bone apart from the object), no blend shapes, no cloth, and no curve or reference aimed at the SkinnedMeshRenderer component becomes a MeshFilter + MeshRenderer on the same mesh and materials. Animators stay. When the bind pose offsets the mesh, a plain leaf object is moved onto it (the mesh stays shared — verified vertex by vertex); otherwise the offset is baked into one mesh asset shared by every copy with the same offset (`<Out>_UnskinnedMeshes/`). Runs first, so the later steps see the new renderers | Babylon skins a skinned mesh every frame and can never instance its copies. A one-bone import of a rigid prop bought nothing — Mario Circuit's coins, item boxes and trees were 112 draws at the start gate that become instances |
79
- | Repeated props stay instanceable | A mesh + materials drawn `instanceRepeatsFrom` (4) times or more stays light-probe lit when marked static (still Contribute GI for bounce) and is skipped by the lightmap step | The exporter gives every lightmapped copy its own mesh; probe-lit copies share one instanced draw |
79
+ | Unskin rigid meshes | A SkinnedMeshRenderer with **one weighted bone** that moves with the object (no clip, Timeline, script, constraint or physics body moves the bone apart from the object), no blend shapes, no cloth, and no curve or reference aimed at the SkinnedMeshRenderer component becomes a MeshFilter + MeshRenderer on the same mesh and materials. Animators stay. When the bind pose offsets the mesh, a plain leaf object is moved onto it (the mesh stays shared — verified vertex by vertex); otherwise the offset is baked into one mesh asset shared by every copy with the same offset (`<Out>_UnskinnedMeshes/`). Three more rigid cases convert too: a **script host** (the only separate motion is a toolkit script on the renderer's own object) is baked as it is drawn now; a **renderer curve** (a clip animates the SkinnedMeshRenderer itself) converts as above, and each Animator playing it gets a copied controller whose copied clips aim those curves at MeshRenderer, same path and property (`<Out>_RetargetedClips/`); a **frozen pose** (several weighted bones, none moved apart from the object) is baked once, copies whose baked vertices match (4 decimals) sharing one mesh asset so they still instance. The swap keeps materials, shadow casting and receiving, occlusion, both probe usages, the probe anchor, motion vectors and rendering layers. Runs first, so the later steps see the new renderers | Babylon skins a skinned mesh every frame and can never instance its copies. A one-bone import of a rigid prop bought nothing — Mario Circuit's coins, item boxes and trees were 112 draws at the start gate that become instances; its grass (a script host), guardrail arrows (a renderer curve) and flag ropes (frozen poses) had to be converted by hand before Tune learned them |
80
+ | Repeated props instance | A mesh + materials drawn `instanceRepeatsFrom` (4) times or more is not lightmapped when marked static (still Contribute GI for bounce) and is skipped by the lightmap step. Last of the renderer steps, every copy that is still unlightmapped gets **Light Probe Usage Off** and Receive GI Light Probes (`Light probes off (instancing)` in `tune.md`); Reflection Probe Usage and Contribute GI stay. **Look trade-off:** the copies light from the scene's ambient instead of the nearest light probe — Phase 5's captures are the proof; `--exclude` a group whose probe lighting matters | The exporter gives every lightmapped copy its own mesh, and the toolkit gives every probe-lit node its own mesh (`SceneManager.DeinstanceProbeLitNodes`): only copies with probes off share one instanced draw |
81
+ | Keep the source's GI (`--keep-gi`) | Tune reads the source scene named in `working-copy.txt` (opened additively, closed unsaved) and collects the renderers with Contribute GI. Mark static then marks an object outside that set static without Contribute GI, the lightmap step leaves it probe-lit (`keep-gi: not a GI contributor in the source` in Left alone), and an unskinned object that carried the flag loses it. `tune.md` always shows `GI contributors: source N → copy N` | Every new contributor is an occluder in the re-bake: unskinned props pulled 62 objects into Mario Circuit's bake and its start-gate light probe fell 0.79 → 0.66. Off by default, because merging needs the newly lightmapped props |
80
82
  | Lights → Baked | Active Realtime / Mixed **point and spot** lights with no browser driver and **no realtime shadows** become Baked. Directional lights (the sun) and `--keep-lights` stay | Practical fill lights cost per-pixel lighting every frame; baked, they cost nothing and still light moving objects through probes |
81
83
  | Shadowed key lights stay runtime, shadows off | A point / spot light that casts realtime shadows (or that a browser driver animates) stays Realtime / Mixed and loses only its realtime shadows. `--bake-shadowed-lights` bakes them too | Each shadowed light re-draws the scene every frame (×6 for a point light) — the shadows are the cost, not the light. Keeping the light realtime keeps its exact look (direct light, specular highlights, light on moving objects) with no bake risk; on Garden, six such lights cost little once their shadow maps were gone. Use `--bake-shadowed-lights` when a scene has many of them and Phase 5 verifies the bake |
82
84
  | Fixture shells stop casting shadows | When a light is baked, the shadow-casting renderers of its own fixture prefab whose bounds hold the light get Cast Shadows Off | A lantern shell around the bulb is clipped by the realtime shadow map's near plane, but the lightmapper traces from the bulb: a shadow-casting shell traps a baked light (lit floor under each lantern, dark walls) |
@@ -87,8 +89,8 @@ Enforced by `scripts/BtOptimize.cs` (`Tune`). A **browser driver** is anything t
87
89
  Kept as they are, by design: wind / vertex-animated vegetation (probe-lit by intent, and unmergeable), props without lightmap UVs (probe-lit), anything a script points at, stencil / depth / VFX utility meshes (no Meta pass), inactive objects.
88
90
 
89
91
  Reported, never converted automatically — each with its next step in `survey.md` and `tune.md`:
90
- - **Rigid, convert by hand:** a single bone that moves apart from its object (parent a plain mesh under the bone), a clip that animates the SkinnedMeshRenderer itself (retarget the curve to MeshRenderer), a component that references the SkinnedMeshRenderer.
91
- - **Frozen pose:** several weighted bones that nothing animates — bake each copy to a static mesh (`SkinnedMeshRenderer.BakeMesh`).
92
+ - **Rigid, convert by hand:** a bone that a clip, Timeline, constraint or physics body moves apart from its object (parent a plain mesh under the bone), a component that references the SkinnedMeshRenderer, a clip Tune cannot retarget (a legacy Animation, an override controller) that animates the SkinnedMeshRenderer.
93
+ - **Deforming:** blend shapes and cloth.
92
94
  - **Really deforming and repeated** (a waving crowd): the toolkit's `AnimatorControlRig` VAT (crowd) mode draws the copies instanced (`unity-authoring-recipes.md` §13). Name the group, its copies and its draws in the report.
93
95
 
94
96
  **Every tune rule above came from a regression found by comparing Unity captures at the browser's poses** — run Phase 5 every time; a rule that changes what the lightmapper sees can change a whole room.
@@ -139,7 +141,7 @@ OUT=Assets/.../Scene_Optimized.unity # --out, or <source folder>/<SceneNa
139
141
  NAME=$(basename "$OUT" .unity); SRC_NAME=$(basename "$SOURCE" .unity)
140
142
  REPORT="$PROJ/.agents/optimize/$NAME"; QA="$PROJ/.agents/optimize/.qa-tools"
141
143
  MERGE='{"cellSize":15,"maxSpread":3,"maxAtlasShare":0.45,"includeShaderGraphs":true,"combineLods":true,"exclude":[],"only":[],"extraShaders":[]}'
142
- TUNE='{"unskinRigid":true,"instanceRepeatsFrom":4,"bakeLights":true,"bakeShadowedLights":false,"keepLights":[],"pointSpotShadowsOff":true,"markStatic":true,"lightmapProbeLit":true,"fixZeroMotionBlur":true,"exclude":[]}'
144
+ TUNE='{"unskinRigid":true,"instanceRepeatsFrom":4,"keepSourceGI":false,"bakeLights":true,"bakeShadowedLights":false,"keepLights":[],"pointSpotShadowsOff":true,"markStatic":true,"lightmapProbeLit":true,"fixZeroMotionBlur":true,"exclude":[]}'
143
145
 
144
146
  bt_run() { # bt_run <File: BtOptimize|BtCombine> <Method> '<json args array>'
145
147
  unity command run_script --file "AgentScripts/bt-optimize/$1.cs" --entry "$1.$2" --args "$3" \
@@ -149,7 +151,7 @@ bt_run() { # bt_run <File: BtOptimize|BtCombine> <Method> '<json args array>'
149
151
  arg() { python3 -c "import json,sys; print(json.dumps([sys.argv[1]]))" "$1"; } # wraps one JSON options string as a run_script args array
150
152
  ```
151
153
 
152
- Map flags into `MERGE` / `TUNE` (`--no-tune:unskin` → `"unskinRigid":false`, `--instance-from:N` → `"instanceRepeatsFrom":N`, `--exclude:A,B*` → both `"exclude":["A","B*"]`, `--keep-lights:` → `keepLights`, `--no-shadergraphs` → `"includeShaderGraphs":false`, `--no-lods` → `"combineLods":false`, `--no-tune:lights` → `"bakeLights":false,"pointSpotShadowsOff":false`, `--no-tune:static` → `"markStatic":false`, `--no-tune:lightmaps` → `"lightmapProbeLit":false`, `--no-tune:post` → `"fixZeroMotionBlur":false`, `--bake-shadowed-lights` → `"bakeShadowedLights":true`).
154
+ Map flags into `MERGE` / `TUNE` (`--no-tune:unskin` → `"unskinRigid":false`, `--instance-from:N` → `"instanceRepeatsFrom":N`, `--keep-gi` → `"keepSourceGI":true`, `--exclude:A,B*` → both `"exclude":["A","B*"]`, `--keep-lights:` → `keepLights`, `--no-shadergraphs` → `"includeShaderGraphs":false`, `--no-lods` → `"combineLods":false`, `--no-tune:lights` → `"bakeLights":false,"pointSpotShadowsOff":false`, `--no-tune:static` → `"markStatic":false`, `--no-tune:lightmaps` → `"lightmapProbeLit":false`, `--no-tune:post` → `"fixZeroMotionBlur":false`, `--bake-shadowed-lights` → `"bakeShadowedLights":true`).
153
155
 
154
156
  ## Phase 0 — Preflight
155
157
 
@@ -178,7 +180,7 @@ node "$QA/profile-browser.mjs" --scene <source>.gltf --pin 40,60,75 --toggles no
178
180
 
179
181
  `--pin` waits the given seconds after the scene is ready, then detaches the camera from its rig and **records its exact pose** (position, rotation and lens — field of view and clip planes, because Timeline / Cinemachine tracks animate the lens too; the lens fields are made read-only while pinned, because a lens track keeps writing them and TAA builds its projection from them before any observer runs). Every later run replays those poses with `--poses before-pinned.json`, so before and after are measured from the same views — pinning by time alone lands on different views, because a lighter scene loads sooner and its tour runs ahead.
180
182
 
181
- Read the JSON: `census` (engine, render size, meshes, materials, lights, shadow generators and their casters, post passes, prepass), `samples` (FPS, p95 / worst frame, draws, active meshes), and per pin `baseline.passes` / `baseline.byTarget` (draws per frame in shadow maps, `DepthRenderer`, main pass, post), **`drawOwners`** (main-pass draws by owning object — `mainDraws` must equal `baseline.passes.main` — with each owner's skinned / instanced / lightmapped meshes and shadow casters, plus `repeats`: every shape drawn more than once and what stops its copies sharing one draw), `lightAudit`, and `cpu.top`. **Pin inside the scene's own motion** (a flythrough, a spawn view after compile): the first seconds after load are still compiling shaders and are not comparable. To confirm a suspected cost, re-run with `--toggles shadows,lights,motionblur,taa,bloom,dpr` (each switched off alone and settled on `whenReadyAsync` — never compare a window that follows a toggle without that wait: thousands of materials recompile).
183
+ Read the JSON: `census` (engine, render size, meshes, materials, lights, shadow generators and their casters, post passes, prepass), `samples` (FPS, p95 / worst frame, draws, active meshes), and per pin `baseline.passes` / `baseline.byTarget` (draws per frame in shadow maps, `DepthRenderer`, main pass, post), **`drawOwners`** (main-pass draws by owning object, measured per render call in one recorded frame — `mainDraws` equals that frame's main-phase counter `frameMainDraws` by construction and should match `baseline.passes.main`; draws no object owns appear as an `(unowned)` owner whose `sources` name the class that drew them — with each owner's skinned / instanced / lightmapped meshes and shadow casters, plus `repeats`: every shape drawn more than once and what stops its copies sharing one draw), `lightAudit`, and `cpu.top`. **Pin inside the scene's own motion** (a flythrough, a spawn view after compile): the first seconds after load are still compiling shaders and are not comparable. To confirm a suspected cost, re-run with `--toggles shadows,lights,motionblur,taa,bloom,dpr` (each switched off alone and settled on `whenReadyAsync` — never compare a window that follows a toggle without that wait: thousands of materials recompile).
182
184
 
183
185
  ## Phase 2 — Survey and plan
184
186
 
@@ -191,7 +193,7 @@ bt_run BtCombine Analyze "$(arg "$MERGE")" # combine-
191
193
 
192
194
  **Account for every draw before planning — ENFORCED.** From `before-pinned.json` → `pins[].drawOwners`, write the main-pass draws by owner at each pin into the plan (`node "$QA/compare-profiles.mjs"` prints it), then put each owner group of 5% or more beside its Unity cause and its fix: `survey.md` → *Skinned meshes* (every skinned renderer's verdict — rigid, frozen pose, deforms — with the evidence), *Repeated meshes* (copies, draws now, draws if instanced, what stops sharing), *Renderers*, *Lights*. A group with no fix gets a measured reason. Do not start Phase 3 with a large group unexplained.
193
195
 
194
- Tell the user in a few lines: the measured frame (FPS, draws per pass, **the draw owners and the top repeated shapes**, the top costs), and the plan with numbers (rigid skinned meshes to convert, repeated props that will instance, lights to bake, props to mark static, renderers to lightmap, merges). `--analyze` stops here. Otherwise continue — do not wait for approval; the source is safe.
196
+ Tell the user in a few lines: the measured frame (FPS, draws per pass, **the draw owners and the top repeated shapes**, the top costs), and the plan with numbers (rigid skinned meshes to convert, repeated props that will instance, lights to bake, props to mark static, renderers to lightmap, merges). Recommend `--keep-gi` whenever the user wants the current lighting kept or the run is `--no-combine` (with no merge, newly lightmapped props buy no draws, only a different bake). `--analyze` stops here. Otherwise continue — do not wait for approval; the source is safe.
195
197
 
196
198
  ## Phase 3 — Working copy, tune, merge
197
199
 
@@ -324,7 +326,7 @@ Reply in plain language with images, and write `$REPORT/report.md`:
324
326
  - **What stayed and why:** top kept reasons with counts, and what the user could change (UV2 on props, scripts that point at objects, vegetation by design, skinned meshes to convert by hand, repeated deforming crowds for the VAT mode).
325
327
  - **Toolkit findings:** costs the scene cannot fix (for example a `DepthRenderer` pass owned by soft particles or a Scene Depth node), with the runtime fix to ask for.
326
328
  - **Checks:** Verify result, Unity captures, browser frames, console errors; anything skipped or unverified, stated as such.
327
- - **How to undo:** `--reset`, or delete the working copy, `<Out>_CombinedMeshes/`, `<Out>/` (baked lighting) and `.agents/optimize/<Out>/`; re-tick any Volume Profile override listed in `tune.md`.
329
+ - **How to undo:** `--reset`, or delete the working copy, `<Out>_CombinedMeshes/`, `<Out>_UnskinnedMeshes/`, `<Out>_RetargetedClips/`, `<Out>/` (baked lighting) and `.agents/optimize/<Out>/`; re-tick any Volume Profile override listed in `tune.md`.
328
330
 
329
331
  ---
330
332
 
@@ -334,7 +336,8 @@ Reply in plain language with images, and write `$REPORT/report.md`:
334
336
  |---|---|
335
337
  | `<out scene>` | the working copy (tuned and merged) |
336
338
  | `<out scene folder>/<Out>_CombinedMeshes/*.asset` | merged meshes |
337
- | `<out scene folder>/<Out>_UnskinnedMeshes/*.asset` | plain meshes baked from rigid skinned meshes whose bind pose was offset and whose object could not be moved (usually empty) |
339
+ | `<out scene folder>/<Out>_UnskinnedMeshes/*.asset` | plain meshes baked from skinned meshes: rigid ones whose bind pose was offset and whose object could not be moved, script hosts, and frozen poses (one asset per distinct pose) |
340
+ | `<out scene folder>/<Out>_RetargetedClips/` | copied clips (`<clip>_MeshRenderer.anim`) and controllers (`<controller>_MeshRenderer.controller`) whose SkinnedMeshRenderer curves now target the MeshRenderer that replaced it |
338
341
  | `<out scene folder>/<Out>/` | the copy's baked lighting |
339
342
  | `.agents/optimize/<Source>/` | survey, tune plan, merge plan and "before" profiles of the source |
340
343
  | `.agents/optimize/<Out>/` | `working-copy.txt`, `tune.md/json`, `combine-plan.*`, `combine-manifest.json`, `combine-verify.md`, `profile/`, `captures/`, `report.md` |
@@ -233,6 +233,8 @@ public static class BtCombine
233
233
  if (AssetDatabase.IsValidFolder(meshFolder)) AssetDatabase.DeleteAsset(meshFolder);
234
234
  string unskinnedFolder = UnskinnedMeshFolderFor(outputScene);
235
235
  if (AssetDatabase.IsValidFolder(unskinnedFolder)) AssetDatabase.DeleteAsset(unskinnedFolder);
236
+ string retargetedFolder = RetargetedClipFolderFor(outputScene);
237
+ if (AssetDatabase.IsValidFolder(retargetedFolder)) AssetDatabase.DeleteAsset(retargetedFolder);
236
238
  string manifest = Path.Combine(ReportFolderFor(outputScene), "combine-manifest.json");
237
239
  if (File.Exists(manifest)) File.Delete(manifest);
238
240
  }
@@ -242,7 +244,7 @@ public static class BtCombine
242
244
  return "opened=" + scene.path + " created=" + !existed + " reset=" + (existed && reset);
243
245
  }
244
246
 
245
- /// <summary>Deletes a working copy, its merged and unskinned meshes, its baked lighting folder and its report folder.</summary>
247
+ /// <summary>Deletes a working copy, its merged and unskinned meshes, its retargeted clips, its baked lighting folder and its report folder.</summary>
246
248
  public static string RemoveCopy(string outputScene, string reopenScene)
247
249
  {
248
250
  if (!File.Exists(WorkingCopyMarker(outputScene))) throw new InvalidOperationException(outputScene + " is not a bt-optimize working copy; refusing to delete it.");
@@ -251,6 +253,7 @@ public static class BtCombine
251
253
  bool sceneDeleted = AssetDatabase.DeleteAsset(outputScene);
252
254
  bool meshesDeleted = AssetDatabase.DeleteAsset(MeshFolderFor(outputScene));
253
255
  AssetDatabase.DeleteAsset(UnskinnedMeshFolderFor(outputScene));
256
+ AssetDatabase.DeleteAsset(RetargetedClipFolderFor(outputScene));
254
257
  bool lightingDeleted = AssetDatabase.DeleteAsset(Path.ChangeExtension(outputScene, null).Replace('\\', '/'));
255
258
  string reportFolder = ReportFolderFor(outputScene);
256
259
  if (Directory.Exists(reportFolder)) Directory.Delete(reportFolder, true);
@@ -1620,6 +1623,15 @@ public static class BtCombine
1620
1623
  return Path.GetDirectoryName(scenePath).Replace('\\', '/') + "/" + Path.GetFileNameWithoutExtension(scenePath) + "_UnskinnedMeshes";
1621
1624
  }
1622
1625
 
1626
+ /// <summary>
1627
+ /// Folder for the clips and controllers BtOptimize.Tune copies with their SkinnedMeshRenderer curves retargeted to
1628
+ /// MeshRenderer: &lt;scene folder&gt;/&lt;scene&gt;_RetargetedClips. Keep the name in step with BtOptimize.RetargetedClipFolder.
1629
+ /// </summary>
1630
+ private static string RetargetedClipFolderFor(string scenePath)
1631
+ {
1632
+ return Path.GetDirectoryName(scenePath).Replace('\\', '/') + "/" + Path.GetFileNameWithoutExtension(scenePath) + "_RetargetedClips";
1633
+ }
1634
+
1623
1635
  /// <summary>Folder for a scene's reports: &lt;project&gt;/.agents/optimize/&lt;scene&gt;.</summary>
1624
1636
  private static string ReportFolderFor(string scenePath)
1625
1637
  {