3.7 KiB
3.7 KiB
NewEditor Inspector Layout Root Refactor Plan
Date: 2026-04-21
Context
This plan targets the new_editor Inspector field layout path only.
Current symptom:
- Inspector field controls do not follow one explicit column policy.
- Different field types shift or compress at different thresholds.
Transformand the fields below it stop aligning once the Inspector becomes narrow.
Current root cause:
- Shared row layout code in
UIEditorFieldRowLayoutis guessing when a caller is "Inspector-like" and silently replacing the caller's requested minimum control width. - That guess is based on generic layout numbers such as
controlColumnStartandlabelControlGap, which is an invalid ownership boundary. - Vector fields also still carry a dead prefix palette chain that no longer affects rendering after the visible background was moved to
componentRects.
Files In Scope
new_editor/include/XCEditor/Widgets/UIEditorFieldRowLayout.hnew_editor/src/Widgets/UIEditorFieldRowLayout.cppnew_editor/include/XCEditor/Fields/UIEditorPropertyGrid.hnew_editor/include/XCEditor/Fields/UIEditorFieldStyle.hnew_editor/src/Fields/UIEditorFieldStyle.cpp- Hosted Inspector field headers under
new_editor/include/XCEditor/Fields/ - Hosted Inspector field sources under
new_editor/src/Fields/
Refactor Goals
- Remove all implicit Inspector detection from shared row layout.
- Make shared control-column width an explicit metric owned by PropertyGrid and forwarded to hosted fields.
- Keep hosted field layout behavior consistent by policy instead of per-field hidden overrides.
- Remove dead vector prefix palette data that no longer drives rendering.
- Rebuild
XCUIEditor.exeafter the refactor and keep the worktree changes scoped tonew_editor.
Implementation Plan
Stage 1: Make The Contract Explicit
Add one explicit metric for hosted shared-column reservation:
sharedControlColumnMinWidth
Propagation chain:
UIEditorPropertyGridMetrics- hosted field metrics (
Bool,Number,Text,Enum,Color,Object,Asset,Vector2,Vector3,Vector4) UIEditorFieldRowLayoutMetrics
Rules:
- Default value outside Inspector stays
0.0f - Inspector-owned PropertyGrid metrics set the shared width explicitly
- Shared row layout consumes this field directly and never infers Inspector mode from unrelated metrics
Stage 2: Remove Hidden Width Guessing
Replace the current behavior in UIEditorFieldRowLayout.cpp:
- delete the implicit
ResolveHostedControlMinimumWidth(...)path - delete the
inspectorHostedControlMinWidthtoken - make reserved control width depend only on explicit row-layout metrics and the caller-provided value
Expected result:
- the row-layout contract becomes deterministic
- hosted fields stop getting different fallback behavior because of hidden special-cases
Stage 3: Clean Vector Dead Code
Remove prefixColor and prefixBorderColor from:
- inspector field tokens
- vector field palette structs
- vector palette resolution code
- PropertyGrid palette builder forwarding
Reason:
- those fields no longer affect visible rendering after the component background moved to
componentRects
Stage 4: Validation
Validation steps:
- compile
XCUIEditorAppinDebug - if the editor process is locking the output exe, kill
XCUIEditorfirst - verify the rebuilt output is
build/new_editor/Debug/XCUIEditor.exe
Done Criteria
This refactor is complete when:
- shared row layout contains no Inspector guessing logic
- Inspector column width policy is explicit in metrics
- hosted field metric forwarding is consistent for all field types
- vector dead palette chain is removed
XCUIEditor.exerebuild succeeds