diff --git a/editor/src/editor/layout/inspector.tsx b/editor/src/editor/layout/inspector.tsx index c60992970..bae22591a 100644 --- a/editor/src/editor/layout/inspector.tsx +++ b/editor/src/editor/layout/inspector.tsx @@ -9,6 +9,7 @@ import { Editor } from "../main"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../ui/shadcn/ui/tabs"; +import { setInspectorSearch } from "./inspector/fields/field"; import { IEditorInspectorImplementationProps } from "./inspector/inspector"; import { EditorSceneInspector } from "./inspector/scene"; @@ -41,6 +42,7 @@ export interface IEditorInspectorProps { } export interface IEditorInspectorState { + search: string; editedObject: unknown | null; } @@ -70,14 +72,15 @@ export class EditorInspector extends Component - +
+ Entity @@ -91,16 +94,18 @@ export class EditorInspector extends Component this._handleSearchChanged(e.currentTarget.value)} className="px-5 py-2 rounded-lg bg-primary-foreground outline-none w-full" /> - +
{this._getContent()}
- +
@@ -140,4 +145,9 @@ export class EditorInspector extends Component )); } + + private _handleSearchChanged(search: string): void { + setInspectorSearch(search); + this.setState({ search }); + } } diff --git a/editor/src/editor/layout/inspector/decals/decals.tsx b/editor/src/editor/layout/inspector/decals/decals.tsx index 87574ca71..d477ca166 100644 --- a/editor/src/editor/layout/inspector/decals/decals.tsx +++ b/editor/src/editor/layout/inspector/decals/decals.tsx @@ -1,14 +1,17 @@ import { readJSON } from "fs-extra"; import { extname } from "path/posix"; +import { Fade } from "react-awesome-reveal"; import { Component, DragEvent, ReactNode } from "react"; +import { GiMaterialsScience } from "react-icons/gi"; import { MdOutlineQuestionMark } from "react-icons/md"; import { AbstractMesh, Mesh, Material, MeshBuilder, Vector2, Vector3, Tools } from "babylonjs"; import { Editor } from "../../../main"; +import { isDarwin } from "../../../../tools/os"; import { registerUndoRedo } from "../../../../tools/undoredo"; import { UniqueNumber, waitNextAnimationFrame } from "../../../../tools/tools"; import { setMeshMetadataNotSerializable, setMeshMetadataNotVisibleInGraph } from "../../../../tools/mesh/metadata"; @@ -70,12 +73,14 @@ export class EditorDecalsInspector extends Component {this._getMaterialDragAndDropComponent()} - - this._handleUpdateCurrentDecalMesh()} /> - this._handleUpdateCurrentDecalMesh()} /> + {this.state.material && + + this._handleUpdateCurrentDecalMesh()} /> + this._handleUpdateCurrentDecalMesh()} /> - this._handleUpdateCurrentDecalMesh()} /> - + this._handleUpdateCurrentDecalMesh()} /> + + }
); } @@ -157,20 +162,32 @@ export class EditorDecalsInspector extends Component {!decalsConfiguration.materialPath && } + + {decalsConfiguration.materialPath && + + }
- No material set + {this.state.material?.name ?? "No material set"}
- Drag and drop a material asset here. + {this.state.material + ? ( + + {`${isDarwin() ? "Cmd" : "Ctrl"} + Click in the preview panel to place the decal.`} + + ) + : "Drag and drop a material asset here." + }
@@ -247,6 +264,8 @@ export class EditorDecalsInspector extends Component { + this.props.editor.layout.graph.setSelectedNode(decalMesh); + }); } this._decalMesh = null; diff --git a/editor/src/editor/layout/inspector/fields/field.ts b/editor/src/editor/layout/inspector/fields/field.ts index 88d0dcae5..f1263ac67 100644 --- a/editor/src/editor/layout/inspector/fields/field.ts +++ b/editor/src/editor/layout/inspector/fields/field.ts @@ -9,3 +9,15 @@ export interface IEditorInspectorFieldProps { noUndoRedo?: boolean; } + +let inspectorSearch = ""; + +/** + * Sets the new search value used to filter fields in inspector. + * @param search defines the new search value to filter fields in inspector. + */ +export function setInspectorSearch(search: string) { + inspectorSearch = search; +} + +// TODO: implement filter of fields in inspector. diff --git a/editor/src/editor/layout/inspector/fields/switch.tsx b/editor/src/editor/layout/inspector/fields/switch.tsx index 80067f370..d14394ab6 100644 --- a/editor/src/editor/layout/inspector/fields/switch.tsx +++ b/editor/src/editor/layout/inspector/fields/switch.tsx @@ -39,7 +39,7 @@ export function EditorInspectorSwitchField(props: IEditorInspectorSwitchFieldPro
{ setValue(ev.currentTarget.checked); setInspectorEffectivePropertyValue(props.object, props.property, ev.currentTarget.checked);