11import { Component , DragEvent , ReactNode } from "react" ;
22
3- import { Grid } from "react-loader-spinner" ;
43import { IoMdCube } from "react-icons/io" ;
5- import { HiOutlineTrash } from "react-icons/hi2" ;
6- import { IoPlay , IoStop } from "react-icons/io5" ;
7-
84import { Divider } from "@blueprintjs/core" ;
95
106import { DepthOfFieldEffectBlurLevel , Scene , TonemappingOperator , AnimationGroup , VolumetricLightScatteringPostProcess } from "babylonjs" ;
117
12- import { Button } from "../../../ui/shadcn/ui/button" ;
8+ import { Button } from "../../../../ ui/shadcn/ui/button" ;
139
14- import { isMesh } from "../../../tools/guards/nodes" ;
15- import { isScene } from "../../../tools/guards/scene" ;
10+ import { isMesh } from "../../../../ tools/guards/nodes" ;
11+ import { isScene } from "../../../../ tools/guards/scene" ;
1612
17- import { registerUndoRedo } from "../../../tools/undoredo" ;
18- import { updateAllLights } from "../../../tools/light/shadows" ;
19- import { updateIblShadowsRenderPipeline } from "../../../tools/light/ibl" ;
13+ import { registerUndoRedo } from "../../../../ tools/undoredo" ;
14+ import { updateAllLights } from "../../../../ tools/light/shadows" ;
15+ import { updateIblShadowsRenderPipeline } from "../../../../ tools/light/ibl" ;
2016
21- import { createVLSPostProcess , disposeVLSPostProcess , getVLSPostProcess , parseVLSPostProcess , serializeVLSPostProcess } from "../../rendering/vls" ;
22- import { createSSRRenderingPipeline , disposeSSRRenderingPipeline , getSSRRenderingPipeline , parseSSRRenderingPipeline , serializeSSRRenderingPipeline } from "../../rendering/ssr" ;
17+ import { createVLSPostProcess , disposeVLSPostProcess , getVLSPostProcess , parseVLSPostProcess , serializeVLSPostProcess } from "../../../ rendering/vls" ;
18+ import { createSSRRenderingPipeline , disposeSSRRenderingPipeline , getSSRRenderingPipeline , parseSSRRenderingPipeline , serializeSSRRenderingPipeline } from "../../../ rendering/ssr" ;
2319import {
2420 createSSAO2RenderingPipeline ,
2521 disposeSSAO2RenderingPipeline ,
2622 getSSAO2RenderingPipeline ,
2723 parseSSAO2RenderingPipeline ,
2824 serializeSSAO2RenderingPipeline ,
29- } from "../../rendering/ssao" ;
25+ } from "../../../ rendering/ssao" ;
3026import {
3127 createMotionBlurPostProcess ,
3228 disposeMotionBlurPostProcess ,
3329 getMotionBlurPostProcess ,
3430 parseMotionBlurPostProcess ,
3531 serializeMotionBlurPostProcess ,
36- } from "../../rendering/motion-blur" ;
32+ } from "../../../ rendering/motion-blur" ;
3733import {
3834 createDefaultRenderingPipeline ,
3935 disposeDefaultRenderingPipeline ,
4036 getDefaultRenderingPipeline ,
4137 parseDefaultRenderingPipeline ,
4238 serializeDefaultRenderingPipeline ,
43- } from "../../rendering/default-pipeline" ;
39+ } from "../../../ rendering/default-pipeline" ;
4440import {
4541 createIblShadowsRenderingPipeline ,
4642 disposeIblShadowsRenderingPipeline ,
4743 getIblShadowsRenderingPipeline ,
4844 parseIblShadowsRenderingPipeline ,
4945 serializeIblShadowsRenderingPipeline ,
50- } from "../../rendering/ibl-shadows" ;
46+ } from "../../../ rendering/ibl-shadows" ;
5147
52- import { EditorInspectorSectionField } from "./fields/section" ;
48+ import { EditorInspectorSectionField } from ".. /fields/section" ;
5349
54- import { EditorInspectorListField } from "./fields/list" ;
55- import { EditorInspectorColorField } from "./fields/color" ;
56- import { EditorInspectorSwitchField } from "./fields/switch" ;
57- import { EditorInspectorNumberField } from "./fields/number" ;
58- import { EditorInspectorVectorField } from "./fields/vector" ;
59- import { EditorInspectorSliderField } from "./fields/slider" ;
60- import { EditorInspectorTextureField } from "./fields/texture" ;
50+ import { EditorInspectorListField } from ".. /fields/list" ;
51+ import { EditorInspectorColorField } from ".. /fields/color" ;
52+ import { EditorInspectorSwitchField } from ".. /fields/switch" ;
53+ import { EditorInspectorNumberField } from ".. /fields/number" ;
54+ import { EditorInspectorVectorField } from ".. /fields/vector" ;
55+ import { EditorInspectorSliderField } from ".. /fields/slider" ;
56+ import { EditorInspectorTextureField } from ".. /fields/texture" ;
6157
62- import { ScriptInspectorComponent } from "./script/script" ;
58+ import { ScriptInspectorComponent } from ".. /script/script" ;
6359
64- import { IEditorInspectorImplementationProps } from "./inspector" ;
60+ import { IEditorInspectorImplementationProps } from "../inspector" ;
61+ import { EditorSceneAnimationGroupsInspector } from "./animation-groups" ;
6562
6663export interface IEditorSceneInspectorState {
6764 dragOverVlsMesh : boolean ;
65+
66+ animationGroupsSearch : string ;
67+ selectedAnimationGroups : AnimationGroup [ ] ;
6868}
6969
7070export class EditorSceneInspector extends Component < IEditorInspectorImplementationProps < Scene > , IEditorSceneInspectorState > {
@@ -82,6 +82,9 @@ export class EditorSceneInspector extends Component<IEditorInspectorImplementati
8282
8383 this . state = {
8484 dragOverVlsMesh : false ,
85+
86+ animationGroupsSearch : "" ,
87+ selectedAnimationGroups : [ ] ,
8588 } ;
8689 }
8790
@@ -149,7 +152,7 @@ export class EditorSceneInspector extends Component<IEditorInspectorImplementati
149152
150153 { /* {this.props.editor.state.enableExperimentalFeatures && this._getIblShadowsRenderingPipelineComponent()} */ }
151154
152- { this . _getAnimationGroupsComponent ( ) }
155+ < EditorSceneAnimationGroupsInspector editor = { this . props . editor } object = { this . props . object } />
153156 </ >
154157 ) ;
155158 }
@@ -998,62 +1001,4 @@ export class EditorSceneInspector extends Component<IEditorInspectorImplementati
9981001 </ EditorInspectorSectionField >
9991002 ) ;
10001003 }
1001-
1002- private _getAnimationGroupsComponent ( ) : ReactNode {
1003- return (
1004- < EditorInspectorSectionField title = "Animation Groups" >
1005- { ! this . props . object . animationGroups . length && < div className = "text-center text-xl" > No animation groups</ div > }
1006- < div className = "flex flex-col" >
1007- { this . props . object . animationGroups . map ( ( animationGroup ) => (
1008- < div key = { animationGroup . name } className = "flex flex-col" >
1009- < div
1010- className = { `
1011- flex gap-2 justify-between items-center p-2 rounded-lg
1012- hover:bg-accent
1013- transition-all duration-300 ease-in-out
1014- ` }
1015- >
1016- < div className = "flex gap-2 items-center" >
1017- < Button
1018- variant = "ghost"
1019- className = "w-8 h-8 p-1"
1020- onClick = { ( ) => {
1021- animationGroup . isPlaying ? animationGroup . stop ( ) : animationGroup . start ( ) ;
1022- this . forceUpdate ( ) ;
1023- } }
1024- >
1025- { animationGroup . isPlaying ? < IoStop className = "w-6 h-6" strokeWidth = { 1 } /> : < IoPlay className = "w-6 h-6" strokeWidth = { 1 } /> }
1026- </ Button >
1027-
1028- < div className = "flex flex-col" >
1029- < div > { animationGroup . name } </ div >
1030-
1031- < div className = "text-xs" > Duration: { Math . round ( animationGroup . to - animationGroup . from ) } frames</ div >
1032- </ div >
1033- </ div >
1034-
1035- < div className = "flex gap-2 items-center" >
1036- { animationGroup . isPlaying && < Grid width = { 16 } height = { 16 } color = "gray" /> }
1037-
1038- < Button variant = "ghost" onClick = { ( ) => this . _handleRemoveAnimationGroup ( animationGroup ) } >
1039- < HiOutlineTrash className = "w-5 h-5" />
1040- </ Button >
1041- </ div >
1042- </ div >
1043- </ div >
1044- ) ) }
1045- </ div >
1046- </ EditorInspectorSectionField >
1047- ) ;
1048- }
1049-
1050- private _handleRemoveAnimationGroup ( animationGroup : AnimationGroup ) : void {
1051- registerUndoRedo ( {
1052- executeRedo : true ,
1053- undo : ( ) => this . props . editor . layout . preview . scene . addAnimationGroup ( animationGroup ) ,
1054- redo : ( ) => this . props . editor . layout . preview . scene . removeAnimationGroup ( animationGroup ) ,
1055- } ) ;
1056-
1057- this . forceUpdate ( ) ;
1058- }
10591004}
0 commit comments