feat(web): Outliner search and state filters run through the native engine
The web Outliner filtered rows in the bundle while desktop filters inside
outliner_build_tree, so the filter controls diverged as soon as the tree
was rebuilt. OUTLINER_SET_FILTER writes SpaceOutliner's own search_string,
search_flags, flag and filter/filter_state fields and lets the native tree
rebuild; OUTLINER_SET_SYNC_SELECT toggles SO_SYNC_SELECT. Both are UI
state, so they report changed=false and leave history alone.
The protocol, worker and snapshot carry filter{...} and syncSelection; the
App drops the client-side filter on the native path (it stays for the
fallback surface), keeps an optimistic draft so the snapshot-controlled
checkboxes do not snap back during the async round trip, and rebases
Outliner intents after any Outliner command bumps the revision.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -356,7 +356,8 @@ export interface NativeAreaLayout {
|
||||
}
|
||||
export interface NativeOutlinerRow { id: string; label: string; depth: number; selected: boolean; active: boolean; expanded: boolean; hasChildren: boolean; objectId: string | null; remapId?: string | null }
|
||||
export interface NativeOutlinerRemapID { id: string; name: string; idType: number; library: string; editable: boolean }
|
||||
export interface NativeOutlinerTree { rows: NativeOutlinerRow[]; truncated: boolean; syncSelection: boolean; displayMode?: string; displayModes?: Array<{ id: string; label: string }>; remapIds?: NativeOutlinerRemapID[] }
|
||||
export interface NativeOutlinerFilter { searchString: string; caseSensitive: boolean; complete: boolean; sortAlpha: boolean; invert: boolean; state: 'ALL' | 'VISIBLE' | 'SELECTED' | 'ACTIVE' | 'SELECTABLE'; showObjects: boolean; showObjectContents: boolean; showChildren: boolean; showCollections: boolean; showViewLayers: boolean }
|
||||
export interface NativeOutlinerTree { rows: NativeOutlinerRow[]; truncated: boolean; syncSelection: boolean; displayMode?: string; displayModes?: Array<{ id: string; label: string }>; filter?: NativeOutlinerFilter; remapIds?: NativeOutlinerRemapID[] }
|
||||
export interface EditorAreaIR { nativeLayout?: NativeAreaLayout; id: string; editor: EditorTypeIR; regions: EditorRegionIR[]; rect: { x: number; y: number; width: number; height: number }; maximized: boolean; filterText?: string; space?: { outliner?: NativeOutlinerTree; kind: string; dataId?: string | null; view?: NativeViewportState; textSelection?: TextSelectionIR; imageView?: NativeImageView; uvPackTarget?: NativeUVPackTarget; properties?: NativePropertiesContext; spreadsheet?: NativeSpreadsheetContext } }
|
||||
export interface EditorWorkspaceIR { id: string; name: string; screenId?: string; writable?: boolean; areas: EditorAreaIR[]; activeAreaId: string; revision: number }
|
||||
// ACTION operator RNA identifiers; the native caller resolves them against the
|
||||
@@ -460,6 +461,8 @@ export type EditorContextEdit = { workspaceId: string; screenId: string } & (
|
||||
| { action: 'OUTLINER_SELECT'; areaId: string; objectId: string; extend: boolean; range: boolean }
|
||||
| { action: 'OUTLINER_SELECT_ALL'; areaId: string; operation: 'SELECT' | 'DESELECT' | 'INVERT' | 'TOGGLE' }
|
||||
| { action: 'OUTLINER_SET_DISPLAY_MODE'; areaId: string; displayMode: string }
|
||||
| { action: 'OUTLINER_SET_FILTER'; areaId: string; filter: NativeOutlinerFilter }
|
||||
| { action: 'OUTLINER_SET_SYNC_SELECT'; areaId: string; sync: boolean }
|
||||
| { action: "SET_EDITOR_TYPE"; areaId: string; editorType: string }
|
||||
| { action: "SPLIT_AREA"; areaId: string; direction: 'HORIZONTAL' | 'VERTICAL'; factor: number }
|
||||
| { action: "JOIN_AREA"; areaId: string; targetAreaId: string }
|
||||
@@ -771,6 +774,22 @@ export function parseEditorWorkflow(value: unknown): EditorWorkflowIR {
|
||||
idType: Number(value.idType), library: value.library, editable: value.editable };
|
||||
});
|
||||
}
|
||||
let filter: NativeOutlinerFilter | undefined;
|
||||
if (tree.filter !== undefined) {
|
||||
const value = tree.filter;
|
||||
if (!record(value) || typeof value.searchString !== 'string' || new TextEncoder().encode(value.searchString).byteLength > 63 ||
|
||||
!['ALL', 'VISIBLE', 'SELECTED', 'ACTIVE', 'SELECTABLE'].includes(String(value.state)) ||
|
||||
['caseSensitive', 'complete', 'sortAlpha', 'invert', 'showObjects', 'showObjectContents',
|
||||
'showChildren', 'showCollections', 'showViewLayers'].some(key => typeof value[key] !== 'boolean')) {
|
||||
throw new EditorWorkflowValidationError('EDITOR_LAYOUT_INVALID', 'Invalid native Outliner filter');
|
||||
}
|
||||
filter = { searchString: value.searchString, state: value.state as NativeOutlinerFilter['state'],
|
||||
caseSensitive: value.caseSensitive as boolean, complete: value.complete as boolean,
|
||||
sortAlpha: value.sortAlpha as boolean, invert: value.invert as boolean,
|
||||
showObjects: value.showObjects as boolean, showObjectContents: value.showObjectContents as boolean,
|
||||
showChildren: value.showChildren as boolean, showCollections: value.showCollections as boolean,
|
||||
showViewLayers: value.showViewLayers as boolean };
|
||||
}
|
||||
let displayMode: string | undefined;
|
||||
let displayModes: Array<{ id: string; label: string }> | undefined;
|
||||
if (tree.displayMode !== undefined || tree.displayModes !== undefined) {
|
||||
@@ -786,7 +805,7 @@ export function parseEditorWorkflow(value: unknown): EditorWorkflowIR {
|
||||
throw new EditorWorkflowValidationError('EDITOR_LAYOUT_INVALID', 'Native Outliner display mode is not in its menu');
|
||||
}
|
||||
}
|
||||
space.outliner = { rows, truncated: tree.truncated, syncSelection: tree.syncSelection, displayMode, displayModes, remapIds };
|
||||
space.outliner = { rows, truncated: tree.truncated, syncSelection: tree.syncSelection, displayMode, displayModes, filter, remapIds };
|
||||
}
|
||||
if (areaValue.space.spreadsheet !== undefined) {
|
||||
const spreadsheet = areaValue.space.spreadsheet;
|
||||
|
||||
Reference in New Issue
Block a user