feat(web): Outliner header exposes the desktop controls and drops the web-only ones

LIBRARIES/ORPHAN_DATA gain the ID-type filter, LIBRARY_OVERRIDES the
lib_override_view_mode selector, VIEW_LAYER the header collection_new
button, ORPHAN_DATA Purge, and DATA_API the keying-set selector with
keyframe insert/delete. The web-only refresh and select/clear/invert/
toggle buttons are removed; selection stays on the keyboard.

The active filter_id_type stays in the ID-type menu after opening a file
whose Main has no data of that type, matching rna_enum_id_type_items,
so the snapshot decoder no longer rejects the open.

Headed case [outliner-header-controls-web] passes; full outliner suite
43/43.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-12-02 04:23:53 +08:00
parent 8173426da2
commit 44ce5cf402
12 changed files with 403 additions and 31 deletions

View File

@@ -359,7 +359,7 @@ export interface NativeOutlinerRow { id: string; label: string; depth: number; s
export interface NativeOutlinerRemapID { id: string; name: string; idType: number; library: string; editable: boolean }
export interface NativeOutlinerTypeAvailability { mesh: boolean; armature: boolean; light: boolean; camera: boolean; greasePencil: boolean; others: boolean }
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; showMeshes: boolean; showArmatures: boolean; showEmpties: boolean; showLights: boolean; showCameras: boolean; showGreasePencil: boolean; showOthers: boolean; systemOverrides: boolean; showModeColumn: boolean; scrollToActive: boolean; typeAvailability?: NativeOutlinerTypeAvailability }
export interface NativeOutlinerTree { rows: NativeOutlinerRow[]; truncated: boolean; syncSelection: boolean; displayMode?: string; displayModes?: Array<{ id: string; label: string }>; filter?: NativeOutlinerFilter; restrictColumns?: NativeOutlinerRestrict; remapIds?: NativeOutlinerRemapID[] }
export interface NativeOutlinerTree { rows: NativeOutlinerRow[]; truncated: boolean; syncSelection: boolean; displayMode?: string; displayModes?: Array<{ id: string; label: string }>; filter?: NativeOutlinerFilter; restrictColumns?: NativeOutlinerRestrict; remapIds?: NativeOutlinerRemapID[]; libOverrideViewMode?: 'PROPERTIES' | 'HIERARCHIES'; idTypeFilter?: { use: boolean; idType: string; items: Array<{ id: string; label: string }> }; keyingSet?: { active: string; items: string[] } }
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
@@ -472,7 +472,10 @@ export type EditorContextEdit = { workspaceId: string; screenId: string } & (
| { action: 'OUTLINER_SET_FILTER'; areaId: string; filter: NativeOutlinerFilter }
| { action: 'OUTLINER_SET_SYNC_SELECT'; areaId: string; sync: boolean }
| { action: 'OUTLINER_VIEW_OPERATION'; areaId: string; operation: 'EXPANDED_TOGGLE' | 'SHOW_HIERARCHY' | 'SHOW_ONE_LEVEL' | 'HIDE_ONE_LEVEL' | 'SHOW_ACTIVE' }
| { action: 'OUTLINER_EDIT_OPERATION'; areaId: string; operation: 'KEYINGSET_ADD' | 'KEYINGSET_REMOVE' | 'DRIVERS_ADD' | 'DRIVERS_DELETE' }
| { action: 'OUTLINER_EDIT_OPERATION'; areaId: string; operation: 'KEYINGSET_ADD' | 'KEYINGSET_REMOVE' | 'DRIVERS_ADD' | 'DRIVERS_DELETE' | 'KEYFRAME_INSERT' | 'KEYFRAME_DELETE' }
| { action: 'OUTLINER_SET_LIB_OVERRIDE_VIEW_MODE'; areaId: string; mode: 'PROPERTIES' | 'HIERARCHIES' }
| { action: 'OUTLINER_SET_ID_TYPE_FILTER'; areaId: string; use: boolean; idType: string }
| { action: 'OUTLINER_SET_ACTIVE_KEYINGSET'; areaId: string; name: string }
| { action: 'OUTLINER_SET_RESTRICTION'; areaId: string; rowId: string; column: keyof NativeOutlinerRestrict; value: boolean; extend: boolean; isolate: boolean }
| { action: 'OUTLINER_SET_RESTRICT_COLUMNS'; areaId: string; columns: NativeOutlinerRestrict }
| { action: "SET_EDITOR_TYPE"; areaId: string; editorType: string }
@@ -878,7 +881,44 @@ export function parseEditorWorkflow(value: unknown): EditorWorkflowIR {
}
const restrictColumns = tree.restrictColumns === undefined ? undefined :
restrictState(tree.restrictColumns, 'outliner.restrictColumns');
space.outliner = { rows, truncated: tree.truncated, syncSelection: tree.syncSelection, displayMode, displayModes, filter, restrictColumns, remapIds };
let libOverrideViewMode: 'PROPERTIES' | 'HIERARCHIES' | undefined;
if (tree.libOverrideViewMode !== undefined) {
if (tree.libOverrideViewMode !== 'PROPERTIES' && tree.libOverrideViewMode !== 'HIERARCHIES') {
throw new EditorWorkflowValidationError('EDITOR_LAYOUT_INVALID', 'Invalid native Outliner library override view mode');
}
libOverrideViewMode = tree.libOverrideViewMode;
}
let idTypeFilter: NativeOutlinerTree['idTypeFilter'];
if (tree.idTypeFilter !== undefined) {
const value = tree.idTypeFilter;
if (!record(value) || typeof value.use !== 'boolean' || typeof value.idType !== 'string' ||
!Array.isArray(value.items) || value.items.length > 128) {
throw new EditorWorkflowValidationError('EDITOR_LAYOUT_INVALID', 'Invalid native Outliner ID type filter');
}
/* Desktop keeps filter_id_type at 0 (empty) until a type is picked,
* so an empty selection is valid; a non-empty one must exist. */
if (value.idType.length > 64) throw new EditorWorkflowValidationError('EDITOR_LAYOUT_INVALID', 'outliner.idTypeFilter.idType is invalid');
const idTypeItems = value.items.map(item => {
if (!record(item)) throw new EditorWorkflowValidationError('EDITOR_LAYOUT_INVALID', 'Invalid native Outliner ID type filter item');
return { id: text(item.id, 'outliner.idTypeFilter.item.id', 64), label: text(item.label, 'outliner.idTypeFilter.item.label', 128) };
});
if (value.idType !== '' && !idTypeItems.some(item => item.id === value.idType)) throw new EditorWorkflowValidationError('EDITOR_LAYOUT_INVALID', 'outliner.idTypeFilter.idType is invalid');
idTypeFilter = { use: value.use, idType: value.idType, items: idTypeItems };
}
let keyingSet: NativeOutlinerTree['keyingSet'];
if (tree.keyingSet !== undefined) {
const value = tree.keyingSet;
if (!record(value) || typeof value.active !== 'string' || !Array.isArray(value.items) || value.items.length > 256) {
throw new EditorWorkflowValidationError('EDITOR_LAYOUT_INVALID', 'Invalid native Outliner keying set');
}
/* scene->active_keyingset is 0 when none is active, which the
* engine reports as an empty name; only a set name must match. */
if (value.active.length > 64) throw new EditorWorkflowValidationError('EDITOR_LAYOUT_INVALID', 'outliner.keyingSet.active is invalid');
const keyingSetItems = value.items.map(item => text(item, 'outliner.keyingSet.item', 64));
if (value.active !== '' && !keyingSetItems.includes(value.active)) throw new EditorWorkflowValidationError('EDITOR_LAYOUT_INVALID', 'outliner.keyingSet.active is invalid');
keyingSet = { active: value.active, items: keyingSetItems };
}
space.outliner = { rows, truncated: tree.truncated, syncSelection: tree.syncSelection, displayMode, displayModes, filter, restrictColumns, remapIds, libOverrideViewMode, idTypeFilter, keyingSet };
}
if (areaValue.space.spreadsheet !== undefined) {
const spreadsheet = areaValue.space.spreadsheet;