@tomorrowevening/hermes
Version:
An extendable set of Web Tools controlled via a separate window for non-intereference with content.
2 lines (1 loc) • 1.41 kB
JavaScript
"use strict";const g=require("react/jsx-runtime"),v=require("react"),f=require("three"),A=require("../InspectorGroup.cjs"),S=require("../../../multiView/MultiView.cjs"),b=require("../../../../utils/three.cjs");function q(r){const t=r.object,i=r.three;function a(){return`${i.name}_animation`}const u=localStorage.getItem(a()),h=u!==null?u==="open":!1;function x(e){localStorage.setItem(a(),e?"open":"closed")}const s=[],l=[];let c=0;t.animations.forEach(e=>{c=Math.max(c,e.duration),e.duration>0&&l.push({title:e.name,items:[{title:"Duration",type:"number",value:e.duration,disabled:!0},{title:"Blend Mode",type:"option",disabled:!0,options:[{title:"Normal",value:2500},{title:"Additive",value:2501}]}]})}),s.push({title:"Animations",items:l});let n;const d=i.getScene(t.uuid);if(d!==null){const e=d.getObjectByProperty("uuid",t.uuid);if(e!==void 0){const o=e.mixer;if(o!==void 0){const m=[{title:"Time Scale",type:"range",value:o.timeScale,step:.01,min:-1,max:2,onChange:(j,p)=>{o.timeScale=p,i.updateObject(t.uuid,"mixer.timeScale",p)}}];m.push({title:"Stop All",type:"button",onChange:()=>{o.stopAllAction(),i.requestMethod(t.uuid,"stopAllAction",void 0,"mixer")}}),s.push({title:"Mixer",items:m}),n=new f.SkeletonHelper(e),S.instance?.scene.add(n)}}}return v.useEffect(()=>()=>{n!==void 0&&b.dispose(n)},[]),g.jsx(A,{three:r.three,title:"Animation",items:s,expanded:h,onToggle:e=>{x(e)}})}module.exports=q;