import * as React from "react"; import { PaneComponent, IPaneComponentProps } from "../paneComponent"; import { ArcRotateCamera } from "babylonjs/Cameras/arcRotateCamera"; import { FreeCamera } from "babylonjs/Cameras/freeCamera"; import { AnimationGroup, TargetedAnimation } from "babylonjs/Animations/animationGroup"; import { Material } from "babylonjs/Materials/material"; import { BackgroundMaterial } from "babylonjs/Materials/Background/backgroundMaterial"; import { StandardMaterial } from "babylonjs/Materials/standardMaterial"; import { PBRMaterial } from "babylonjs/Materials/PBR/pbrMaterial"; import { PBRMetallicRoughnessMaterial } from "babylonjs/Materials/PBR/pbrMetallicRoughnessMaterial"; import { PBRSpecularGlossinessMaterial } from "babylonjs/Materials/PBR/pbrSpecularGlossinessMaterial"; import { Texture } from "babylonjs/Materials/Textures/texture"; import { TransformNode } from "babylonjs/Meshes/transformNode"; import { Mesh } from "babylonjs/Meshes/mesh"; import { HemisphericLight } from "babylonjs/Lights/hemisphericLight"; import { PointLight } from "babylonjs/Lights/pointLight"; import { Scene } from "babylonjs/scene"; import { MaterialPropertyGridComponent } from "./propertyGrids/materials/materialPropertyGridComponent"; import { StandardMaterialPropertyGridComponent } from "./propertyGrids/materials/standardMaterialPropertyGridComponent"; import { TexturePropertyGridComponent } from "./propertyGrids/materials/texturePropertyGridComponent"; import { PBRMaterialPropertyGridComponent } from "./propertyGrids/materials/pbrMaterialPropertyGridComponent"; import { ScenePropertyGridComponent } from "./propertyGrids/scenePropertyGridComponent"; import { HemisphericLightPropertyGridComponent } from "./propertyGrids/lights/hemisphericLightPropertyGridComponent"; import { PointLightPropertyGridComponent } from "./propertyGrids/lights/pointLightPropertyGridComponent"; import { FreeCameraPropertyGridComponent } from "./propertyGrids/cameras/freeCameraPropertyGridComponent"; import { ArcRotateCameraPropertyGridComponent } from "./propertyGrids/cameras/arcRotateCameraPropertyGridComponent"; import { MeshPropertyGridComponent } from "./propertyGrids/meshes/meshPropertyGridComponent"; import { TransformNodePropertyGridComponent } from "./propertyGrids/meshes/transformNodePropertyGridComponent"; import { BackgroundMaterialPropertyGridComponent } from "./propertyGrids/materials/backgroundMaterialPropertyGridComponent"; import { Control } from "babylonjs-gui/2D/controls/control"; import { ControlPropertyGridComponent } from "./propertyGrids/gui/controlPropertyGridComponent"; import { TextBlockPropertyGridComponent } from "./propertyGrids/gui/textBlockPropertyGridComponent"; import { TextBlock } from "babylonjs-gui/2D/controls/textBlock"; import { InputText } from "babylonjs-gui/2D/controls/inputText"; import { InputTextPropertyGridComponent } from "./propertyGrids/gui/inputTextPropertyGridComponent"; import { ColorPicker } from "babylonjs-gui/2D/controls/colorpicker"; import { Image } from "babylonjs-gui/2D/controls/image"; import { Slider } from "babylonjs-gui/2D/controls/sliders/slider"; import { ImageBasedSlider } from "babylonjs-gui/2D/controls/sliders/imageBasedSlider"; import { Rectangle } from "babylonjs-gui/2D/controls/rectangle"; import { Ellipse } from "babylonjs-gui/2D/controls/ellipse"; import { Checkbox } from "babylonjs-gui/2D/controls/checkbox"; import { RadioButton } from "babylonjs-gui/2D/controls/radioButton"; import { Line } from "babylonjs-gui/2D/controls/line"; import { ScrollViewer } from "babylonjs-gui/2D/controls/scrollViewers/scrollViewer"; import { Grid } from "babylonjs-gui/2D/controls/grid"; import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel"; import { ColorPickerPropertyGridComponent } from "./propertyGrids/gui/colorPickerPropertyGridComponent"; import { AnimationGroupGridComponent } from "./propertyGrids/animations/animationGroupPropertyGridComponent"; import { LockObject } from "./propertyGrids/lockObject"; import { ImagePropertyGridComponent } from "./propertyGrids/gui/imagePropertyGridComponent"; import { SliderPropertyGridComponent } from "./propertyGrids/gui/sliderPropertyGridComponent"; import { ImageBasedSliderPropertyGridComponent } from "./propertyGrids/gui/imageBasedSliderPropertyGridComponent"; import { RectanglePropertyGridComponent } from "./propertyGrids/gui/rectanglePropertyGridComponent"; import { EllipsePropertyGridComponent } from "./propertyGrids/gui/ellipsePropertyGridComponent"; import { CheckboxPropertyGridComponent } from "./propertyGrids/gui/checkboxPropertyGridComponent"; import { RadioButtonPropertyGridComponent } from "./propertyGrids/gui/radioButtonPropertyGridComponent"; import { LinePropertyGridComponent } from "./propertyGrids/gui/linePropertyGridComponent"; import { ScrollViewerPropertyGridComponent } from "./propertyGrids/gui/scrollViewerPropertyGridComponent"; import { GridPropertyGridComponent } from "./propertyGrids/gui/gridPropertyGridComponent"; import { PBRMetallicRoughnessMaterialPropertyGridComponent } from "./propertyGrids/materials/pbrMetallicRoughnessMaterialPropertyGridComponent"; import { PBRSpecularGlossinessMaterialPropertyGridComponent } from "./propertyGrids/materials/pbrSpecularGlossinessMaterialPropertyGridComponent"; import { StackPanelPropertyGridComponent } from "./propertyGrids/gui/stackPanelPropertyGridComponent"; import { PostProcess } from 'babylonjs/PostProcesses/postProcess'; import { PostProcessPropertyGridComponent } from './propertyGrids/postProcesses/postProcessPropertyGridComponent'; import { RenderingPipelinePropertyGridComponent } from './propertyGrids/postProcesses/renderingPipelinePropertyGridComponent'; import { PostProcessRenderPipeline } from 'babylonjs/PostProcesses/RenderPipeline/postProcessRenderPipeline'; import { DefaultRenderingPipelinePropertyGridComponent } from './propertyGrids/postProcesses/defaultRenderingPipelinePropertyGridComponent'; import { DefaultRenderingPipeline } from 'babylonjs/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline'; import { SSAORenderingPipeline } from 'babylonjs/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline'; import { SSAORenderingPipelinePropertyGridComponent } from './propertyGrids/postProcesses/ssaoRenderingPipelinePropertyGridComponent'; import { SSAO2RenderingPipeline } from 'babylonjs/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline'; import { SSAO2RenderingPipelinePropertyGridComponent } from './propertyGrids/postProcesses/ssao2RenderingPipelinePropertyGridComponent'; import { Skeleton } from 'babylonjs/Bones/skeleton'; import { SkeletonPropertyGridComponent } from './propertyGrids/meshes/skeletonPropertyGridComponent'; import { Bone } from 'babylonjs/Bones/bone'; import { BonePropertyGridComponent } from './propertyGrids/meshes/bonePropertyGridComponent'; import { DirectionalLightPropertyGridComponent } from './propertyGrids/lights/directionalLightPropertyGridComponent'; import { DirectionalLight } from 'babylonjs/Lights/directionalLight'; import { SpotLight } from 'babylonjs/Lights/spotLight'; import { SpotLightPropertyGridComponent } from './propertyGrids/lights/spotLightPropertyGridComponent'; import { LensRenderingPipeline } from 'babylonjs/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline'; import { LensRenderingPipelinePropertyGridComponent } from './propertyGrids/postProcesses/lensRenderingPipelinePropertyGridComponent'; import { NodeMaterial } from 'babylonjs/Materials/Node/nodeMaterial'; import { NodeMaterialPropertyGridComponent } from './propertyGrids/materials/nodeMaterialPropertyGridComponent'; import { MultiMaterial } from 'babylonjs/Materials/multiMaterial'; import { MultiMaterialPropertyGridComponent } from './propertyGrids/materials/multiMaterialPropertyGridComponent'; import { ParticleSystemPropertyGridComponent } from './propertyGrids/particleSystems/particleSystemPropertyGridComponent'; import { IParticleSystem } from 'babylonjs/Particles/IParticleSystem'; import { SpriteManagerPropertyGridComponent } from './propertyGrids/sprites/spriteManagerPropertyGridComponent'; import { SpriteManager } from 'babylonjs/Sprites/spriteManager'; import { SpritePropertyGridComponent } from './propertyGrids/sprites/spritePropertyGridComponent'; import { Sprite } from 'babylonjs/Sprites/sprite'; import { TargetedAnimationGridComponent } from './propertyGrids/animations/targetedAnimationPropertyGridComponent'; import { FollowCamera } from 'babylonjs/Cameras/followCamera'; import { FollowCameraPropertyGridComponent } from './propertyGrids/cameras/followCameraPropertyGridComponent'; export class PropertyGridTabComponent extends PaneComponent { private _timerIntervalId: number; private _lockObject = new LockObject(); constructor(props: IPaneComponentProps) { super(props); } timerRefresh() { if (!this._lockObject.lock) { this.forceUpdate(); } } componentDidMount() { this._timerIntervalId = window.setInterval(() => this.timerRefresh(), 500); } componentWillUnmount() { window.clearInterval(this._timerIntervalId); } render() { const entity = this.props.selectedEntity; if (!entity) { return (
Please select an entity in the scene explorer.
); } if (entity.getClassName) { const className = entity.getClassName(); if (className === "Scene") { const scene = entity as Scene; return (); } if (className === "Sprite") { const sprite = entity as Sprite; return (); } if (className === "SpriteManager") { const spriteManager = entity as SpriteManager; return (); } if (className.indexOf("Mesh") !== -1) { const mesh = entity as Mesh; if (mesh.getTotalVertices() > 0) { return (
); } } if (className.indexOf("ParticleSystem") !== -1) { const particleSystem = entity as IParticleSystem; return (); } if (className.indexOf("FreeCamera") !== -1 || className.indexOf("UniversalCamera") !== -1 || className.indexOf("WebXRCamera") !== -1 || className.indexOf("DeviceOrientationCamera") !== -1) { const freeCamera = entity as FreeCamera; return (); } if (className.indexOf("ArcRotateCamera") !== -1) { const arcRotateCamera = entity as ArcRotateCamera; return (); } if (className.indexOf("FollowCamera") !== -1) { const followCamera = entity as FollowCamera; return (); } if (className === "HemisphericLight") { const hemisphericLight = entity as HemisphericLight; return (); } if (className === "PointLight") { const pointLight = entity as PointLight; return (); } if (className === "DirectionalLight") { const pointLight = entity as DirectionalLight; return (); } if (className === "SpotLight") { const pointLight = entity as SpotLight; return (); } if (className.indexOf("TransformNode") !== -1 || className.indexOf("Mesh") !== -1) { const transformNode = entity as TransformNode; return (); } if (className === "MultiMaterial") { const material = entity as MultiMaterial; return (); } if (className === "StandardMaterial") { const material = entity as StandardMaterial; return (); } if (className === "NodeMaterial") { const material = entity as NodeMaterial; return (); } if (className === "PBRMaterial") { const material = entity as PBRMaterial; return (); } if (className === "PBRMetallicRoughnessMaterial") { const material = entity as PBRMetallicRoughnessMaterial; return (); } if (className === "PBRSpecularGlossinessMaterial") { const material = entity as PBRSpecularGlossinessMaterial; return (); } if (className === "BackgroundMaterial") { const material = entity as BackgroundMaterial; return (); } if (className === "AnimationGroup") { const animationGroup = entity as AnimationGroup; return (); } if (className === "TargetedAnimation") { const targetedAnimation = entity as TargetedAnimation; return (); } if (className.indexOf("Material") !== -1) { const material = entity as Material; return (); } if (className.indexOf("DefaultRenderingPipeline") !== -1) { const renderPipeline = entity as DefaultRenderingPipeline; return (); } if (className.indexOf("LensRenderingPipeline") !== -1) { const renderPipeline = entity as LensRenderingPipeline; return (); } if (className.indexOf("SSAORenderingPipeline") !== -1) { const renderPipeline = entity as SSAORenderingPipeline; return (); } if (className.indexOf("SSAO2RenderingPipeline") !== -1) { const renderPipeline = entity as SSAO2RenderingPipeline; return (); } if (className.indexOf("RenderingPipeline") !== -1) { const renderPipeline = entity as PostProcessRenderPipeline; return (); } if (className.indexOf("PostProcess") !== -1) { const postProcess = entity as PostProcess; return (); } if (className.indexOf("Texture") !== -1) { const texture = entity as Texture; return (); } if (className.indexOf("Skeleton") !== -1) { const skeleton = entity as Skeleton; return (); } if (className.indexOf("Bone") !== -1) { const bone = entity as Bone; return (); } if (className === "TextBlock") { const textBlock = entity as TextBlock; return (); } if (className === "InputText") { const inputText = entity as InputText; return (); } if (className === "ColorPicker") { const colorPicker = entity as ColorPicker; return (); } if (className === "Image") { const image = entity as Image; return (); } if (className === "Slider") { const slider = entity as Slider; return (); } if (className === "ImageBasedSlider") { const imageBasedSlider = entity as ImageBasedSlider; return (); } if (className === "Rectangle") { const rectangle = entity as Rectangle; return (); } if (className === "StackPanel") { const stackPanel = entity as StackPanel; return (); } if (className === "Grid") { const grid = entity as Grid; return (); } if (className === "ScrollViewer") { const scrollViewer = entity as ScrollViewer; return (); } if (className === "Ellipse") { const ellipse = entity as Ellipse; return (); } if (className === "Checkbox") { const checkbox = entity as Checkbox; return (); } if (className === "RadioButton") { const radioButton = entity as RadioButton; return (); } if (className === "Line") { const line = entity as Line; return (); } if (entity._host) { const control = entity as Control; return (); } } return null; } }