@tomorrowevening/hermes
Version:
An extendable set of Web Tools controlled via a separate window for non-intereference with content.
2 lines (1 loc) • 2.07 kB
JavaScript
"use strict";const t=require("react/jsx-runtime"),u=require("react");;/* empty css */const v=require("../Accordion.cjs"),c=require("./InspectorField.cjs"),E=require("./utils/InspectCamera.cjs"),T=require("./utils/InspectMaterial.cjs"),I=require("./utils/InspectTransform.cjs"),j=require("./utils/InspectLight.cjs"),x=require("./utils/InspectAnimation.cjs"),C=require("../../tools/Transform.cjs"),r=require("../../../core/remote/RemoteThree.cjs"),o={name:"",uuid:"",type:"",visible:!1,matrix:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0,children:[]};function g(n){const[e,a]=u.useState(o);u.useEffect(()=>{function l(m){a(m.value)}function i(){a(o)}return n.three.addEventListener(r.ToolEvents.CLEAR_OBJECT,i),n.three.addEventListener(r.ToolEvents.SET_SCENE,i),n.three.addEventListener(r.ToolEvents.SET_OBJECT,l),()=>{n.three.removeEventListener(r.ToolEvents.CLEAR_OBJECT,i),n.three.removeEventListener(r.ToolEvents.SET_SCENE,i),n.three.removeEventListener(r.ToolEvents.SET_OBJECT,l)}},[]);const s=e.type.toLowerCase(),h=e.animations.length>0||e.mixer!==void 0,d=s.search("mesh")>-1||s.search("line")>-1||s.search("points")>-1;return t.jsx(v,{three:n.three,label:"Inspector",button:e.uuid.length>0?t.jsx("button",{className:"remove",onClick:()=>{C.instance.remove(e.name),a(o)}}):void 0,children:t.jsx("div",{id:"Inspector",className:n.class,children:e.uuid.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs(t.Fragment,{children:[t.jsx(c,{type:"string",title:"Name",prop:"name",value:e.name,disabled:!0}),t.jsx(c,{type:"string",title:"Type",prop:"type",value:e.type,disabled:!0}),t.jsx(c,{type:"string",title:"UUID",prop:"uuid",value:e.uuid,disabled:!0})]}),t.jsxs(t.Fragment,{children:[t.jsx(I.InspectTransform,{object:e,three:n.three}),h?t.jsx(x,{object:e,three:n.three}):null,s.search("camera")>-1?E.InspectCamera(e,n.three):null,s.search("light")>-1?j.InspectLight(e,n.three):null,d?T.InspectMaterial(e,n.three):null]})]})})},"Inspector")}module.exports=g;