@galacean/cli 2.0.0-alpha.12 → 2.0.0-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/dist/cli.bundle.cjs +134 -135
  2. package/dist/viewport-client/_static/Accordion-3d330bc6.js +1 -0
  3. package/dist/viewport-client/_static/{AmbientLightAsset-f70b95f1.js → AmbientLightAsset-bdbc4e1d.js} +2 -2
  4. package/dist/viewport-client/_static/AnimationClipAsset-9167378a.js +1 -0
  5. package/dist/viewport-client/_static/AnimatorControllerAsset-21dc6332.js +1 -0
  6. package/dist/viewport-client/_static/AnimatorStore-18d3c551.js +1 -0
  7. package/dist/viewport-client/_static/{AssetViewer-bc198e16.js → AssetViewer-64cd01fa.js} +1 -1
  8. package/dist/viewport-client/_static/AudioAsset-0c828c80.js +1 -0
  9. package/dist/viewport-client/_static/AudioComponent-fbff3825.js +1 -0
  10. package/dist/viewport-client/_static/{Callout-cb4a55ff.js → Callout-ba7e2adf.js} +1 -1
  11. package/dist/viewport-client/_static/CameraComponent-74975570.js +1 -0
  12. package/dist/viewport-client/_static/{Component-f923abb1.js → Component-ed7aa0ab.js} +1 -1
  13. package/dist/viewport-client/_static/DirectLight-b884e7db.js +1 -0
  14. package/dist/viewport-client/_static/FontAsset-d1ced18d.js +5 -0
  15. package/dist/viewport-client/_static/FormItemArray-6d69acd4.js +6 -0
  16. package/dist/viewport-client/_static/{GlTFAsset-9c68f862.js → GlTFAsset-2723b84a.js} +9 -9
  17. package/dist/viewport-client/_static/IconEdit-ab77303f.js +6 -0
  18. package/dist/viewport-client/_static/{IconPointFilled-a304fd34.js → IconPointFilled-811fc660.js} +1 -1
  19. package/dist/viewport-client/_static/LightBaseComponent-12dc27d1.js +1 -0
  20. package/dist/viewport-client/_static/LottieAnimationComponent-c48c5eb5.js +1 -0
  21. package/dist/viewport-client/_static/LottieAsset-3692580d.js +6 -0
  22. package/dist/viewport-client/_static/MarkdownAsset-bcb90be4.js +1 -0
  23. package/dist/viewport-client/_static/MaterialAsset-6ef9b4ed.js +1 -0
  24. package/dist/viewport-client/_static/MaterialInspector-e8242674.js +1 -0
  25. package/dist/viewport-client/_static/Menu-0b8da92f.js +17 -0
  26. package/dist/viewport-client/_static/MeshAsset-ca9305e5.js +1 -0
  27. package/dist/viewport-client/_static/MeshRendererBaseComponent-9efd3943.js +1 -0
  28. package/dist/viewport-client/_static/MeshRendererComponent-c9a03641.js +1 -0
  29. package/dist/viewport-client/_static/{MeshThumbnail-49273f71.js → MeshThumbnail-ab28b3b8.js} +1 -1
  30. package/dist/viewport-client/_static/ParticleRendererComponent-96947c1d.js +26 -0
  31. package/dist/viewport-client/_static/PhysicsMaterialAsset-4a1e5ea3.js +1 -0
  32. package/dist/viewport-client/_static/PhysicsStore-33cac578.js +1 -0
  33. package/dist/viewport-client/_static/PointLight-fd514526.js +1 -0
  34. package/dist/viewport-client/_static/PostProcessComponent-d0ea27a4.js +6 -0
  35. package/dist/viewport-client/_static/PrefabAsset-9179b95c.js +1 -0
  36. package/dist/viewport-client/_static/PrimitiveMesh-0572a073.js +1 -0
  37. package/dist/viewport-client/_static/ProxyConfigs-3a5fd860.js +1 -0
  38. package/dist/viewport-client/_static/{ReferencedMaterial-a87818f3.js → ReferencedMaterial-5773c9d2.js} +1 -1
  39. package/dist/viewport-client/_static/RenderTargetAsset-ab6e06d2.js +1 -0
  40. package/dist/viewport-client/_static/SceneAsset-385fa837.js +1 -0
  41. package/dist/viewport-client/_static/{ShaderAsset-cb3ff628.js → ShaderAsset-f4514b03.js} +6 -6
  42. package/dist/viewport-client/_static/ShaderChunkAsset-34116f2c.js +5 -0
  43. package/dist/viewport-client/_static/{ShaderUIScriptAsset-d13fa4e2.js → ShaderUIScriptAsset-fc503291.js} +5 -5
  44. package/dist/viewport-client/_static/SkinnedMeshRendererComponent-494ad439.js +1 -0
  45. package/dist/viewport-client/_static/SpineAnimationComponent-3918d7b5.js +1 -0
  46. package/dist/viewport-client/_static/SpineSkeletonDataAsset-27244892.js +1 -0
  47. package/dist/viewport-client/_static/SpotLight-f9972dc0.js +1 -0
  48. package/dist/viewport-client/_static/SpriteAsset-558ffca8.js +6 -0
  49. package/dist/viewport-client/_static/SpriteAtlasAsset-cdc34386.js +1 -0
  50. package/dist/viewport-client/_static/SpriteBaseComponent-3edafa31.js +1 -0
  51. package/dist/viewport-client/_static/SpriteMaskComponent-de2e5231.js +1 -0
  52. package/dist/viewport-client/_static/SpriteRendererComponent-e999e735.js +1 -0
  53. package/dist/viewport-client/_static/{TextBaseComponent-69233798.js → TextBaseComponent-ce1402c3.js} +2 -2
  54. package/dist/viewport-client/_static/TextRendererComponent-f7c0deae.js +1 -0
  55. package/dist/viewport-client/_static/TextureAsset-39fb07fe.js +36 -0
  56. package/dist/viewport-client/_static/Tooltip-82063435.js +1 -0
  57. package/dist/viewport-client/_static/TrailRendererComponent-37f5c981.js +1 -0
  58. package/dist/viewport-client/_static/TransformBaseComponent-713d57e9.js +1 -0
  59. package/dist/viewport-client/_static/TransformComponent-40a57948.js +1 -0
  60. package/dist/viewport-client/_static/XRReferenceImageAsset-2f6ff226.js +1 -0
  61. package/dist/viewport-client/_static/audio-7120ec91.js +1 -0
  62. package/dist/viewport-client/_static/glTFIO-79bbca27.js +1 -0
  63. package/dist/viewport-client/_static/index-483b5738.js +1 -0
  64. package/dist/viewport-client/_static/{index-98982ce2.js → index-74130ff3.js} +1 -1
  65. package/dist/viewport-client/_static/index-78269e76.js +1 -0
  66. package/dist/viewport-client/_static/index-7834b582.js +1 -0
  67. package/dist/viewport-client/_static/{index-237c84cd.js → index-7917f782.js} +3 -3
  68. package/dist/viewport-client/_static/index-7acd49d2.js +1 -0
  69. package/dist/viewport-client/_static/index-9d3917da.js +1 -0
  70. package/dist/viewport-client/_static/index-a9b2675e.js +1 -0
  71. package/dist/viewport-client/_static/index-aec7e708.js +11487 -0
  72. package/dist/viewport-client/_static/index-b5582401.js +1 -0
  73. package/dist/viewport-client/_static/{index-e46ec5b1.js → index-bfe6f30e.js} +7 -7
  74. package/dist/viewport-client/_static/index-c63c9606.js +2 -0
  75. package/dist/viewport-client/_static/index-cd1fee9d.js +1 -0
  76. package/dist/viewport-client/_static/index-e73ceaed.js +1 -0
  77. package/dist/viewport-client/_static/index-e8a45e82.js +1 -0
  78. package/dist/viewport-client/_static/index-f2cb64af.js +1 -0
  79. package/dist/viewport-client/_static/index-fbe040bf.js +31 -0
  80. package/dist/viewport-client/_static/ktx2-encoder-53b21bdc.js +1 -0
  81. package/dist/viewport-client/_static/{module-5c85b07e.js → module-220b3921.js} +1 -1
  82. package/dist/viewport-client/_static/{module-6406b050.js → module-8816772d.js} +1 -1
  83. package/dist/viewport-client/_static/{module-107b7430.js → module-ffeaf99f.js} +1 -1
  84. package/dist/viewport-client/_static/postmen-2f47f6bb.js +1 -0
  85. package/dist/viewport-client/index.html +2 -2
  86. package/package.json +1 -1
  87. package/dist/viewport-client/_static/Accordion-4897319b.js +0 -6
  88. package/dist/viewport-client/_static/AnimationClipAsset-01f3deb6.js +0 -1
  89. package/dist/viewport-client/_static/AnimatorControllerAsset-b7424e9c.js +0 -1
  90. package/dist/viewport-client/_static/AnimatorStore-fd98c00e.js +0 -1
  91. package/dist/viewport-client/_static/AssetPreviewer-24e31d97.js +0 -6
  92. package/dist/viewport-client/_static/AudioAsset-eae03324.js +0 -1
  93. package/dist/viewport-client/_static/AudioComponent-44070c2c.js +0 -1
  94. package/dist/viewport-client/_static/CameraComponent-907ac745.js +0 -1
  95. package/dist/viewport-client/_static/CanvasRenderer-9dd98cb3.js +0 -1
  96. package/dist/viewport-client/_static/DirectLight-58f5fe9e.js +0 -1
  97. package/dist/viewport-client/_static/FontAsset-abfb9a8a.js +0 -5
  98. package/dist/viewport-client/_static/FormItemArray-66be8701.js +0 -1
  99. package/dist/viewport-client/_static/IconPlayerPlayFilled-b058c98f.js +0 -6
  100. package/dist/viewport-client/_static/InstanceEditorAsset-a70e73fe.js +0 -1
  101. package/dist/viewport-client/_static/LightBaseComponent-fbc3ae49.js +0 -1
  102. package/dist/viewport-client/_static/LottieAnimationComponent-1c3e02a5.js +0 -1
  103. package/dist/viewport-client/_static/LottieAsset-377c1419.js +0 -1
  104. package/dist/viewport-client/_static/MarkdownAsset-7ea387a9.js +0 -1
  105. package/dist/viewport-client/_static/MaterialAsset-74a15124.js +0 -1
  106. package/dist/viewport-client/_static/MaterialInspector-aec1248b.js +0 -1
  107. package/dist/viewport-client/_static/Menu-cd3be298.js +0 -17
  108. package/dist/viewport-client/_static/MeshAsset-73e2cc8e.js +0 -1
  109. package/dist/viewport-client/_static/MeshRendererBaseComponent-3a0e09ed.js +0 -1
  110. package/dist/viewport-client/_static/MeshRendererComponent-5385d30f.js +0 -1
  111. package/dist/viewport-client/_static/ParticleRendererComponent-5a7b57d9.js +0 -21
  112. package/dist/viewport-client/_static/PhysicsMaterialAsset-a5ac9f82.js +0 -1
  113. package/dist/viewport-client/_static/PhysicsStore-0729e76d.js +0 -1
  114. package/dist/viewport-client/_static/PointLight-0e1d1546.js +0 -1
  115. package/dist/viewport-client/_static/PostProcessComponent-8276d33c.js +0 -1
  116. package/dist/viewport-client/_static/PrefabAsset-1a7edfbd.js +0 -1
  117. package/dist/viewport-client/_static/PrimitiveMesh-3ce6fa2f.js +0 -1
  118. package/dist/viewport-client/_static/ProxyConfigs-4de3304c.js +0 -1
  119. package/dist/viewport-client/_static/RenderTargetAsset-33c0d9e7.js +0 -1
  120. package/dist/viewport-client/_static/SceneAsset-8917c210.js +0 -1
  121. package/dist/viewport-client/_static/ShaderChunkAsset-83f923f4.js +0 -5
  122. package/dist/viewport-client/_static/SkinnedMeshRendererComponent-2a8323bf.js +0 -1
  123. package/dist/viewport-client/_static/SpineAnimationComponent-e733d50f.js +0 -1
  124. package/dist/viewport-client/_static/SpineSkeletonDataAsset-b64a3ee3.js +0 -1
  125. package/dist/viewport-client/_static/SpotLight-ca6c0c3b.js +0 -1
  126. package/dist/viewport-client/_static/SpriteAsset-9a31ec24.js +0 -1
  127. package/dist/viewport-client/_static/SpriteAtlasAsset-a862db46.js +0 -1
  128. package/dist/viewport-client/_static/SpriteBaseComponent-f6f1731f.js +0 -1
  129. package/dist/viewport-client/_static/SpriteMaskComponent-778be04f.js +0 -1
  130. package/dist/viewport-client/_static/SpriteRendererComponent-2b4d153b.js +0 -1
  131. package/dist/viewport-client/_static/TextRendererComponent-130b4e99.js +0 -1
  132. package/dist/viewport-client/_static/TextureAsset-28fedf2a.js +0 -36
  133. package/dist/viewport-client/_static/ThumbnailMixin-35997457.js +0 -1
  134. package/dist/viewport-client/_static/ThumbnailRegistry-495c18c9.js +0 -1
  135. package/dist/viewport-client/_static/Tooltip-33f770ba.js +0 -1
  136. package/dist/viewport-client/_static/TrailRendererComponent-148550b5.js +0 -1
  137. package/dist/viewport-client/_static/TransformBaseComponent-02318c5a.js +0 -1
  138. package/dist/viewport-client/_static/TransformComponent-96106065.js +0 -1
  139. package/dist/viewport-client/_static/ViewerManager-202b570a.js +0 -1
  140. package/dist/viewport-client/_static/XRReferenceImageAsset-6a6adb3b.js +0 -1
  141. package/dist/viewport-client/_static/audio-244358e2.js +0 -1
  142. package/dist/viewport-client/_static/glTFIO-45ff9a17.js +0 -1
  143. package/dist/viewport-client/_static/index-0a8702e2.js +0 -11217
  144. package/dist/viewport-client/_static/index-37c74ae9.js +0 -26
  145. package/dist/viewport-client/_static/index-4cca0201.js +0 -1
  146. package/dist/viewport-client/_static/index-59732f86.js +0 -1
  147. package/dist/viewport-client/_static/index-6c8198f6.js +0 -2
  148. package/dist/viewport-client/_static/index-6f827618.js +0 -1
  149. package/dist/viewport-client/_static/index-803ca489.js +0 -1
  150. package/dist/viewport-client/_static/index-85a6cf6a.js +0 -1
  151. package/dist/viewport-client/_static/index-b3d51f87.js +0 -1
  152. package/dist/viewport-client/_static/index-be6bc38a.js +0 -177
  153. package/dist/viewport-client/_static/index-c403cbcd.js +0 -1
  154. package/dist/viewport-client/_static/index-e73966ae.js +0 -1
  155. package/dist/viewport-client/_static/index-e95b4498.js +0 -1
  156. package/dist/viewport-client/_static/index-f5a67a46.js +0 -1
  157. package/dist/viewport-client/_static/ktx-parse.modern-6c9f771f.js +0 -1
  158. package/dist/viewport-client/_static/ktx2-encoder-1e63c1eb.js +0 -1
  159. package/dist/viewport-client/_static/postmen-45d4c238.js +0 -1
  160. package/dist/viewport-client/_static/utilities-e09052e3.js +0 -11
@@ -1 +0,0 @@
1
- var j=Object.defineProperty;var O=(r,t,a)=>t in r?j(r,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[t]=a;var c=(r,t,a)=>(O(r,typeof t!="symbol"?t+"":t,a),a);import{aT as v,aU as x,aJ as N,aD as S,aK as B,aI as I,j as L,aZ as U,a_ as z,a$ as F,u as M,b0 as R,m as _,b1 as J,e as V,n as $,b2 as K}from"./index-0a8702e2.js";import{u as W,a as Z,A as k}from"./InstanceEditorAsset-a70e73fe.js";import"./ThumbnailMixin-35997457.js";import"./AssetPreviewer-24e31d97.js";import"./CanvasRenderer-9dd98cb3.js";import"./postmen-45d4c238.js";import"./meshopt_simplifier.module-cd99529d.js";import{b as q}from"./bundlers-9b0d37fc.js";import{o as G}from"./assetEditorActions-c4e5962f.js";import"./ThumbnailRegistry-495c18c9.js";import"./IconPlayerPlayFilled-b058c98f.js";const H=v(function(){const{layoutStore:t}=W(),{t:a}=x(),e=N.useCallback(()=>{t.toggleTabVisibility("AnimatorController")},[]);return S.jsx(B,{align:"both",css:{padding:"$1"},fullWidth:!0,children:S.jsx(I,{size:"sm",onClick:e,children:a("animation.animator-controller.editor.open")})})});var Q=Object.defineProperty,X=Object.getOwnPropertyDescriptor,y=(r,t,a,e)=>{for(var s=e>1?void 0:e?X(t,a):t,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(e?i(t,a,s):i(s))||s);return e&&s&&Q(t,a,s),s};let d=class extends L{constructor(t){super(t);c(this,"statesNameMap",{});c(this,"internalDataUpdated",!1);c(this,"layers",[]);c(this,"parameters",[]);c(this,"_syncing");c(this,"_syncingPromise");this.onDoubleClick=this.onDoubleClick.bind(this)}applyPropertyFromDomain(t,a){super.applyPropertyFromDomain(t,a),(t==="layers"||t==="parameters")&&this.applyControllerData().catch(e=>{console.error("[AnimatorControllerAsset] applyControllerData failed:",e)})}initByEngineObject(t){return this.setNameByIncrease("AnimatorController"),this.bindEngineObject(t),this.layers=t.layers.map(a=>{const e=a.stateMachine,o={states:e.states.map(i=>({name:i.name,speed:i.speed,wrapMode:i.wrapMode,clipStartNormalizedTime:i.clipStartTime,clipEndNormalizedTime:i.clipEndTime,clip:this.root.assetStore.engineObjectToAssetMap.get(i.clip).getCurrentRef(),transitions:[],scripts:[],isEntryState:i===e.defaultState,isExitState:!1,isAnyState:!1})),transitions:[],entryTransitions:[],anyTransitions:[]};return{name:a.name,blendingMode:a.blendingMode,weight:a.weight,stateMachine:o}}),this.internalDataUpdated=!0,this.getMainData()}async initByMain(t){const{internalDataUpdated:a}=this.meta;a&&(this.internalDataUpdated=!0);const e=JSON.parse(await t.text()),s=new U(this.engine);this.bindEngineObject(s),this.layers=e.layers||[],this.parameters=e.parameters||[],await this.applyControllerData()}async applyControllerData(){this._syncing&&await this._syncingPromise,this._syncing=!0;try{this.statesNameMap={};const t=this.engineObject;t.clearLayers(),t._parameters.length=0,t._parametersMap={};const{layers:a,parameters:e}=this;this._syncingPromise=Promise.all(a.map((s,o)=>{const{name:i,blendingMode:m,weight:u}=s,l=new z(i);return t.addLayer(l),l.blendingMode=m,l.weight=u,this._applyStateMachineData(o)})),e.forEach(s=>{const{isTrigger:o,name:i,defaultValue:m}=s;o?t.addTriggerParameter(i):t.addParameter(i,m)}),await this._syncingPromise}finally{this._syncing=!1}}async initByCreation(){return this.layers=[{name:"Base",weight:1,blendingMode:F.Override,stateMachine:{states:[],transitions:[],entryTransitions:[],anyTransitions:[]}}],this.getMainData()}onDoubleClick(){G(this.root,"AnimatorController",{clearSceneSelection:!0})}async _applyStateMachineData(t){const a=this.engineObject.layers[t],{stateMachine:e}=this.layers[t],s=a.stateMachine;if(e){const{states:o=[],transitions:i=[],entryTransitions:m=[],anyTransitions:u=[]}=e,l={},T={},w=o.map(async n=>{var A,E;const{id:h,name:f,speed:b,wrapMode:g,clipStartNormalizedTime:P,clipEndNormalizedTime:D,clip:C}=n;(A=this.statesNameMap)[t]||(A[t]={}),this.statesNameMap[t][n.name]=n;const p=s.addState(f);p.speed=b,p.wrapMode=g,p.clipStartTime=P,p.clipEndTime=D,l[h]=p,C&&(p.clip=(E=await this.root.assetStore.getAssetByRef(C))==null?void 0:E.engineObject)});i.forEach(n=>{const h=this._createTransition(n,l[n.destinationStateId]);T[n.id]=h}),o.forEach(n=>{const{id:h,transitions:f}=n;f.forEach(b=>{const g=T[b];g&&l[h].addTransition(g)})}),m.forEach(n=>{s.addEntryStateTransition(this._createTransition(n,l[n.destinationStateId]))}),u.forEach(n=>{s.addAnyStateTransition(this._createTransition(n,l[n.destinationStateId]))}),await Promise.all(w),this.engineObject._updateFlagManager.dispatch()}}_createTransition(t,a){const e=new K;return e.duration=t.duration,e.offset=t.offset,e.exitTime=t.exitTime,e.solo=t.solo,e.mute=t.mute,e.hasExitTime=t.hasExitTime,e._isExit=t.isExit,e.destinationState=a,t.conditions.forEach(s=>{e.addCondition(s.parameterName,s.mode,s.threshold)}),e}};y([M,R()],d.prototype,"internalDataUpdated",2);y([_(),M],d.prototype,"layers",2);y([_(),M],d.prototype,"parameters",2);y([J],d.prototype,"applyPropertyFromDomain",1);d=y([Z({type:"AnimatorController",label:V("asset.animator-controller.title"),icon:"animate-controller",extname:"animCtrl",importMenuConfig:{type:k.Add},dragLayer:$.AnimationController,customInspector:H,async bundle({content:r}){return{content:new Blob([q(await r.text())])}}})],d);export{d as AnimatorControllerAsset};
@@ -1 +0,0 @@
1
- var f=Object.defineProperty;var P=(n,o,t)=>o in n?f(n,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[o]=t;var i=(n,o,t)=>(P(n,typeof o!="symbol"?o+"":o,t),t);import{E as y,bc as u,s as m,p as c,C as d,t as h,e as C,bd as _,be as v,o as g,bf as S,bg as O}from"./index-0a8702e2.js";import"./InstanceEditorAsset-a70e73fe.js";import"./ThumbnailMixin-35997457.js";import"./AssetPreviewer-24e31d97.js";import"./CanvasRenderer-9dd98cb3.js";import{c as A}from"./Component-f923abb1.js";import"./postmen-45d4c238.js";var w=Object.defineProperty,E=Object.getOwnPropertyDescriptor,p=(n,o,t,r)=>{for(var e=r>1?void 0:r?E(o,t):o,a=n.length-1,l;a>=0;a--)(l=n[a])&&(e=(r?l(o,t,e):l(e))||e);return r&&e&&w(o,t,e),e};let s=class extends y{constructor(o,t){super(o,t);i(this,"animatorController",null);i(this,"cullingMode",u.None);i(this,"speed",1)}async bindEngineObject(o){await super.bindEngineObject(o),o.enabled=!1}};p([m(),c({type:d.AssetPicker,assetType:"AnimatorController",label:"animation.animator-controller.controller.title",info:"animation.animator-controller.controller.info",bindPath:"animatorController"})],s.prototype,"animatorController",2);p([m(),c({type:d.Select,label:"animation.animator-controller.culling-mode.title",info:"animation.animator-controller.culling-mode.info",options:h(u,void 0,n=>C(`animation.animator-controller.culling-mode.${n.toLowerCase()}`)),bindPath:"cullingMode"})],s.prototype,"cullingMode",2);p([m(),c({type:d.Number,label:"animation.animator-controller.speed.title",info:"animation.animator-controller.speed.info",bindPath:"speed"})],s.prototype,"speed",2);s=p([A({type:"Animator",componentsMenu:{label:"component.animator.title"},unique:!0})],s);class M extends _{constructor(){super(...arguments);i(this,"_animatorComponents",[]);i(this,"onScriptPlay")}init(t){this.onScriptPlay=t.onScriptPlay}onPlay(t){this.engine.sceneManager.scenes[0].rootEntities.forEach(e=>{e.getComponentsIncludeChildren(v,this._animatorComponents)}),this._animatorComponents.forEach(e=>{e.enabled=t,t||e._reset()}),this.onScriptPlay&&this.onScriptPlay(t)}}var j=Object.defineProperty,D=Object.getOwnPropertyDescriptor,$=(n,o,t,r)=>{for(var e=r>1?void 0:r?D(o,t):o,a=n.length-1,l;a>=0;a--)(l=n[a])&&(e=(r?l(o,t,e):l(e))||e);return r&&e&&j(o,t,e),e};let b=class{constructor(n){i(this,"script");i(this,"root");g(this),this.root=n}init(){this.script=S.addScript(M),this.script.init({onScriptPlay:n=>{var o;(o=this.root.animatorControllerStore)==null||o.updateGlobalPlayState(n)}})}};b=$([O({type:"animatorStore"})],b);export{s as A,b as a};
@@ -1,6 +0,0 @@
1
- import{aC as p,aH as l,aT as o,aD as i,b4 as u,aG as d,aM as x,b5 as g,b6 as m,aJ as r}from"./index-0a8702e2.js";import{I as h}from"./IconPlayerPlayFilled-b058c98f.js";/**
2
- * @license @tabler/icons-react v3.24.0 - MIT
3
- *
4
- * This source code is licensed under the MIT license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */var y=p("filled","player-pause-filled","IconPlayerPauseFilled",[["path",{d:"M9 4h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h2a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2z",key:"svg-0"}],["path",{d:"M17 4h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h2a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2z",key:"svg-1"}]]);const f=l("div",{position:"absolute",top:0,padding:"$1",backgroundColor:"$panelBg",width:"100%",variants:{sticky:{true:{position:"absolute",top:0}}}}),S=l("div",{height:"220px",width:"100%",border:"1px solid $gray5",borderRadius:"$4",overflow:"hidden"}),j=l("div",{position:"absolute",bottom:"$3",left:0,width:"100%",textAlign:"center",color:"#ddd",textShadow:"0 0 2px #000",fontWeight:"bold",fontSize:"$2"}),z=({asset:t,viewer:e})=>{const a=r.useRef(null),[n,s]=r.useState("");return r.useEffect(()=>{t.startViewer(a.current),s(e.getDescription(t));const c=()=>s(e.getDescription(t));return t.addPropertyChangeListener("engineObjectReady",c),()=>{t.removePropertyChangeListener("engineObjectReady",c),t.stopViewer()}},[t]),i.jsxs(f,{children:[i.jsx(S,{ref:a}),i.jsx($,{asset:t,viewerWithAnimations:e}),n&&i.jsxs(j,{children:[n," "]})]})},v=l("div",{position:"absolute",bottom:8,left:8,right:8,display:"grid",gap:"$1",marginTop:"$1 $2",variants:{hasClips:{true:{gridTemplateColumns:"100px 18px 1fr"},false:{gridTemplateColumns:"$4_5 1fr"}}}}),b=o(function(t){const{frameTime:e,duration:a}=t.clipState;return i.jsx(u,{size:"xs",startSlot:i.jsx(d,{size:"sm",css:{color:"$grayA10"},children:e.toFixed(2).replace(".",":")}),endSlot:i.jsx(d,{size:"sm",css:{color:"$grayA10"},children:a.toFixed(2).replace(".",":")}),tooltip:!1,min:0,max:a||0,disabled:a===0,step:.01,defaultValue:[0],value:[e],onValueChange:n=>{t.clipState.setFrameTime(n[0])},css:{flex:1}})}),C=o(function(t){const e=t.clipState;return i.jsx(x,{size:"xs",onClick:()=>{e.playing=!e.playing,e.playing?e.playAnimation():e.pauseAnimation()},children:e.playing?i.jsx(y,{}):i.jsx(h,{})})}),P=o(function(t){const{animationNames:e,animationIndex:a=0}=t.clipState;return i.jsxs(v,{hasClips:!!e.length,children:[i.jsx(g,{value:a,onValueChange:n=>{t.clipState.selectAnimation&&t.clipState.selectAnimation(n)},valueType:"number",size:"xs",sideOffset:8,children:e.map((n,s)=>n?i.jsx(m,{value:s,children:n},s):null)}),t.children]})}),$=o(function({asset:t,viewerWithAnimations:e}){var n;if(!t.getViewerReady())return null;const a=((n=e.animationNames)==null?void 0:n.length)>0;return a&&e.selectAnimation&&e.selectAnimation(0),a?i.jsxs(P,{clipState:e,children:[i.jsx(C,{clipState:e}),i.jsx(b,{clipState:e})]}):null});export{z as A,y as I};
@@ -1 +0,0 @@
1
- var b=Object.defineProperty;var m=(t,e,r)=>e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var p=(t,e,r)=>(m(t,typeof e!="symbol"?e+"":e,r),r);import{aH as y,aT as c,aD as n,o as f,u as d,j as A,a7 as O,e as j}from"./index-0a8702e2.js";import{a as w,A as P}from"./InstanceEditorAsset-a70e73fe.js";import"./ThumbnailMixin-35997457.js";import"./AssetPreviewer-24e31d97.js";import"./CanvasRenderer-9dd98cb3.js";import"./postmen-45d4c238.js";import{A as _}from"./AssetViewer-bc198e16.js";import"./ThumbnailRegistry-495c18c9.js";import"./IconPlayerPlayFilled-b058c98f.js";var g=Object.defineProperty,h=Object.getOwnPropertyDescriptor,v=(t,e,r,s)=>{for(var o=s>1?void 0:s?h(e,r):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(s?a(e,r,o):a(o))||o);return s&&o&&g(e,r,o),o};const x=y("div",{position:"absolute",top:"100px",backgroundColor:"$panelBg",variants:{sticky:{true:{position:"absolute",top:0}}}}),R=c(({asset:t})=>n.jsx(x,{children:n.jsx("audio",{src:t.url,controls:!0,children:"Your browser does not support the audio element."})}));class l extends _{constructor(){super();p(this,"duration",0);p(this,"playing",!1);p(this,"audioName");p(this,"overridePreviewer",c(({asset:r})=>n.jsx(R,{asset:r})));f(this)}setViewAsset(r,s){}}v([d],l.prototype,"duration",2);v([d],l.prototype,"playing",2);var D=Object.defineProperty,U=Object.getOwnPropertyDescriptor,C=(t,e,r,s)=>{for(var o=s>1?void 0:s?U(e,r):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=(s?a(e,r,o):a(o))||o);return s&&o&&D(e,r,o),o};let u=class extends A{constructor(e){super(e);p(this,"urlObj")}async initByMain(e){this.urlObj=e;const r=URL.createObjectURL(e);try{const s=await this.engine.resourceManager.load({url:r,type:O.Audio});this.bindEngineObject(s)}finally{URL.revokeObjectURL(r)}}};u=C([w({type:"Audio",label:j("asset.audio.title"),loaderType:"Audio",importMenuConfig:{type:P.Upload,tooltip:"请上传音频文件(支持 OGG, WAV, MP3)",accept:".ogg,.wav,.mp3"},viewer:l,bundle({content:t}){return{content:t}}})],u);export{u as AudioAsset};
@@ -1 +0,0 @@
1
- var b=Object.defineProperty;var d=(p,o,e)=>o in p?b(p,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):p[o]=e;var n=(p,o,e)=>(d(p,typeof o!="symbol"?o+"":o,e),e);import{E as f,p as r,C as a,s as m}from"./index-0a8702e2.js";import"./InstanceEditorAsset-a70e73fe.js";import"./ThumbnailMixin-35997457.js";import"./AssetPreviewer-24e31d97.js";import"./CanvasRenderer-9dd98cb3.js";import{c}from"./Component-f923abb1.js";import"./postmen-45d4c238.js";import"./ThumbnailRegistry-495c18c9.js";import"./IconPlayerPlayFilled-b058c98f.js";var P=Object.defineProperty,v=Object.getOwnPropertyDescriptor,i=(p,o,e,u)=>{for(var t=u>1?void 0:u?v(o,e):o,s=p.length-1,y;s>=0;s--)(y=p[s])&&(t=(u?y(o,e,t):y(t))||t);return u&&t&&P(o,e,t),t};let l=class extends f{constructor(o,e){super(o,e);n(this,"clip",null);n(this,"playOnEnabled",!0);n(this,"loop",!0);n(this,"volume",0);n(this,"mute",!1)}};i([r({label:"Audio resource",info:"Audio resource info",type:a.AssetPicker,assetType:"Audio",bindPath:"clip"}),m()],l.prototype,"clip",2);i([r({label:"playOnEnabled",info:"playOnEnabled info",type:a.Toggle,bindPath:"playOnEnabled"}),m()],l.prototype,"playOnEnabled",2);i([r({label:"IsLooping",info:"IsLooping info",type:a.Toggle,bindPath:"loop"}),m()],l.prototype,"loop",2);i([r({label:"Volume",info:"Volume info",type:a.Slider,min:0,max:1,bindPath:"volume"}),m()],l.prototype,"volume",2);i([r({label:"Mute",info:"Mute info",type:a.Toggle,bindPath:"mute"}),m()],l.prototype,"mute",2);l=i([c({type:"AudioSource",componentsMenu:{label:"component.audio.title"}})],l);export{l as AudioComponent};
@@ -1 +0,0 @@
1
- var _=Object.defineProperty;var q=(e,l,a)=>l in e?_(e,l,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[l]=a;var t=(e,l,a)=>(q(e,typeof l!="symbol"?l+"":l,a),a);import{L as m,a as f,E as k,V as L,b as w,d as P,D as C,c as x,A as O,M as A,C as s,s as o,p as i,t as g,e as b,l as R,g as S,f as M,h as E,r as D,S as F}from"./index-0a8702e2.js";import"./InstanceEditorAsset-a70e73fe.js";import"./AssetPreviewer-24e31d97.js";import{c as z}from"./Component-f923abb1.js";import"./ThumbnailRegistry-495c18c9.js";import"./IconPlayerPlayFilled-b058c98f.js";var V=Object.defineProperty,j=Object.getOwnPropertyDescriptor,n=(e,l,a,p)=>{for(var c=p>1?void 0:p?j(l,a):l,u=e.length-1,h;u>=0;u--)(h=e[u])&&(c=(p?h(l,a,c):h(c))||c);return p&&c&&V(l,a,c),c};const d=[...Object.values(m),f.Nothing,f.Everything];class T extends F{constructor(){super(...arguments);t(this,"_originalMask");t(this,"_onEndRenderOnce",null)}onBeginRender(a){this._originalMask=a.cullingMask,a.cullingMask&=~(m.Viewport|m.Outline|m.NavigationGizmo|m.Gizmo)}onEndRender(a){if(a.cullingMask=this._originalMask,this._onEndRenderOnce){const p=this._onEndRenderOnce;this._onEndRenderOnce=null,p(a)}}executeAfterRender(a){this._onEndRenderOnce=a}}let r=class extends k{constructor(){super(...arguments);t(this,"_lastRTAsset",null);t(this,"isOrthographic",!1);t(this,"nearClipPlane",.1);t(this,"farClipPlane",100);t(this,"fieldOfView",45);t(this,"orthographicSize",10);t(this,"viewport",new L(0,0,1,1));t(this,"priority",0);t(this,"enableFrustumCulling",!0);t(this,"clearFlags",w.All);t(this,"cullingMask",P(f.Everything,d));t(this,"postProcessMask",P(f.Everything,d));t(this,"depthTextureMode",C.None);t(this,"opaqueTextureEnabled",!1);t(this,"opaqueTextureDownsampling",x.TwoX);t(this,"antiAliasing",O.None);t(this,"msaaSamples",A.FourX);t(this,"enableHDR",!1);t(this,"enablePostProcess",!0);t(this,"isAlphaOutputRequired",!1);t(this,"renderTarget",null)}onEnabled(){this.applyBoundPathChange("enabled",s.Toggle,!1)}onInitComplete(){if(this.engineObject.entity.addComponent(T),this.renderTarget){const l=this.root.assetStore.assets[this.renderTarget.refId];if(l){this._lastRTAsset=l;const a=this.engineObject.entity.getComponent(T);a&&a.executeAfterRender(()=>{var p;l.updateThumbnail(),(p=l.subAssets)==null||p.forEach(c=>c.updateThumbnail())})}}else this.applyBoundPathChange("enabled",s.Toggle,!1)}};n([o(),i({label:"camera.is-orthographic",bindPath:"isOrthographic"})],r.prototype,"isOrthographic",2);n([o(),i({label:"camera.near-clip-plane",bindPath:"nearClipPlane"})],r.prototype,"nearClipPlane",2);n([o(),i({label:"camera.far-clip-plane",bindPath:"farClipPlane"})],r.prototype,"farClipPlane",2);n([o(),i({label:"camera.field-of-view",bindPath:"fieldOfView",when:e=>!e.isOrthographic})],r.prototype,"fieldOfView",2);n([o(),i({label:"camera.orthographic-size",bindPath:"orthographicSize",when:e=>e.isOrthographic})],r.prototype,"orthographicSize",2);n([o(),i({type:s.Vector4,min:0,max:1,label:"camera.viewport.title",bindPath:"viewport"})],r.prototype,"viewport",2);n([o(),i({label:"camera.priority.title",bindPath:"priority"})],r.prototype,"priority",2);n([o(),i({label:"camera.enable-frustum-culling",bindPath:"enableFrustumCulling"})],r.prototype,"enableFrustumCulling",2);n([o(),i({label:"camera.clear-flags.title",bindPath:"clearFlags",type:s.Select,options:g(w,void 0,e=>b(`camera.clear-flags.${e.toLocaleLowerCase()}`))})],r.prototype,"clearFlags",2);n([o(R(d)),i({label:"camera.culling-mask",bindPath:"cullingMask",type:s.Select,...S(d)}),M(E(d))],r.prototype,"cullingMask",2);n([o(R(d)),i({label:"camera.post-process-mask",bindPath:"postProcessMask",type:s.Select,...S(d)}),M(E(d))],r.prototype,"postProcessMask",2);n([o(),i({label:"camera.depth-texture-mode.title",info:"camera.depth-texture-mode.info",bindPath:"depthTextureMode",type:s.Select,options:g(C,void 0,e=>b(`camera.depth-texture-mode.${e.toLowerCase()}`))})],r.prototype,"depthTextureMode",2);n([o(),i({label:"camera.opaque-texture-enabled.title",info:"camera.opaque-texture-enabled.info",bindPath:"opaqueTextureEnabled",type:s.Toggle})],r.prototype,"opaqueTextureEnabled",2);n([o(),i({label:"camera.opaque-texture-down-sampling.title",info:"camera.opaque-texture-down-sampling.info",bindPath:"opaqueTextureDownsampling",type:s.Select,options:g(x,void 0,e=>b(`camera.opaque-texture-down-sampling.${e.toLowerCase()}`)),when:e=>e.opaqueTextureEnabled})],r.prototype,"opaqueTextureDownsampling",2);n([o(),i({label:"camera.anti-aliasing.title",info:"camera.anti-aliasing.info",bindPath:"antiAliasing",type:s.Select,options:g(O,void 0,e=>b(`camera.anti-aliasing.${e.toLowerCase()}`))})],r.prototype,"antiAliasing",2);n([o(),i({label:"camera.msaa-samples.title",info:"camera.msaa-samples.info",bindPath:"msaaSamples",type:s.Select,options:g(A,void 0,e=>b(`camera.msaa-samples.${e.toLowerCase()}`))})],r.prototype,"msaaSamples",2);n([o(),i({label:"camera.enable-hdr.title",info:"camera.enable-hdr.info",bindPath:"enableHDR",type:s.Toggle})],r.prototype,"enableHDR",2);n([o(),i({label:"camera.enable-post-process.title",info:"camera.enable-post-process.info",bindPath:"enablePostProcess",type:s.Toggle})],r.prototype,"enablePostProcess",2);n([o(),i({label:"camera.is-alpha-output-required.title",info:"camera.is-alpha-output-required.info",bindPath:"isAlphaOutputRequired",type:s.Toggle})],r.prototype,"isAlphaOutputRequired",2);n([i({label:"camera.render-target.title",type:s.AssetPicker,assetType:"RenderTarget",onChange:async(e,l,a)=>{var h;const p=e._lastRTAsset;p&&!a&&D(()=>{var y;p.thumbnailUrl="",(y=p.subAssets)==null||y.forEach(v=>{v.thumbnailUrl=""})}),e._lastRTAsset=a??null,e.renderTarget=a?a.getCurrentRef():null,await e.applyBoundPathChange("renderTarget",s.AssetPicker,e.renderTarget);const c=e.root.projectStore.currentViewport.previewManager;c.hasUserRT=!!a;const u=e.engineObject;a?(u.enabled=!0,a.updateThumbnail(),(h=a.subAssets)==null||h.forEach(y=>y.updateThumbnail())):c.isPreviewOn||(u.enabled=!1)}}),o()],r.prototype,"renderTarget",2);r=n([z({type:"Camera",componentsMenu:{label:"component.camera.title"}})],r);export{r as CameraComponent};
@@ -1 +0,0 @@
1
- var v=Object.defineProperty;var y=(c,t,e)=>t in c?v(c,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[t]=e;var i=(c,t,e)=>(y(c,typeof t!="symbol"?t+"":t,e),e);import{bq as p,H as h,ay as u,S as C,bA as b,I as g,U as w,bB as z,bC as M,x as f,bD as P,bu as T,bw as E,bv as D}from"./index-0a8702e2.js";import"./AssetPreviewer-24e31d97.js";const x=p.zeroTolerance,d=class d{constructor(t=1,e=0,a=0){i(this,"_matrix",new u);i(this,"_matrixInv",new u);this.radius=t,this.phi=e,this.theta=a}makeSafe(){const t=Math.floor(this.phi/Math.PI);return this.phi=p.clamp(this.phi,t*Math.PI+x,(t+1)*Math.PI-x),this}set(t,e,a){return this.radius=t,this.phi=e,this.theta=a,this}setYAxis(t){const{_xAxis:e,_yAxis:a,_zAxis:n}=d;h.equals(e.set(1,0,0),a.copyFrom(t).normalize())&&e.set(0,1,0),h.cross(e,a,n),n.normalize(),h.cross(a,n,e);const{elements:s}=this._matrix;s[0]=e.x,s[1]=e.y,s[2]=e.z,s[4]=a.x,s[5]=a.y,s[6]=a.z,s[8]=n.x,s[9]=n.y,s[10]=n.z;const{elements:r}=this._matrixInv;r[0]=e.x,r[4]=e.y,r[8]=e.z,r[1]=a.x,r[5]=a.y,r[9]=a.z,r[2]=n.x,r[6]=n.y,r[10]=n.z}setFromVec3(t,e=!1){return t.transformNormal(this._matrixInv),this.radius=t.length(),this.radius===0?(this.theta=0,this.phi=0):e?(this.phi=2*Math.PI-Math.acos(p.clamp(t.y/this.radius,-1,1)),this.theta=Math.atan2(-t.x,-t.z)):(this.phi=Math.acos(p.clamp(t.y/this.radius,-1,1)),this.theta=Math.atan2(t.x,t.z)),this}setToVec3(t){const{radius:e,phi:a,theta:n}=this,s=Math.sin(a)*e;return this.phi-=Math.floor(this.phi/Math.PI/2)*Math.PI*2,t.set(s*Math.sin(n),e*Math.cos(a),s*Math.cos(n)),t.transformNormal(this._matrix),this.phi>Math.PI}};i(d,"_xAxis",new h),i(d,"_yAxis",new h),i(d,"_zAxis",new h);let _=d;class A extends C{constructor(e){super(e);i(this,"domElement");i(this,"camera");i(this,"cameraTransform");i(this,"autoRotate",!1);i(this,"autoRotateSpeed",Math.PI);i(this,"enableDamping",!0);i(this,"rotateSpeed",2);i(this,"zoomSpeed",1);i(this,"keyPanSpeed",7);i(this,"dampingFactor",.2);i(this,"zoomFactor",.2);i(this,"minDistance",.1);i(this,"maxDistance",1/0);i(this,"minZoom",0);i(this,"maxZoom",1/0);i(this,"minPolarAngle",1/180*Math.PI);i(this,"maxPolarAngle",179/180*Math.PI);i(this,"minAzimuthAngle",-1/0);i(this,"maxAzimuthAngle",1/0);i(this,"_enableKeys",!0);i(this,"_up",new h(0,1,0));i(this,"_target",new h);i(this,"_atTheBack",!1);i(this,"_spherical",new _);i(this,"_sphericalDelta",new _);i(this,"_sphericalDump",new _);i(this,"_zoomFrag",0);i(this,"_scale",1);i(this,"_panOffset",new h);i(this,"_tempVec3",new h);i(this,"_enableHandler",7);i(this,"_isRotating",!1);this.domElement=e.engine.canvas._webCanvas}get up(){return this._up}set up(e){this._up.copyFrom(e),this._spherical.setYAxis(e),this._atTheBack=!1}get target(){return this._target}set target(e){this._target.copyFrom(e),this._atTheBack=!1}get enableRotate(){return(this._enableHandler&1)!==0}set enableRotate(e){e?this._enableHandler|=1:this._enableHandler&=-2}get enableZoom(){return(this._enableHandler&2)!==0}set enableZoom(e){e?this._enableHandler|=2:this._enableHandler&=-3}get enablePan(){return(this._enableHandler&4)!==0}set enablePan(e){e?this._enableHandler|=4:this._enableHandler&=-5}onAwake(){const{engine:e,entity:a}=this;this.input=e.inputManager,this.camera=a.getComponent(b),this.cameraTransform=a.transform,this._spherical.setYAxis(this._up),this._atTheBack=!1}onUpdate(e){this._updateTransform()}rotate(e){if(!(this._enableHandler&1))return;const a=2*Math.PI*e.x/this.domElement.clientWidth*this.rotateSpeed;this._sphericalDelta.theta-=a;const n=2*Math.PI*e.y/this.domElement.clientHeight*this.rotateSpeed;this._sphericalDelta.phi-=n,this._sphericalDump.theta=-a,this._sphericalDump.phi=-n,this._isRotating=!0}zoom(e){this._enableHandler&2&&(e>0?this._scale/=Math.pow(.95,this.zoomSpeed):e<0&&(this._scale*=Math.pow(.95,this.zoomSpeed)))}pan(e){if(!(this._enableHandler&4))return;const{cameraTransform:a}=this,{elements:n}=a.worldMatrix,{clientHeight:s}=this.domElement,r=h.distance(a.position,this.target)*(this.camera.fieldOfView/2)*(Math.PI/180),o=-2*e.x*(r/s),m=2*e.y*(r/s);this._panOffset.x+=n[0]*o+n[4]*m,this._panOffset.y+=n[1]*o+n[5]*m,this._panOffset.z+=n[2]*o+n[6]*m}_updateTransform(){const{cameraTransform:e,target:a,_tempVec3:n,_spherical:s,_sphericalDump:r,_sphericalDelta:o,_panOffset:m}=this;this.enableDamping&&!this._isRotating&&(o.theta=r.theta*=1-this.dampingFactor,o.phi=r.phi*=1-this.dampingFactor),h.subtract(e.position,a,n),s.setFromVec3(n,this._atTheBack),s.theta+=o.theta,s.phi+=o.phi,s.theta=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,s.theta)),s.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,s.phi)),s.makeSafe(),this._scale!==1&&(this._zoomFrag=s.radius*(this._scale-1)),s.radius+=this._zoomFrag,s.radius=Math.max(this.minDistance,Math.min(this.maxDistance,s.radius)),this._atTheBack=s.setToVec3(n),h.add(a.add(m),n,e.worldPosition),e.lookAt(a,n.copyFrom(this.up).scale(this._atTheBack?-1:1)),this._zoomFrag=0,this._scale=1,o.set(0,0,0),m.set(0,0,0),this._isRotating=!1}addDefaultControl(){const e=new g,a=new g,n=this.domElement,s=l=>{e.set(l.clientX,l.clientY),document.addEventListener("pointermove",r),document.addEventListener("pointerup",o)},r=l=>{a.set(l.clientX,l.clientY).subtract(e),this.rotate(a),e.set(l.clientX,l.clientY)},o=()=>{document.removeEventListener("pointerup",o),document.removeEventListener("pointermove",r)},m=l=>{this.zoom(l.deltaY)};return n.addEventListener("pointerdown",s),n.addEventListener("wheel",m,{passive:!1}),()=>{n.removeEventListener("pointerdown",s),document.removeEventListener("pointerup",o),document.removeEventListener("pointermove",r),n.removeEventListener("wheel",m)}}}function I({currentRenderTarget:c,width:t,height:e,createRenderTarget:a,createImageData:n}){if(c&&c.width===t&&c.height===e)return{renderTarget:c,imageData:null,reused:!0};if(c){const o=c.getColorTexture(0);o==null||o.destroy(),c.destroy()}const s=a(t,e),r=new Uint8ClampedArray(t*e*4);return{renderTarget:s,imageData:n(r,t,e),reused:!1}}class S{constructor(t,e,a,n=!1){i(this,"_engine");i(this,"_renderTarget");i(this,"_scene");i(this,"_rootEntity");i(this,"_camera");i(this,"_canvas",null);i(this,"_imageData");i(this,"_curBoundingBox",new w);i(this,"_tempSizeVec3",new h);i(this,"_tempCenterVec",new h);i(this,"_orbitControl",null);i(this,"_resizeObserver");i(this,"_preventWheelCallback");i(this,"_renderComponent");i(this,"_container");t=t>>0,e=e>>0;const s=this._createCanvas(t,e);this._canvas=s,this._engine=a,this._createScene(a);const r=this.createRenderTarget(a,t,e);this._renderTarget=r,n&&this._addOrbitControl()}get engine(){return this._engine}get width(){return this._canvas.width}get height(){return this._canvas.height}get canvas(){return this._canvas}get camera(){return this._camera}get scene(){return this._scene}get rootEntity(){return this._rootEntity}_createCanvas(t,e){const a=document.createElement("canvas");return a.width=t,a.height=e,a}_createScene(t){var m;const e=new z(t),a=e.createRootEntity("root"),n=a.createChild("light");n.transform.setPosition(-9,15,17),n.transform.lookAt(new h(0,0,0));const s=n.addComponent(M);s.color=new f(1,1,1,1);const o=a.createChild("camera_entity").addComponent(b);return e.ambientLight=(m=t.sceneManager.activeScene)==null?void 0:m.ambientLight,e.background.solidColor=new f(.0157,.0157,.0157,0),this._scene=e,this._camera=o,o.nearClipPlane=.1,o.farClipPlane=100,this._rootEntity=a,{scene:e,camera:o,rootEntity:a}}_addOrbitControl(){const t=this._camera.entity,e=t.addComponent(A);e.domElement=this._canvas,e.addDefaultControl(),e.maxDistance=1/0,this._orbitControl=e;const a=this;this._renderComponent=t.addComponent(class extends C{onEndRender(){a._render()}}),this._renderComponent.enabled=!1,this._preventWheelCallback=n=>{n.stopPropagation(),n.preventDefault()}}renderOneFrame(t,e){const a=this._engine,n=this._scene;a.sceneManager.addScene(n),this._resetCamera(),this.setCamera(t/e),a.update(),this._render(),a.sceneManager.removeScene(n)}setCamera(t){this._camera.aspectRatio=t,this._camera.renderTarget=this._renderTarget}_resetCamera(t,e){var a,n;if(e!=null&&e.getSize){const{width:s,height:r}=e.getSize(),o=new g(s,r).length();this._camera.entity.transform.setPosition(0,0,o*1.2),(a=this._orbitControl)==null||a.target.set(0,0,0)}else{P(t||this._rootEntity,this._curBoundingBox),this._curBoundingBox.getExtent(this._tempSizeVec3),this._curBoundingBox.getCenter(this._tempCenterVec);const{_tempCenterVec:s}=this,r=this._camera.entity,o=this._tempSizeVec3.length();this._camera.farClipPlane=o*1e3,r.transform.setPosition(s.x,s.y,o*1.8),(n=this._orbitControl)==null||n.target.set(s.x,s.y,s.z)}}createRenderTarget(t,e,a){const n=I({currentRenderTarget:this._renderTarget,width:e,height:a,createRenderTarget:(s,r)=>{const o=new T(t,s,r,void 0,!1);return new E(t,s,r,o,D.Depth,4)},createImageData:(s,r,o)=>new ImageData(new Uint8ClampedArray(s),r,o)});return n.reused||(this._imageData=n.imageData,this._renderTarget=n.renderTarget),n.renderTarget}_render(){if(!this._renderTarget)return;const t=this._renderTarget;t.getColorTexture(0).getPixelBuffer(0,0,t.width,t.height,0,this._imageData.data),this._canvas.getContext("2d").putImageData(this._imageData,0,0)}async createImageUrl(){return new Promise(t=>{this._canvas.toBlob(e=>{const a=URL.createObjectURL(new Blob([e],{type:"image/png"}));t(a)})})}addToContainer(t,e,a){this._renderComponent.enabled=!0,this._container=t,t.appendChild(this._canvas);const n=new ResizeObserver(()=>{this._onCanvasResize(t.clientWidth,t.clientHeight),this._resetCamera(a,e)});n.observe(t),this._resizeObserver=n,e._requestResetCamera=()=>this._resetCamera(a,e),t.addEventListener("mousewheel",this._preventWheelCallback,{passive:!1})}removeFromContainer(){this._renderComponent.enabled=!1,this._resizeObserver.disconnect(),this._canvas.remove(),this._container.removeEventListener("mousewheel",this._preventWheelCallback)}_onCanvasResize(t,e){const a=Math.round(t*window.devicePixelRatio),n=Math.round(e*window.devicePixelRatio),s=this._canvas;s.width=a,s.height=n,this.createRenderTarget(this._engine,a,n),this.setCamera(a/n),this._engine.sceneManager.addScene(this._scene)}}export{S as C};
@@ -1 +0,0 @@
1
- var g=Object.defineProperty;var y=(e,a,o)=>a in e?g(e,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[a]=o;var r=(e,a,o)=>(y(e,typeof a!="symbol"?a+"":a,o),o);import{i as f,e as m,p as h,C as i,t as b,s as l,v as c}from"./index-0a8702e2.js";import"./InstanceEditorAsset-a70e73fe.js";import"./AssetPreviewer-24e31d97.js";import{c as P}from"./Component-f923abb1.js";import{L as N}from"./LightBaseComponent-fbc3ae49.js";import"./ThumbnailRegistry-495c18c9.js";import"./IconPlayerPlayFilled-b058c98f.js";var u=Object.defineProperty,S=Object.getOwnPropertyDescriptor,p=(e,a,o,n)=>{for(var t=n>1?void 0:n?S(a,o):a,d=e.length-1,w;d>=0;d--)(w=e[d])&&(t=(n?w(a,o,t):w(t))||t);return n&&t&&u(a,o,t),t};let s=class extends N{constructor(a,o){super(a,o);r(this,"shadowType",f.None);r(this,"shadowBias",1);r(this,"shadowNormalBias",1);r(this,"shadowNearPlaneOffset",.1);r(this,"shadowStrength",1);this.formSchema.addGroup(m("light.shadow.title"),["shadowType","shadowBias","shadowNormalBias","shadowNearPlaneOffset","shadowStrength"],{collapsible:!1})}};p([h({type:i.Select,options:b(f,void 0,e=>m(`light.shadow.type.${e.toLowerCase()}`)),bindPath:"shadowType",property:"shadowType",label:"light.shadow.type.label",info:"light.shadow.type.info"}),l(),c()],s.prototype,"shadowType",2);p([h({type:i.Number,bindPath:"shadowBias",property:"shadowBias",dragStep:.01,label:"light.shadow.bias.label",info:"light.shadow.bias.info"}),l()],s.prototype,"shadowBias",2);p([h({type:i.Number,bindPath:"shadowNormalBias",property:"shadowNormalBias",dragStep:.01,label:"light.shadow.normal-bias.label",info:"light.shadow.normal-bias.info"}),l()],s.prototype,"shadowNormalBias",2);p([h({type:i.Number,bindPath:"shadowNearPlaneOffset",property:"shadowNearPlaneOffset",dragStep:.01,label:"light.shadow.near-plane-offset.label",info:"light.shadow.near-plane-offset.info"}),l()],s.prototype,"shadowNearPlaneOffset",2);p([h({type:i.Slider,bindPath:"shadowStrength",property:"shadowStrength",min:0,max:1,dragStep:.01,label:"light.shadow.strength.label",info:"light.shadow.strength.info"}),l()],s.prototype,"shadowStrength",2);s=p([P({type:"DirectLight",componentsMenu:{group:"light",label:"component.light.direct.title"}})],s);export{s as DirectLightComponent};
@@ -1,5 +0,0 @@
1
- var d=Object.defineProperty;var m=(s,e,t)=>e in s?d(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var a=(s,e,t)=>(m(s,typeof e!="symbol"?e+"":e,t),t);import{cc as u,cd as y,ce as h,aT as w,aD as b,a1 as f,j as v,a7 as x,e as j}from"./index-0a8702e2.js";import{a as O,A}from"./InstanceEditorAsset-a70e73fe.js";import{A as F}from"./AssetPreviewer-24e31d97.js";import{n as R}from"./index-be6bc38a.js";import{A as U}from"./AssetViewer-bc198e16.js";import"./ThumbnailRegistry-495c18c9.js";import"./IconPlayerPlayFilled-b058c98f.js";async function g(s){const e={uploadFiles:[],errors:[]};for(const t in s){const n=s[t],r=n.name.toLocaleLowerCase();(r.endsWith(".ttf")||r.endsWith(".otf")||r.endsWith(".woff"))&&e.uploadFiles.push({main:n})}return e}async function C(s){const e=s.main;try{const t=e.name,n=u(t),r=y(t,n),o=await h.uploadBlob(`${t}.json`,e),i={fontName:r,fontUrl:encodeURI(o.url).replace(/\(/g,"%28").replace(/\)/g,"%29")};return new File([JSON.stringify(i)],r)}catch(t){console.error(t),R.error(`parse font file fail ${t}`)}return e}class p extends U{constructor(){super()}setViewAsset(e,t){const n=t.createChild("font_entity"),r=n.addComponent(f);r.font=e.engineObject,r.text=`ABCDEFGHIJKLM
2
- NOPQRSTUVWXYZ
3
- abcdefghijklm
4
- nopqrstuvwxyz
5
- 1234567890`,this._entity=n}}const L=w(({asset:s})=>b.jsx(F,{asset:s}));p.previewer=L;class c{static update(e,t){this.entity?this.entity.isActive=!0:this.initScene(e),this.textRenderer.font=t.engineObject}static clear(){this.entity.isActive=!1}static initScene(e){const t=this.entity=e.createChild("font"),n=this.textRenderer=t.addComponent(f);n.text="Aa",n.fontSize=60}}a(c,"entity"),a(c,"textRenderer");var P=Object.defineProperty,T=Object.getOwnPropertyDescriptor,_=(s,e,t,n)=>{for(var r=n>1?void 0:n?T(e,t):e,o=s.length-1,i;o>=0;o--)(i=s[o])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&P(e,t,r),r};let l=class extends v{constructor(e){super(e);a(this,"urlObj")}async initByMain(e){this.urlObj=e;const t=URL.createObjectURL(e),n=await this.engine.resourceManager.load({url:t,type:x.Font});URL.revokeObjectURL(t),this.bindEngineObject(n)}};l=_([O({type:"Font",label:j("asset.font.title"),loaderType:"Font",extname:"font",viewer:p,thumbnail:c,importMenuConfig:{type:A.Upload,tooltip:"请上传字体文件(支持 TTF, OTF, WOFF)",accept:".ttf,.otf,.woff"},filterUploadFiles:g,preUpload:C})],l);export{l as FontAsset};
@@ -1 +0,0 @@
1
- import{aH as p,aI as m,aJ as h,aD as e,aE as f,aF as b,aK as i,aL as j,aM as l,aN as I}from"./index-0a8702e2.js";import{A as v,a as A,I as g}from"./Accordion-4897319b.js";const D=p(m,{width:"100%",border:"none",position:"relative",borderRadius:0,"& > svg":{marginRight:"$1"},"&::after":{content:"''",position:"absolute",top:0,left:0,width:"100%",borderTop:"1px solid $grayA2"}});function z(r){const{renameable:n,onDelete:s,removable:o}=r;return e.jsxs(i,{align:"v",css:{flex:1,justifyContent:"space-between"},children:[e.jsx("span",{children:r.title}),e.jsxs(i,{gap:"xxs",children:[n&&e.jsx(l,{as:"div",variant:"subtle","aria-hidden":!0,tabIndex:-1,size:"xs",onClick:t=>{t.preventDefault(),t.stopPropagation(),s&&s()},children:e.jsx(g,{size:"14px"})}),o&&e.jsx(l,{as:"div",variant:"subtle","aria-hidden":!0,tabIndex:-1,size:"xs",onClick:t=>{t.preventDefault(),t.stopPropagation(),s&&s()},children:e.jsx(I,{size:"14px"})})]})]})}function w(r){const{items:n=[],onAdd:s,onDelete:o,addItemText:t="Add Item",defaultValue:d,addable:c=!1}=r,u=a=>()=>{o&&o(a)},x=h.useMemo(()=>n.length?n.map(a=>`${a.id}`):[],[n]);return e.jsx(f,{...b(r),direction:"column",children:e.jsxs(v,{type:"multiple",defaultValue:d??x,children:[n.map(a=>e.jsx(A,{value:`${a.id}`,title:e.jsx(z,{title:a.name,onDelete:u(a),removable:a.removable,renameable:a.renameable}),arrow:!!a.children,children:a.children&&e.jsx(i,{direction:"column",children:a.children})},a.id)),c&&e.jsxs(D,{size:"sm",variant:"soft",onClick:s,children:[e.jsx(j,{size:"12px"})," ",t]})]})})}export{w as F};
@@ -1,6 +0,0 @@
1
- import{aC as a}from"./index-0a8702e2.js";/**
2
- * @license @tabler/icons-react v3.24.0 - MIT
3
- *
4
- * This source code is licensed under the MIT license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */var e=a("filled","player-play-filled","IconPlayerPlayFilled",[["path",{d:"M6 4v16a1 1 0 0 0 1.524 .852l13 -8a1 1 0 0 0 0 -1.704l-13 -8a1 1 0 0 0 -1.524 .852z",key:"svg-0"}]]);export{e as I};
@@ -1 +0,0 @@
1
- var w=Object.defineProperty;var x=(i,t,e)=>t in i?w(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var c=(i,t,e)=>(x(i,typeof t!="symbol"?t+"":t,e),e);import{dC as D,aJ as g,j as p,aX as A,cj as B,e as R,n as E,dD as y,o as F,dE as _,u as C,bp as z,J as O,H as P,U as k,S as L,bD as M}from"./index-0a8702e2.js";import{r as T}from"./ThumbnailRegistry-495c18c9.js";let b=null;function l(){return b??(b=new D),b}const j=new Proxy({},{get(i,t,e){const s=l(),n=Reflect.get(s,t,s);return typeof n=="function"?n.bind(s):n},set(i,t,e,s){return Reflect.set(l(),t,e),!0},has(i,t){return Reflect.has(l(),t)},ownKeys(){return Reflect.ownKeys(l())},getOwnPropertyDescriptor(i,t){const e=Reflect.getOwnPropertyDescriptor(l(),t);return e||{configurable:!0,enumerable:!0,writable:!0,value:l()[t]}}}),v=g.createContext(j);function $(){const i=g.useContext(v);if(!i)throw new Error("useRootStore must be used within a RootProvider");return i}const q=i=>g.useContext(v)[i],K=B("Plugin Asset");var S=(i=>(i[i.Add=1]="Add",i[i.Upload=2]="Upload",i))(S||{});function U(i){return t=>{var e;K.info("register",i.type,"verbose"),typeof i.icon=="string"?(i.icon,i.icon=void 0):(e=i==null?void 0:i.icon)!=null&&e.fallback&&i.icon.fallback,p.registerAssetMeta(t,{...i,targetConstructor:t}),i.viewer&&A(i.type,new i.viewer),i.thumbnail&&T(i.type,i.thumbnail),i.dragLayer&&(t.dragLayer=i.dragLayer)}}var N=Object.defineProperty,J=Object.getOwnPropertyDescriptor,h=(i,t,e,s)=>{for(var n=s>1?void 0:s?J(t,e):t,r=i.length-1,a;r>=0;r--)(a=i[r])&&(n=(s?a(t,e,n):a(n))||n);return s&&n&&N(t,e,n),n};let u=class extends p{constructor(t){super(t);c(this,"isRoot",!1);c(this,"isFolder",!0);c(this,"hidden",!1);c(this,"extname","");c(this,"childrenId",[]);c(this,"acceptDragLayer",E.MainAsset);F(this)}get thumbnailUrl(){return this.locked?y.FolderLocked:y.Folder}get children(){const t=[];return this.childrenId.forEach(e=>{const s=this.root.assetStore.assets[e];s&&t.push(s)}),t}afterDelete(){const t=this.root.assetStore.assets;for(;this.childrenId.length;){const e=this.childrenId[0],s=t[e];s.loadingStatus==="success"&&s.beforeDelete&&s.beforeDelete(),this.childrenId.splice(0,1),delete this.root.assetStore.assets[e],s.loadingStatus==="success"&&s.afterDelete&&s.afterDelete()}}async initByMeta(t){super.initByMeta(t),this.isRoot=!!t.isRoot,t.hidden!=null&&(this.hidden=t.hidden),this.initObjectProperties()}async initByMain(t){}initByCreation(t,e,s){return Promise.resolve()}onDoubleClick(){this.root.assetStore.openFolder(this.id)}saveMain(){return null}recursive(t,e=!1){const s=this.children,n=[];for(let r=0;r<s.length;r++){const a=s[r];a.isFolder?(n.push(a),e&&t(a)):t(a)}return n.forEach(r=>r.recursive(t,e))}async asyncRecursive(t,e=!1){const s=this.children,n=[];for(let r=0;r<s.length;r++){const a=s[r];a.isFolder?(n.push(a),e&&await t(a)):await t(a)}for(let r=0;r<n.length;r++)await n[r].asyncRecursive(t,e)}_onDrop(t,e){if(!e||this.id===e.id)return;const{assetStore:s,assetUIStore:n,assetFacade:r}=this.root;if(this.dropping=!1,n.pickedAssets.includes(e.id)){if(n.pickedAssets.includes(this.id))return;for(let a=0;a<n.pickedAssets.length;a++)try{const o=n.pickedAssets[a];if(!s.assets[o])continue;r.moveAsset(o,this.id)}catch(o){_(o instanceof Error?o.message:String(o))}}else try{r.moveAsset(e.id,this.id)}catch(a){_(a instanceof Error?a.message:String(a))}}};h([C],u.prototype,"childrenId",2);h([z],u.prototype,"children",1);h([O],u.prototype,"_onDrop",1);u=h([U({type:"Folder",label:R("asset.folder.title"),dragLayer:E.Folder,importMenuConfig:{type:S.Add}})],u);const d=class d extends p{constructor(){super(...arguments);c(this,"isTemplate",!0);c(this,"_clonedEntities",[]);c(this,"_instances",new Map);c(this,"_rootKey","");c(this,"_tempSize",0)}_buildInstanceLink(){const e=this.getMetaConfig().type;if(e!=="Prefab"&&e!=="glTF")return null;const s=e;return{assetId:this.id,bindingId:"",assetKind:s,role:"root",...this._rootKey&&{sourceEntityId:this._rootKey}}}instantiateEngineObject(){const e=this._instantiateEngineObject();this._clonedEntities.push(e);const s=this._clonedEntities;return e.addComponent(class extends L{onDestroy(){const n=s.indexOf(this.entity);n>=0&&s.splice(n,1)}}),e}addInstance(e,s){var m;const n=e.instanceAssetId;if(n){const f=this.root.assetStore.assets[n];f.isTemplate&&f.removeInstance(e)}const a=e.root.domainStore.getNormalizedState().entities[e.id],o=this._buildInstanceLink();a&&o?(m=a.instance)!=null&&m.bindingId||e.root.entityFacade.updateEntity(e.id,{instance:o}):o&&(e.pendingInstance=o),this._instances.set(e.id,e.entityManager),e.on("delete",()=>{this.removeInstance(e)})}removeInstance(e){var n;((n=e.root.domainStore.getNormalizedState().entities[e.id])==null?void 0:n.instance)!==void 0?e.root.entityFacade.updateEntity(e.id,{instance:null}):e.pendingInstance=null,this._instances.delete(e.id)}get instanceCount(){return this._instances.size}static resolveInstanceEntityIds(e,s){const n=new Set;for(let r=0;r<e.length;r++){const a=e[r],o=s[a];o&&n.add(o.parentId===null?a:o.parentId)}return Array.from(n)}getInstanceEntityIds(){return d.resolveInstanceEntityIds(Array.from(this._instances.keys()),this.root.domainStore.state.entities)}unpackAllInstances(){this._instances.forEach((e,s)=>{var r;const n=e.entities.get(s);n&&(((r=n.root.domainStore.getNormalizedState().entities[n.id])==null?void 0:r.instance)!==void 0?n.root.entityFacade.updateEntity(n.id,{instance:null}):n.pendingInstance=null)}),this._instances.clear()}afterDelete(){this.unpackAllInstances(),this.root.sceneStore.selectEntity(null),this._clonedEntities.forEach(s=>s.destroy());const e=this.getDragTempEntity();e&&(e.destroy(),this.setDragTempEntity(null))}_updateDragTempEntity(){try{const e=this.instantiateEngineObject();this.setDragTempEntity(e),this._tempSize=this._getSize(e)}catch(e){console.warn(`[InstanceEditorAsset] Failed to create drag temp entity for asset ${this.id}:`,e)}}_destroyInstances(){this._instances.forEach((e,s)=>{const n=e.entities.get(s);n==null||n.destroy()}),this._instances.clear()}async updateThumbnail(){this._tempSize?super.updateThumbnail():super.updateThumbnail(!0)}_getSize(e){M(e,d._tempBoundingBox),d._tempBoundingBox.getExtent(d._tempExtend);const s=d._tempExtend.length();return s===1/0?0:s}};c(d,"_tempExtend",new P),c(d,"_tempBoundingBox",new k);let I=d;export{S as A,u as F,I,U as a,q as b,$ as u};
@@ -1 +0,0 @@
1
- var m=Object.defineProperty;var u=(r,e,o)=>e in r?m(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o;var p=(r,e,o)=>(u(r,typeof e!="symbol"?e+"":e,o),o);import{a as n,s as y,aR as v,p as c,C as g,l as P,f as b,h as f,g as C,E as L,d as _}from"./index-0a8702e2.js";import"./InstanceEditorAsset-a70e73fe.js";import"./AssetPreviewer-24e31d97.js";var x=Object.defineProperty,O=Object.getOwnPropertyDescriptor,h=(r,e,o,l)=>{for(var a=l>1?void 0:l?O(e,o):e,s=r.length-1,i;s>=0;s--)(i=r[s])&&(a=(l?i(e,o,a):i(a))||a);return l&&a&&x(e,o,a),a};const t=[n.Everything,n.Nothing];class d extends L{constructor(){super(...arguments);p(this,"color",{r:1,g:1,b:1,a:1,intensity:1});p(this,"cullingMask",_(n.Everything,t))}}h([y(v()),c({label:"light.color",type:g.Color,mode:"hdr",bindPath:"color"})],d.prototype,"color",2);h([y(P(t)),b(f(t)),c({label:"light.culling-mask",type:g.Select,...C(t),bindPath:"cullingMask"})],d.prototype,"cullingMask",2);export{d as L};
@@ -1 +0,0 @@
1
- var f=Object.defineProperty;var c=(o,e,t)=>e in o?f(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var p=(o,e,t)=>(c(o,typeof e!="symbol"?e+"":e,t),t);import{L as g}from"./module-6406b050.js";import{E as b,p as l,C as a,s}from"./index-0a8702e2.js";import"./InstanceEditorAsset-a70e73fe.js";import"./ThumbnailMixin-35997457.js";import"./AssetPreviewer-24e31d97.js";import"./CanvasRenderer-9dd98cb3.js";import{c as P}from"./Component-f923abb1.js";import"./postmen-45d4c238.js";import"./ThumbnailRegistry-495c18c9.js";import"./IconPlayerPlayFilled-b058c98f.js";var d=Object.defineProperty,L=Object.getOwnPropertyDescriptor,n=(o,e,t,m)=>{for(var i=m>1?void 0:m?L(e,t):e,y=o.length-1,u;y>=0;y--)(u=o[y])&&(i=(m?u(e,t,i):u(i))||i);return m&&i&&d(e,t,i),i};let r=class extends b{constructor(e,t){super(e,t);p(this,"resource",null);p(this,"autoPlay",!0);p(this,"isLooping",!0);p(this,"speed",1);p(this,"priority",0)}};n([l({label:"lottie.resource.label",info:"lottie.resource.info",type:a.AssetPicker,assetType:"Lottie",bindPath:"resource"}),s()],r.prototype,"resource",2);n([l({label:"lottie.auto-play.label",info:"lottie.auto-play.info",type:a.Toggle,bindPath:"autoPlay",onChange(o,e,t){t||o.engineObject.pause()}}),s()],r.prototype,"autoPlay",2);n([l({label:"lottie.is-looping.label",info:"lottie.is-looping.info",type:a.Toggle,bindPath:"isLooping"}),s()],r.prototype,"isLooping",2);n([l({label:"lottie.speed.label",info:"lottie.speed.info",type:a.Number,dragStep:.01,bindPath:"speed"}),s()],r.prototype,"speed",2);n([l({label:"lottie.priority.label",info:"lottie.priority.info",type:a.Number,bindPath:"priority"}),s()],r.prototype,"priority",2);r=n([P({type:"LottieAnimation",external:!0,componentsMenu:{group:"2D",label:"component.lottie-animation.title"}})],r);b.registerCustomEngineComponent("LottieAnimation",g);export{r as LottieAnimationComponent};
@@ -1 +0,0 @@
1
- var Q=Object.defineProperty;var X=(a,s,t)=>s in a?Q(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t;var c=(a,s,t)=>(X(a,typeof s!="symbol"?s+"":s,t),t);import{j as E,aH as Y,aU as q,aD as x,e1 as D,e2 as Z,aT as k,aJ as $,aV as tt,aK as et,aI as st,aL as it,ce as L,o as at,S as ot,u as P,J as W,an as B,a0 as M,e as m,_ as rt,cb as V,p as v,C as _,b0 as I,n as nt,cd as F}from"./index-0a8702e2.js";import{L as J}from"./module-6406b050.js";import{a as H,u as lt,A as pt}from"./InstanceEditorAsset-a70e73fe.js";import"./ThumbnailMixin-35997457.js";import"./AssetPreviewer-24e31d97.js";import"./CanvasRenderer-9dd98cb3.js";import"./postmen-45d4c238.js";import{c as ct}from"./SpriteAsset-9a31ec24.js";import{n as R}from"./index-be6bc38a.js";import{A as mt}from"./AssetViewer-bc198e16.js";import{c as G,S as ut}from"./SpriteAtlasAsset-a862db46.js";import{c as dt}from"./TextureAsset-28fedf2a.js";import"./ThumbnailRegistry-495c18c9.js";import"./IconPlayerPlayFilled-b058c98f.js";import"./meshopt_simplifier.module-cd99529d.js";import"./bundlers-9b0d37fc.js";import"./FormItemArray-66be8701.js";import"./Accordion-4897319b.js";import"./utilities-e09052e3.js";import"./enum-58295f88.js";import"./encode-ac4bb64e.js";import"./Tooltip-33f770ba.js";import"./ktx2-encoder-1e63c1eb.js";import"./TaskQueue-05c94a4d.js";import"./ktx-parse.modern-6c9f771f.js";var ht=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,yt=(a,s,t,e)=>{for(var i=e>1?void 0:e?ft(s,t):s,o=a.length-1,r;o>=0;o--)(r=a[o])&&(i=(e?r(s,t,i):r(i))||i);return e&&i&&ht(s,t,i),i};let z=class extends E{initByMain(a,s){return Promise.resolve()}};z=yt([H({type:"LottieAnimation",async bundle(a){const s=JSON.parse(await a.content.text());return{content:new Blob([JSON.stringify(s)])}}})],z);const gt=Y("div",{display:"grid",columnGap:"$1",gridColumn:2/-1,gridTemplateColumns:"minmax(0, 4fr) repeat(1, 2fr) repeat(1, auto) repeat(1, 2fr) repeat(1, auto)",marginBottom:"$1"}),wt=function({clip:a,removeClip:s,onClipChange:t}){const{t:e}=q();return x.jsxs(gt,{children:[x.jsx(D,{size:"sm",value:a.name??"",placeholder:e("lottie.clip.name"),onChange:i=>{t({name:i.currentTarget.value})}}),x.jsx(D,{size:"sm",value:a.start??"",placeholder:e("lottie.clip.start"),onChange:i=>{t({start:+i.currentTarget.value})}}),x.jsx(Z,{width:12,onClick:s}),x.jsx(D,{size:"sm",value:a.end??"",placeholder:e("lottie.clip.end"),onChange:i=>{t({end:+i.currentTarget.value})}})]})},bt=k(function(a){const s=a.model,t=s.getViewer(),{inspectorFacade:e}=lt(),{t:i}=q(),[o,r]=$.useState(()=>Array.isArray(s.clips)?[...s.clips]:[]);$.useEffect(()=>{r(Array.isArray(s.clips)?[...s.clips]:[])},[s,s.clips]),$.useEffect(()=>{t==null||t.setClips(o)},[o,t]);const p=n=>{r(n),e.assetChange(s.id,"clips",n,"asset-meta")},l=()=>{p([...o,{}])},d=n=>{n<0||n>=o.length||p(o.filter((u,y)=>y!==n))},h=(n,u)=>{if(n<0||n>=o.length)return;const y={...o[n],...u},C=o.map((A,b)=>b===n?y:A);p(C)};return x.jsxs(tt,{title:i("lottie.clips.title"),defaultOpen:!0,collapsible:!0,children:[o.map((n,u)=>x.jsx(wt,{clip:n,removeClip:()=>d(u),onClipChange:y=>h(u,y)},`${s.id}-${u}`)),x.jsx(et,{align:"h",css:{margin:"0 auto",padding:"$1 0 0 0"},children:x.jsx(st,{size:"sm",variant:"soft",startSlot:x.jsx(it,{size:"14px"}),onClick:l,children:i("lottie.clips.add")})})]})});async function vt(a,s,t={}){try{const e=JSON.parse(a),{assets:i}=e,o=[];for(let p=0,l=i.length;p<l;p++){const d=i[p],{p:h}=d;h&&o.push({name:d.id,src:h})}const r=await ct(o,{width:2048,height:2048,...t});return r.code!==0?(console.log("Atlas Error:",r.msg),r):(e.assets=i.filter(p=>!p.p),r.info.jsonFile=JSON.stringify(e),r)}catch{return{code:11,msg:"Parse lottie file error"}}}async function xt(a){const s={uploadFiles:[],errors:[]};for(const t in a){const e=a[t],i=e.name;if(i.endsWith(".json"))try{const o=await e.text(),r=JSON.parse(o);_t(r)&&s.uploadFiles.push({main:e})}catch(o){s.errors.push(K(i,o))}}return s}async function Mt(a,s,t){const e=a.main,i=await e.text();let o;try{o=JSON.parse(i)}catch(l){return console.error(l),R.error(K(e.name,l)),e}const{nm:r}=o,p=await vt(i);if(p.code===0)try{const{imageFiles:l,atlasFile:d,jsonFile:h}=p.info,n=JSON.parse(d),{atlasItems:u}=n,y=u.length,C=Ct(),A=St(r,e.name),b=[];for(let g=0;g<y;++g)l[g]&&b.push(L.uploadBlob(`${A}-${C}-${g}.png`,new Blob([l[g]])));const U=await Promise.all(b);for(let g=0;g<y;++g)u[g].img=U[g].url;const[S,T]=await Promise.all([L.uploadBlob(`${A}-${C}.atlas`,new Blob([JSON.stringify(n)])),L.uploadBlob(`${A}-${C}.json`,new Blob([h]))]),N={jsonUrl:T.url,atlasUrl:S.url};return new File([JSON.stringify(N)],e.name)}catch(l){console.error(l),R.error(`parse lottie file fail ${l}`)}else console.error(p.msg),R.error(p.msg);return e}function _t(a){return a.nm&&a.w&&a.h&&a.assets&&a.assets.length>0&&a.layers&&a.layers.length>0}function Ct(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2,10)}function St(a,s){const t=s.replace(/\.[^.]+$/,"")||"lottie";return(typeof a=="string"&&a.length>0?a:t).trim().replace(/[^\w.-]+/g,"_")||"lottie"}function K(a,s){const t=s instanceof Error?s.message:String(s);return`Failed to parse JSON file "${a}": ${t}`}var jt=Object.defineProperty,At=Object.getOwnPropertyDescriptor,O=(a,s,t,e)=>{for(var i=e>1?void 0:e?At(s,t):s,o=a.length-1,r;o>=0;o--)(r=a[o])&&(i=(e?r(s,t,i):r(i))||i);return e&&i&&jt(s,t,i),i};class j extends mt{constructor(){super();c(this,"lottie");c(this,"_updateComponent");c(this,"_lottieAsset");c(this,"playing",!1);c(this,"frameTime",0);c(this,"animationNames",[]);c(this,"animationIndex",0);c(this,"_hasClips",!1);at(this)}get duration(){const{_lottieAsset:t}=this;return this._hasClips&&t.clips[this.animationIndex]?t.clips[this.animationIndex].end-t.clips[this.animationIndex].start:this._lottieAsset.duration}_setAnimationNames(t){this.animationNames=this._hasClips?t==null?void 0:t.map(e=>e.name):[this._lottieAsset.engineObject.name]}setViewAsset(t,e){const i=t.engineObject,o=e.createChild("lottie_entity"),r=o.addComponent(J);this._entity=o,this.lottie=r,r.resource=i,this._lottieAsset=t,this._hasClips=t.clips&&t.clips.length>0,this._setAnimationNames(t.clips),this.animationIndex=0;const p=this;this._updateComponent=this._entity.addComponent(class extends ot{onUpdate(l){p._onUpdate()}}),this.frameTime=0}getSize(){var t;if((t=this.lottie)!=null&&t.resource){const{width:e,height:i}=this.lottie.resource;return{width:e/100,height:i/100}}return{width:0,height:0}}stopViewAsset(){var t;super.stopViewAsset(),this.lottie=null,(t=this._updateComponent)==null||t.destroy(),this.animationNames=null}setClips(t){this.lottie.resource.setClips(t),this._setAnimationNames(t)}play(t){this.lottie.isLooping=!0,this.lottie.play(t),this.playing=!0}pauseAnimation(){this.lottie.pause(),this.playing=!1}selectAnimation(t){this.animationIndex=t;const e=this._lottieAsset.clips[t];this.play(e==null?void 0:e.name)}playAnimation(){const t=this._lottieAsset.clips[this.animationIndex];this.play(t==null?void 0:t.name)}setFrameTime(t){}_onUpdate(){this.playing&&(this.frameTime=this.lottie.frame)}}O([P],j.prototype,"playing",2);O([P],j.prototype,"frameTime",2);O([P],j.prototype,"animationNames",2);O([P],j.prototype,"animationIndex",2);O([W],j.prototype,"play",1);O([W],j.prototype,"pauseAnimation",1);O([W],j.prototype,"_onUpdate",1);var It=Object.defineProperty,Ot=Object.getOwnPropertyDescriptor,w=(a,s,t,e)=>{for(var i=e>1?void 0:e?Ot(s,t):s,o=a.length-1,r;o>=0;o--)(r=a[o])&&(i=(e?r(s,t,i):r(i))||i);return e&&i&&It(s,t,i),i};let f=class extends E{constructor(s){super(s);c(this,"textureSet",new Set);c(this,"width",0);c(this,"height",0);c(this,"duration",0);c(this,"inPoint",0);c(this,"outPoint",0);c(this,"clips",[]);c(this,"mipmap",!1);c(this,"colorDilate",!1);c(this,"filterMode",B.Bilinear);c(this,"wrapModeU",M.Repeat);c(this,"wrapModeV",M.Repeat);c(this,"runtimeOptions",{overwrite:!1,textureType:"ktx2",mode:"ETC1S",quality:150,isNormal:!1});this.formSchema.addGroup(m("lottie.asset.atlas-export"),["filterMode","wrapModeU","wrapModeV","mipmap","colorDilate"])}destroy(){super.destroy(),this.textureSet.clear(),this.textureSet=null}async initByUploadFile(s){return await this._initByUrl(this.engine,s),this}async initByMain(s){const{engine:t,meta:e}=this;e.runtimeOptions&&(this.runtimeOptions=e.runtimeOptions),this.clips=e.clips||[],this.filterMode=e.filterMode??this.filterMode,this.wrapModeU=e.wrapModeU??this.wrapModeU,this.wrapModeV=e.wrapModeV??this.wrapModeV,this.mipmap=e.mipmap??this.mipmap,this.colorDilate=e.colorDilate??this.colorDilate,await this._initByUrl(t,s);const i=new rt(this.engine),o=i.addComponent(J);o.resource=this.engineObject,this.setDragTempEntity(i)}instantiate(){const s=this.root.sceneStore.createEntity(),t=this.getDragTempEntity(),{position:e,rotation:i}=t.transform,o={components:[{class:"LottieAnimation",id:V(),props:{resource:this.getCurrentRef(),priority:0,defaultState:{}}}],id:s.id,isActive:!0,isClone:!1,name:this.name?this.name:"lottie",transform:{class:"Transform",props:{position:{x:e.x,y:e.y,z:e.z},rotation:{x:i.x,y:i.y,z:i.z},scale:{x:1,y:1,z:1}}}};return s.initByFile(o),s}async _createLottieResource(s,t,e){return(await s.resourceManager.load({urls:[t,e],type:"lottie"})).getComponent(J).resource}async _initByUrl(s,t){const e=JSON.parse(await t.text()),{jsonUrl:i,atlasUrl:o}=e,r=await this._createLottieResource(s,i,o);this.bindEngineObject(r);const{sprites:p}=r.atlas,{textureSet:l}=this;for(let d=0,h=p.length;d<h;++d){const n=p[d].texture;l.has(n)||(l.add(n),n.filterMode=this.filterMode,n.wrapModeU=this.wrapModeU,n.wrapModeV=this.wrapModeV)}return this.width=r.width,this.height=r.height,this.duration=r.duration,this.inPoint=r.inPoint,this.outPoint=r.outPoint,this}};w([v({type:_.Input,disabled:!0,label:m("lottie.asset.width")})],f.prototype,"width",2);w([v({type:_.Input,disabled:!0,label:m("lottie.asset.height")})],f.prototype,"height",2);w([v({type:_.Input,disabled:!0,label:m("lottie.asset.duration")})],f.prototype,"duration",2);w([v({type:_.Input,disabled:!0,label:m("lottie.asset.in-point")})],f.prototype,"inPoint",2);w([v({type:_.Input,disabled:!0,label:m("lottie.asset.out-point")})],f.prototype,"outPoint",2);w([v({disabled:!0,customComponent:bt}),I()],f.prototype,"clips",2);w([v({label:m("lottie.asset.mipmap"),type:_.Toggle}),I()],f.prototype,"mipmap",2);w([v({label:m("lottie.asset.color-dilate"),type:_.Toggle}),I()],f.prototype,"colorDilate",2);w([v({label:m("lottie.asset.filter-mode.title"),type:_.Select,value:B.Bilinear,options:[{label:m("lottie.asset.filter-mode.point"),value:B.Point},{label:m("lottie.asset.filter-mode.bilinear"),value:B.Bilinear},{label:m("lottie.asset.filter-mode.trilinear"),value:B.Trilinear}],onChange(a,s,t){const{textureSet:e}=a;e.forEach(i=>{i.filterMode=t})}}),I()],f.prototype,"filterMode",2);w([v({label:m("lottie.asset.wrap-mode.u"),type:_.Select,value:M.Repeat,options:[{label:m("lottie.asset.wrap-mode.clamp"),value:M.Clamp},{label:m("lottie.asset.wrap-mode.repeat"),value:M.Repeat},{label:m("lottie.asset.wrap-mode.mirror"),value:M.Mirror}],onChange(a,s,t){const{textureSet:e}=a;e.forEach(i=>{i.wrapModeU=t})}}),I()],f.prototype,"wrapModeU",2);w([v({label:m("lottie.asset.wrap-mode.v"),type:_.Select,value:M.Repeat,options:[{label:m("lottie.asset.wrap-mode.clamp"),value:M.Clamp},{label:m("lottie.asset.wrap-mode.repeat"),value:M.Repeat},{label:m("lottie.asset.wrap-mode.mirror"),value:M.Mirror}],onChange(a,s,t){const{textureSet:e}=a;e.forEach(i=>{i.wrapModeV=t})}}),I()],f.prototype,"wrapModeV",2);w([P,I()],f.prototype,"runtimeOptions",2);f=w([H({type:"Lottie",label:m("asset.lottie.title"),loaderType:"EditorLottie",importMenuConfig:{type:pt.Upload,accept:".json"},viewer:j,filterUploadFiles:xt,preUpload:Mt,dragLayer:nt.Lottie,customInspector:dt,async bundle(a,s,t){var N,g;const e=JSON.parse(await a.content.text()),i=a.meta,{jsonUrl:o,atlasUrl:r}=e,p=F(a.name).split(".")[0],l=a.dependencies||(a.dependencies=[]),d=t.vfs,h=((N=l[0])==null?void 0:N.ref.refId)??V();let n;l[0]||(l[0]={key:"atlasUrl",ref:{refId:h}});let u=d.getFileById(h);u?n=u.meta:(n=G(h,E.getRegisteredAssetMeta(ut).type,s,{ignorePack:!0}),t.addFile({name:p+"_atlas.atlas",assetId:h,url:null,parentId:a.parentId,main:null,meta:n}),u=d.getFileById(h),u.ignoreBundle=!0),n.colorDilate=i.colorDilate,n.filterMode=i.filterMode,n.wrapModeU=i.wrapModeU,n.wrapModeV=i.wrapModeV,n.mipmap=i.mipmap;const y=a.meta.runtimeOptions;let C=s.assetOptions.textureOptions;y!=null&&y.overwrite&&(C=Object.assign({},C,y)),n.runtimeOptions=C;const A=await(await fetch(r)).json();t.updateFile(h,{main:new Blob([JSON.stringify(A)]),meta:n}),await t.bundleSingleFile(u,s),e.atlasUrl="./"+F(u.exportPath);const b=((g=l[1])==null?void 0:g.ref.refId)??V();let U;l[1]||(l[1]={key:"jsonUrl",ref:{refId:b}});let S=d.getFileById(b);S?U=S.meta:(U=G(b,E.getRegisteredAssetMeta(z).type,s),t.addFile({name:p+"_clip.json",assetId:b,url:null,parentId:a.parentId,main:null,meta:U}),S=d.getFileById(b),S.ignoreBundle=!0);const T=await(await fetch(o)).json();return T.lolitaAnimations=i.clips,t.updateFile(b,{main:new Blob([JSON.stringify(T)])}),await t.bundleSingleFile(S,s),e.jsonUrl="./"+F(S.exportPath),{content:new Blob([JSON.stringify(e)])}}})],f);export{f as LottieAsset};
@@ -1 +0,0 @@
1
- var l=Object.defineProperty;var c=(e,t,o)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var p=(e,t,o)=>(c(e,typeof t!="symbol"?t+"":t,o),o);import{j as u,o as d,q as b,u as f,e as h}from"./index-0a8702e2.js";import{a as w,A as y}from"./InstanceEditorAsset-a70e73fe.js";import"./ThumbnailMixin-35997457.js";import"./AssetPreviewer-24e31d97.js";import"./CanvasRenderer-9dd98cb3.js";import"./postmen-45d4c238.js";import"./ThumbnailRegistry-495c18c9.js";import"./IconPlayerPlayFilled-b058c98f.js";var v=Object.defineProperty,D=Object.getOwnPropertyDescriptor,m=(e,t,o,n)=>{for(var r=n>1?void 0:n?D(t,o):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(r=(n?i(t,o,r):i(r))||r);return n&&r&&v(t,o,r),r};let a=class extends u{constructor(t){super(t);p(this,"content","");d(this),this.onDoubleClick=this.onDoubleClick.bind(this)}async initByMain(t){this.content=await t.text()}async initByCreation(){return""}getMainData(){return this.content}onDoubleClick(){b(this.root.projectStore.id,this.id)}};m([f],a.prototype,"content",2);a=m([w({type:"Markdown",label:h("asset.markdown.title"),defaultName:"Document.md",extname:"md",importMenuConfig:{type:y.Add},bundle({content:e}){return{content:new Blob([e],{type:"text/markdown; charset=utf-8"})}}})],a);export{a as MarkdownAsset};
@@ -1 +0,0 @@
1
- var G=Object.defineProperty;var K=(p,e,t)=>e in p?G(p,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):p[e]=t;var l=(p,e,t)=>(K(p,typeof e!="symbol"?e+"":e,t),t);import{O as V,b$ as k,cQ as L,cR as U,I as Q,H as z,V as H,x as W,cS as f,j as J,n as $,cT as v,F as M,o as q,cU as x,G as I,ab as b,ac as O,cK as Y,C as P,cV as E,cW as X,w as S,cO as Z,e as w,bU as ee,_ as te,ao as ae,ap as re,B,a8 as se,Q as ne,u as N,J as m}from"./index-0a8702e2.js";import{a as ie,A as oe}from"./InstanceEditorAsset-a70e73fe.js";import"./AssetPreviewer-24e31d97.js";import{M as he}from"./MaterialInspector-aec1248b.js";import{A as pe}from"./AssetViewer-bc198e16.js";import{E as y,s as F,b as C}from"./ProxyConfigs-4de3304c.js";async function de(p){var e;if(p.shaderRef)try{const t=await p.assetStore.getAssetByRef(p.shaderRef);if(!t||t===p.nextShaderAsset)return;(e=t.removeReferencedMaterial)==null||e.call(t,p.material)}catch{}}class ce extends pe{constructor(){super(...arguments);l(this,"_sphereRenderer",null);l(this,"_particleRenderer",null);l(this,"_asset",null);l(this,"_shaderReactionDisposer",null);l(this,"onShaderChange",()=>{const{_asset:t}=this;t.engineObject.shader.name==="particle-shader"?(this._particleRenderer.entity.isActive=!0,this._sphereRenderer.entity.isActive=!1,this._particleRenderer.setMaterial(t.engineObject)):(this._particleRenderer.entity.isActive=!1,this._sphereRenderer.entity.isActive=!0,this._sphereRenderer.setMaterial(t.engineObject))})}setViewAsset(t,a){if(!(t instanceof u))return;const n=a.createChild("material");this._asset=t;const r=this._sphereRenderer=n.createChild("mat").addComponent(V);r.mesh=k.createSphere(a.engine,1,32,!0);const o=this._particleRenderer=n.createChild("pat").addComponent(L);o.generator.main.duration=1e3,o.generator.main.startSpeed.constant=0,this._entity=n,a.addChild(this._entity),this.onShaderChange(),this._shaderReactionDisposer=U(()=>{var i,d;return(d=(i=this._asset)==null?void 0:i.shaderRef)==null?void 0:d.refId},()=>{this.onShaderChange()})}stopViewAsset(){var t;super.stopViewAsset(),(t=this._shaderReactionDisposer)==null||t.call(this),this._shaderReactionDisposer=null,this._asset=null}}class D{static update(e,t){if(!(t instanceof u))return;const a=t.engineObject;if(!a||!a.shader){this.entity&&this.sphereRenderer&&this.particleRenderer&&this.clear();return}this.entity?this.entity.isActive=!0:this.initScene(e),a.shader.name==="particle-shader"?(this.sphereRenderer.entity.isActive=!1,this.particleRenderer.entity.isActive=!0,this.particleRenderer.setMaterial(a),this.particleRenderer.generator._playTime=5):(this.particleRenderer.entity.isActive=!1,this.sphereRenderer.entity.isActive=!0,this.sphereRenderer.setMaterial(a))}static clear(){var e,t;(e=this.sphereRenderer)!=null&&e.entity&&(this.sphereRenderer.entity.isActive=!1),(t=this.particleRenderer)!=null&&t.entity&&(this.particleRenderer.entity.isActive=!1),this.entity&&(this.entity.isActive=!1)}static initScene(e){const t=this.entity=e.createChild("material"),a=this.sphereRenderer=t.createChild("mat").addComponent(V);a.mesh=k.createSphere(e.engine,2,64,!0),this.particleRenderer=t.createChild("pat").addComponent(L),this.particleRenderer.bounds.max.set(.5,.5,.5),this.particleRenderer.bounds.min.set(-.5,-.5,-.5)}}l(D,"entity",null),l(D,"sphereRenderer",null),l(D,"particleRenderer",null);function j(p){return p instanceof Q?{x:p.x,y:p.y}:p instanceof z?{x:p.x,y:p.y,z:p.z}:p instanceof H?{x:p.x,y:p.y,z:p.z,w:p.w}:p instanceof W?{r:p.r,g:p.g,b:p.b,a:p.a}:p}function le(p){switch(p){case f.Color:return"Color";case f.Float:return"Float";case f.Int:return"Integer";case f.Matrix:return"Matrix";case f.Texture:return"Texture";case f.TextureArray:return"TextureArray";case f.Vector2:return"Vector2";case f.Vector3:return"Vector3";case f.Vector4:return"Vector4"}}var ue=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,g=(p,e,t,a)=>{for(var n=a>1?void 0:a?fe(e,t):e,r=p.length-1,o;r>=0;r--)(o=p[r])&&(n=(a?o(e,t,n):o(n))||n);return a&&n&&ue(e,t,n),n};let u=class extends J{constructor(e){super(e);l(this,"acceptDragLayer",$.Texture);l(this,"shaderRef",{refId:null});l(this,"shaderDataKeys",new Set);l(this,"formConfig",null);l(this,"_autoSaveSuppressed",!1);q(this),x(this,{proxyConfigs:[]})}static initBuiltinMaterial(e,t){e.shader=t;const a=e.shaderData;switch(a.disableMacro("MATERIAL_NEED_WORLD_POS"),a.disableMacro("MATERIAL_OMIT_NORMAL"),a.disableMacro("MATERIAL_NEED_TILING_OFFSET"),a.disableMacro("MATERIAL_SUN_HIGH_QUALITY"),e.renderState.depthState.compareFunction=v.Less,t.name){case"unlit":a.enableMacro("MATERIAL_OMIT_NORMAL"),a.enableMacro("MATERIAL_NEED_TILING_OFFSET");break;case"pbr-specular":case"pbr":case"bake-pbr":case"blinn-phong":a.enableMacro("MATERIAL_NEED_WORLD_POS"),a.enableMacro("MATERIAL_NEED_TILING_OFFSET");break;case"skybox":e.renderState.rasterState.cullMode=M.Off,e.renderState.depthState.compareFunction=v.LessEqual;break;case"SkyProcedural":a.enableMacro("MATERIAL_SUN_HIGH_QUALITY"),e.renderState.rasterState.cullMode=M.Off,e.renderState.depthState.compareFunction=v.LessEqual;break;case"particle-shader":a.enableMacro("MATERIAL_OMIT_NORMAL");break}}setAutoSaveSuppressed(e){this._autoSaveSuppressed=e}setRenderQueueType(e){this.engineObject.renderState.renderQueueType=e}setBlendStateEnabled(e){this.engineObject.renderState.blendState.targetBlendState.enabled=e}setDepthWriteEnabled(e){this.engineObject.renderState.depthState.writeEnabled=e}setCullMode(e){this.engineObject.renderState.rasterState.cullMode=e}setBlendMode(e){const t=this.engineObject.renderState.blendState.targetBlendState;switch(e){case I.Normal:t.sourceColorBlendFactor=b.SourceAlpha,t.destinationColorBlendFactor=b.OneMinusSourceAlpha,t.sourceAlphaBlendFactor=b.One,t.destinationAlphaBlendFactor=b.OneMinusSourceAlpha,t.colorBlendOperation=O.Add,t.alphaBlendOperation=O.Add;break;case I.Additive:t.sourceColorBlendFactor=b.SourceAlpha,t.destinationColorBlendFactor=b.One,t.sourceAlphaBlendFactor=b.One,t.destinationAlphaBlendFactor=b.OneMinusSourceAlpha,t.colorBlendOperation=O.Add,t.alphaBlendOperation=O.Add;break}}bindShaderAsset(e,t){for(const a of this.shaderDataKeys)this.removePropertyChangeListener(a);return this.shaderDataKeys.clear(),e.onReady().then(async()=>{var n;if(e.shaderScriptRefId){const r=this.root.assetStore.assets[e.shaderScriptRefId.refId];this.isInitCompleted&&(r==null||r.onShaderChange(this._engineObject),t=this._getMainData())}const a=e.properties?Y(e.properties):[];e.isBuiltinShader()&&u.initBuiltinMaterial(this.engineObject,e.engineObject),t=t||this._getMainData(),await this._proxyShaderProps(a,t,this.isInitCompleted),this.refreshFormConfig(a,t),this.refreshAnimatableProperties(a),de({assetStore:this.root.assetStore,shaderRef:this.shaderRef,nextShaderAsset:e,material:this}),e.addReferencedMaterial(this),this.shaderRef={refId:e.id},await this.applyBoundPathChange("shader",P.AssetPicker,this.shaderRef),(n=this.updateThumbnail)==null||n.call(this)})}async _proxyShaderProps(e,t,a=!0){var o;this.proxyConfigs=e;const n=(o=this.extraData)==null?void 0:o.disabledMacros,r=e.map(async i=>{var d;if(this.proxySetter(i),this._virualShaderProps(e),i.bundleType==="macro"){const s=i.macroInfo,h=t.macros.find(c=>c.name===i.prop);if(!E(this,i.prop)){let c;h!=null?(c=h.value,s&&(s.checked=!0)):n!=null&&n.includes(i.prop)?(c=void 0,s&&(s.checked=!1)):c=i.defaultValue,x(this,{[i.prop]:c})}if(a)if(h){const c=h.value??i.defaultValue;c==null?s==null||s.onSwitch(!0,this):await i.onChange(this,i.prop,c)}else!(n!=null&&n.includes(i.prop))&&(s!=null&&s.checked)&&(s==null||s.onSwitch(!0,this))}else{const s=t.shaderData[i.prop];let h=s?s.value:this[i.prop]??i.defaultValue;if(h!=null&&h.refId&&!this.root.assetStore.assets[h.refId]&&(h=void 0),((d=i.uiInfo)==null?void 0:d.type)===y.Color)if(i.uiInfo.mode==="hdr"){const c=h.intensity??1;c!==0&&(h.r/=c,h.g/=c,h.b/=c),h.intensity=c}else h.intensity=1;E(this,i.prop)||x(this,{[i.prop]:h}),a&&this.notifyPropertyChange(i.prop,!1)}});await Promise.all(r)}proxySetter(e){const{prop:t,onChange:a,bundleType:n}=e,r=async(o,i)=>{var s;const d=this._engineObject.shaderData;n==="macro"?d.enableMacro(t,o):await F(this,t,o,e.engineType??((s=e.uiInfo)==null?void 0:s.type)),await a(this,t,o),i!==!1&&!this._autoSaveSuppressed&&(await this.root.assetFacade.persistAssetMain(this.id),this.updateThumbnail())};this.addPropertyChangeListener(t,r),this.shaderDataKeys.add(t)}_virualShaderProps(e){const t=this;e.forEach(a=>{X(t,a.prop)})}refreshFormConfig(e,t){var n,r,o,i,d;const a={root:[],groups:{}};if(t){for(const s of e)if(!((n=s.uiInfo)!=null&&n.hide)){if((r=s.uiInfo)!=null&&r.group){if((o=s.uiInfo)!=null&&o.group){let h=a.groups[s.uiInfo.group];h||(h={type:P.Group,property:s.uiInfo.group,children:[]},a.groups[s.uiInfo.group]=h);const c=s.uiInfo;c.property=s.prop,s.macroInfo&&(c.macroConfig=s.macroInfo),h.children.push(c)}}else{const h=s.uiInfo;h.property=s.prop,s.macroInfo&&(h.macroConfig=s.macroInfo),a.root.push(h)}s.bundleType==="macro"?this[s.prop]=((i=t.macros.find(h=>h.name===s.prop))==null?void 0:i.value)??s.defaultValue:this[s.prop]=((d=t.shaderData[s.prop])==null?void 0:d.value)??s.defaultValue}}this.formConfig=a}refreshAnimatableProperties(e){var t,a,n;this._additionAnimatableProperties.length=0;for(const r of e){if(!r.uiInfo||r.uiInfo.hide||r.bundleType==="macro")continue;let o={};if((r.setPath||r.getPath||r.valueType||r.interpolationType)&&(o={setPath:r.setPath,getPath:r.getPath,valueType:r.valueType,interpolationType:r.interpolationType}),!o.setPath&&!o.getPath&&r.engineType&&(r.bundleType==="shaderData"||!r.bundleType))switch(r.engineType){case y.Float:o={setPath:`shaderData.setFloat('${r.prop}', $value)`,getPath:`shaderData.getFloat('${r.prop}')`,valueType:S.Float};break;case y.Integer:o={setPath:`shaderData.setInt('${r.prop}', $value)`,getPath:`shaderData.getInt('${r.prop}')`,valueType:S.Float,interpolationType:Z.Step};break;case y.Vector2:o={setPath:`shaderData.getVector2('${r.prop}')`,getPath:`shaderData.getVector2('${r.prop}')`,valueType:S.Vector2};break;case y.Vector3:o={setPath:`shaderData.getVector3('${r.prop}')`,getPath:`shaderData.getVector3('${r.prop}')`,valueType:S.Vector3};break;case y.Vector4:o={setPath:`shaderData.getVector4('${r.prop}')`,getPath:`shaderData.getVector4('${r.prop}')`,valueType:S.Vector4};break;case y.Color:o={setPath:`shaderData.getColor('${r.prop}')`,getPath:`shaderData.getColor('${r.prop}')`,valueType:S.Color};break;case y.Boolean:o={setPath:`shaderData.setBoolean('${r.prop}', $value)`,getPath:`shaderData.getBoolean('${r.prop}')`,valueType:S.Boolean};break;case y.Texture:o={setPath:`shaderData.setTexture('${r.prop}', $value)`,getPath:`shaderData.getTexture('${r.prop}')`,valueType:S.ReferResource};break}if(!o.setPath&&!o.getPath){if(r.bundleType==="other")continue;continue}this._additionAnimatableProperties.push({property:r.prop,label:(t=r.uiInfo)!=null&&t.label?w(r.uiInfo.label):r.prop,type:(a=r.uiInfo)==null?void 0:a.type,propertyProxyConfig:o}),(n=r.uiInfo)!=null&&n.label&&(o.label=w(r.uiInfo.label)),ee(this,r.prop,o)}}async initByMain(e){var c;const t=JSON.parse(await e.text());this.shaderRef=t.shaderRef;const a=t.shaderData,n=t.macros,r=t.renderState;if(!t.shaderRef)throw"invalid material";const o=new te(this.engine);this.setDragTempEntity(o);const i=await this.root.assetStore.getAssetByRef(t.shaderRef),d=i.engineObject??ae.find("unlit"),s=new re(this.engine,d);this.bindEngineObject(s);const h=s.shaderData;if(n)for(const R of n)h.enableMacro(R.name,R.value);if(a)for(const R in a){const _=a[R];let A=_.value;if(_.type===y.Color){A={..._.value};const T=_.value.intensity??1;T!==0&&(A.r/=T,A.g/=T,A.b/=T)}F(this,R,A,_.type)}r&&this._parseProperty(s,"renderState",r),await this.bindShaderAsset(i,t),(c=this.updateThumbnail)==null||c.call(this),await this.applyBoundPathChange("name",P.Input,this.name),this._checkSchemaOnInit(t,i)}_checkSchemaOnInit(e,t){e.shader!==t.engineObject.name&&this.root.assetFacade.persistAssetMain(this.id)}initByEngineObject(e){const t=this;this.bindEngineObject(e),t.shader=e.shader.name,t._name=e.name??"";const n=Object.values(this.root.assetStore.assets).filter(d=>d.meta.type==="Shader"&&!!d.meta.builtinShaderName).find(d=>d.meta.builtinShaderName===e.shader.name);switch(this.shaderRef={refId:n.id},t.isTransparent=e.renderState.blendState.targetBlendState.enabled,t.alphaCutoff=e.shaderData.getFloat("material_AlphaCutoff"),e.renderState.rasterState.cullMode){case M.Back:t.renderFace=B.Front;break;case M.Front:t.renderFace=B.Back;break;case M.Off:t.renderFace=B.Double;break}t.blendMode=e.renderState.blendState.targetBlendState.destinationColorBlendFactor===b.One?I.Additive:I.Normal;const r=e.shaderData;r.getProperties().forEach(d=>{const s=r.getPropertyValue(d);if(s instanceof se){const h=this.root.assetStore.engineObjectToAssetMap.get(s);this[d.name]=h==null?void 0:h.getCurrentRef()}else this[d.name]=j(s)});const i=this._getMainData();this._proxyShaderProps(C,i,!1),this.bindShaderAsset(n,i)}afterDelete(){var e;(e=this.engineObject)==null||e.destroy(!0)}rename(e){return this.root.assetFacade.persistAssetMain(this.id),super.rename(e)}_getMainData(e){var i,d;const t=[],a=(e??this.engineObject).shaderData;a.getMacros(t);const n=t.map(({name:s,value:h})=>h===void 0?{name:s}:{name:s,value:h}),r=[],o={};a.getProperties(r);for(const s of r){let h;if(s.type===f.Texture||s.type===f.TextureArray)h=this[s.name];else{const c=a.getPropertyValue(s);h=j(c),((i=this[s.name])==null?void 0:i.intensity)!=null&&(h.intensity=(d=this[s.name])==null?void 0:d.intensity)}h!=null&&(o[s.name]={type:le(s.type),value:h})}return{name:this.name,shader:this.engineObject.shader.name,macros:n,renderState:this.engineObject.renderState,shaderData:o,shaderRef:this.shaderRef}}getMainData(){return JSON.stringify(this._getMainData())}async initByCreation(){var o;const e=new ne(this.engine),t=[];e.shaderData.getMacros(t);const a=t.map(({name:i,value:d})=>d===void 0?{name:i}:{name:i,value:d});this.bindEngineObject(e);const n={};for(const i of C)i.defaultValue&&(n[i.prop]={value:i.defaultValue,type:i.engineType??((o=i.uiInfo)==null?void 0:o.type)});const r={shaderData:n,shaderRef:{refId:"0000501"},name:this.name,shader:e.shader.name,macros:a,renderState:e.renderState};return this._proxyShaderProps(C,r,!1),r}async onSubAssetEdit(){var n;const e=await this.root.assetFacade.createAssetByAdd({assetType:"Material",name:`${this._name}-copied`});this.engineObject.cloneTo(e.engineObject),await e.applyBoundPathChange("name",P.Input,e.name),e.initByEngineObject(e.engineObject),e.updateThumbnail(),await this.root.assetFacade.persistAssetMain(e.id);const t=await this.root.assetStore.getAssetByRef({refId:this.mainId}),a=((n=t.engineObject.materials)==null?void 0:n.indexOf(this._engineObject))??-1;a>=0&&await t.replaceMaterial(a,e.getCurrentRef()),this.root.assetStore.selectAsset(e.id)}saveMainImmediately(){return!this.engineObject||!this.engineObject.shaderData?Promise.resolve(void 0):(this.root.projectStore.setSyncStatus("syncing"),super.saveMainImmediately().then(e=>(e&&this.root.projectStore.setSyncStatus("success"),e)).catch(e=>{throw this.root.projectStore.setSyncStatus("error"),e}))}_parseProperty(e,t,a){if(typeof a=="object")for(const n in a)this._parseProperty(e[t],n,a[n]);else e[t]=a}async _onDrop(e,t){const a="material_BaseTexture";if(a in this){const n=t.getCurrentRef();this[a]=n;const r=C.find(o=>o.prop===a);r&&await r.onChange(this,a,n),await this.root.assetFacade.persistAssetMain(this.id)}this.dropping=!1}async onDropToViewport(){const{sceneStore:e,sceneUIStore:t}=this.root,a=t.hoveredEntityId;if(a){const n=e.entities.get(a);if(n){const r=n.getComponentByTypeName("MeshRenderer"),o=n.getComponentByTypeName("SkinnedMeshRenderer"),i=r||o;i&&this.root.componentFacade.updateComponent(n.id,i.id,{material:this.getCurrentRef()})}}this.root.projectStore.currentViewport.viewport.onDrop()}};g([N],u.prototype,"shaderRef",2);g([N.ref],u.prototype,"formConfig",2);g([m],u.prototype,"bindShaderAsset",1);g([m],u.prototype,"_proxyShaderProps",1);g([m],u.prototype,"proxySetter",1);g([m],u.prototype,"_virualShaderProps",1);g([m],u.prototype,"refreshAnimatableProperties",1);g([m],u.prototype,"_onDrop",1);u=g([ie({type:"Material",label:w("asset.material.title"),loaderType:"Material",extname:"mat",importMenuConfig:{type:oe.Add},customInspector:he,viewer:ce,thumbnail:D,dragLayer:$.Material})],u);const Ae=Object.freeze(Object.defineProperty({__proto__:null,get MaterialAsset(){return u}},Symbol.toStringTag,{value:"Module"}));export{u as M,ce as a,Ae as b};
@@ -1 +0,0 @@
1
- var A=Object.defineProperty;var L=(d,e,t)=>e in d?A(d,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):d[e]=t;var j=(d,e,t)=>(L(d,typeof e!="symbol"?e+"":e,t),t);import{aH as x,aI as N,aT as S,aJ as $,aD as s,aK as M,C as n,bx as V,aE as F,by as B,aY as f,aU as E,bz as T,e as z}from"./index-0a8702e2.js";import{u as W}from"./InstanceEditorAsset-a70e73fe.js";import"./AssetPreviewer-24e31d97.js";import{I as O}from"./IconPointFilled-a304fd34.js";const U=x(O,{marginRight:"-$1",variants:{checked:{true:{color:"$green10"}}}}),H=x(N,{width:"100%",border:"none",position:"relative",whiteSpace:"pre-wrap",boxShadow:"$2","& > svg":{marginRight:"$1"}});function b(d){return S(function(t){const{inspectorConfig:r,macroConfig:c,...p}=t,{model:i}=p;let{models:g}=p;const{checked:u,onSwitch:h}=c,{type:m,...a}=r,[o,l]=$.useState(u);$.useEffect(()=>{l(u)},[u]),g=g||[i];const y=()=>{const I=!o;if(h)for(const k of g)h(I,k);l(I)},v=r.label;return s.jsxs(M,{direction:"column",fullWidth:!0,children:[m!==n.Null&&o&&V.createElement(d,{...p,inspectorConfig:{...a,type:m}}),s.jsx(F,{label:o?"":v,children:s.jsx(H,{size:"sm",variant:"subtle",startSlot:s.jsx(U,{size:"12px",checked:o}),onClick:y,children:o?"Enabled ":"Disabled"})})]})})}const J=x(M),K=x(B,{backgroundColor:"$gray1",height:"2px !important"});function Y(d){const{inspectorConfig:e,models:t,onModelChange:r,model:c,macroConfig:p}=d,{type:i,property:g,info:u}=e,{t:h}=E(),m=!c&&t&&t.length>1;if(m&&!t.find(R=>e.when?e.when(R):!0)||e.when&&!e.when(c))return null;const a=p?w.getRegisteredMacroComponent(i):w.getRegisteredComponent(i);if(!a)return console.warn(`缺少${i}类型的组件`),null;let o=e.disabled;!m&&c.getEditable&&(o=c.getEditable(e.property)===!1);const l=typeof e.label=="string"?h(e.label):e.label;let y=e.options;y&&(y=y.map(R=>({label:typeof R.label=="string"?h(R.label):R.label,value:R.value})));const v={...e,label:l,info:u,options:y,disabled:o},{triggerAfterInit:I,customComponent:k,...P}=v;return s.jsx(a,{inspectorConfig:P,macroConfig:p,models:t,model:c,onModelChange:r},g)}const C=class C{static registerComponent(e,t){this.components[e]=t}static getRegisteredComponent(e){return C.components[e]}static getRegisteredMacroComponent(e){return C.macroComponents[e]}};j(C,"components",f.getRegisteredComponents()),j(C,"macroComponents",{[n.Color]:b(f.getRegisteredComponent(n.Color)),[n.Vector4]:b(f.getRegisteredComponent(n.Vector4)),[n.Vector3]:b(f.getRegisteredComponent(n.Vector3)),[n.Vector2]:b(f.getRegisteredComponent(n.Vector2)),[n.Number]:b(f.getRegisteredComponent(n.Number)),[n.AssetPicker]:b(f.getRegisteredComponent(n.AssetPicker)),[n.Boolean]:b(f.getRegisteredComponent(n.Boolean)),[n.Null]:b(f.getRegisteredComponent(n.Null))}),j(C,"Item",S(Y)),j(C,"List",S(function(t){const{configs:r,models:c,css:p,onModelChange:i,model:g,children:u,fullWidth:h=!1,withSeparator:m}=t;return r!=null&&r.length&&r.sort((a,o)=>{const l=a.priority??0;return(o.priority??0)-l}),r?s.jsxs(J,{css:p,className:"shader-inspector-form",fullWidth:h,children:[r.map(a=>s.jsxs($.Fragment,{children:[s.jsx(C.Item,{inspectorConfig:a,macroConfig:a.macroConfig,model:g,models:c,onModelChange:i},a.property),m&&s.jsx(K,{})]},a.property)),u]}):null}));let w=C;const q=x("div",{backgroundColor:"$appBg",width:"100%"}),D=x("div",{backgroundColor:"$panelBg",borderRadius:"0 0 $2 $2",overflow:"hidden",paddingBottom:"$1"}),G=x("div",{width:"100%",backgroundColor:"$gray3",paddingBottom:"$0_5"}),Q=x(B,{backgroundColor:"$appBg",height:"2px !important"}),X=d=>{var a;const{asset:e}=d,t=e.formConfig,{assetStore:r,inspectorFacade:c}=W(),{i18n:p}=E(),i=r.assets[e.shaderRef.refId],g=i==null?void 0:i.name,u=Object.values(r.assets).filter(o=>o.meta.type==="Shader"&&o.meta.utility!=="error"),h=()=>{r.selectAsset(e.shaderRef.refId)},m=(o,l)=>{c.assetChange(e.id,o,l)};if(t.root)for(const o of t.root){const l=o.comments;l&&(o.info=l[p.language]??l.default??void 0)}return s.jsxs(q,{children:[s.jsx(G,{children:s.jsx(T,{label:z("asset.shader.title"),assets:u,disabled:!!(i!=null&&i.isSubAsset)||e.isSubAsset||!e.getEditable(),value:g,dropLayer:0,onSelect:async o=>{await e.bindShaderAsset(o,e._getMainData()),await c.assetChanges(e.id,{shaderRef:e.shaderRef,shader:e.shader})},onLocate:h})}),((a=t.root)==null?void 0:a.length)>0&&s.jsx(D,{children:s.jsx(w.List,{model:e,onModelChange:m,configs:t.root,withSeparator:!1})}),s.jsx(Q,{}),s.jsx(w.List,{model:e,onModelChange:m,configs:Object.values(t.groups)})]})},ne=S(X);export{ne as M};