188 lines
6.1 KiB
Markdown
188 lines
6.1 KiB
Markdown
# NewEditor Tree Actual Redundancy Reduction Plan
|
|
|
|
Date: `2026-04-22`
|
|
Status: `In Progress`
|
|
|
|
## Goal
|
|
|
|
- Remove only the redundancy that is structurally real in `new_editor` tree-related code.
|
|
- Keep the existing panel refresh split, frame ownership, and hosted-panel dispatch architecture intact.
|
|
- Accept only changes that produce clear net code reduction and keep ownership clearer, not blurrier.
|
|
|
|
## Why The Previous Plan Was Deleted
|
|
|
|
- The deleted plan incorrectly treated the rename flow as a shared tree host skeleton.
|
|
- `HierarchyPanel` is a single-tree, single-surface rename owner.
|
|
- `ProjectPanel` is a tree/grid dual-surface rename owner and its rename bounds, state, and commit side-effects differ materially.
|
|
- Because of that difference, extracting rename state handling upward adds request/status/surface glue instead of deleting real code.
|
|
- Any cross-panel rename abstraction is now considered a wrong direction for this codebase.
|
|
|
|
## Hard Constraints
|
|
|
|
- `HierarchyPanel` / `ProjectPanel` rename flow is explicitly not a dedup target.
|
|
- Do not merge panel refresh loops.
|
|
- Do not merge project tree and asset grid behavior.
|
|
- Do not change viewport independent request/render flow.
|
|
- Do not change `EditorWindowFrameDriver` single frame owner semantics.
|
|
- Do not move project or scene runtime semantics into `XCEditor`.
|
|
- Do not create new `Behavior`, `Host`, `Helper`, `Support`, `Tooling`, or similar glue files.
|
|
- Any phase must have a credible negative net diff before implementation starts.
|
|
|
|
## Real Remaining Redundancy Targets
|
|
|
|
### 1. `ProjectPanel` Left-Tree Internal Repetition
|
|
|
|
This is the first valid target.
|
|
|
|
Current repetition shape:
|
|
|
|
- repeated left-tree layout rebuild sequences after navigation / drop / refresh paths
|
|
- repeated left-tree draw call setup for background / foreground / rename overlay / drop preview
|
|
- repeated left-tree state sync and cleanup around operations inside the same panel
|
|
|
|
Rules:
|
|
|
|
- Keep this work inside `ProjectPanel` and existing tree modules.
|
|
- Prefer local private functions or same-file narrowing over new files.
|
|
- Do not generalize tree/grid business logic together.
|
|
|
|
### 2. Cross-Panel Tree Draw Chain Re-Audit
|
|
|
|
This is only a candidate target, not an automatic extraction target.
|
|
|
|
Possible shared shape:
|
|
|
|
- append tree background
|
|
- append tree foreground
|
|
- append inline rename overlay
|
|
- append drop preview
|
|
|
|
Rules:
|
|
|
|
- Only extract if the result is a pure UI draw chain with no business ownership leakage.
|
|
- Only extract into existing `UIEditorTreeView.*` if total code clearly goes down.
|
|
- If the net diff is not negative, stop and keep the code local.
|
|
|
|
### 3. Final Intentional-Duplication Audit
|
|
|
|
After the valid reductions above, re-check what remains.
|
|
|
|
Expected intentional duplicates:
|
|
|
|
- rename ownership between `HierarchyPanel` and `ProjectPanel`
|
|
- scene-specific drag/drop commit behavior
|
|
- project-specific folder / asset / breadcrumb / splitter / context menu orchestration
|
|
|
|
If a remaining overlap is only superficial orchestration around different business surfaces, record it as intentional and stop.
|
|
|
|
## Execution Plan
|
|
|
|
### Phase A. Freeze The Rename Boundary
|
|
|
|
Status: `Completed`
|
|
|
|
Target:
|
|
|
|
- Remove the invalid rename-dedup direction from the active plan baseline.
|
|
|
|
Completed result:
|
|
|
|
- Deleted the wrong plan that targeted cross-panel rename host dedup.
|
|
- Re-established rename as panel-owned business logic, not a shared tree abstraction target.
|
|
|
|
Validation:
|
|
|
|
- Documentation baseline corrected.
|
|
|
|
### Phase B. Reduce `ProjectPanel` Left-Tree Internal Repetition
|
|
|
|
Status: `Completed`
|
|
|
|
Target:
|
|
|
|
- Shrink repeated left-tree orchestration inside `ProjectPanel` without changing behavior boundaries.
|
|
|
|
Allowed scope:
|
|
|
|
- `new_editor/app/Features/Project/ProjectPanel.cpp`
|
|
- `new_editor/app/Features/Project/ProjectPanel.h`
|
|
|
|
Rules:
|
|
|
|
- No new file.
|
|
- No tree/grid semantic merge.
|
|
- No rename abstraction promotion.
|
|
- Only keep helpers that delete more code than they add.
|
|
|
|
Validation:
|
|
|
|
- `cmake --build build --config Debug --target XCUIEditorApp`
|
|
- smoke-launch `build/new_editor/Debug/XCUIEditor.exe`
|
|
- confirm latest `runtime.log` contains:
|
|
- `EnsureEditorStartupScene loaded scene=Main Scene`
|
|
- `[app] initialize end`
|
|
- `[app] shutdown end`
|
|
|
|
Completed result:
|
|
|
|
- Reduced the real repeated reconcile chain inside `ProjectPanel`.
|
|
- Kept tree/grid business ownership split intact.
|
|
- Landed local private narrowing only:
|
|
- runtime-to-UI selection sync now funnels through one panel-local path
|
|
- layout/tree-frame rebuild now funnels through one panel-local path
|
|
- `ProjectBrowserModel` also now owns a single browser-state refresh chain instead of repeating:
|
|
- `RefreshFolderTree()`
|
|
- `EnsureValidCurrentFolder()`
|
|
- `RefreshAssetList()`
|
|
|
|
### Phase C. Re-Audit The Shared Tree Draw Chain
|
|
|
|
Status: `Pending`
|
|
|
|
Target:
|
|
|
|
- Check whether a narrow draw-chain entry in existing `UIEditorTreeView.*` can reduce real code across `HierarchyPanel` and the Project left tree.
|
|
|
|
Allowed scope:
|
|
|
|
- `new_editor/include/XCEditor/Collections/UIEditorTreeView.h`
|
|
- `new_editor/src/Collections/UIEditorTreeView.cpp`
|
|
- the two panel files only where call sites get smaller
|
|
|
|
Rules:
|
|
|
|
- No state machine extraction.
|
|
- No rename surface abstraction.
|
|
- No drag/drop business extraction.
|
|
- Cancel the phase immediately if the predicted diff is not net-negative.
|
|
|
|
Validation:
|
|
|
|
- `rg` verification of targeted duplicate draw blocks
|
|
- `cmake --build build --config Debug --target XCUIEditorApp`
|
|
- smoke-launch `build/new_editor/Debug/XCUIEditor.exe`
|
|
|
|
### Phase D. Final Closure Audit
|
|
|
|
Status: `Pending`
|
|
|
|
Target:
|
|
|
|
- Verify that all remaining overlap is either reduced or explicitly intentional.
|
|
|
|
Validation:
|
|
|
|
- targeted `rg` audit
|
|
- `git diff --stat` confirms accepted phases reduced code overall
|
|
- `cmake --build build --config Debug --target XCUIEditorApp`
|
|
- smoke-launch `build/new_editor/Debug/XCUIEditor.exe`
|
|
|
|
## Acceptance
|
|
|
|
- The wrong rename-dedup plan no longer exists in `docs/plan`.
|
|
- Cross-panel rename dedup is explicitly excluded.
|
|
- The next implementation target is `ProjectPanel` left-tree internal repetition, not rename.
|
|
- No new glue-layer file is introduced.
|
|
- Each accepted phase must reduce code, not grow it.
|
|
- Build and smoke validation pass after each completed implementation phase.
|