Update syncModelInstanceSelectionShell to return the selection shell or null

This commit is contained in:
2026-04-27 00:17:27 +02:00
parent e2bb0e5f14
commit 5c706d1dc6

View File

@@ -165,7 +165,7 @@ export function syncModelInstanceSelectionShell(
group: Group, group: Group,
asset: ProjectAssetRecord | undefined, asset: ProjectAssetRecord | undefined,
selected: boolean selected: boolean
) { ): Mesh | null {
const existingShells = group.children.filter( const existingShells = group.children.filter(
(child): child is Mesh => (child): child is Mesh =>
child instanceof Mesh && child instanceof Mesh &&
@@ -178,7 +178,7 @@ export function syncModelInstanceSelectionShell(
} }
if (!selected) { if (!selected) {
return; return null;
} }
const bounds = getLocalModelBounds(asset); const bounds = getLocalModelBounds(asset);
@@ -192,6 +192,7 @@ export function syncModelInstanceSelectionShell(
selectionShell.userData.nonPickable = true; selectionShell.userData.nonPickable = true;
selectionShell.userData[MODEL_SELECTION_SHELL_KEY] = true; selectionShell.userData[MODEL_SELECTION_SHELL_KEY] = true;
group.add(selectionShell); group.add(selectionShell);
return selectionShell;
} }
export function createModelInstanceRenderGroup( export function createModelInstanceRenderGroup(