Update ViewportCanvas to include projectAssets and loadedModelAssets
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
|
||||||
|
import type { LoadedModelAsset } from "../assets/gltf-model-import";
|
||||||
|
import type { ProjectAssetRecord } from "../assets/project-assets";
|
||||||
import type { EditorSelection } from "../core/selection";
|
import type { EditorSelection } from "../core/selection";
|
||||||
import type { ToolMode } from "../core/tool-mode";
|
import type { ToolMode } from "../core/tool-mode";
|
||||||
import type { Vec3 } from "../core/vector";
|
import type { Vec3 } from "../core/vector";
|
||||||
@@ -13,6 +15,8 @@ import { ViewportHost } from "./viewport-host";
|
|||||||
interface ViewportCanvasProps {
|
interface ViewportCanvasProps {
|
||||||
world: WorldSettings;
|
world: WorldSettings;
|
||||||
sceneDocument: SceneDocument;
|
sceneDocument: SceneDocument;
|
||||||
|
projectAssets: Record<string, ProjectAssetRecord>;
|
||||||
|
loadedModelAssets: Record<string, LoadedModelAsset>;
|
||||||
selection: EditorSelection;
|
selection: EditorSelection;
|
||||||
toolMode: ToolMode;
|
toolMode: ToolMode;
|
||||||
focusRequestId: number;
|
focusRequestId: number;
|
||||||
@@ -32,6 +36,8 @@ function formatVec3(vector: Vec3 | null): string {
|
|||||||
export function ViewportCanvas({
|
export function ViewportCanvas({
|
||||||
world,
|
world,
|
||||||
sceneDocument,
|
sceneDocument,
|
||||||
|
projectAssets,
|
||||||
|
loadedModelAssets,
|
||||||
selection,
|
selection,
|
||||||
toolMode,
|
toolMode,
|
||||||
focusRequestId,
|
focusRequestId,
|
||||||
@@ -87,6 +93,10 @@ export function ViewportCanvas({
|
|||||||
hostRef.current?.updateDocument(sceneDocument, selection);
|
hostRef.current?.updateDocument(sceneDocument, selection);
|
||||||
}, [sceneDocument, selection]);
|
}, [sceneDocument, selection]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
hostRef.current?.updateAssets(projectAssets, loadedModelAssets);
|
||||||
|
}, [projectAssets, loadedModelAssets]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
hostRef.current?.setBrushSelectionChangeHandler(onSelectionChange);
|
hostRef.current?.setBrushSelectionChangeHandler(onSelectionChange);
|
||||||
}, [onSelectionChange]);
|
}, [onSelectionChange]);
|
||||||
|
|||||||
Reference in New Issue
Block a user