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

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 (92) hide show
  1. package/dist/cli.bundle.cjs +24 -9
  2. package/dist/viewport-client/_static/{Accordion-3d330bc6.js → Accordion-930aedee.js} +1 -1
  3. package/dist/viewport-client/_static/{AmbientLightAsset-bdbc4e1d.js → AmbientLightAsset-f9c1eb91.js} +1 -1
  4. package/dist/viewport-client/_static/{AnimationClipAsset-9167378a.js → AnimationClipAsset-61699477.js} +1 -1
  5. package/dist/viewport-client/_static/{AnimatorControllerAsset-21dc6332.js → AnimatorControllerAsset-1c05f4db.js} +1 -1
  6. package/dist/viewport-client/_static/{AnimatorStore-18d3c551.js → AnimatorStore-6a3679e5.js} +1 -1
  7. package/dist/viewport-client/_static/{AssetViewer-64cd01fa.js → AssetViewer-0ce46fa1.js} +1 -1
  8. package/dist/viewport-client/_static/{AudioAsset-0c828c80.js → AudioAsset-5127eeec.js} +1 -1
  9. package/dist/viewport-client/_static/{AudioComponent-fbff3825.js → AudioComponent-18a3e59f.js} +1 -1
  10. package/dist/viewport-client/_static/{Callout-ba7e2adf.js → Callout-b6ac1af7.js} +1 -1
  11. package/dist/viewport-client/_static/{CameraComponent-74975570.js → CameraComponent-0a115258.js} +1 -1
  12. package/dist/viewport-client/_static/{Component-ed7aa0ab.js → Component-746be670.js} +1 -1
  13. package/dist/viewport-client/_static/{DirectLight-b884e7db.js → DirectLight-4c53e9f6.js} +1 -1
  14. package/dist/viewport-client/_static/{FontAsset-d1ced18d.js → FontAsset-a3a92f7d.js} +1 -1
  15. package/dist/viewport-client/_static/{FormItemArray-6d69acd4.js → FormItemArray-a2f72cf1.js} +1 -1
  16. package/dist/viewport-client/_static/{GlTFAsset-2723b84a.js → GlTFAsset-5f37feef.js} +1 -1
  17. package/dist/viewport-client/_static/{IconEdit-ab77303f.js → IconEdit-2c768a0a.js} +1 -1
  18. package/dist/viewport-client/_static/{IconPointFilled-811fc660.js → IconPointFilled-209638e2.js} +1 -1
  19. package/dist/viewport-client/_static/{LightBaseComponent-12dc27d1.js → LightBaseComponent-51d498ea.js} +1 -1
  20. package/dist/viewport-client/_static/{LottieAnimationComponent-c48c5eb5.js → LottieAnimationComponent-bff0244b.js} +1 -1
  21. package/dist/viewport-client/_static/{LottieAsset-3692580d.js → LottieAsset-9d3ef507.js} +1 -1
  22. package/dist/viewport-client/_static/{MarkdownAsset-bcb90be4.js → MarkdownAsset-a17933fb.js} +1 -1
  23. package/dist/viewport-client/_static/{MaterialAsset-6ef9b4ed.js → MaterialAsset-3b56ac00.js} +1 -1
  24. package/dist/viewport-client/_static/{MaterialInspector-e8242674.js → MaterialInspector-a36197f2.js} +1 -1
  25. package/dist/viewport-client/_static/{Menu-0b8da92f.js → Menu-0a7dbec0.js} +1 -1
  26. package/dist/viewport-client/_static/{MeshAsset-ca9305e5.js → MeshAsset-2cf47eb2.js} +1 -1
  27. package/dist/viewport-client/_static/{MeshRendererBaseComponent-9efd3943.js → MeshRendererBaseComponent-4a3af376.js} +1 -1
  28. package/dist/viewport-client/_static/{MeshRendererComponent-c9a03641.js → MeshRendererComponent-ac4c3954.js} +1 -1
  29. package/dist/viewport-client/_static/{MeshThumbnail-ab28b3b8.js → MeshThumbnail-25cd4a13.js} +1 -1
  30. package/dist/viewport-client/_static/{ParticleRendererComponent-96947c1d.js → ParticleRendererComponent-0a470dee.js} +1 -1
  31. package/dist/viewport-client/_static/{PhysicsMaterialAsset-4a1e5ea3.js → PhysicsMaterialAsset-d87d35aa.js} +1 -1
  32. package/dist/viewport-client/_static/{PhysicsStore-33cac578.js → PhysicsStore-c283b2be.js} +1 -1
  33. package/dist/viewport-client/_static/{PointLight-fd514526.js → PointLight-b7de209f.js} +1 -1
  34. package/dist/viewport-client/_static/{PostProcessComponent-d0ea27a4.js → PostProcessComponent-d4c9ef58.js} +1 -1
  35. package/dist/viewport-client/_static/{PrefabAsset-9179b95c.js → PrefabAsset-d0c0cd25.js} +1 -1
  36. package/dist/viewport-client/_static/{PrimitiveMesh-0572a073.js → PrimitiveMesh-35092ad0.js} +1 -1
  37. package/dist/viewport-client/_static/{ProxyConfigs-3a5fd860.js → ProxyConfigs-ad92ebc7.js} +1 -1
  38. package/dist/viewport-client/_static/{ReferencedMaterial-5773c9d2.js → ReferencedMaterial-800a1955.js} +1 -1
  39. package/dist/viewport-client/_static/{RenderTargetAsset-ab6e06d2.js → RenderTargetAsset-a003f9f5.js} +1 -1
  40. package/dist/viewport-client/_static/{SceneAsset-385fa837.js → SceneAsset-87f2ea92.js} +1 -1
  41. package/dist/viewport-client/_static/{ShaderAsset-f4514b03.js → ShaderAsset-98ce1f70.js} +1 -1
  42. package/dist/viewport-client/_static/{ShaderChunkAsset-34116f2c.js → ShaderChunkAsset-e9072307.js} +1 -1
  43. package/dist/viewport-client/_static/{ShaderUIScriptAsset-fc503291.js → ShaderUIScriptAsset-ac824e68.js} +1 -1
  44. package/dist/viewport-client/_static/{SkinnedMeshRendererComponent-494ad439.js → SkinnedMeshRendererComponent-5f34bf46.js} +1 -1
  45. package/dist/viewport-client/_static/{SpineAnimationComponent-3918d7b5.js → SpineAnimationComponent-7c5db747.js} +1 -1
  46. package/dist/viewport-client/_static/{SpineSkeletonDataAsset-27244892.js → SpineSkeletonDataAsset-5b202ba0.js} +1 -1
  47. package/dist/viewport-client/_static/{SpotLight-f9972dc0.js → SpotLight-2b4e593e.js} +1 -1
  48. package/dist/viewport-client/_static/{SpriteAsset-558ffca8.js → SpriteAsset-4e895da5.js} +1 -1
  49. package/dist/viewport-client/_static/{SpriteAtlasAsset-cdc34386.js → SpriteAtlasAsset-c2894c12.js} +1 -1
  50. package/dist/viewport-client/_static/{SpriteBaseComponent-3edafa31.js → SpriteBaseComponent-a75e84c1.js} +1 -1
  51. package/dist/viewport-client/_static/{SpriteMaskComponent-de2e5231.js → SpriteMaskComponent-a31f3384.js} +1 -1
  52. package/dist/viewport-client/_static/{SpriteRendererComponent-e999e735.js → SpriteRendererComponent-c2123918.js} +1 -1
  53. package/dist/viewport-client/_static/{TextBaseComponent-ce1402c3.js → TextBaseComponent-95846acf.js} +1 -1
  54. package/dist/viewport-client/_static/{TextRendererComponent-f7c0deae.js → TextRendererComponent-429cf17b.js} +1 -1
  55. package/dist/viewport-client/_static/{TextureAsset-39fb07fe.js → TextureAsset-93475ade.js} +2 -2
  56. package/dist/viewport-client/_static/{Tooltip-82063435.js → Tooltip-dfde37c6.js} +1 -1
  57. package/dist/viewport-client/_static/{TrailRendererComponent-37f5c981.js → TrailRendererComponent-112b1618.js} +1 -1
  58. package/dist/viewport-client/_static/{TransformBaseComponent-713d57e9.js → TransformBaseComponent-a8050787.js} +1 -1
  59. package/dist/viewport-client/_static/{TransformComponent-40a57948.js → TransformComponent-c95e25c2.js} +1 -1
  60. package/dist/viewport-client/_static/{XRReferenceImageAsset-2f6ff226.js → XRReferenceImageAsset-dbf129aa.js} +1 -1
  61. package/dist/viewport-client/_static/{audio-7120ec91.js → audio-10589bb4.js} +1 -1
  62. package/dist/viewport-client/_static/index-010da0b3.js +1 -0
  63. package/dist/viewport-client/_static/{index-fbe040bf.js → index-07bbf729.js} +1 -1
  64. package/dist/viewport-client/_static/{index-aec7e708.js → index-1e23212d.js} +4 -4
  65. package/dist/viewport-client/_static/{index-f2cb64af.js → index-2cdbb69f.js} +1 -1
  66. package/dist/viewport-client/_static/{index-7834b582.js → index-31b7a6d3.js} +1 -1
  67. package/dist/viewport-client/_static/index-3439012b.js +1 -0
  68. package/dist/viewport-client/_static/{index-c63c9606.js → index-48760ac4.js} +1 -1
  69. package/dist/viewport-client/_static/index-65a103b6.js +1 -0
  70. package/dist/viewport-client/_static/{index-bfe6f30e.js → index-77b1de5c.js} +1 -1
  71. package/dist/viewport-client/_static/{index-e8a45e82.js → index-92830754.js} +1 -1
  72. package/dist/viewport-client/_static/{index-7917f782.js → index-93eab932.js} +1 -1
  73. package/dist/viewport-client/_static/{index-7acd49d2.js → index-b259cf2e.js} +1 -1
  74. package/dist/viewport-client/_static/{index-74130ff3.js → index-b2e1cba4.js} +1 -1
  75. package/dist/viewport-client/_static/index-b7bf2586.js +1 -0
  76. package/dist/viewport-client/_static/{index-78269e76.js → index-c20fc198.js} +1 -1
  77. package/dist/viewport-client/_static/index-dc62ba4b.js +1 -0
  78. package/dist/viewport-client/_static/index-ea9ea505.js +1 -0
  79. package/dist/viewport-client/_static/{ktx2-encoder-53b21bdc.js → ktx2-encoder-075abd75.js} +1 -1
  80. package/dist/viewport-client/_static/{module-8816772d.js → module-251ecc50.js} +1 -1
  81. package/dist/viewport-client/_static/{module-ffeaf99f.js → module-498119f3.js} +1 -1
  82. package/dist/viewport-client/_static/{module-220b3921.js → module-c6e2d190.js} +1 -1
  83. package/dist/viewport-client/_static/postmen-9e1e15bd.js +1 -0
  84. package/dist/viewport-client/index.html +1 -1
  85. package/package.json +1 -1
  86. package/dist/viewport-client/_static/index-483b5738.js +0 -1
  87. package/dist/viewport-client/_static/index-9d3917da.js +0 -1
  88. package/dist/viewport-client/_static/index-a9b2675e.js +0 -1
  89. package/dist/viewport-client/_static/index-b5582401.js +0 -1
  90. package/dist/viewport-client/_static/index-cd1fee9d.js +0 -1
  91. package/dist/viewport-client/_static/index-e73ceaed.js +0 -1
  92. package/dist/viewport-client/_static/postmen-2f47f6bb.js +0 -1
@@ -1 +1 @@
1
- import{C as n,z as g,T as A,V as C,B as I,R as h,F as x,t as R,G as y,H as m,I as P,J as E,K as B,N as V}from"./index-aec7e708.js";import"./index-e8a45e82.js";var w=(e=>(e.Vector2="Vector2",e.Vector3="Vector3",e.Vector4="Vector4",e.Color="Color",e.Float="Float",e.Texture="Texture",e.Boolean="Boolean",e.Integer="Integer",e))(w||{});function t(e,r){return e.indexOf(r)!==-1}function u(e,r,a){const o=r.engineObject.shaderData;a==="enable"?o.enableMacro(e):o.disableMacro(e)}async function l(e,r,a,o,d){var T;const i=e.engineObject.shaderData;let s;const p=r.toString();switch(o){case n.Slider:case n.Number:case"Float":i.setFloat(p,a);break;case n.Toggle:case n.Boolean:case n.Select:case"Integer":i.setInt(p,Number(a));break;case n.AssetPicker:case"Texture":if(a){const c=await e.root.assetStore.getAssetByRef(a);if(c){const b=c.engineObject;i.setTexture(p,b),d&&u(d,e,"enable")}else i.setTexture(p,null),d&&u(d,e,"disable"),console.error(`${p} in ${e.name} is missing.`)}else i.setTexture(p,null),d&&u(d,e,"disable");break;case n.Vector2:case"Vector2":s=i.getVector2(p),a==null?i.setVector2(p,a):s?(s.x=a.x,s.y=a.y):i.setVector2(p,new V(a.x,a.y));break;case n.Vector3:case"Vector3":s=i.getVector3(p),a==null?i.setVector3(p,a):s?(s.x=a.x,s.y=a.y,s.z=a.z):i.setVector3(p,new B(a.x,a.y,a.z));break;case n.Vector4:case"Vector4":s=i.getVector4(p),a==null?i.setVector4(p,a):s?(s.x=a.x,s.y=a.y,s.z=a.z,s.w=a.w):i.setVector4(p,new C(a.x,a.y,a.z,a.w));break;case n.Color:case"Color":{s=i.getColor(p);let{r:c,g:b,b:S}=a;const{a:_,intensity:f=1}=a;c*=f,b*=f,S*=f,a==null?i.setColor(p,new I(c,b,S,_)):s?(s.r=c,s.g=b,s.b=S,s.a=_):i.setColor(p,new I(c,b,S,_));break}}(T=e.updateThumbnail)==null||T.call(e)}const M=[{prop:"material_IOR",defaultValue:1.5,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.ior",type:n.Slider,min:1,max:5,dragStep:.01,group:"Base"},engineType:"Float"},{prop:"material_BaseColor",defaultValue:{r:1,g:1,b:1,a:1},bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.base-color",type:n.Color,group:"Base"},engineType:"Color"},{prop:"material_BaseTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_BASETEXTURE")},bundleType:"shaderData",when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.base-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Base"},engineType:"Texture"},{prop:"material_Metal",defaultValue:1,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.metallic",type:n.Slider,min:0,max:1,dragStep:.01,group:"Metal roughness"},engineType:"Float"},{prop:"material_Roughness",defaultValue:1,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.roughness",type:n.Slider,min:0,max:1,dragStep:.01,group:"Metal roughness"},engineType:"Float"},{prop:"material_RoughnessMetallicTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.roughness-metallic-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Metal roughness"},engineType:"Texture"},{prop:"material_SpecularIntensity",defaultValue:1,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.pbr-specular-intensity",type:n.Slider,min:0,max:2,dragStep:.01,group:"Specular"},engineType:"Float"},{prop:"material_SpecularColor",defaultValue:{r:1,g:1,b:1,a:1},bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.pbr-specular-color",type:n.Color,group:"Specular"}},{prop:"material_SpecularIntensityTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_SPECULAR_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.pbr-specular-intensity-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Specular"},engineType:"Texture"},{prop:"material_SpecularColorTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.pbr-specular-color-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Specular"},engineType:"Texture"},{prop:"material_AnisotropyInfo",defaultValue:{x:1,y:0,z:0},bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Vector3)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.anisotropy-info",type:n.Vector3,group:"Anisotropy",hide:!0},engineType:"Vector3"},{prop:"anisotropy",defaultValue:0,bundleType:"other",async onChange(e,r,a){const o=e.material_AnisotropyInfo;a===0?u("MATERIAL_ENABLE_ANISOTROPY",e,"disable"):u("MATERIAL_ENABLE_ANISOTROPY",e,"enable"),o.z=a,e.material_AnisotropyInfo=o,await l(e,"material_AnisotropyInfo",o,n.Vector3)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.anisotropy",type:n.Slider,min:0,max:1,dragStep:.01,group:"Anisotropy"},setPath:"shaderData.getVector3('material_AnisotropyInfo').z",getPath:"shaderData.getVector3('material_AnisotropyInfo').z",valueType:g.Float},{prop:"anisotropyRotation",defaultValue:0,bundleType:"other",async onChange(e,r,a){const o=e.material_AnisotropyInfo,d=Math.PI/180*a;o.x=Math.cos(d),o.y=Math.sin(d),e.material_AnisotropyInfo=o,await l(e,"material_AnisotropyInfo",o,n.Vector3)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.anisotropy-rotation",type:n.Slider,min:0,max:360,dragStep:1,group:"Anisotropy"}},{prop:"material_AnisotropyTexture",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_ANISOTROPY_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.anisotropy-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Anisotropy"},engineType:"Texture"},{prop:"material_NormalTexture",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_NORMALTEXTURE")},bundleType:"shaderData",when:t.bind(null,["BlinnPhong","PBR","PbrSpecular"]),uiInfo:{label:"shader.material.normal-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Normal"},engineType:"Texture"},{prop:"material_NormalIntensity",defaultValue:1,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["BlinnPhong","PBR","PbrSpecular"]),uiInfo:{label:"shader.material.normal-intensity",type:n.Slider,min:0,max:5,dragStep:.1,group:"Normal"},engineType:"Float"},{prop:"material_EmissiveColor",defaultValue:{r:0,g:0,b:0,a:1,intensity:1},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.emissive-color",type:n.Color,mode:"hdr",group:"Emissive"}},{prop:"material_EmissiveTexture",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_EMISSIVETEXTURE")},bundleType:"shaderData",when:t.bind(null,["BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.emissive-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Emissive"},engineType:"Texture"},{prop:"material_SpecularColor",defaultValue:{r:1,g:1,b:1,a:1},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["BlinnPhong"]),uiInfo:{label:"shader.material.specular-color",type:n.Color,group:"Blinn Phong"}},{prop:"material_SpecularTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_SPECULAR_TEXTURE")},when:t.bind(null,["BlinnPhong"]),uiInfo:{label:"shader.material.specular-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Blinn Phong"},engineType:"Texture"},{prop:"material_Shininess",defaultValue:16,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["BlinnPhong"]),uiInfo:{label:"shader.material.shininess",type:n.Slider,min:0,max:100,dragStep:1,group:"Blinn Phong"},engineType:"Float"},{prop:"material_OcclusionTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_OCCLUSION_TEXTURE")},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.occlusion-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Occlusion"},engineType:"Texture"},{prop:"material_OcclusionIntensity",defaultValue:1,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.occlusion-intensity",type:n.Slider,min:0,max:5,dragStep:.1,group:"Occlusion"},engineType:"Float"},{prop:"material_OcclusionTextureCoord",defaultValue:A.UV0,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.occlusion-texture-coord",type:n.Select,value:A.UV0,options:[{label:"shader.material.uv.uv0",value:A.UV0},{label:"shader.material.uv.uv1",value:A.UV1}],group:"Occlusion"},engineType:"Float"},{prop:"material_ClearCoat",defaultValue:0,bundleType:"other",async onChange(e,r,a){l(e,r,a,n.Slider),a===0?u("MATERIAL_ENABLE_CLEAR_COAT",e,"disable"):u("MATERIAL_ENABLE_CLEAR_COAT",e,"enable")},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.clearcoat",type:n.Slider,min:0,max:1,dragStep:.01,group:"Clear coat"},engineType:"Float",setPath:"shaderData.setFloat('material_ClearCoat', $value)",getPath:"shaderData.getFloat('material_ClearCoat')",valueType:g.Float},{prop:"material_ClearCoatTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_CLEAR_COAT_TEXTURE")},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.clear-coat-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Clear coat"},engineType:"Texture"},{prop:"material_ClearCoatRoughness",defaultValue:0,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.clear-coat-roughness",type:n.Slider,min:0,max:1,dragStep:.01,group:"Clear coat"},engineType:"Float"},{prop:"material_ClearCoatRoughnessTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE")},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.clear-coat-roughness-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Clear coat"},engineType:"Texture"},{prop:"material_ClearCoatNormalTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE")},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.clear-coat-normal-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Clear coat"},engineType:"Texture"},{prop:"material_IridescenceInfo",defaultValue:{x:0,y:1.3,z:100,w:400},bundleType:"shaderData",async onChange(e,r,a){e.iridescence=a.x,e.iridescenceIOR=a.y,e.iridescenceRange.x=a.z,e.iridescenceRange.y=a.w},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence",type:n.Vector4,group:"Iridescence",hide:!0},engineType:"Vector4"},{prop:"iridescence",defaultValue:0,bundleType:"other",async onChange(e,r,a){const o=e.engineObject.shaderData.getVector4("material_IridescenceInfo");o?(o.x=a,l(e,"material_IridescenceInfo",o,n.Vector4)):l(e,"material_IridescenceInfo",new C(a,1.3,100,400),n.Vector4),a?u("MATERIAL_ENABLE_IRIDESCENCE",e,"enable"):u("MATERIAL_ENABLE_IRIDESCENCE",e,"disable")},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence",type:n.Slider,min:0,max:1,dragStep:.01,group:"Iridescence"},setPath:"shaderData.getVector4('material_IridescenceInfo').x",getPath:"shaderData.getVector4('material_IridescenceInfo').x",valueType:g.Float},{prop:"iridescenceIOR",defaultValue:1.3,bundleType:"other",async onChange(e,r,a){const o=e.engineObject.shaderData.getVector4("material_IridescenceInfo");o?(o.y=a,l(e,"material_IridescenceInfo",o,n.Vector4)):l(e,"material_IridescenceInfo",new C(0,a,100,400),n.Vector4)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence-ior",type:n.Slider,min:1,max:5,dragStep:.01,group:"Iridescence"},setPath:"shaderData.getVector4('material_IridescenceInfo').y",getPath:"shaderData.getVector4('material_IridescenceInfo').y",valueType:g.Float},{prop:"iridescenceRange",defaultValue:{x:100,y:400},bundleType:"other",async onChange(e,r,a){const o=e.engineObject.shaderData.getVector4("material_IridescenceInfo");o?(o.z=a.x,o.w=a.y,l(e,"material_IridescenceInfo",o,n.Vector4)):l(e,"material_IridescenceInfo",new C(0,1.3,a.x,a.y),n.Vector4)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence-range",type:n.Vector2,group:"Iridescence"},engineType:"Vector2"},{prop:"material_IridescenceThicknessTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence-thickness-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Iridescence"},engineType:"Texture"},{prop:"material_IridescenceTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_IRIDESCENCE_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Iridescence"},engineType:"Texture"},{prop:"material_SheenColor",defaultValue:{r:0,g:0,b:0,a:1},bundleType:"shaderData",async onChange(e,r,a){if(e.sheenIntensity===1){const o=e.sheenColor;o.r=a.r,o.g=a.g,o.b=a.b}},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-color",type:n.Color,group:"Sheen",hide:!0},engineType:"Color"},{prop:"sheenColor",defaultValue:{r:0,g:0,b:0,a:1},bundleType:"other",async onChange(e,r,a){const o=e.engineObject.shaderData.getColor("material_SheenColor"),d=e.sheenIntensity??1,i=a.r*d,s=a.g*d,p=a.b*d;i+s+p>0?u("MATERIAL_ENABLE_SHEEN",e,"enable"):u("MATERIAL_ENABLE_SHEEN",e,"disable"),o?(o.set(i,s,p,a.a),l(e,"material_SheenColor",o,n.Color)):l(e,"material_SheenColor",new I(i,s,p,a.a),n.Color)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-color",type:n.Color,group:"Sheen"}},{prop:"sheenIntensity",defaultValue:1,bundleType:"other",async onChange(e,r,a){const o=e.engineObject.shaderData.getColor("material_SheenColor"),d=e.sheenColor,i=a,s=d.r*i,p=d.g*i,T=d.b*i,c=d.a;s+p+T>0?u("MATERIAL_ENABLE_SHEEN",e,"enable"):u("MATERIAL_ENABLE_SHEEN",e,"disable"),o?(o.set(s,p,T,c),l(e,"material_SheenColor",o,n.Color)):l(e,"material_SheenColor",new I(s,p,T,c),n.Color)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-intensity",type:n.Slider,min:0,max:1,dragStep:.01,group:"Sheen"}},{prop:"material_SheenRoughness",defaultValue:0,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-roughness",type:n.Slider,min:0,max:1,dragStep:.01,group:"Sheen"},engineType:"Float"},{prop:"material_SheenTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_SHEEN_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Sheen"},engineType:"Texture"},{prop:"material_SheenRoughnessTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-roughness-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Sheen"},engineType:"Texture"},{prop:"material_Transmission",defaultValue:0,bundleType:"shaderData",async onChange(e,r,a){a?(u("MATERIAL_ENABLE_TRANSMISSION",e,"enable"),e.setRenderQueueType(h.Transparent)):(u("MATERIAL_ENABLE_TRANSMISSION",e,"disable"),e.isTransparent?e.setRenderQueueType(h.Transparent):e.material_AlphaCutoff?e.setRenderQueueType(h.AlphaTest):e.setRenderQueueType(h.Opaque)),l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.transmission",type:n.Slider,min:0,max:1,dragStep:.01,group:"Transmission"},engineType:"Float"},{prop:"material_TransmissionTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_TRANSMISSION_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.transmission-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Transmission"},engineType:"Texture"},{prop:"material_Thickness",defaultValue:0,bundleType:"shaderData",async onChange(e,r,a){a?u("MATERIAL_HAS_THICKNESS",e,"enable"):u("MATERIAL_HAS_THICKNESS",e,"disable"),l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.transmission-thickness",type:n.Slider,min:0,max:5,dragStep:.01,group:"Transmission"},engineType:"Float"},{prop:"material_ThicknessTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_THICKNESS_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.transmission-thickness-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Transmission"},engineType:"Texture"},{prop:"refractionMode",defaultValue:x.Planar,bundleType:"other",async onChange(e,r,a){e.engineObject.shaderData.enableMacro("REFRACTION_MODE",a.toString())},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.refraction-mode",type:n.Select,options:R(x),group:"Transmission"}},{prop:"material_AttenuationColor",defaultValue:{r:1,g:1,b:1,a:1},bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.attenuation-color",type:n.Color,group:"Transmission"},engineType:"Color"},{prop:"material_AttenuationDistance",defaultValue:0,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.attenuation-distance",type:n.Slider,min:0,max:5,dragStep:.01,group:"Transmission"},engineType:"Float"},{prop:"u_lightMapTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"LIGHTMAP_TEXTURE")},when:t.bind(null,["bake-pbr"]),uiInfo:{label:"shader.material.lightmap-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Base"},engineType:"Texture"},{prop:"u_lightMapIntensity",defaultValue:1,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when(e){return e==="bake-pbr"},uiInfo:{label:"shader.material.lightmap-intensity",type:n.Slider,min:0,max:10,dragStep:.1,when(e){return e==="bake-pbr"},group:"Base"},engineType:"Float"},{prop:"material_TintColor",defaultValue:{r:1,g:1,b:1,a:1},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["SkyBox"]),uiInfo:{label:"shader.material.tint-color",type:n.Color,group:"Base"}},{prop:"material_Exposure",defaultValue:1,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["SkyBox","SkyProcedural"]),uiInfo:{label:"shader.material.exposure",type:n.Slider,min:0,max:8,dragStep:.1,group:"Base"},engineType:"Float"},{prop:"material_Rotation",defaultValue:0,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["SkyBox"]),uiInfo:{label:"shader.material.rotation",type:n.Slider,min:0,max:360,dragStep:1,group:"Base"},engineType:"Float"},{prop:"material_CubeTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker)},when:t.bind(null,["SkyBox"]),uiInfo:{label:"shader.material.texture-cube",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape==="Cube",group:"Base"},engineType:"Texture"},{prop:"sunMode",defaultValue:y.HighQuality,bundleType:"other",async onChange(e,r,a){switch(a){case y.HighQuality:u("MATERIAL_SUN_SIMPLE",e,"disable"),u("MATERIAL_SUN_HIGH_QUALITY",e,"enable");break;case y.Simple:u("MATERIAL_SUN_HIGH_QUALITY",e,"disable"),u("MATERIAL_SUN_SIMPLE",e,"enable");break;case y.None:u("MATERIAL_SUN_HIGH_QUALITY",e,"disable"),u("MATERIAL_SUN_SIMPLE",e,"disable");break;default:throw"SkyBoxProceduralMaterial: unknown sun value."}},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.sun-mode",type:n.Select,options:R(y),group:"Base"}},{prop:"material_SunSize",defaultValue:.04,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.sun-size",type:n.Slider,min:0,max:1,dragStep:.01,group:"Base"},engineType:"Float"},{prop:"material_SunSizeConvergence",defaultValue:5,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.sun-size-convergence",type:n.Slider,min:0,max:20,dragStep:.1,group:"Base"},engineType:"Float"},{prop:"material_AtmosphereThickness",defaultValue:1,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.atmosphere-thickness",type:n.Slider,min:0,max:5,dragStep:.1,group:"Base"},engineType:"Float"},{prop:"material_SkyTint",defaultValue:{r:.21404114048223255,g:.21404114048223255,b:.21404114048223255,a:1},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.sky-tint",type:n.Color,group:"Base"},engineType:"Color"},{prop:"material_GroundTint",defaultValue:{r:.11216882039252905,g:.09988709277986121,b:.09520561068319185,a:1},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.ground-tint",type:n.Color,group:"Base"},engineType:"Color"},{prop:"isTransparent",defaultValue:!1,bundleType:"other",async onChange(e,r,a){if(e.setBlendStateEnabled(a),e.setDepthWriteEnabled(!a),a?(e.setRenderQueueType(h.Transparent),u("MATERIAL_IS_TRANSPARENT",e,"enable")):(e.setRenderQueueType(e.material_AlphaCutoff?h.AlphaTest:h.Opaque),u("MATERIAL_IS_TRANSPARENT",e,"disable")),e.material_Transmission>0&&e.setRenderQueueType(h.Transparent),a)l(e,"material_ShadowCasterRenderQueue",h.AlphaTest,n.Number),l(e,"material_DepthOnlyRenderQueue",h.Transparent,n.Number);else{const d=e.material_AlphaCutoff?h.AlphaTest:h.Opaque;l(e,"material_ShadowCasterRenderQueue",d,n.Number),l(e,"material_DepthOnlyRenderQueue",d,n.Number)}},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.is-transparent",type:n.Toggle,group:"Common"}},{prop:"material_AlphaCutoff",defaultValue:0,bundleType:"shaderData",async onChange(e,r,a){const{shaderData:o}=e.engineObject,d=e.isTransparent;if(a){u("MATERIAL_IS_ALPHA_CUTOFF",e,"enable");const i=d?h.Transparent:h.AlphaTest;e.setRenderQueueType(i),o.setFloat("material_ShadowCasterRenderQueue",h.AlphaTest),o.setFloat("material_DepthOnlyRenderQueue",i)}else{u("MATERIAL_IS_ALPHA_CUTOFF",e,"disable");const i=d?h.Transparent:h.Opaque;e.setRenderQueueType(i);const s=d?h.AlphaTest:h.Opaque;o.setFloat("material_ShadowCasterRenderQueue",s),o.setFloat("material_DepthOnlyRenderQueue",i)}o.setFloat("material_AlphaCutoff",a),e.material_Transmission>0&&e.setRenderQueueType(h.Transparent)},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.alpha-cutoff",type:n.Slider,min:0,max:1,dragStep:.01,group:"Common"},engineType:"Float"},{prop:"renderFace",defaultValue:m.Front,bundleType:"other",async onChange(e,r,a){if(!["SkyBox","SkyProcedural"].includes(e.engineObject.shader.name))switch(a){case m.Front:e.setCullMode(P.Back);break;case m.Back:e.setCullMode(P.Front);break;case m.Double:e.setCullMode(P.Off);break}},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.render-face",type:n.Select,options:R(m),group:"Common"}},{prop:"blendMode",defaultValue:E.Normal,bundleType:"other",async onChange(e,r,a){e.setBlendMode(a)},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.blend-mode",type:n.Select,options:[{label:"shader.material.blend-mode-options.normal",value:E.Normal},{label:"shader.material.blend-mode-options.additive",value:E.Additive}],group:"Common"}},{prop:"material_TilingOffset",defaultValue:{x:1,y:1,z:0,w:0},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Vector4)},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular"]),uiInfo:{label:"shader.material.tiling-offset",type:n.Vector4,group:"Common"},engineType:"Vector4"}];export{w as E,M as b,l as s};
1
+ import{C as n,z as g,T as A,V as C,B as I,R as h,F as x,t as R,G as y,H as m,I as P,J as E,K as B,N as V}from"./index-1e23212d.js";import"./index-92830754.js";var w=(e=>(e.Vector2="Vector2",e.Vector3="Vector3",e.Vector4="Vector4",e.Color="Color",e.Float="Float",e.Texture="Texture",e.Boolean="Boolean",e.Integer="Integer",e))(w||{});function t(e,r){return e.indexOf(r)!==-1}function u(e,r,a){const o=r.engineObject.shaderData;a==="enable"?o.enableMacro(e):o.disableMacro(e)}async function l(e,r,a,o,d){var T;const i=e.engineObject.shaderData;let s;const p=r.toString();switch(o){case n.Slider:case n.Number:case"Float":i.setFloat(p,a);break;case n.Toggle:case n.Boolean:case n.Select:case"Integer":i.setInt(p,Number(a));break;case n.AssetPicker:case"Texture":if(a){const c=await e.root.assetStore.getAssetByRef(a);if(c){const b=c.engineObject;i.setTexture(p,b),d&&u(d,e,"enable")}else i.setTexture(p,null),d&&u(d,e,"disable"),console.error(`${p} in ${e.name} is missing.`)}else i.setTexture(p,null),d&&u(d,e,"disable");break;case n.Vector2:case"Vector2":s=i.getVector2(p),a==null?i.setVector2(p,a):s?(s.x=a.x,s.y=a.y):i.setVector2(p,new V(a.x,a.y));break;case n.Vector3:case"Vector3":s=i.getVector3(p),a==null?i.setVector3(p,a):s?(s.x=a.x,s.y=a.y,s.z=a.z):i.setVector3(p,new B(a.x,a.y,a.z));break;case n.Vector4:case"Vector4":s=i.getVector4(p),a==null?i.setVector4(p,a):s?(s.x=a.x,s.y=a.y,s.z=a.z,s.w=a.w):i.setVector4(p,new C(a.x,a.y,a.z,a.w));break;case n.Color:case"Color":{s=i.getColor(p);let{r:c,g:b,b:S}=a;const{a:_,intensity:f=1}=a;c*=f,b*=f,S*=f,a==null?i.setColor(p,new I(c,b,S,_)):s?(s.r=c,s.g=b,s.b=S,s.a=_):i.setColor(p,new I(c,b,S,_));break}}(T=e.updateThumbnail)==null||T.call(e)}const M=[{prop:"material_IOR",defaultValue:1.5,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.ior",type:n.Slider,min:1,max:5,dragStep:.01,group:"Base"},engineType:"Float"},{prop:"material_BaseColor",defaultValue:{r:1,g:1,b:1,a:1},bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.base-color",type:n.Color,group:"Base"},engineType:"Color"},{prop:"material_BaseTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_BASETEXTURE")},bundleType:"shaderData",when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.base-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Base"},engineType:"Texture"},{prop:"material_Metal",defaultValue:1,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.metallic",type:n.Slider,min:0,max:1,dragStep:.01,group:"Metal roughness"},engineType:"Float"},{prop:"material_Roughness",defaultValue:1,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.roughness",type:n.Slider,min:0,max:1,dragStep:.01,group:"Metal roughness"},engineType:"Float"},{prop:"material_RoughnessMetallicTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.roughness-metallic-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Metal roughness"},engineType:"Texture"},{prop:"material_SpecularIntensity",defaultValue:1,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.pbr-specular-intensity",type:n.Slider,min:0,max:2,dragStep:.01,group:"Specular"},engineType:"Float"},{prop:"material_SpecularColor",defaultValue:{r:1,g:1,b:1,a:1},bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.pbr-specular-color",type:n.Color,group:"Specular"}},{prop:"material_SpecularIntensityTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_SPECULAR_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.pbr-specular-intensity-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Specular"},engineType:"Texture"},{prop:"material_SpecularColorTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.pbr-specular-color-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Specular"},engineType:"Texture"},{prop:"material_AnisotropyInfo",defaultValue:{x:1,y:0,z:0},bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Vector3)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.anisotropy-info",type:n.Vector3,group:"Anisotropy",hide:!0},engineType:"Vector3"},{prop:"anisotropy",defaultValue:0,bundleType:"other",async onChange(e,r,a){const o=e.material_AnisotropyInfo;a===0?u("MATERIAL_ENABLE_ANISOTROPY",e,"disable"):u("MATERIAL_ENABLE_ANISOTROPY",e,"enable"),o.z=a,e.material_AnisotropyInfo=o,await l(e,"material_AnisotropyInfo",o,n.Vector3)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.anisotropy",type:n.Slider,min:0,max:1,dragStep:.01,group:"Anisotropy"},setPath:"shaderData.getVector3('material_AnisotropyInfo').z",getPath:"shaderData.getVector3('material_AnisotropyInfo').z",valueType:g.Float},{prop:"anisotropyRotation",defaultValue:0,bundleType:"other",async onChange(e,r,a){const o=e.material_AnisotropyInfo,d=Math.PI/180*a;o.x=Math.cos(d),o.y=Math.sin(d),e.material_AnisotropyInfo=o,await l(e,"material_AnisotropyInfo",o,n.Vector3)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.anisotropy-rotation",type:n.Slider,min:0,max:360,dragStep:1,group:"Anisotropy"}},{prop:"material_AnisotropyTexture",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_ANISOTROPY_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.anisotropy-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Anisotropy"},engineType:"Texture"},{prop:"material_NormalTexture",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_NORMALTEXTURE")},bundleType:"shaderData",when:t.bind(null,["BlinnPhong","PBR","PbrSpecular"]),uiInfo:{label:"shader.material.normal-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Normal"},engineType:"Texture"},{prop:"material_NormalIntensity",defaultValue:1,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["BlinnPhong","PBR","PbrSpecular"]),uiInfo:{label:"shader.material.normal-intensity",type:n.Slider,min:0,max:5,dragStep:.1,group:"Normal"},engineType:"Float"},{prop:"material_EmissiveColor",defaultValue:{r:0,g:0,b:0,a:1,intensity:1},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.emissive-color",type:n.Color,mode:"hdr",group:"Emissive"}},{prop:"material_EmissiveTexture",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_EMISSIVETEXTURE")},bundleType:"shaderData",when:t.bind(null,["BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.emissive-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Emissive"},engineType:"Texture"},{prop:"material_SpecularColor",defaultValue:{r:1,g:1,b:1,a:1},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["BlinnPhong"]),uiInfo:{label:"shader.material.specular-color",type:n.Color,group:"Blinn Phong"}},{prop:"material_SpecularTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_SPECULAR_TEXTURE")},when:t.bind(null,["BlinnPhong"]),uiInfo:{label:"shader.material.specular-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Blinn Phong"},engineType:"Texture"},{prop:"material_Shininess",defaultValue:16,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["BlinnPhong"]),uiInfo:{label:"shader.material.shininess",type:n.Slider,min:0,max:100,dragStep:1,group:"Blinn Phong"},engineType:"Float"},{prop:"material_OcclusionTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_OCCLUSION_TEXTURE")},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.occlusion-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Occlusion"},engineType:"Texture"},{prop:"material_OcclusionIntensity",defaultValue:1,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.occlusion-intensity",type:n.Slider,min:0,max:5,dragStep:.1,group:"Occlusion"},engineType:"Float"},{prop:"material_OcclusionTextureCoord",defaultValue:A.UV0,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.occlusion-texture-coord",type:n.Select,value:A.UV0,options:[{label:"shader.material.uv.uv0",value:A.UV0},{label:"shader.material.uv.uv1",value:A.UV1}],group:"Occlusion"},engineType:"Float"},{prop:"material_ClearCoat",defaultValue:0,bundleType:"other",async onChange(e,r,a){l(e,r,a,n.Slider),a===0?u("MATERIAL_ENABLE_CLEAR_COAT",e,"disable"):u("MATERIAL_ENABLE_CLEAR_COAT",e,"enable")},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.clearcoat",type:n.Slider,min:0,max:1,dragStep:.01,group:"Clear coat"},engineType:"Float",setPath:"shaderData.setFloat('material_ClearCoat', $value)",getPath:"shaderData.getFloat('material_ClearCoat')",valueType:g.Float},{prop:"material_ClearCoatTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_CLEAR_COAT_TEXTURE")},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.clear-coat-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Clear coat"},engineType:"Texture"},{prop:"material_ClearCoatRoughness",defaultValue:0,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.clear-coat-roughness",type:n.Slider,min:0,max:1,dragStep:.01,group:"Clear coat"},engineType:"Float"},{prop:"material_ClearCoatRoughnessTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE")},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.clear-coat-roughness-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Clear coat"},engineType:"Texture"},{prop:"material_ClearCoatNormalTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE")},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.clear-coat-normal-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Clear coat"},engineType:"Texture"},{prop:"material_IridescenceInfo",defaultValue:{x:0,y:1.3,z:100,w:400},bundleType:"shaderData",async onChange(e,r,a){e.iridescence=a.x,e.iridescenceIOR=a.y,e.iridescenceRange.x=a.z,e.iridescenceRange.y=a.w},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence",type:n.Vector4,group:"Iridescence",hide:!0},engineType:"Vector4"},{prop:"iridescence",defaultValue:0,bundleType:"other",async onChange(e,r,a){const o=e.engineObject.shaderData.getVector4("material_IridescenceInfo");o?(o.x=a,l(e,"material_IridescenceInfo",o,n.Vector4)):l(e,"material_IridescenceInfo",new C(a,1.3,100,400),n.Vector4),a?u("MATERIAL_ENABLE_IRIDESCENCE",e,"enable"):u("MATERIAL_ENABLE_IRIDESCENCE",e,"disable")},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence",type:n.Slider,min:0,max:1,dragStep:.01,group:"Iridescence"},setPath:"shaderData.getVector4('material_IridescenceInfo').x",getPath:"shaderData.getVector4('material_IridescenceInfo').x",valueType:g.Float},{prop:"iridescenceIOR",defaultValue:1.3,bundleType:"other",async onChange(e,r,a){const o=e.engineObject.shaderData.getVector4("material_IridescenceInfo");o?(o.y=a,l(e,"material_IridescenceInfo",o,n.Vector4)):l(e,"material_IridescenceInfo",new C(0,a,100,400),n.Vector4)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence-ior",type:n.Slider,min:1,max:5,dragStep:.01,group:"Iridescence"},setPath:"shaderData.getVector4('material_IridescenceInfo').y",getPath:"shaderData.getVector4('material_IridescenceInfo').y",valueType:g.Float},{prop:"iridescenceRange",defaultValue:{x:100,y:400},bundleType:"other",async onChange(e,r,a){const o=e.engineObject.shaderData.getVector4("material_IridescenceInfo");o?(o.z=a.x,o.w=a.y,l(e,"material_IridescenceInfo",o,n.Vector4)):l(e,"material_IridescenceInfo",new C(0,1.3,a.x,a.y),n.Vector4)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence-range",type:n.Vector2,group:"Iridescence"},engineType:"Vector2"},{prop:"material_IridescenceThicknessTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence-thickness-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Iridescence"},engineType:"Texture"},{prop:"material_IridescenceTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_IRIDESCENCE_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Iridescence"},engineType:"Texture"},{prop:"material_SheenColor",defaultValue:{r:0,g:0,b:0,a:1},bundleType:"shaderData",async onChange(e,r,a){if(e.sheenIntensity===1){const o=e.sheenColor;o.r=a.r,o.g=a.g,o.b=a.b}},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-color",type:n.Color,group:"Sheen",hide:!0},engineType:"Color"},{prop:"sheenColor",defaultValue:{r:0,g:0,b:0,a:1},bundleType:"other",async onChange(e,r,a){const o=e.engineObject.shaderData.getColor("material_SheenColor"),d=e.sheenIntensity??1,i=a.r*d,s=a.g*d,p=a.b*d;i+s+p>0?u("MATERIAL_ENABLE_SHEEN",e,"enable"):u("MATERIAL_ENABLE_SHEEN",e,"disable"),o?(o.set(i,s,p,a.a),l(e,"material_SheenColor",o,n.Color)):l(e,"material_SheenColor",new I(i,s,p,a.a),n.Color)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-color",type:n.Color,group:"Sheen"}},{prop:"sheenIntensity",defaultValue:1,bundleType:"other",async onChange(e,r,a){const o=e.engineObject.shaderData.getColor("material_SheenColor"),d=e.sheenColor,i=a,s=d.r*i,p=d.g*i,T=d.b*i,c=d.a;s+p+T>0?u("MATERIAL_ENABLE_SHEEN",e,"enable"):u("MATERIAL_ENABLE_SHEEN",e,"disable"),o?(o.set(s,p,T,c),l(e,"material_SheenColor",o,n.Color)):l(e,"material_SheenColor",new I(s,p,T,c),n.Color)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-intensity",type:n.Slider,min:0,max:1,dragStep:.01,group:"Sheen"}},{prop:"material_SheenRoughness",defaultValue:0,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-roughness",type:n.Slider,min:0,max:1,dragStep:.01,group:"Sheen"},engineType:"Float"},{prop:"material_SheenTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_SHEEN_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Sheen"},engineType:"Texture"},{prop:"material_SheenRoughnessTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-roughness-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Sheen"},engineType:"Texture"},{prop:"material_Transmission",defaultValue:0,bundleType:"shaderData",async onChange(e,r,a){a?(u("MATERIAL_ENABLE_TRANSMISSION",e,"enable"),e.setRenderQueueType(h.Transparent)):(u("MATERIAL_ENABLE_TRANSMISSION",e,"disable"),e.isTransparent?e.setRenderQueueType(h.Transparent):e.material_AlphaCutoff?e.setRenderQueueType(h.AlphaTest):e.setRenderQueueType(h.Opaque)),l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.transmission",type:n.Slider,min:0,max:1,dragStep:.01,group:"Transmission"},engineType:"Float"},{prop:"material_TransmissionTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_TRANSMISSION_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.transmission-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Transmission"},engineType:"Texture"},{prop:"material_Thickness",defaultValue:0,bundleType:"shaderData",async onChange(e,r,a){a?u("MATERIAL_HAS_THICKNESS",e,"enable"):u("MATERIAL_HAS_THICKNESS",e,"disable"),l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.transmission-thickness",type:n.Slider,min:0,max:5,dragStep:.01,group:"Transmission"},engineType:"Float"},{prop:"material_ThicknessTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_THICKNESS_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.transmission-thickness-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Transmission"},engineType:"Texture"},{prop:"refractionMode",defaultValue:x.Planar,bundleType:"other",async onChange(e,r,a){e.engineObject.shaderData.enableMacro("REFRACTION_MODE",a.toString())},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.refraction-mode",type:n.Select,options:R(x),group:"Transmission"}},{prop:"material_AttenuationColor",defaultValue:{r:1,g:1,b:1,a:1},bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.attenuation-color",type:n.Color,group:"Transmission"},engineType:"Color"},{prop:"material_AttenuationDistance",defaultValue:0,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.attenuation-distance",type:n.Slider,min:0,max:5,dragStep:.01,group:"Transmission"},engineType:"Float"},{prop:"u_lightMapTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"LIGHTMAP_TEXTURE")},when:t.bind(null,["bake-pbr"]),uiInfo:{label:"shader.material.lightmap-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Base"},engineType:"Texture"},{prop:"u_lightMapIntensity",defaultValue:1,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when(e){return e==="bake-pbr"},uiInfo:{label:"shader.material.lightmap-intensity",type:n.Slider,min:0,max:10,dragStep:.1,when(e){return e==="bake-pbr"},group:"Base"},engineType:"Float"},{prop:"material_TintColor",defaultValue:{r:1,g:1,b:1,a:1},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["SkyBox"]),uiInfo:{label:"shader.material.tint-color",type:n.Color,group:"Base"}},{prop:"material_Exposure",defaultValue:1,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["SkyBox","SkyProcedural"]),uiInfo:{label:"shader.material.exposure",type:n.Slider,min:0,max:8,dragStep:.1,group:"Base"},engineType:"Float"},{prop:"material_Rotation",defaultValue:0,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["SkyBox"]),uiInfo:{label:"shader.material.rotation",type:n.Slider,min:0,max:360,dragStep:1,group:"Base"},engineType:"Float"},{prop:"material_CubeTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker)},when:t.bind(null,["SkyBox"]),uiInfo:{label:"shader.material.texture-cube",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape==="Cube",group:"Base"},engineType:"Texture"},{prop:"sunMode",defaultValue:y.HighQuality,bundleType:"other",async onChange(e,r,a){switch(a){case y.HighQuality:u("MATERIAL_SUN_SIMPLE",e,"disable"),u("MATERIAL_SUN_HIGH_QUALITY",e,"enable");break;case y.Simple:u("MATERIAL_SUN_HIGH_QUALITY",e,"disable"),u("MATERIAL_SUN_SIMPLE",e,"enable");break;case y.None:u("MATERIAL_SUN_HIGH_QUALITY",e,"disable"),u("MATERIAL_SUN_SIMPLE",e,"disable");break;default:throw"SkyBoxProceduralMaterial: unknown sun value."}},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.sun-mode",type:n.Select,options:R(y),group:"Base"}},{prop:"material_SunSize",defaultValue:.04,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.sun-size",type:n.Slider,min:0,max:1,dragStep:.01,group:"Base"},engineType:"Float"},{prop:"material_SunSizeConvergence",defaultValue:5,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.sun-size-convergence",type:n.Slider,min:0,max:20,dragStep:.1,group:"Base"},engineType:"Float"},{prop:"material_AtmosphereThickness",defaultValue:1,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.atmosphere-thickness",type:n.Slider,min:0,max:5,dragStep:.1,group:"Base"},engineType:"Float"},{prop:"material_SkyTint",defaultValue:{r:.21404114048223255,g:.21404114048223255,b:.21404114048223255,a:1},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.sky-tint",type:n.Color,group:"Base"},engineType:"Color"},{prop:"material_GroundTint",defaultValue:{r:.11216882039252905,g:.09988709277986121,b:.09520561068319185,a:1},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.ground-tint",type:n.Color,group:"Base"},engineType:"Color"},{prop:"isTransparent",defaultValue:!1,bundleType:"other",async onChange(e,r,a){if(e.setBlendStateEnabled(a),e.setDepthWriteEnabled(!a),a?(e.setRenderQueueType(h.Transparent),u("MATERIAL_IS_TRANSPARENT",e,"enable")):(e.setRenderQueueType(e.material_AlphaCutoff?h.AlphaTest:h.Opaque),u("MATERIAL_IS_TRANSPARENT",e,"disable")),e.material_Transmission>0&&e.setRenderQueueType(h.Transparent),a)l(e,"material_ShadowCasterRenderQueue",h.AlphaTest,n.Number),l(e,"material_DepthOnlyRenderQueue",h.Transparent,n.Number);else{const d=e.material_AlphaCutoff?h.AlphaTest:h.Opaque;l(e,"material_ShadowCasterRenderQueue",d,n.Number),l(e,"material_DepthOnlyRenderQueue",d,n.Number)}},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.is-transparent",type:n.Toggle,group:"Common"}},{prop:"material_AlphaCutoff",defaultValue:0,bundleType:"shaderData",async onChange(e,r,a){const{shaderData:o}=e.engineObject,d=e.isTransparent;if(a){u("MATERIAL_IS_ALPHA_CUTOFF",e,"enable");const i=d?h.Transparent:h.AlphaTest;e.setRenderQueueType(i),o.setFloat("material_ShadowCasterRenderQueue",h.AlphaTest),o.setFloat("material_DepthOnlyRenderQueue",i)}else{u("MATERIAL_IS_ALPHA_CUTOFF",e,"disable");const i=d?h.Transparent:h.Opaque;e.setRenderQueueType(i);const s=d?h.AlphaTest:h.Opaque;o.setFloat("material_ShadowCasterRenderQueue",s),o.setFloat("material_DepthOnlyRenderQueue",i)}o.setFloat("material_AlphaCutoff",a),e.material_Transmission>0&&e.setRenderQueueType(h.Transparent)},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.alpha-cutoff",type:n.Slider,min:0,max:1,dragStep:.01,group:"Common"},engineType:"Float"},{prop:"renderFace",defaultValue:m.Front,bundleType:"other",async onChange(e,r,a){if(!["SkyBox","SkyProcedural"].includes(e.engineObject.shader.name))switch(a){case m.Front:e.setCullMode(P.Back);break;case m.Back:e.setCullMode(P.Front);break;case m.Double:e.setCullMode(P.Off);break}},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.render-face",type:n.Select,options:R(m),group:"Common"}},{prop:"blendMode",defaultValue:E.Normal,bundleType:"other",async onChange(e,r,a){e.setBlendMode(a)},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.blend-mode",type:n.Select,options:[{label:"shader.material.blend-mode-options.normal",value:E.Normal},{label:"shader.material.blend-mode-options.additive",value:E.Additive}],group:"Common"}},{prop:"material_TilingOffset",defaultValue:{x:1,y:1,z:0,w:0},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Vector4)},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular"]),uiInfo:{label:"shader.material.tiling-offset",type:n.Vector4,group:"Common"},engineType:"Vector4"}];export{w as E,M as b,l as s};
@@ -1 +1 @@
1
- import{aO as n,aP as s,aQ as o,aR as i,aS as t,aT as d,aU as c,aV as g}from"./index-aec7e708.js";import{M as h}from"./MaterialInspector-e8242674.js";const m=n("div",{marginLeft:"5px"}),u=n(s,{borderRadius:"$3",padding:"$1_5",marginLeft:"-$1_5",marginRight:"-$0_5",marginBottom:"$1",color:"$gray11",cursor:"pointer",backgroundColor:"transparent",transition:"background-color 0.2s","&:hover":{backgroundColor:"$grayA3"},variants:{open:{true:{boxShadow:"inset 0 0 0 1px $colors$grayA3",backgroundColor:"$grayA5","&:hover":{backgroundColor:"$grayA5"}}}}});function x(r){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...r,children:t.jsx("path",{fill:"currentColor",d:"m12 17.4l-3.9 3.9q-.275.275-.7.275t-.7-.275t-.275-.7t.275-.7l3.875-3.875q.575-.575 1.425-.575t1.425.575L17.3 19.9q.275.275.275.7t-.275.7t-.7.275t-.7-.275zm0-10.8l3.9-3.9q.275-.275.7-.275t.7.275t.275.7t-.275.7l-3.875 3.875Q12.85 8.55 12 8.55t-1.425-.575L6.7 4.1q-.275-.275-.275-.7t.275-.7t.7-.275t.7.275z"})})}function p(r){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...r,children:t.jsx("path",{fill:"currentColor",d:"m12 19.15l3.875-3.875q.3-.3.7-.3t.7.3t.3.713t-.3.712l-3.85 3.875q-.575.575-1.425.575t-1.425-.575L6.7 16.7q-.3-.3-.288-.712t.313-.713t.713-.3t.712.3zm0-14.3L8.15 8.7q-.3.3-.7.288t-.7-.288q-.3-.3-.312-.712t.287-.713l3.85-3.85Q11.15 2.85 12 2.85t1.425.575l3.85 3.85q.3.3.288.713t-.313.712q-.3.275-.7.288t-.7-.288z"})})}const b=o(function(e){const{t:a}=i();return t.jsxs(u,{align:"v",justifyContent:"between",open:e.open,children:[t.jsxs(s,{align:"v",gap:"xs",children:[t.jsx("img",{src:e.thumbnailUrl,alt:a("mesh-renderer.material.thumbnail"),width:"20px",height:"20px"}),t.jsxs(m,{children:[a("mesh-renderer.material.title"),"(",e.name,")"]})]}),t.jsx(d,{size:"xs",variant:"subtle",children:e.open?t.jsx(x,{}):t.jsx(p,{})})]})}),f=r=>{const{materialAsset:e}=r,[a,l]=c.useState(!1);return t.jsx(g,{nesting:!0,title:t.jsx(b,{open:a,thumbnailUrl:e.thumbnailUrl,name:e.name}),defaultOpen:!1,open:a,onOpenChange:l,children:t.jsx(h,{asset:e})})};export{f as R};
1
+ import{aO as n,aP as s,aQ as o,aR as i,aS as t,aT as d,aU as c,aV as g}from"./index-1e23212d.js";import{M as h}from"./MaterialInspector-a36197f2.js";const m=n("div",{marginLeft:"5px"}),u=n(s,{borderRadius:"$3",padding:"$1_5",marginLeft:"-$1_5",marginRight:"-$0_5",marginBottom:"$1",color:"$gray11",cursor:"pointer",backgroundColor:"transparent",transition:"background-color 0.2s","&:hover":{backgroundColor:"$grayA3"},variants:{open:{true:{boxShadow:"inset 0 0 0 1px $colors$grayA3",backgroundColor:"$grayA5","&:hover":{backgroundColor:"$grayA5"}}}}});function x(r){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...r,children:t.jsx("path",{fill:"currentColor",d:"m12 17.4l-3.9 3.9q-.275.275-.7.275t-.7-.275t-.275-.7t.275-.7l3.875-3.875q.575-.575 1.425-.575t1.425.575L17.3 19.9q.275.275.275.7t-.275.7t-.7.275t-.7-.275zm0-10.8l3.9-3.9q.275-.275.7-.275t.7.275t.275.7t-.275.7l-3.875 3.875Q12.85 8.55 12 8.55t-1.425-.575L6.7 4.1q-.275-.275-.275-.7t.275-.7t.7-.275t.7.275z"})})}function p(r){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...r,children:t.jsx("path",{fill:"currentColor",d:"m12 19.15l3.875-3.875q.3-.3.7-.3t.7.3t.3.713t-.3.712l-3.85 3.875q-.575.575-1.425.575t-1.425-.575L6.7 16.7q-.3-.3-.288-.712t.313-.713t.713-.3t.712.3zm0-14.3L8.15 8.7q-.3.3-.7.288t-.7-.288q-.3-.3-.312-.712t.287-.713l3.85-3.85Q11.15 2.85 12 2.85t1.425.575l3.85 3.85q.3.3.288.713t-.313.712q-.3.275-.7.288t-.7-.288z"})})}const b=o(function(e){const{t:a}=i();return t.jsxs(u,{align:"v",justifyContent:"between",open:e.open,children:[t.jsxs(s,{align:"v",gap:"xs",children:[t.jsx("img",{src:e.thumbnailUrl,alt:a("mesh-renderer.material.thumbnail"),width:"20px",height:"20px"}),t.jsxs(m,{children:[a("mesh-renderer.material.title"),"(",e.name,")"]})]}),t.jsx(d,{size:"xs",variant:"subtle",children:e.open?t.jsx(x,{}):t.jsx(p,{})})]})}),f=r=>{const{materialAsset:e}=r,[a,l]=c.useState(!1);return t.jsx(g,{nesting:!0,title:t.jsx(b,{open:a,thumbnailUrl:e.thumbnailUrl,name:e.name}),defaultOpen:!1,open:a,onOpenChange:l,children:t.jsx(h,{asset:e})})};export{f as R};
@@ -1 +1 @@
1
- var C=Object.defineProperty;var M=(s,t,e)=>t in s?C(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var h=(s,t,e)=>(M(s,typeof t!="symbol"?t+"":t,e),e);import{$ as R,a9 as y,bJ as l,j as x,bI as v,bK as S,p as b,C as m,m as f,n as G,e as F,o as O,q as D}from"./index-aec7e708.js";import"./index-e8a45e82.js";import{A as B}from"./AssetViewer-64cd01fa.js";class A{static update(t,e){var o;this.spriteEntity?this.spriteEntity.isActive=!0:this.initScene(t),this.entity=this.spriteEntity;const i=(o=e.engineObject)==null?void 0:o.getColorTexture(0);i&&(this.sprite.texture=i)}static clear(){this.spriteEntity&&(this.spriteEntity.isActive=!1)}static initScene(t){const e=this.spriteEntity=t.createChild("rt-thumbnail");this.spriteRenderer=e.addComponent(R),this.spriteRenderer.sprite=this.sprite=new y(t.engine)}}h(A,"entity"),h(A,"spriteEntity"),h(A,"spriteRenderer"),h(A,"sprite");class j extends B{constructor(){super(...arguments);h(this,"_asset");h(this,"_sprite");h(this,"_onRebuild",()=>{var e;if(this._sprite&&((e=this._asset)!=null&&e.engineObject)){const i=this._asset.engineObject.getColorTexture(0);i&&(this._sprite.texture=i)}})}setViewAsset(e,i){var _;this._asset=e;const o=i.engine,r=i.createChild("rt_preview"),n=(_=e.engineObject)==null?void 0:_.getColorTexture(0),a=new y(o,n),c=r.addComponent(R);c.sprite=a,this._sprite=a,this._entity=r,e.onRebuild(this._onRebuild)}stopViewAsset(){super.stopViewAsset(),this._asset&&this._asset.offRebuild(this._onRebuild),this._asset=null,this._sprite=null}getDescription(e){return`${e.width}x${e.height}`}}var E=Object.defineProperty,V=Object.getOwnPropertyDescriptor,g=(s,t,e,i)=>{for(var o=i>1?void 0:i?V(t,e):t,r=s.length-1,n;r>=0;r--)(n=s[r])&&(o=(i?n(t,e,o):n(o))||o);return i&&o&&E(t,e,o),o};const I=[{label:"R8G8B8A8",value:l.R8G8B8A8},{label:"R8G8B8",value:l.R8G8B8},{label:"R16G16B16A16",value:l.R16G16B16A16},{label:"R32G32B32A32",value:l.R32G32B32A32},{label:"R11G11B10_UFloat",value:l.R11G11B10_UFloat}],w=-1,L=[{label:"None",value:w},{label:"Depth",value:l.Depth},{label:"Depth16",value:l.Depth16},{label:"Depth24",value:l.Depth24},{label:"Depth32",value:l.Depth32},{label:"Depth24Stencil8",value:l.Depth24Stencil8},{label:"Depth32Stencil8",value:l.Depth32Stencil8}],U=[{label:"1",value:1},{label:"2",value:2},{label:"4",value:4},{label:"8",value:8}];let u=class extends x{constructor(){super(...arguments);h(this,"_onRebuildCallbacks",[]);h(this,"width",512);h(this,"height",512);h(this,"colorFormat",l.R8G8B8A8);h(this,"depthFormat",l.Depth);h(this,"antiAliasing",1);h(this,"autoGenerateMipmaps",!0)}registerThumbnail(){}onRebuild(t){this._onRebuildCallbacks.push(t)}offRebuild(t){const e=this._onRebuildCallbacks.indexOf(t);e!==-1&&this._onRebuildCallbacks.splice(e,1)}async initByCreation(){return this.getMainData()}getMainData(){var i;const t={width:this.width,height:this.height,colorFormats:[this.colorFormat],depthFormat:this.depthFormat,antiAliasing:this.antiAliasing,autoGenerateMipmaps:this.autoGenerateMipmaps},e=(i=this.engineObject)==null?void 0:i.getColorTexture(0);return e&&(t.colorTextures=[{isSRGBColorSpace:e.isSRGBColorSpace,mipmap:e.mipmapCount>1,filterMode:e.filterMode,wrapModeU:e.wrapModeU,wrapModeV:e.wrapModeV,anisoLevel:e.anisoLevel}]),JSON.stringify(t)}async initByMain(t){const e=JSON.parse(await t.text());this.width=Math.round(e.width??512),this.height=Math.round(e.height??512);const i=e.colorFormats??[e.colorFormat??l.R8G8B8A8];this.colorFormat=i[0],this.depthFormat=e.depthFormat??l.Depth,this.antiAliasing=e.antiAliasing??1,this.autoGenerateMipmaps=e.autoGenerateMipmaps??!1;const r=(e.colorTextures??(e.colorTexture?[e.colorTexture]:[]))[0],n=this._buildRenderTarget((r==null?void 0:r.mipmap)??!0,r==null?void 0:r.isSRGBColorSpace);await this.bindEngineObject(n);const a=n.getColorTexture(0);a&&r&&(r.filterMode!=null&&(a.filterMode=r.filterMode),r.wrapModeU!=null&&(a.wrapModeU=r.wrapModeU),r.wrapModeV!=null&&(a.wrapModeV=r.wrapModeV),r.anisoLevel!=null&&(a.anisoLevel=r.anisoLevel)),await this._generateSubAssets()}destroy(){this._destroySubAssets(),this.engineObject&&this._replaceCameraRenderTarget(this.engineObject,null),this._onRebuildCallbacks.length=0,this._destroyRenderTarget(),super.destroy()}async _rebuild(){var _;if(!this.engineObject)return;const t=this.engineObject,e=t.getColorTexture(0),i=(_=this._subAssets)==null?void 0:_[0],o=i?i.mipmap??!0:!0,r=i?i.isSRGBColorSpace??this.colorFormat===l.R8G8B8A8:this.colorFormat===l.R8G8B8A8,n=e&&e.format===this.colorFormat&&e.width===this.width&&e.height===this.height&&e.isSRGBColorSpace===r&&o===e.mipmapCount>1;let a;try{a=n?this._buildRenderTargetWithTexture(e):this._buildRenderTarget(o,r)}catch(p){console.warn("Failed to create RenderTarget:",p);return}if(!n&&e){const p=a.getColorTexture(0);p&&(p.filterMode=e.filterMode,p.wrapModeU=e.wrapModeU,p.wrapModeV=e.wrapModeV,p.anisoLevel=e.anisoLevel)}const c=this._replaceCameraRenderTarget(t,a);if(t.destroy(),await this.bindEngineObject(a),n||(e==null||e.destroy(),this._destroySubAssets(),await this._generateSubAssets()),c.length>0){const p=c.map(d=>d.enabled);c.forEach(d=>d.enabled=!0),requestAnimationFrame(()=>{this._onRebuildCallbacks.forEach(d=>d()),c.forEach((d,T)=>d.enabled=p[T])})}else this._onRebuildCallbacks.forEach(p=>p())}_buildRenderTarget(t=!0,e){const{width:i,height:o,colorFormat:r}=this;e===void 0&&(e=r===l.R8G8B8A8);const n=new v(this.engine,i,o,r,t,e);return n.isGCIgnored=!0,this._buildRenderTargetWithTexture(n)}_buildRenderTargetWithTexture(t){const{width:e,height:i,depthFormat:o,antiAliasing:r,autoGenerateMipmaps:n}=this,a=o===w?null:o,c=new S(this.engine,e,i,t,a,r);return c.isGCIgnored=!0,c.autoGenerateMipmaps=n,c}_destroyRenderTarget(){var e;const t=this.engineObject;t&&((e=t.getColorTexture(0))==null||e.destroy(),t.destroy())}_replaceCameraRenderTarget(t,e){const i=this.root.projectStore.currentScene;if(!i)return[];const o=[];for(const r of i.entities.values())for(const n of r.components)if(n.type==="Camera"){const a=n.engineObject;(a==null?void 0:a.renderTarget)===t&&(a.renderTarget=e,o.push(a))}return o}async _generateSubAssets(){const t=this.engineObject,e=[],i=t.getColorTexture(0);if(i){i.name=`${this.name}-color`;const o=await this.root.assetStore.createSubAsset("Texture",i,this.id,"colorTextures[0]");o._editable=!0,e.push(o)}this._subAssets=e}_destroySubAssets(){if(this._subAssets){for(const t of this._subAssets)this.root.assetStore.deleteSubAsset(t.id);this._subAssets=[]}}};g([b({type:m.Number,label:"Width",min:1,max:8192,triggerAfterInit:!1,onChange:s=>{s.width=Math.round(s.width),s._rebuild()}}),f()],u.prototype,"width",2);g([b({type:m.Number,label:"Height",min:1,max:8192,triggerAfterInit:!1,onChange:s=>{s.height=Math.round(s.height),s._rebuild()}}),f()],u.prototype,"height",2);g([b({type:m.Select,label:"Color Format",options:I,triggerAfterInit:!1,onChange:s=>s._rebuild()}),f()],u.prototype,"colorFormat",2);g([b({type:m.Select,label:"Depth Format",options:L,triggerAfterInit:!1,onChange:s=>s._rebuild()}),f()],u.prototype,"depthFormat",2);g([b({type:m.Select,label:"Anti-Aliasing",options:U,triggerAfterInit:!1,onChange:s=>s._rebuild()}),f()],u.prototype,"antiAliasing",2);g([b({type:m.Toggle,label:"Auto Generate Mipmaps",triggerAfterInit:!1,onChange:s=>{const t=s.engineObject;t&&(t.autoGenerateMipmaps=s.autoGenerateMipmaps)}}),f()],u.prototype,"autoGenerateMipmaps",2);u=g([G({type:"RenderTarget",label:F("asset.render-target.title"),extname:"renderTarget",importMenuConfig:{type:O.Add},dragLayer:D.RenderTarget,viewer:j,thumbnail:A,async bundle({content:s}){return{content:s}}})],u);export{u as RenderTargetAsset};
1
+ var C=Object.defineProperty;var M=(s,t,e)=>t in s?C(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var h=(s,t,e)=>(M(s,typeof t!="symbol"?t+"":t,e),e);import{$ as R,a9 as y,bJ as l,j as x,bI as v,bK as S,p as b,C as m,m as f,n as G,e as F,o as O,q as D}from"./index-1e23212d.js";import"./index-92830754.js";import{A as B}from"./AssetViewer-0ce46fa1.js";class A{static update(t,e){var o;this.spriteEntity?this.spriteEntity.isActive=!0:this.initScene(t),this.entity=this.spriteEntity;const i=(o=e.engineObject)==null?void 0:o.getColorTexture(0);i&&(this.sprite.texture=i)}static clear(){this.spriteEntity&&(this.spriteEntity.isActive=!1)}static initScene(t){const e=this.spriteEntity=t.createChild("rt-thumbnail");this.spriteRenderer=e.addComponent(R),this.spriteRenderer.sprite=this.sprite=new y(t.engine)}}h(A,"entity"),h(A,"spriteEntity"),h(A,"spriteRenderer"),h(A,"sprite");class j extends B{constructor(){super(...arguments);h(this,"_asset");h(this,"_sprite");h(this,"_onRebuild",()=>{var e;if(this._sprite&&((e=this._asset)!=null&&e.engineObject)){const i=this._asset.engineObject.getColorTexture(0);i&&(this._sprite.texture=i)}})}setViewAsset(e,i){var _;this._asset=e;const o=i.engine,r=i.createChild("rt_preview"),n=(_=e.engineObject)==null?void 0:_.getColorTexture(0),a=new y(o,n),c=r.addComponent(R);c.sprite=a,this._sprite=a,this._entity=r,e.onRebuild(this._onRebuild)}stopViewAsset(){super.stopViewAsset(),this._asset&&this._asset.offRebuild(this._onRebuild),this._asset=null,this._sprite=null}getDescription(e){return`${e.width}x${e.height}`}}var E=Object.defineProperty,V=Object.getOwnPropertyDescriptor,g=(s,t,e,i)=>{for(var o=i>1?void 0:i?V(t,e):t,r=s.length-1,n;r>=0;r--)(n=s[r])&&(o=(i?n(t,e,o):n(o))||o);return i&&o&&E(t,e,o),o};const I=[{label:"R8G8B8A8",value:l.R8G8B8A8},{label:"R8G8B8",value:l.R8G8B8},{label:"R16G16B16A16",value:l.R16G16B16A16},{label:"R32G32B32A32",value:l.R32G32B32A32},{label:"R11G11B10_UFloat",value:l.R11G11B10_UFloat}],w=-1,L=[{label:"None",value:w},{label:"Depth",value:l.Depth},{label:"Depth16",value:l.Depth16},{label:"Depth24",value:l.Depth24},{label:"Depth32",value:l.Depth32},{label:"Depth24Stencil8",value:l.Depth24Stencil8},{label:"Depth32Stencil8",value:l.Depth32Stencil8}],U=[{label:"1",value:1},{label:"2",value:2},{label:"4",value:4},{label:"8",value:8}];let u=class extends x{constructor(){super(...arguments);h(this,"_onRebuildCallbacks",[]);h(this,"width",512);h(this,"height",512);h(this,"colorFormat",l.R8G8B8A8);h(this,"depthFormat",l.Depth);h(this,"antiAliasing",1);h(this,"autoGenerateMipmaps",!0)}registerThumbnail(){}onRebuild(t){this._onRebuildCallbacks.push(t)}offRebuild(t){const e=this._onRebuildCallbacks.indexOf(t);e!==-1&&this._onRebuildCallbacks.splice(e,1)}async initByCreation(){return this.getMainData()}getMainData(){var i;const t={width:this.width,height:this.height,colorFormats:[this.colorFormat],depthFormat:this.depthFormat,antiAliasing:this.antiAliasing,autoGenerateMipmaps:this.autoGenerateMipmaps},e=(i=this.engineObject)==null?void 0:i.getColorTexture(0);return e&&(t.colorTextures=[{isSRGBColorSpace:e.isSRGBColorSpace,mipmap:e.mipmapCount>1,filterMode:e.filterMode,wrapModeU:e.wrapModeU,wrapModeV:e.wrapModeV,anisoLevel:e.anisoLevel}]),JSON.stringify(t)}async initByMain(t){const e=JSON.parse(await t.text());this.width=Math.round(e.width??512),this.height=Math.round(e.height??512);const i=e.colorFormats??[e.colorFormat??l.R8G8B8A8];this.colorFormat=i[0],this.depthFormat=e.depthFormat??l.Depth,this.antiAliasing=e.antiAliasing??1,this.autoGenerateMipmaps=e.autoGenerateMipmaps??!1;const r=(e.colorTextures??(e.colorTexture?[e.colorTexture]:[]))[0],n=this._buildRenderTarget((r==null?void 0:r.mipmap)??!0,r==null?void 0:r.isSRGBColorSpace);await this.bindEngineObject(n);const a=n.getColorTexture(0);a&&r&&(r.filterMode!=null&&(a.filterMode=r.filterMode),r.wrapModeU!=null&&(a.wrapModeU=r.wrapModeU),r.wrapModeV!=null&&(a.wrapModeV=r.wrapModeV),r.anisoLevel!=null&&(a.anisoLevel=r.anisoLevel)),await this._generateSubAssets()}destroy(){this._destroySubAssets(),this.engineObject&&this._replaceCameraRenderTarget(this.engineObject,null),this._onRebuildCallbacks.length=0,this._destroyRenderTarget(),super.destroy()}async _rebuild(){var _;if(!this.engineObject)return;const t=this.engineObject,e=t.getColorTexture(0),i=(_=this._subAssets)==null?void 0:_[0],o=i?i.mipmap??!0:!0,r=i?i.isSRGBColorSpace??this.colorFormat===l.R8G8B8A8:this.colorFormat===l.R8G8B8A8,n=e&&e.format===this.colorFormat&&e.width===this.width&&e.height===this.height&&e.isSRGBColorSpace===r&&o===e.mipmapCount>1;let a;try{a=n?this._buildRenderTargetWithTexture(e):this._buildRenderTarget(o,r)}catch(p){console.warn("Failed to create RenderTarget:",p);return}if(!n&&e){const p=a.getColorTexture(0);p&&(p.filterMode=e.filterMode,p.wrapModeU=e.wrapModeU,p.wrapModeV=e.wrapModeV,p.anisoLevel=e.anisoLevel)}const c=this._replaceCameraRenderTarget(t,a);if(t.destroy(),await this.bindEngineObject(a),n||(e==null||e.destroy(),this._destroySubAssets(),await this._generateSubAssets()),c.length>0){const p=c.map(d=>d.enabled);c.forEach(d=>d.enabled=!0),requestAnimationFrame(()=>{this._onRebuildCallbacks.forEach(d=>d()),c.forEach((d,T)=>d.enabled=p[T])})}else this._onRebuildCallbacks.forEach(p=>p())}_buildRenderTarget(t=!0,e){const{width:i,height:o,colorFormat:r}=this;e===void 0&&(e=r===l.R8G8B8A8);const n=new v(this.engine,i,o,r,t,e);return n.isGCIgnored=!0,this._buildRenderTargetWithTexture(n)}_buildRenderTargetWithTexture(t){const{width:e,height:i,depthFormat:o,antiAliasing:r,autoGenerateMipmaps:n}=this,a=o===w?null:o,c=new S(this.engine,e,i,t,a,r);return c.isGCIgnored=!0,c.autoGenerateMipmaps=n,c}_destroyRenderTarget(){var e;const t=this.engineObject;t&&((e=t.getColorTexture(0))==null||e.destroy(),t.destroy())}_replaceCameraRenderTarget(t,e){const i=this.root.projectStore.currentScene;if(!i)return[];const o=[];for(const r of i.entities.values())for(const n of r.components)if(n.type==="Camera"){const a=n.engineObject;(a==null?void 0:a.renderTarget)===t&&(a.renderTarget=e,o.push(a))}return o}async _generateSubAssets(){const t=this.engineObject,e=[],i=t.getColorTexture(0);if(i){i.name=`${this.name}-color`;const o=await this.root.assetStore.createSubAsset("Texture",i,this.id,"colorTextures[0]");o._editable=!0,e.push(o)}this._subAssets=e}_destroySubAssets(){if(this._subAssets){for(const t of this._subAssets)this.root.assetStore.deleteSubAsset(t.id);this._subAssets=[]}}};g([b({type:m.Number,label:"Width",min:1,max:8192,triggerAfterInit:!1,onChange:s=>{s.width=Math.round(s.width),s._rebuild()}}),f()],u.prototype,"width",2);g([b({type:m.Number,label:"Height",min:1,max:8192,triggerAfterInit:!1,onChange:s=>{s.height=Math.round(s.height),s._rebuild()}}),f()],u.prototype,"height",2);g([b({type:m.Select,label:"Color Format",options:I,triggerAfterInit:!1,onChange:s=>s._rebuild()}),f()],u.prototype,"colorFormat",2);g([b({type:m.Select,label:"Depth Format",options:L,triggerAfterInit:!1,onChange:s=>s._rebuild()}),f()],u.prototype,"depthFormat",2);g([b({type:m.Select,label:"Anti-Aliasing",options:U,triggerAfterInit:!1,onChange:s=>s._rebuild()}),f()],u.prototype,"antiAliasing",2);g([b({type:m.Toggle,label:"Auto Generate Mipmaps",triggerAfterInit:!1,onChange:s=>{const t=s.engineObject;t&&(t.autoGenerateMipmaps=s.autoGenerateMipmaps)}}),f()],u.prototype,"autoGenerateMipmaps",2);u=g([G({type:"RenderTarget",label:F("asset.render-target.title"),extname:"renderTarget",importMenuConfig:{type:O.Add},dragLayer:D.RenderTarget,viewer:j,thumbnail:A,async bundle({content:s}){return{content:s}}})],u);export{u as RenderTargetAsset};
@@ -1 +1 @@
1
- var l=Object.defineProperty;var p=(s,e,t)=>e in s?l(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var o=(s,e,t)=>(p(s,typeof e!="symbol"?e+"":e,t),t);import{j as m,u as h,b2 as d,n as u,e as y,o as f}from"./index-aec7e708.js";import"./index-e8a45e82.js";const D={entities:[{id:"1000000",name:"Camera",isActive:!0,position:{x:0,y:0,z:10},rotation:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},children:[],isClone:!1,components:[{id:"1000100",class:"Camera",props:{isOrthographic:!1,nearClipPlane:.1,farClipPlane:100,viewport:{x:0,y:0,z:1,w:1}},methods:{}}]},{id:"1000001",name:"DirectLight",isActive:!0,position:{x:0,y:3,z:0},rotation:{x:-45,y:-45,z:0},scale:{x:1,y:1,z:1},children:[],isClone:!1,components:[{id:"1000101",class:"DirectLight",props:{enabled:!0,intensity:.6,color:{r:1,g:1,b:1,a:1}},methods:{}}]}],scene:{background:{mode:0,color:{r:.0157,g:.0157,b:.0157,a:1}},ambient:{},shadow:{},fog:{}}};var v=Object.defineProperty,b=Object.getOwnPropertyDescriptor,S=(s,e,t,n)=>{for(var a=n>1?void 0:n?b(e,t):e,i=s.length-1,r;i>=0;i--)(r=s[i])&&(a=(n?r(e,t,a):r(a))||a);return n&&a&&v(e,t,a),a};let c=class extends m{constructor(e){super(e);o(this,"sceneData",null);h(this)}async initByMain(e,t){this.sceneData=JSON.parse(await e.text())}getMainData(){return JSON.stringify(this.sceneData)}async rename(e){await super.rename(e),await this.root.assetFacade.persistAssetMain(this.id)}saveMainImmediately(){const e=this.root.sceneStore;if(this.id===e.refId){if(e.destroyed){d(this.root.projectStore.id,this.serverId);return}return this.sceneData=e.toJSON(),this.sceneData.name=this.name,super.saveMainImmediately()}else{const t=this.sceneData;if(t&&t.name!==this.name)return t.name=this.name,super.saveMainImmediately()}}async initByCreation(e,t,n){return this.sceneData={name:this._name,...D}}onDoubleClick(){this.root.projectStore.switchScene({scene:this.id})}};c=S([u({type:"Scene",label:y("asset.scene.title"),defaultName:"Scene",extname:"scene",importMenuConfig:{type:f.Add},async bundle(s){return{content:new Blob([s.content],{type:"application/json"})}}})],c);export{c as SceneAsset};
1
+ var l=Object.defineProperty;var p=(s,e,t)=>e in s?l(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var o=(s,e,t)=>(p(s,typeof e!="symbol"?e+"":e,t),t);import{j as m,u as h,b2 as d,n as u,e as y,o as f}from"./index-1e23212d.js";import"./index-92830754.js";const D={entities:[{id:"1000000",name:"Camera",isActive:!0,position:{x:0,y:0,z:10},rotation:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},children:[],isClone:!1,components:[{id:"1000100",class:"Camera",props:{isOrthographic:!1,nearClipPlane:.1,farClipPlane:100,viewport:{x:0,y:0,z:1,w:1}},methods:{}}]},{id:"1000001",name:"DirectLight",isActive:!0,position:{x:0,y:3,z:0},rotation:{x:-45,y:-45,z:0},scale:{x:1,y:1,z:1},children:[],isClone:!1,components:[{id:"1000101",class:"DirectLight",props:{enabled:!0,intensity:.6,color:{r:1,g:1,b:1,a:1}},methods:{}}]}],scene:{background:{mode:0,color:{r:.0157,g:.0157,b:.0157,a:1}},ambient:{},shadow:{},fog:{}}};var v=Object.defineProperty,b=Object.getOwnPropertyDescriptor,S=(s,e,t,n)=>{for(var a=n>1?void 0:n?b(e,t):e,i=s.length-1,r;i>=0;i--)(r=s[i])&&(a=(n?r(e,t,a):r(a))||a);return n&&a&&v(e,t,a),a};let c=class extends m{constructor(e){super(e);o(this,"sceneData",null);h(this)}async initByMain(e,t){this.sceneData=JSON.parse(await e.text())}getMainData(){return JSON.stringify(this.sceneData)}async rename(e){await super.rename(e),await this.root.assetFacade.persistAssetMain(this.id)}saveMainImmediately(){const e=this.root.sceneStore;if(this.id===e.refId){if(e.destroyed){d(this.root.projectStore.id,this.serverId);return}return this.sceneData=e.toJSON(),this.sceneData.name=this.name,super.saveMainImmediately()}else{const t=this.sceneData;if(t&&t.name!==this.name)return t.name=this.name,super.saveMainImmediately()}}async initByCreation(e,t,n){return this.sceneData={name:this._name,...D}}onDoubleClick(){this.root.projectStore.switchScene({scene:this.id})}};c=S([u({type:"Scene",label:y("asset.scene.title"),defaultName:"Scene",extname:"scene",importMenuConfig:{type:f.Add},async bundle(s){return{content:new Blob([s.content],{type:"application/json"})}}})],c);export{c as SceneAsset};
@@ -1,4 +1,4 @@
1
- var k=Object.defineProperty;var $=(i,e,r)=>e in i?k(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r;var g=(i,e,r)=>($(i,typeof e!="symbol"?e+"":e,r),r);import{aO as H,aQ as G,aS as T,e as A,C as l,bu as Q,aW as X,bv as z,bw as K,j as Z,u as q,bx as J,N as w,K as E,V as N,B as O,by as Y,bz as ee,bA as te,ao as L,bB as re,bC as se,a$ as ae,x as ie,bD as oe,n as ne,o as ce}from"./index-aec7e708.js";import"./index-e8a45e82.js";import{E as S,b as le,s as de}from"./ProxyConfigs-3a5fd860.js";import{I as pe}from"./IconPointFilled-811fc660.js";import{F as ue}from"./index-74130ff3.js";import{c as j,E as U,b as he}from"./ShaderUIScriptAsset-fc503291.js";H(pe,{variants:{checked:{true:{color:"$green10"}}}});const fe=G(i=>{const{asset:e}=i;if(e.compileError)return T.jsx(ue,{label:A("shader.inspector.compile-error"),value:e.compileError});const r=[],t={};for(const a of e.properties??[]){const{uiInfo:s}=a;if(!s||s.hide)continue;const o=s.assetType??s.type,n={label:s.label,type:l.PureDisplay,disabled:!0,value:a.bundleType==="macro"?"MACRO":o,property:a.prop};if(s.group){const c=t[a.uiInfo.group]??{children:[],type:l.Group,property:s.group};c.children.push(n),t[s.group]=c}else r.push(n)}for(const a in t)r.push(t[a]);return T.jsxs(T.Fragment,{children:[T.jsx(Q,{inspectorConfig:{property:A("shader.inspector.properties"),type:l.Group,children:r},onModelChange:null,model:e},"Properties"),e.shaderScriptRefId&&T.jsx(X.Item,{model:e,inspectorConfig:{label:A("shader.inspector.included-ui-script"),type:l.Display,disabled:!0,property:"uiScript",value:e.root.assetStore.assets[e.shaderScriptRefId.refId].getRouteString()},onModelChange:null})]})}),Se={Unlit:{filename:"UnlitShader.shader",uiScriptTemplateType:j.UnlitUIScript,uiScriptFileName:"UnlitScript.ts"},PBR:{filename:"PBRShader.shader",uiScriptTemplateType:j.PbrUIScript,uiScriptFileName:"PBRScript.ts"},Sprite:{filename:"SpriteShader.shader"}},me=`
1
+ var k=Object.defineProperty;var $=(i,e,r)=>e in i?k(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r;var g=(i,e,r)=>($(i,typeof e!="symbol"?e+"":e,r),r);import{aO as H,aQ as G,aS as T,e as A,C as l,bu as Q,aW as X,bv as z,bw as K,j as Z,u as q,bx as J,N as w,K as E,V as N,B as O,by as Y,bz as ee,bA as te,ao as L,bB as re,bC as se,a$ as ae,x as ie,bD as oe,n as ne,o as ce}from"./index-1e23212d.js";import"./index-92830754.js";import{E as S,b as le,s as de}from"./ProxyConfigs-ad92ebc7.js";import{I as pe}from"./IconPointFilled-209638e2.js";import{F as ue}from"./index-b2e1cba4.js";import{c as j,E as U,b as he}from"./ShaderUIScriptAsset-ac824e68.js";H(pe,{variants:{checked:{true:{color:"$green10"}}}});const fe=G(i=>{const{asset:e}=i;if(e.compileError)return T.jsx(ue,{label:A("shader.inspector.compile-error"),value:e.compileError});const r=[],t={};for(const a of e.properties??[]){const{uiInfo:s}=a;if(!s||s.hide)continue;const o=s.assetType??s.type,n={label:s.label,type:l.PureDisplay,disabled:!0,value:a.bundleType==="macro"?"MACRO":o,property:a.prop};if(s.group){const c=t[a.uiInfo.group]??{children:[],type:l.Group,property:s.group};c.children.push(n),t[s.group]=c}else r.push(n)}for(const a in t)r.push(t[a]);return T.jsxs(T.Fragment,{children:[T.jsx(Q,{inspectorConfig:{property:A("shader.inspector.properties"),type:l.Group,children:r},onModelChange:null,model:e},"Properties"),e.shaderScriptRefId&&T.jsx(X.Item,{model:e,inspectorConfig:{label:A("shader.inspector.included-ui-script"),type:l.Display,disabled:!0,property:"uiScript",value:e.root.assetStore.assets[e.shaderScriptRefId.refId].getRouteString()},onModelChange:null})]})}),Se={Unlit:{filename:"UnlitShader.shader",uiScriptTemplateType:j.UnlitUIScript,uiScriptFileName:"UnlitScript.ts"},PBR:{filename:"PBRShader.shader",uiScriptTemplateType:j.PbrUIScript,uiScriptFileName:"PBRScript.ts"},Sprite:{filename:"SpriteShader.shader"}},me=`
2
2
  RenderQueueType renderQueueType;
3
3
  BlendFactor sourceColorBlendFactor;
4
4
  BlendFactor destinationColorBlendFactor;
@@ -1,4 +1,4 @@
1
- var T=Object.defineProperty;var j=(s,e,t)=>e in s?T(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var m=(s,e,t)=>(j(s,typeof e!="symbol"?e+"":e,t),t);import{L as D}from"./module-ffeaf99f.js";import{aO as R,aQ as w,aU as x,aS as h,bN as O,q as A,j as v,a$ as F,x as P,m as M,n as _,e as b,c5 as $,u as E,c6 as d,bz as B,bA as L,p as k,C as U,o as z}from"./index-aec7e708.js";import{u as N}from"./index-e8a45e82.js";import"./postmen-2f47f6bb.js";import{F as S}from"./index-74130ff3.js";import{F as q}from"./FormItemArray-6d69acd4.js";import{s as Q}from"./SpineSkeletonDataAsset-27244892.js";const V=R("div",{marginTop:"20px",fontSize:"12px",fontWeight:500,color:"$gray12"}),W=w(function(s){const{asset:{textures:e,textureAtlas:t,missingTexture:r}}=s,{assetStore:o}=N(),[l,a]=x.useState([]),u=x.useMemo(()=>{if(!t)return[];const n=t.pages,i=[];for(let p=0;p<n.length;p+=1){const c=n[p];i.push({name:c.name,regions:c.regions.map(C=>C.name)})}return i},[t]);return x.useEffect(()=>{let n=!1;return Promise.all(e.map(i=>o.getAssetByRef(i))).then(i=>{n||a(i)}).catch(i=>{n||(console.warn("[SpineAtlasInspector] Failed to load atlas textures:",i),a([]))}),()=>{n=!0}},[o,e]),r?h.jsx(V,{children:"Missing atlas texture, please reupload atlas and image files."}):h.jsxs(h.Fragment,{children:[h.jsx(S,{label:"atlas textures",value:""}),l.map((n,i)=>h.jsx(O,{dropLayer:A.Texture,label:"",value:n.name,assets:[],asset:n,onLocate:()=>{var c;const p=(c=e==null?void 0:e[i])==null?void 0:c.refId;p&&o.selectAsset(p)}},n.id)),h.jsx(S,{label:"atlas regions",value:""}),h.jsx(q,{label:"",items:u.map((n,i)=>({removable:!1,children:n.regions.map(c=>h.jsx(S,{label:"",value:c},c)),id:`${i}`,name:n.name}))})]})});var G=Object.defineProperty,H=Object.getOwnPropertyDescriptor,g=(s,e,t,r)=>{for(var o=r>1?void 0:r?H(e,t):e,l=s.length-1,a;l>=0;l--)(a=s[l])&&(o=(r?a(e,t,o):a(o))||o);return r&&o&&G(e,t,o),o};let f=class extends v{constructor(e){super(e);m(this,"_textureAtlas");m(this,"textures",[]);m(this,"atlasText","");m(this,"missingTexture",!1)}get textureAtlas(){return this._textureAtlas}async initByMain(e){this.atlasText=await e.text();const t=this.meta,{textures:r}=t;this.textures=r;const l=(await Promise.all(this.textures.map(n=>this.root.assetStore.getAssetByRef(n)))).map(n=>n==null?void 0:n.engineObject),a=l.some(n=>n==null)||r.length===0;if(this.missingTexture=a,a)return;const u=D.createTextureAtlas(this.atlasText,l);this._textureAtlas=u}};g([F(),P],f.prototype,"textures",2);g([M()],f.prototype,"atlasText",2);g([P],f.prototype,"missingTexture",2);f=g([_({type:"SpineAtlas",label:b("asset.spine-atlas.title"),dragLayer:A.SpineAtlas,customInspector:W,loaderType:"SpineAtlas",preUpload:Q,bundle(s){return s.dependencies=$(s.meta,["textures"]),{content:s.content}}})],f);function J(s){return`// ${s}
1
+ var T=Object.defineProperty;var j=(s,e,t)=>e in s?T(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var m=(s,e,t)=>(j(s,typeof e!="symbol"?e+"":e,t),t);import{L as D}from"./module-498119f3.js";import{aO as R,aQ as w,aU as x,aS as h,bN as O,q as A,j as v,a$ as F,x as P,m as M,n as _,e as b,c5 as $,u as E,c6 as d,bz as B,bA as L,p as k,C as U,o as z}from"./index-1e23212d.js";import{u as N}from"./index-92830754.js";import"./postmen-9e1e15bd.js";import{F as S}from"./index-b2e1cba4.js";import{F as q}from"./FormItemArray-a2f72cf1.js";import{s as Q}from"./SpineSkeletonDataAsset-5b202ba0.js";const V=R("div",{marginTop:"20px",fontSize:"12px",fontWeight:500,color:"$gray12"}),W=w(function(s){const{asset:{textures:e,textureAtlas:t,missingTexture:r}}=s,{assetStore:o}=N(),[l,a]=x.useState([]),u=x.useMemo(()=>{if(!t)return[];const n=t.pages,i=[];for(let p=0;p<n.length;p+=1){const c=n[p];i.push({name:c.name,regions:c.regions.map(C=>C.name)})}return i},[t]);return x.useEffect(()=>{let n=!1;return Promise.all(e.map(i=>o.getAssetByRef(i))).then(i=>{n||a(i)}).catch(i=>{n||(console.warn("[SpineAtlasInspector] Failed to load atlas textures:",i),a([]))}),()=>{n=!0}},[o,e]),r?h.jsx(V,{children:"Missing atlas texture, please reupload atlas and image files."}):h.jsxs(h.Fragment,{children:[h.jsx(S,{label:"atlas textures",value:""}),l.map((n,i)=>h.jsx(O,{dropLayer:A.Texture,label:"",value:n.name,assets:[],asset:n,onLocate:()=>{var c;const p=(c=e==null?void 0:e[i])==null?void 0:c.refId;p&&o.selectAsset(p)}},n.id)),h.jsx(S,{label:"atlas regions",value:""}),h.jsx(q,{label:"",items:u.map((n,i)=>({removable:!1,children:n.regions.map(c=>h.jsx(S,{label:"",value:c},c)),id:`${i}`,name:n.name}))})]})});var G=Object.defineProperty,H=Object.getOwnPropertyDescriptor,g=(s,e,t,r)=>{for(var o=r>1?void 0:r?H(e,t):e,l=s.length-1,a;l>=0;l--)(a=s[l])&&(o=(r?a(e,t,o):a(o))||o);return r&&o&&G(e,t,o),o};let f=class extends v{constructor(e){super(e);m(this,"_textureAtlas");m(this,"textures",[]);m(this,"atlasText","");m(this,"missingTexture",!1)}get textureAtlas(){return this._textureAtlas}async initByMain(e){this.atlasText=await e.text();const t=this.meta,{textures:r}=t;this.textures=r;const l=(await Promise.all(this.textures.map(n=>this.root.assetStore.getAssetByRef(n)))).map(n=>n==null?void 0:n.engineObject),a=l.some(n=>n==null)||r.length===0;if(this.missingTexture=a,a)return;const u=D.createTextureAtlas(this.atlasText,l);this._textureAtlas=u}};g([F(),P],f.prototype,"textures",2);g([M()],f.prototype,"atlasText",2);g([P],f.prototype,"missingTexture",2);f=g([_({type:"SpineAtlas",label:b("asset.spine-atlas.title"),dragLayer:A.SpineAtlas,customInspector:W,loaderType:"SpineAtlas",preUpload:Q,bundle(s){return s.dependencies=$(s.meta,["textures"]),{content:s.content}}})],f);function J(s){return`// ${s}
2
2
  float function() {
3
3
  return 3.1415926;
4
4
  }
@@ -1,4 +1,4 @@
1
- var P=Object.defineProperty;var F=(t,a,e)=>a in t?P(t,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[a]=e;var d=(t,a,e)=>(F(t,typeof a!="symbol"?a+"":a,e),e);import{aQ as U,C as h,aS as u,bu as m,j as O,u as N,bz as C,bA as f,x,a$ as R,p as B,e as y,bD as w,n as H,q as Q,o as k,eb as X,ec as j,ed as V,by as $,bx as G}from"./index-aec7e708.js";import"./index-e8a45e82.js";function z(t){return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}var c=(t=>(t.Default="default",t.ShaderUI="shader_ui",t.StateMachine="state_machine",t))(c||{});const W=`import { Script } from '@galacean/engine';
1
+ var P=Object.defineProperty;var F=(t,a,e)=>a in t?P(t,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[a]=e;var d=(t,a,e)=>(F(t,typeof a!="symbol"?a+"":a,e),e);import{aQ as U,C as h,aS as u,bu as m,j as O,u as N,bz as C,bA as f,x,a$ as R,p as B,e as y,bD as w,n as H,q as Q,o as k,eb as X,ec as j,ed as V,by as $,bx as G}from"./index-1e23212d.js";import"./index-92830754.js";function z(t){return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}var c=(t=>(t.Default="default",t.ShaderUI="shader_ui",t.StateMachine="state_machine",t))(c||{});const W=`import { Script } from '@galacean/engine';
2
2
  /**
3
3
  * 脚本参考: https://galacean.antgroup.com/engine/docs/script/class
4
4
  */
@@ -1 +1 @@
1
- var y=Object.defineProperty;var j=(s,e,r)=>e in s?y(s,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[e]=r;var c=(s,e,r)=>(j(s,typeof e!="symbol"?e+"":e,r),r);import{aQ as m,bm as S,aR as b,aS as t,aD as v,aF as d,aO as f,aP as g,aU as u,aW as k,aV as B,f as F,p as h,C as O,s as R}from"./index-aec7e708.js";import{u as E}from"./index-e8a45e82.js";import{c as I}from"./Component-ed7aa0ab.js";import{c as M}from"./createOnModelChange-b57a0da8.js";import{M as P}from"./MaterialInspector-e8242674.js";import{M as _}from"./MeshRendererBaseComponent-9efd3943.js";import"./IconPointFilled-811fc660.js";const x=m(S),z=m(({model:s,inspectorConfig:e,onModelChange:r})=>{const{disabled:n,property:o}=e,{t:l}=b();return t.jsxs(t.Fragment,{children:[t.jsx(v,{label:l(e.label),info:l(e.info),fieldCss:{minHeight:"$5"},children:t.jsx(d,{size:"sm",selectable:!0,code:!0,children:null})}),t.jsx(x,{label:" ",disabled:n,value:s[o].min,onChange:a=>{r==null||r(o,{...s[o],min:a})},formEndSlot:t.jsx(d,{size:"sm",selectable:!0,code:!0,children:l("skinned-mesh-renderer.local-bounds.min.label")})}),t.jsx(x,{label:" ",disabled:n,value:s[o].max,onChange:a=>{r==null||r(o,{...s[o],max:a})},formEndSlot:t.jsx(d,{size:"sm",selectable:!0,code:!0,children:l("skinned-mesh-renderer.local-bounds.max.label")})})]})}),C=f("div",{marginLeft:"5px"}),T=f(g,{border:"1px solid $gray6",borderRadius:"$2",padding:"$0_5",color:"$gray11",cursor:"pointer"}),$=m(function(s){const e=s.data,{t:r}=b();return t.jsxs(T,{align:"v",children:[t.jsx("img",{src:e.thumbnailUrl,alt:"Material Thumbnail",width:"20px",height:"20px"}),t.jsxs(C,{children:[r("skinned-mesh-renderer.material.label"),"(",e.name,")"]})]})}),V=m(function(s){const[e,r]=u.useState(null),n=s.data,{assetStore:o,inspectorFacade:l}=E();return u.useEffect(()=>{o.getAssetByRef(n.material).then(a=>{r(a)})},[n.material]),t.jsxs(t.Fragment,{children:[t.jsx(k.List,{model:n,configs:n.formSchema.items,onModelChange:M("component",n.id,l,n)}),e&&t.jsx(B,{nesting:!0,title:t.jsx($,{data:e}),open:n.materialOpen,onOpenChange:a=>{n.setMaterialOpen(a)},children:t.jsx(P,{asset:e})})]})});var w=Object.defineProperty,D=Object.getOwnPropertyDescriptor,p=(s,e,r,n)=>{for(var o=n>1?void 0:n?D(e,r):e,l=s.length-1,a;l>=0;l--)(a=s[l])&&(o=(n?a(e,r,o):a(o))||o);return n&&o&&w(e,r,o),o};let i=class extends _{constructor(e,r){super(e,r);c(this,"rootBone",null);c(this,"localBounds",{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}})}};p([F({getEngineValue:s=>{var e;return(e=s.skin)==null?void 0:e.rootBone}}),h({label:"skinned-mesh-renderer.skin.root-bone.label",info:"skinned-mesh-renderer.skin.root-bone.info",type:O.EntityPicker,disabled:!0})],i.prototype,"rootBone",2);p([h({label:"skinned-mesh-renderer.local-bounds.title",info:"skinned-mesh-renderer.local-bounds.info",customComponent:z,type:"BoundingBox"}),R()],i.prototype,"localBounds",2);i=p([I({type:"SkinnedMeshRenderer",customInspector:V,componentsMenu:{label:"component.renderer.skinned-mesh.title"}})],i);export{i as SkinnedMeshRendererComponent};
1
+ var y=Object.defineProperty;var j=(s,e,r)=>e in s?y(s,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[e]=r;var c=(s,e,r)=>(j(s,typeof e!="symbol"?e+"":e,r),r);import{aQ as m,bm as S,aR as b,aS as t,aD as v,aF as d,aO as f,aP as g,aU as u,aW as k,aV as B,f as F,p as h,C as O,s as R}from"./index-1e23212d.js";import{u as E}from"./index-92830754.js";import{c as I}from"./Component-746be670.js";import{c as M}from"./createOnModelChange-b57a0da8.js";import{M as P}from"./MaterialInspector-a36197f2.js";import{M as _}from"./MeshRendererBaseComponent-4a3af376.js";import"./IconPointFilled-209638e2.js";const x=m(S),z=m(({model:s,inspectorConfig:e,onModelChange:r})=>{const{disabled:n,property:o}=e,{t:l}=b();return t.jsxs(t.Fragment,{children:[t.jsx(v,{label:l(e.label),info:l(e.info),fieldCss:{minHeight:"$5"},children:t.jsx(d,{size:"sm",selectable:!0,code:!0,children:null})}),t.jsx(x,{label:" ",disabled:n,value:s[o].min,onChange:a=>{r==null||r(o,{...s[o],min:a})},formEndSlot:t.jsx(d,{size:"sm",selectable:!0,code:!0,children:l("skinned-mesh-renderer.local-bounds.min.label")})}),t.jsx(x,{label:" ",disabled:n,value:s[o].max,onChange:a=>{r==null||r(o,{...s[o],max:a})},formEndSlot:t.jsx(d,{size:"sm",selectable:!0,code:!0,children:l("skinned-mesh-renderer.local-bounds.max.label")})})]})}),C=f("div",{marginLeft:"5px"}),T=f(g,{border:"1px solid $gray6",borderRadius:"$2",padding:"$0_5",color:"$gray11",cursor:"pointer"}),$=m(function(s){const e=s.data,{t:r}=b();return t.jsxs(T,{align:"v",children:[t.jsx("img",{src:e.thumbnailUrl,alt:"Material Thumbnail",width:"20px",height:"20px"}),t.jsxs(C,{children:[r("skinned-mesh-renderer.material.label"),"(",e.name,")"]})]})}),V=m(function(s){const[e,r]=u.useState(null),n=s.data,{assetStore:o,inspectorFacade:l}=E();return u.useEffect(()=>{o.getAssetByRef(n.material).then(a=>{r(a)})},[n.material]),t.jsxs(t.Fragment,{children:[t.jsx(k.List,{model:n,configs:n.formSchema.items,onModelChange:M("component",n.id,l,n)}),e&&t.jsx(B,{nesting:!0,title:t.jsx($,{data:e}),open:n.materialOpen,onOpenChange:a=>{n.setMaterialOpen(a)},children:t.jsx(P,{asset:e})})]})});var w=Object.defineProperty,D=Object.getOwnPropertyDescriptor,p=(s,e,r,n)=>{for(var o=n>1?void 0:n?D(e,r):e,l=s.length-1,a;l>=0;l--)(a=s[l])&&(o=(n?a(e,r,o):a(o))||o);return n&&o&&w(e,r,o),o};let i=class extends _{constructor(e,r){super(e,r);c(this,"rootBone",null);c(this,"localBounds",{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}})}};p([F({getEngineValue:s=>{var e;return(e=s.skin)==null?void 0:e.rootBone}}),h({label:"skinned-mesh-renderer.skin.root-bone.label",info:"skinned-mesh-renderer.skin.root-bone.info",type:O.EntityPicker,disabled:!0})],i.prototype,"rootBone",2);p([h({label:"skinned-mesh-renderer.local-bounds.title",info:"skinned-mesh-renderer.local-bounds.info",customComponent:z,type:"BoundingBox"}),R()],i.prototype,"localBounds",2);i=p([I({type:"SkinnedMeshRenderer",customInspector:V,componentsMenu:{label:"component.renderer.skinned-mesh.title"}})],i);export{i as SkinnedMeshRendererComponent};
@@ -1 +1 @@
1
- var F=Object.defineProperty;var S=(e,i,n)=>i in e?F(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n;var a=(e,i,n)=>(S(e,typeof i!="symbol"?i+"":i,n),n);import{S as v,a as B}from"./module-ffeaf99f.js";import{aQ as h,bl as b,e as y,E as N,x as g,p as l,C as f,s as m}from"./index-aec7e708.js";import{u as k}from"./index-e8a45e82.js";import{c as O}from"./Component-ed7aa0ab.js";import"./postmen-2f47f6bb.js";const P=h(function(e){const{model:i}=e,{inspectorFacade:n}=k();return b({label:y("spine.animation.label"),value:i.animationName,options:i.animationForm,onChange(t){n.componentChange(i.id,"animationName",t)}})}),_=h(function(e){const{model:i}=e,{inspectorFacade:n}=k();return b({label:y("spine.skin.label"),value:i.skinName,options:i.skinForm,onChange(t){n.componentChange(i.id,"skinName",t)}})});var j=Object.defineProperty,I=Object.getOwnPropertyDescriptor,p=(e,i,n,t)=>{for(var o=t>1?void 0:t?I(i,n):i,c=e.length-1,u;c>=0;c--)(u=e[c])&&(o=(t?u(i,n,o):u(o))||o);return t&&o&&j(i,n,o),o};let s=class extends N{constructor(i,n){super(i,n);a(this,"animationForm",[]);a(this,"skinForm",[]);a(this,"hasInit",!1);a(this,"resource",null);a(this,"loop",!1);a(this,"animationName","none");a(this,"skinName","default");a(this,"priority",0);a(this,"premultipliedAlpha",!1);a(this,"tintBlack",!1)}deserialize(i){const{props:n}=i;if(this._enabled=(n==null?void 0:n.enabled)??!0,n){this.priority=n.priority,this.resource=n.resource,this.premultipliedAlpha=n.premultipliedAlpha,this.tintBlack=n.tintBlack??!1;const{animationName:t,skinName:o,loop:c}=n.defaultConfig;this.animationName=t||"none",this.skinName=o,this.loop=c}super.deserialize(i)}toJSON(){const i=this.animationName==="none"?null:this.animationName;return{id:this.id,class:this.type,props:{enabled:this.enabled,priority:this.priority,resource:this.resource,premultipliedAlpha:this.premultipliedAlpha,tintBlack:this.tintBlack,defaultConfig:{animationName:i,skinName:this.skinName,loop:this.loop}}}}};p([g],s.prototype,"animationForm",2);p([g],s.prototype,"skinForm",2);p([l({label:"spine.resource.label",info:"spine.resource.info",type:f.AssetPicker,assetType:"SpineSkeletonData",onChange:async(e,i,n)=>{const t=e.engineObject;if(n){t.enabled=!0;const{skeletonData:o}=n;if(!o)return;const u=o.animations.map(r=>r.name).map(r=>({label:r,value:r}));u.unshift({label:"none",value:"none"}),e.animationForm=u,e.skinForm=o.skins.map(r=>({label:r.name,value:r.name})),e.hasInit?(e.animationName="none",e.skinName="default"):e.hasInit=!0;const{loop:d,skinName:C}=e,A=e.animationName==="none"?null:e.animationName;t.defaultConfig.animationName=A,t.defaultConfig.skinName=C,t.defaultConfig.loop=d,t.resource=new v(t.engine,o)}else t.enabled=!1,e.animationName="none",e.animationForm.length=0,e.skinForm.length=0,e.premultipliedAlpha=!1,e.tintBlack=!1}}),m()],s.prototype,"resource",2);p([l({label:"spine.loop.label",info:"spine.loop.info",type:f.Toggle,onChange(e,i,n){const{state:t}=e.engineObject;if(t){const o=t.getCurrent(0);o&&(o.loop=n)}}}),m()],s.prototype,"loop",2);p([l({info:"spine.animation.info",customComponent:P,onChange(e,i,n){const{state:t}=e.engineObject;t&&(n==="none"?t.setEmptyAnimation(0,0):t.setAnimation(0,n,e.loop))}}),m()],s.prototype,"animationName",2);p([l({info:"spine.skin.info",customComponent:_,onChange(e,i,n){const{engineObject:{skeleton:t}}=e;t&&n&&(t.setSkinByName(n),t.setSlotsToSetupPose())}}),m()],s.prototype,"skinName",2);p([l({label:"spine.priority.label",info:"spine.priority.info",type:f.Number,bindPath:"priority"}),m()],s.prototype,"priority",2);p([l({label:"spine.premultiplied-alpha.label",info:"spine.premultiplied-alpha.info",type:f.Toggle,bindPath:"premultipliedAlpha"}),m()],s.prototype,"premultipliedAlpha",2);p([l({label:"spine.tint-black.label",info:"spine.tint-black.info",type:f.Toggle,bindPath:"tintBlack"}),m()],s.prototype,"tintBlack",2);s=p([O({type:"SpineAnimationRenderer",componentsMenu:{group:"2D",label:"component.spine-animation.title"}})],s);N.registerCustomEngineComponent("SpineAnimationRenderer",B);export{s as SpineAnimationComponent};
1
+ var F=Object.defineProperty;var S=(e,i,n)=>i in e?F(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n;var a=(e,i,n)=>(S(e,typeof i!="symbol"?i+"":i,n),n);import{S as v,a as B}from"./module-498119f3.js";import{aQ as h,bl as b,e as y,E as N,x as g,p as l,C as f,s as m}from"./index-1e23212d.js";import{u as k}from"./index-92830754.js";import{c as O}from"./Component-746be670.js";import"./postmen-9e1e15bd.js";const P=h(function(e){const{model:i}=e,{inspectorFacade:n}=k();return b({label:y("spine.animation.label"),value:i.animationName,options:i.animationForm,onChange(t){n.componentChange(i.id,"animationName",t)}})}),_=h(function(e){const{model:i}=e,{inspectorFacade:n}=k();return b({label:y("spine.skin.label"),value:i.skinName,options:i.skinForm,onChange(t){n.componentChange(i.id,"skinName",t)}})});var j=Object.defineProperty,I=Object.getOwnPropertyDescriptor,p=(e,i,n,t)=>{for(var o=t>1?void 0:t?I(i,n):i,c=e.length-1,u;c>=0;c--)(u=e[c])&&(o=(t?u(i,n,o):u(o))||o);return t&&o&&j(i,n,o),o};let s=class extends N{constructor(i,n){super(i,n);a(this,"animationForm",[]);a(this,"skinForm",[]);a(this,"hasInit",!1);a(this,"resource",null);a(this,"loop",!1);a(this,"animationName","none");a(this,"skinName","default");a(this,"priority",0);a(this,"premultipliedAlpha",!1);a(this,"tintBlack",!1)}deserialize(i){const{props:n}=i;if(this._enabled=(n==null?void 0:n.enabled)??!0,n){this.priority=n.priority,this.resource=n.resource,this.premultipliedAlpha=n.premultipliedAlpha,this.tintBlack=n.tintBlack??!1;const{animationName:t,skinName:o,loop:c}=n.defaultConfig;this.animationName=t||"none",this.skinName=o,this.loop=c}super.deserialize(i)}toJSON(){const i=this.animationName==="none"?null:this.animationName;return{id:this.id,class:this.type,props:{enabled:this.enabled,priority:this.priority,resource:this.resource,premultipliedAlpha:this.premultipliedAlpha,tintBlack:this.tintBlack,defaultConfig:{animationName:i,skinName:this.skinName,loop:this.loop}}}}};p([g],s.prototype,"animationForm",2);p([g],s.prototype,"skinForm",2);p([l({label:"spine.resource.label",info:"spine.resource.info",type:f.AssetPicker,assetType:"SpineSkeletonData",onChange:async(e,i,n)=>{const t=e.engineObject;if(n){t.enabled=!0;const{skeletonData:o}=n;if(!o)return;const u=o.animations.map(r=>r.name).map(r=>({label:r,value:r}));u.unshift({label:"none",value:"none"}),e.animationForm=u,e.skinForm=o.skins.map(r=>({label:r.name,value:r.name})),e.hasInit?(e.animationName="none",e.skinName="default"):e.hasInit=!0;const{loop:d,skinName:C}=e,A=e.animationName==="none"?null:e.animationName;t.defaultConfig.animationName=A,t.defaultConfig.skinName=C,t.defaultConfig.loop=d,t.resource=new v(t.engine,o)}else t.enabled=!1,e.animationName="none",e.animationForm.length=0,e.skinForm.length=0,e.premultipliedAlpha=!1,e.tintBlack=!1}}),m()],s.prototype,"resource",2);p([l({label:"spine.loop.label",info:"spine.loop.info",type:f.Toggle,onChange(e,i,n){const{state:t}=e.engineObject;if(t){const o=t.getCurrent(0);o&&(o.loop=n)}}}),m()],s.prototype,"loop",2);p([l({info:"spine.animation.info",customComponent:P,onChange(e,i,n){const{state:t}=e.engineObject;t&&(n==="none"?t.setEmptyAnimation(0,0):t.setAnimation(0,n,e.loop))}}),m()],s.prototype,"animationName",2);p([l({info:"spine.skin.info",customComponent:_,onChange(e,i,n){const{engineObject:{skeleton:t}}=e;t&&n&&(t.setSkinByName(n),t.setSlotsToSetupPose())}}),m()],s.prototype,"skinName",2);p([l({label:"spine.priority.label",info:"spine.priority.info",type:f.Number,bindPath:"priority"}),m()],s.prototype,"priority",2);p([l({label:"spine.premultiplied-alpha.label",info:"spine.premultiplied-alpha.info",type:f.Toggle,bindPath:"premultipliedAlpha"}),m()],s.prototype,"premultipliedAlpha",2);p([l({label:"spine.tint-black.label",info:"spine.tint-black.info",type:f.Toggle,bindPath:"tintBlack"}),m()],s.prototype,"tintBlack",2);s=p([O({type:"SpineAnimationRenderer",componentsMenu:{group:"2D",label:"component.spine-animation.title"}})],s);N.registerCustomEngineComponent("SpineAnimationRenderer",B);export{s as SpineAnimationComponent};
@@ -1 +1 @@
1
- var I=Object.defineProperty;var j=(t,s,e)=>s in t?I(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e;var c=(t,s,e)=>(j(t,typeof s!="symbol"?s+"":s,e),e);import{c7 as b,e as w,aO as $,u as B,S as U,aQ as q,aU as C,aS as A,c8 as z,x as g,aL as k,c9 as V,ca as M,j as J,_ as K,cb as L,p as W,C as X,a$ as Y,m as Q,n as G,q as H,o as Z,c5 as ee,by as te}from"./index-aec7e708.js";import{b as ne,c as se,T as ie,d as ae,R as oe,M as re,B as le,P as pe,e as ce,C as ue,f as me,a as v,S as T,L as he}from"./module-ffeaf99f.js";import"./index-e8a45e82.js";import"./postmen-2f47f6bb.js";import{A as de}from"./AssetViewer-64cd01fa.js";const x=new Map;function fe(t){return t??""}function ge(t){return`${t.name}|${t.size}|${t.lastModified}|${t.type}`}function ye(t,s){const{uploadAssetFile:e,assetType:n,parentFolderId:i,assetMeta:a}=s,o=i??t.currentFolderId??"",r=b(e.main,"upload.bin"),u=ge(r),l=fe(a);return`${o}|${n}|${u}|${l}`}function N(t,s){const e=ye(t,s),n=x.get(e);if(n)return n;const i=t.createAssetByUpload(s).finally(()=>{x.get(e)===i&&x.delete(e)});return x.set(e,i),i}var O=(t=>(t.region="region",t.boundingbox="boundingbox",t.mesh="mesh",t.linkedmesh="linkedmesh",t.path="path",t.point="point",t.clipping="clipping",t.sequence="sequence",t))(O||{});const Ae=["region","linkedmesh","mesh"];async function we(t,s){const e={uploadFiles:[],usedFiles:[],errors:[]},{atlasRawFiles:n,atlasFound:i}=await ke(t,e),a=await Promise.all(n.map(l=>N(s.root.assetFacade,{uploadAssetFile:l,assetType:"SpineAtlas"})));e.usedFiles.push(...n.flatMap(l=>[b(l.main,"spine.atlas"),...Object.values(l.subFiles)]));const o=await Se(t,e);o.length>0&&!i&&e.errors.push(w("spine.error.no-atlas-file"));const r=o.map(l=>(e.usedFiles.push(l.spineFile),xe(l,a,e)));let u=await Promise.all(r);return u=u.filter(l=>l!==null),e.uploadFiles.push(...u),e}async function ke(t,s){const e=[];let n=!1;for(const i in t){const a=t[i];if(a.name.endsWith(".atlas")){n=!0;const r=await Pe(t,a);if(r.length>0){const u={};r.forEach(l=>u[l.name]=l),e.push({main:a,subFiles:u})}else s.errors.push(w("spine.error.missing-images"))}}return{atlasRawFiles:e,atlasFound:n}}async function Se(t,s){const e=[];for(const n in t){const i=t[n],a=i.name,o=a.split(".")[0];if(a.endsWith(".json"))try{const r=await i.text(),u=JSON.parse(r);u.skeleton&&u.skeleton.spine&&e.push({spineFile:i,spineName:o,isBinary:!1})}catch(r){s.errors.push(P(a,r))}else a.endsWith(".skel")&&e.push({spineFile:i,spineName:o,isBinary:!0})}return e}async function xe(t,s,e){const{spineFile:n}=t,i={type:"SpineSkeletonData",atlas:{refId:null}},a={main:n,meta:null};let o;try{o=await De(t,s,e)}catch(r){return e.errors.push(r instanceof Error?r.message:P(n.name,r)),null}return s.length===0?null:o?(i.atlas.refId=o.id,a.meta=JSON.stringify(i),a):(e.errors.push(w("spine.error.missing-attachments")),null)}async function De(t,s,e){const n=await _e(t);return await Re(s,n)}async function _e(t){const{spineFile:s,isBinary:e}=t,n=new Set;if(e){const r=await s.arrayBuffer();return Fe(r,n),Array.from(n)}const i=await s.text();let a;try{a=JSON.parse(i)}catch(r){throw new Error(P(s.name,r))}return!a||!a.skins?[]:(a.skins.forEach(r=>{if(r.attachments)for(const u in r.attachments){const l=r.attachments[u];for(const y in l){const p=l[y];if(p.type){let h;const f=p.type;try{h=O[f]}catch(F){throw console.warn(w("spine.error.incompatible-version",f)),F}if(!Ae.includes(h))continue}if(p.path)n.add(p.path);else if(p.name)n.add(p.name);else if(p.sequence){const h=new ne(null).readSequence(p.sequence);if(h)for(let f=0;f<h.regions.length;++f)n.add(h.getPath(y,f));else n.add(y)}else n.add(y)}}}),Array.from(n))}function Fe(t,s){new se(new D(s)).readSkeletonData(new Uint8Array(t))}class D{constructor(s){c(this,"requiredPaths");this.requiredPaths=s}static assignDummyRegion(s){s.region=new ie(new ae("dummy"),"")}newRegionAttachment(s,e,n,i){const a=new oe(e,"");return i?this.loadSequence(n,i):(this.requiredPaths.add(n),D.assignDummyRegion(a)),a}newMeshAttachment(s,e,n,i){const a=new re(e,"");return i?this.loadSequence(n,i):(this.requiredPaths.add(n),D.assignDummyRegion(a)),a}newBoundingBoxAttachment(s,e){return new le(e)}newPathAttachment(s,e){return new pe(e)}newPointAttachment(s,e){return new ce(e)}newClippingAttachment(s,e){return new ue(e)}loadSequence(s,e){const n=e.regions;for(let i=0,a=n.length;i<a;i++){const o=e.getPath(s,i);this.requiredPaths.add(o)}}}async function Re(t,s){for(let e=0;e<t.length;e+=1){const n=t[e];if(Te(n.textureAtlas,s))return n}return null}async function Te(t,s){for(let e=0;e<s.length;e+=1){const n=s[e];if(!be(t,n))return!1}return!0}function P(t,s){const e=s instanceof Error?s.message:String(s);return`Failed to parse spine JSON "${t}": ${e}`}function be(t,s){const e=t.findRegion(s);if(e)return e;const n=s.length;for(const i of t.regions){const a=i.name;if(a.startsWith(s)&&a.substring(n).split("").every(r=>r>="0"&&r<="9"))return i}return null}async function Pe(t,s){const e=await s.text(),n=new me(e),i=[];return n.pages.forEach(a=>{const o=a.name,r=t[o];if(r)i.push(r);else return null}),i}async function Me(t,s,e){const n=b(t.main,"spine.atlas"),i=await Ce(t,e);return{main:n,meta:JSON.stringify({textures:i,type:"SpineAtlas"})}}async function Ce(t,s){const e=[];for(const p in t.subFiles){const h=t.subFiles[p];h.name.endsWith(".atlas")||e.push({main:h,type:"Texture"})}const n=[];let i=[],a;const o=s.getAssetFromCurrentFolder();(o==null?void 0:o.length)>0&&(a=o.filter(p=>p.meta.type==="Texture")),a?e.forEach(p=>{const h=a.find(f=>f.name===p.main.name);h?n.push(h.getCurrentRef()):i.push(p)}):i=e;const r=[];i.forEach(p=>{r.push(N(s.root.assetFacade,{uploadAssetFile:p,assetType:"Texture"}))});const l=(await Promise.all(r)).map(p=>p.getCurrentRef());return n.concat(l)}var ve=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,d=(t,s,e,n)=>{for(var i=n>1?void 0:n?Ne(s,e):s,a=t.length-1,o;a>=0;a--)(o=t[a])&&(i=(n?o(s,e,i):o(i))||i);return n&&i&&ve(s,e,i),i};const Oe=$("div",{position:"absolute",top:8,left:8,display:"grid",gap:"$1",marginTop:"$1 $2",variants:{hasClips:{true:{gridTemplateColumns:"150px 18px 1fr"},false:{gridTemplateColumns:"$4_5 1fr"}}}});class m extends de{constructor(){super();c(this,"_spineAnimationRenderer");c(this,"_animationTrack");c(this,"_updateComponent");c(this,"playing",!1);c(this,"frameTime",0);c(this,"duration",0);c(this,"animationNames",[]);c(this,"skinNames",[]);c(this,"animationIndex",0);c(this,"skinIndex",0);c(this,"_size",{w:0,h:0});c(this,"overridePreviewer",q(({asset:e,viewer:n})=>{const i=e.getViewerRootEntity();return C.useEffect(()=>{this.skinIndex=0},[e]),C.useEffect(()=>{this._spineAnimationRenderer?this.updateViewAsset(e,i):this.setViewAsset(e,i)},[e.skeletonData]),A.jsxs(A.Fragment,{children:[A.jsx(z,{asset:e,viewer:n}),A.jsx(Ee,{selectedKey:this.skinIndex,clips:this.skinNames,onSelectClip:a=>{this.skinIndex=a,this.changeSkin(this.skinNames[a])}})]})}));B(this)}setViewAsset(e,n){if(!e.skeletonData){this.stopViewAsset();return}this.animationIndex=0,this.duration=0;const i=n.engine,a=e.skeletonData,o=n.createChild("spine-entity"),r=o.addComponent(v);this.animationNames=a.animations.map(R=>R.name),this.animationNames.unshift("none"),this.skinNames=a.skins.map(R=>R.name),this._entity=o,this._spineAnimationRenderer=r,r.resource=new T(i,a);const{width:u,height:l,x:y,y:p}=a;this._size={w:u,h:l};const h=y+u/2,f=p+l/2;o.transform.setPosition(-h/100,-f/100,0);const F=this;this._updateComponent=this._entity.addComponent(class extends U{onUpdate(){F._onUpdate()}})}updateViewAsset(e,n){if(!e.skeletonData){this.stopViewAsset();return}const i=n.engine,a=e.skeletonData;this.animationNames=a.animations.map(o=>o.name),this.animationNames.unshift("none"),this.skinNames=a.skins.map(o=>o.name),this._spineAnimationRenderer.resource=new T(i,a)}getSize(){return{width:this._size.w/100,height:this._size.h/100}}stopViewAsset(){var e;super.stopViewAsset(),this.playing=!1,this.frameTime=0,this.duration=0,this.animationNames=[],this.skinNames=[],this.animationIndex=0,this.skinIndex=0,this._spineAnimationRenderer&&(this._spineAnimationRenderer.enabled=!1),this._spineAnimationRenderer=null,(e=this._updateComponent)==null||e.destroy()}changeSkin(e){const{skeleton:n,state:i}=this._spineAnimationRenderer;n.setSkinByName(e),n.setSlotsToSetupPose(),i.apply(n)}selectAnimation(e){this.animationIndex=e;const n=this.animationNames[e];this.play(n)}play(e){let n;const{state:i}=this._spineAnimationRenderer;e==="none"?n=i.setEmptyAnimation(0,0):n=i.setAnimation(0,e,!0),this._animationTrack=n,this._spineAnimationRenderer.state.timeScale=1,this.playing=!0,this.duration=n.animationEnd}pauseAnimation(){this.pause()}playAnimation(){this._spineAnimationRenderer.state.timeScale=1}pause(){this._spineAnimationRenderer.state.timeScale=0,this.playing=!1}_onUpdate(){if(!this.playing)return;const e=this._animationTrack.trackTime%this.duration;this.frameTime=isNaN(e)?0:e}}d([g],m.prototype,"playing",2);d([g],m.prototype,"frameTime",2);d([g],m.prototype,"duration",2);d([g],m.prototype,"animationNames",2);d([g],m.prototype,"skinNames",2);d([g],m.prototype,"animationIndex",2);d([g],m.prototype,"skinIndex",2);d([k],m.prototype,"changeSkin",1);d([k],m.prototype,"selectAnimation",1);d([k],m.prototype,"play",1);d([k],m.prototype,"pauseAnimation",1);d([k],m.prototype,"playAnimation",1);d([k],m.prototype,"pause",1);d([k],m.prototype,"_onUpdate",1);function Ee({onSelectClip:t,clips:s,selectedKey:e}){return A.jsx(Oe,{hasClips:!!s.length,children:s.length>0&&A.jsx(V,{value:e,onValueChange:t,valueType:"number",size:"xs",sideOffset:8,children:s.map((n,i)=>n?A.jsx(M,{value:i,children:n},i):null)})})}var Ie=Object.defineProperty,je=Object.getOwnPropertyDescriptor,_=(t,s,e,n)=>{for(var i=n>1?void 0:n?je(s,e):s,a=t.length-1,o;a>=0;a--)(o=t[a])&&(i=(n?o(s,e,i):o(i))||i);return n&&i&&Ie(s,e,i),i};let S=class extends J{constructor(s){super(s);c(this,"_delOnSkeletonDel");c(this,"_delOnAtlasDel");c(this,"_hasInit",!1);c(this,"atlas",null);c(this,"skeletonRawData","");c(this,"skeletonData")}async initByMain(s){const e=await s.text();try{JSON.parse(e),this.skeletonRawData=e}catch{this.skeletonRawData=await s.arrayBuffer()}const n=this.meta,{atlas:i}=n;this.atlas=i;const a=await this.root.assetStore.getAssetByRef(i),o=E(this.skeletonRawData,a,!0);o&&this.createDragTempEntity(o)}createDragTempEntity(s){this.skeletonData=s;const e=new K(this.engine),n=e.addComponent(v);n.resource=new T(this.engine,this.skeletonData),this.setDragTempEntity(e)}instantiate(){if(!this.skeletonData)return;const s=this.root.sceneStore.createEntity(),e=this.getDragTempEntity(),{position:n,rotation:i}=e.transform,a={components:[{class:"SpineAnimationRenderer",id:L(),props:{resource:this.getCurrentRef(),priority:0,defaultConfig:{loop:!1,animationName:"none",skinName:"default"}}}],id:s.id,isActive:!0,isClone:!1,name:this.name?this.name:"spine",position:{x:n.x,y:n.y,z:n.z},rotation:{x:i.x,y:i.y,z:i.z},scale:{x:1,y:1,z:1}};return s.initByFile(a),s}};_([W({assetType:"SpineAtlas",label:w("asset.spine-atlas.title"),type:X.AssetPicker,onChange:async(t,s,e)=>{if(t._delOnAtlasDel&&(t._delOnAtlasDel(),t._delOnAtlasDel=null),e){let n=!0;t._hasInit?n=!1:t._hasInit=!0,t.skeletonData=E(t.skeletonRawData,e,n),t.skeletonData&&t.createDragTempEntity(t.skeletonData);const i=()=>{t._delOnSkeletonDel&&t._delOnSkeletonDel(),t._delOnSkeletonDel=null,t.skeletonData=null};e.on("delete",i),t._delOnSkeletonDel=()=>{e.off("delete",i)}}else t.skeletonData=null}}),Y()],S.prototype,"atlas",2);_([Q()],S.prototype,"skeletonRawData",2);_([g.ref],S.prototype,"skeletonData",2);S=_([G({type:"SpineSkeletonData",label:w("asset.spine-skeleton-data.title"),loaderType:"Spine",viewer:m,dragLayer:H.SpineSkeletonData,dragType:"2d",filterUploadFiles:we,importMenuConfig:{type:Z.Upload,accept:".json,.atlas,.skel,.png,.jpg,.jpeg,.webp",multiple:!0},bundle(t){return t.dependencies=ee(t.meta,["atlas"]),{content:t.content}}})],S);function E(t,s,e){if(!s)return null;try{return he.createSkeletonData(t,s.textureAtlas,.01)}catch{return!e&&te.error(w("spine.error.generate-skeleton-data")),null}}const Je=Object.freeze(Object.defineProperty({__proto__:null,get SpineSkeletonDataAsset(){return S}},Symbol.toStringTag,{value:"Module"}));export{S,Je as a,Me as s};
1
+ var I=Object.defineProperty;var j=(t,s,e)=>s in t?I(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e;var c=(t,s,e)=>(j(t,typeof s!="symbol"?s+"":s,e),e);import{c7 as b,e as w,aO as $,u as B,S as U,aQ as q,aU as C,aS as A,c8 as z,x as g,aL as k,c9 as V,ca as M,j as J,_ as K,cb as L,p as W,C as X,a$ as Y,m as Q,n as G,q as H,o as Z,c5 as ee,by as te}from"./index-1e23212d.js";import{b as ne,c as se,T as ie,d as ae,R as oe,M as re,B as le,P as pe,e as ce,C as ue,f as me,a as v,S as T,L as he}from"./module-498119f3.js";import"./index-92830754.js";import"./postmen-9e1e15bd.js";import{A as de}from"./AssetViewer-0ce46fa1.js";const x=new Map;function fe(t){return t??""}function ge(t){return`${t.name}|${t.size}|${t.lastModified}|${t.type}`}function ye(t,s){const{uploadAssetFile:e,assetType:n,parentFolderId:i,assetMeta:a}=s,o=i??t.currentFolderId??"",r=b(e.main,"upload.bin"),u=ge(r),l=fe(a);return`${o}|${n}|${u}|${l}`}function N(t,s){const e=ye(t,s),n=x.get(e);if(n)return n;const i=t.createAssetByUpload(s).finally(()=>{x.get(e)===i&&x.delete(e)});return x.set(e,i),i}var O=(t=>(t.region="region",t.boundingbox="boundingbox",t.mesh="mesh",t.linkedmesh="linkedmesh",t.path="path",t.point="point",t.clipping="clipping",t.sequence="sequence",t))(O||{});const Ae=["region","linkedmesh","mesh"];async function we(t,s){const e={uploadFiles:[],usedFiles:[],errors:[]},{atlasRawFiles:n,atlasFound:i}=await ke(t,e),a=await Promise.all(n.map(l=>N(s.root.assetFacade,{uploadAssetFile:l,assetType:"SpineAtlas"})));e.usedFiles.push(...n.flatMap(l=>[b(l.main,"spine.atlas"),...Object.values(l.subFiles)]));const o=await Se(t,e);o.length>0&&!i&&e.errors.push(w("spine.error.no-atlas-file"));const r=o.map(l=>(e.usedFiles.push(l.spineFile),xe(l,a,e)));let u=await Promise.all(r);return u=u.filter(l=>l!==null),e.uploadFiles.push(...u),e}async function ke(t,s){const e=[];let n=!1;for(const i in t){const a=t[i];if(a.name.endsWith(".atlas")){n=!0;const r=await Pe(t,a);if(r.length>0){const u={};r.forEach(l=>u[l.name]=l),e.push({main:a,subFiles:u})}else s.errors.push(w("spine.error.missing-images"))}}return{atlasRawFiles:e,atlasFound:n}}async function Se(t,s){const e=[];for(const n in t){const i=t[n],a=i.name,o=a.split(".")[0];if(a.endsWith(".json"))try{const r=await i.text(),u=JSON.parse(r);u.skeleton&&u.skeleton.spine&&e.push({spineFile:i,spineName:o,isBinary:!1})}catch(r){s.errors.push(P(a,r))}else a.endsWith(".skel")&&e.push({spineFile:i,spineName:o,isBinary:!0})}return e}async function xe(t,s,e){const{spineFile:n}=t,i={type:"SpineSkeletonData",atlas:{refId:null}},a={main:n,meta:null};let o;try{o=await De(t,s,e)}catch(r){return e.errors.push(r instanceof Error?r.message:P(n.name,r)),null}return s.length===0?null:o?(i.atlas.refId=o.id,a.meta=JSON.stringify(i),a):(e.errors.push(w("spine.error.missing-attachments")),null)}async function De(t,s,e){const n=await _e(t);return await Re(s,n)}async function _e(t){const{spineFile:s,isBinary:e}=t,n=new Set;if(e){const r=await s.arrayBuffer();return Fe(r,n),Array.from(n)}const i=await s.text();let a;try{a=JSON.parse(i)}catch(r){throw new Error(P(s.name,r))}return!a||!a.skins?[]:(a.skins.forEach(r=>{if(r.attachments)for(const u in r.attachments){const l=r.attachments[u];for(const y in l){const p=l[y];if(p.type){let h;const f=p.type;try{h=O[f]}catch(F){throw console.warn(w("spine.error.incompatible-version",f)),F}if(!Ae.includes(h))continue}if(p.path)n.add(p.path);else if(p.name)n.add(p.name);else if(p.sequence){const h=new ne(null).readSequence(p.sequence);if(h)for(let f=0;f<h.regions.length;++f)n.add(h.getPath(y,f));else n.add(y)}else n.add(y)}}}),Array.from(n))}function Fe(t,s){new se(new D(s)).readSkeletonData(new Uint8Array(t))}class D{constructor(s){c(this,"requiredPaths");this.requiredPaths=s}static assignDummyRegion(s){s.region=new ie(new ae("dummy"),"")}newRegionAttachment(s,e,n,i){const a=new oe(e,"");return i?this.loadSequence(n,i):(this.requiredPaths.add(n),D.assignDummyRegion(a)),a}newMeshAttachment(s,e,n,i){const a=new re(e,"");return i?this.loadSequence(n,i):(this.requiredPaths.add(n),D.assignDummyRegion(a)),a}newBoundingBoxAttachment(s,e){return new le(e)}newPathAttachment(s,e){return new pe(e)}newPointAttachment(s,e){return new ce(e)}newClippingAttachment(s,e){return new ue(e)}loadSequence(s,e){const n=e.regions;for(let i=0,a=n.length;i<a;i++){const o=e.getPath(s,i);this.requiredPaths.add(o)}}}async function Re(t,s){for(let e=0;e<t.length;e+=1){const n=t[e];if(Te(n.textureAtlas,s))return n}return null}async function Te(t,s){for(let e=0;e<s.length;e+=1){const n=s[e];if(!be(t,n))return!1}return!0}function P(t,s){const e=s instanceof Error?s.message:String(s);return`Failed to parse spine JSON "${t}": ${e}`}function be(t,s){const e=t.findRegion(s);if(e)return e;const n=s.length;for(const i of t.regions){const a=i.name;if(a.startsWith(s)&&a.substring(n).split("").every(r=>r>="0"&&r<="9"))return i}return null}async function Pe(t,s){const e=await s.text(),n=new me(e),i=[];return n.pages.forEach(a=>{const o=a.name,r=t[o];if(r)i.push(r);else return null}),i}async function Me(t,s,e){const n=b(t.main,"spine.atlas"),i=await Ce(t,e);return{main:n,meta:JSON.stringify({textures:i,type:"SpineAtlas"})}}async function Ce(t,s){const e=[];for(const p in t.subFiles){const h=t.subFiles[p];h.name.endsWith(".atlas")||e.push({main:h,type:"Texture"})}const n=[];let i=[],a;const o=s.getAssetFromCurrentFolder();(o==null?void 0:o.length)>0&&(a=o.filter(p=>p.meta.type==="Texture")),a?e.forEach(p=>{const h=a.find(f=>f.name===p.main.name);h?n.push(h.getCurrentRef()):i.push(p)}):i=e;const r=[];i.forEach(p=>{r.push(N(s.root.assetFacade,{uploadAssetFile:p,assetType:"Texture"}))});const l=(await Promise.all(r)).map(p=>p.getCurrentRef());return n.concat(l)}var ve=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,d=(t,s,e,n)=>{for(var i=n>1?void 0:n?Ne(s,e):s,a=t.length-1,o;a>=0;a--)(o=t[a])&&(i=(n?o(s,e,i):o(i))||i);return n&&i&&ve(s,e,i),i};const Oe=$("div",{position:"absolute",top:8,left:8,display:"grid",gap:"$1",marginTop:"$1 $2",variants:{hasClips:{true:{gridTemplateColumns:"150px 18px 1fr"},false:{gridTemplateColumns:"$4_5 1fr"}}}});class m extends de{constructor(){super();c(this,"_spineAnimationRenderer");c(this,"_animationTrack");c(this,"_updateComponent");c(this,"playing",!1);c(this,"frameTime",0);c(this,"duration",0);c(this,"animationNames",[]);c(this,"skinNames",[]);c(this,"animationIndex",0);c(this,"skinIndex",0);c(this,"_size",{w:0,h:0});c(this,"overridePreviewer",q(({asset:e,viewer:n})=>{const i=e.getViewerRootEntity();return C.useEffect(()=>{this.skinIndex=0},[e]),C.useEffect(()=>{this._spineAnimationRenderer?this.updateViewAsset(e,i):this.setViewAsset(e,i)},[e.skeletonData]),A.jsxs(A.Fragment,{children:[A.jsx(z,{asset:e,viewer:n}),A.jsx(Ee,{selectedKey:this.skinIndex,clips:this.skinNames,onSelectClip:a=>{this.skinIndex=a,this.changeSkin(this.skinNames[a])}})]})}));B(this)}setViewAsset(e,n){if(!e.skeletonData){this.stopViewAsset();return}this.animationIndex=0,this.duration=0;const i=n.engine,a=e.skeletonData,o=n.createChild("spine-entity"),r=o.addComponent(v);this.animationNames=a.animations.map(R=>R.name),this.animationNames.unshift("none"),this.skinNames=a.skins.map(R=>R.name),this._entity=o,this._spineAnimationRenderer=r,r.resource=new T(i,a);const{width:u,height:l,x:y,y:p}=a;this._size={w:u,h:l};const h=y+u/2,f=p+l/2;o.transform.setPosition(-h/100,-f/100,0);const F=this;this._updateComponent=this._entity.addComponent(class extends U{onUpdate(){F._onUpdate()}})}updateViewAsset(e,n){if(!e.skeletonData){this.stopViewAsset();return}const i=n.engine,a=e.skeletonData;this.animationNames=a.animations.map(o=>o.name),this.animationNames.unshift("none"),this.skinNames=a.skins.map(o=>o.name),this._spineAnimationRenderer.resource=new T(i,a)}getSize(){return{width:this._size.w/100,height:this._size.h/100}}stopViewAsset(){var e;super.stopViewAsset(),this.playing=!1,this.frameTime=0,this.duration=0,this.animationNames=[],this.skinNames=[],this.animationIndex=0,this.skinIndex=0,this._spineAnimationRenderer&&(this._spineAnimationRenderer.enabled=!1),this._spineAnimationRenderer=null,(e=this._updateComponent)==null||e.destroy()}changeSkin(e){const{skeleton:n,state:i}=this._spineAnimationRenderer;n.setSkinByName(e),n.setSlotsToSetupPose(),i.apply(n)}selectAnimation(e){this.animationIndex=e;const n=this.animationNames[e];this.play(n)}play(e){let n;const{state:i}=this._spineAnimationRenderer;e==="none"?n=i.setEmptyAnimation(0,0):n=i.setAnimation(0,e,!0),this._animationTrack=n,this._spineAnimationRenderer.state.timeScale=1,this.playing=!0,this.duration=n.animationEnd}pauseAnimation(){this.pause()}playAnimation(){this._spineAnimationRenderer.state.timeScale=1}pause(){this._spineAnimationRenderer.state.timeScale=0,this.playing=!1}_onUpdate(){if(!this.playing)return;const e=this._animationTrack.trackTime%this.duration;this.frameTime=isNaN(e)?0:e}}d([g],m.prototype,"playing",2);d([g],m.prototype,"frameTime",2);d([g],m.prototype,"duration",2);d([g],m.prototype,"animationNames",2);d([g],m.prototype,"skinNames",2);d([g],m.prototype,"animationIndex",2);d([g],m.prototype,"skinIndex",2);d([k],m.prototype,"changeSkin",1);d([k],m.prototype,"selectAnimation",1);d([k],m.prototype,"play",1);d([k],m.prototype,"pauseAnimation",1);d([k],m.prototype,"playAnimation",1);d([k],m.prototype,"pause",1);d([k],m.prototype,"_onUpdate",1);function Ee({onSelectClip:t,clips:s,selectedKey:e}){return A.jsx(Oe,{hasClips:!!s.length,children:s.length>0&&A.jsx(V,{value:e,onValueChange:t,valueType:"number",size:"xs",sideOffset:8,children:s.map((n,i)=>n?A.jsx(M,{value:i,children:n},i):null)})})}var Ie=Object.defineProperty,je=Object.getOwnPropertyDescriptor,_=(t,s,e,n)=>{for(var i=n>1?void 0:n?je(s,e):s,a=t.length-1,o;a>=0;a--)(o=t[a])&&(i=(n?o(s,e,i):o(i))||i);return n&&i&&Ie(s,e,i),i};let S=class extends J{constructor(s){super(s);c(this,"_delOnSkeletonDel");c(this,"_delOnAtlasDel");c(this,"_hasInit",!1);c(this,"atlas",null);c(this,"skeletonRawData","");c(this,"skeletonData")}async initByMain(s){const e=await s.text();try{JSON.parse(e),this.skeletonRawData=e}catch{this.skeletonRawData=await s.arrayBuffer()}const n=this.meta,{atlas:i}=n;this.atlas=i;const a=await this.root.assetStore.getAssetByRef(i),o=E(this.skeletonRawData,a,!0);o&&this.createDragTempEntity(o)}createDragTempEntity(s){this.skeletonData=s;const e=new K(this.engine),n=e.addComponent(v);n.resource=new T(this.engine,this.skeletonData),this.setDragTempEntity(e)}instantiate(){if(!this.skeletonData)return;const s=this.root.sceneStore.createEntity(),e=this.getDragTempEntity(),{position:n,rotation:i}=e.transform,a={components:[{class:"SpineAnimationRenderer",id:L(),props:{resource:this.getCurrentRef(),priority:0,defaultConfig:{loop:!1,animationName:"none",skinName:"default"}}}],id:s.id,isActive:!0,isClone:!1,name:this.name?this.name:"spine",position:{x:n.x,y:n.y,z:n.z},rotation:{x:i.x,y:i.y,z:i.z},scale:{x:1,y:1,z:1}};return s.initByFile(a),s}};_([W({assetType:"SpineAtlas",label:w("asset.spine-atlas.title"),type:X.AssetPicker,onChange:async(t,s,e)=>{if(t._delOnAtlasDel&&(t._delOnAtlasDel(),t._delOnAtlasDel=null),e){let n=!0;t._hasInit?n=!1:t._hasInit=!0,t.skeletonData=E(t.skeletonRawData,e,n),t.skeletonData&&t.createDragTempEntity(t.skeletonData);const i=()=>{t._delOnSkeletonDel&&t._delOnSkeletonDel(),t._delOnSkeletonDel=null,t.skeletonData=null};e.on("delete",i),t._delOnSkeletonDel=()=>{e.off("delete",i)}}else t.skeletonData=null}}),Y()],S.prototype,"atlas",2);_([Q()],S.prototype,"skeletonRawData",2);_([g.ref],S.prototype,"skeletonData",2);S=_([G({type:"SpineSkeletonData",label:w("asset.spine-skeleton-data.title"),loaderType:"Spine",viewer:m,dragLayer:H.SpineSkeletonData,dragType:"2d",filterUploadFiles:we,importMenuConfig:{type:Z.Upload,accept:".json,.atlas,.skel,.png,.jpg,.jpeg,.webp",multiple:!0},bundle(t){return t.dependencies=ee(t.meta,["atlas"]),{content:t.content}}})],S);function E(t,s,e){if(!s)return null;try{return he.createSkeletonData(t,s.textureAtlas,.01)}catch{return!e&&te.error(w("spine.error.generate-skeleton-data")),null}}const Je=Object.freeze(Object.defineProperty({__proto__:null,get SpineSkeletonDataAsset(){return S}},Symbol.toStringTag,{value:"Module"}));export{S,Je as a,Me as s};
@@ -1 +1 @@
1
- var f=Object.defineProperty;var c=(t,e,o)=>e in t?f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var r=(t,e,o)=>(c(t,typeof e!="symbol"?e+"":e,o),o);import{s as m,aI as h,p as g,C as b,f as u}from"./index-aec7e708.js";import"./index-e8a45e82.js";import{c as d}from"./Component-ed7aa0ab.js";import"./postmen-2f47f6bb.js";import{L as P}from"./LightBaseComponent-12dc27d1.js";var y=Object.defineProperty,v=Object.getOwnPropertyDescriptor,i=(t,e,o,n)=>{for(var p=n>1?void 0:n?v(e,o):e,l=t.length-1,s;l>=0;l--)(s=t[l])&&(p=(n?s(e,o,p):s(p))||p);return n&&p&&y(e,o,p),p};let a=class extends P{constructor(e,o){super(e,o);r(this,"angle",20);r(this,"distance",60);r(this,"penumbra",60)}};i([m(h()),g({type:b.Slider,min:1,max:179,bindPath:"angle",label:"light.spot.angle.label",info:"light.spot.angle.info"}),u({getPath:"angle",getEditorValue:t=>t*180/Math.PI})],a.prototype,"angle",2);i([m(),g({type:b.Number,bindPath:"distance",label:"light.spot.distance.label",info:"light.spot.distance.info"})],a.prototype,"distance",2);i([m(h()),g({type:b.Slider,min:1,max:179,bindPath:"penumbra",label:"light.spot.penumbra.label",info:"light.spot.penumbra.info"}),u({getPath:"penumbra",getEditorValue:t=>t*180/Math.PI})],a.prototype,"penumbra",2);a=i([d({type:"SpotLight",componentsMenu:{group:"light",label:"component.light.spot.title"}})],a);export{a as SpotLightComponent};
1
+ var f=Object.defineProperty;var c=(t,e,o)=>e in t?f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var r=(t,e,o)=>(c(t,typeof e!="symbol"?e+"":e,o),o);import{s as m,aI as h,p as g,C as b,f as u}from"./index-1e23212d.js";import"./index-92830754.js";import{c as d}from"./Component-746be670.js";import"./postmen-9e1e15bd.js";import{L as P}from"./LightBaseComponent-51d498ea.js";var y=Object.defineProperty,v=Object.getOwnPropertyDescriptor,i=(t,e,o,n)=>{for(var p=n>1?void 0:n?v(e,o):e,l=t.length-1,s;l>=0;l--)(s=t[l])&&(p=(n?s(e,o,p):s(p))||p);return n&&p&&y(e,o,p),p};let a=class extends P{constructor(e,o){super(e,o);r(this,"angle",20);r(this,"distance",60);r(this,"penumbra",60)}};i([m(h()),g({type:b.Slider,min:1,max:179,bindPath:"angle",label:"light.spot.angle.label",info:"light.spot.angle.info"}),u({getPath:"angle",getEditorValue:t=>t*180/Math.PI})],a.prototype,"angle",2);i([m(),g({type:b.Number,bindPath:"distance",label:"light.spot.distance.label",info:"light.spot.distance.info"})],a.prototype,"distance",2);i([m(h()),g({type:b.Slider,min:1,max:179,bindPath:"penumbra",label:"light.spot.penumbra.label",info:"light.spot.penumbra.info"}),u({getPath:"penumbra",getEditorValue:t=>t*180/Math.PI})],a.prototype,"penumbra",2);a=i([d({type:"SpotLight",componentsMenu:{group:"light",label:"component.light.spot.title"}})],a);export{a as SpotLightComponent};
@@ -1,4 +1,4 @@
1
- var fe=Object.defineProperty;var pe=(r,e,t)=>e in r?fe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var p=(r,e,t)=>(pe(r,typeof e!="symbol"?e+"":e,t),t);import{aG as de,aQ as mt,aU as v,aS as R,aW as zt,bM as me,aP as tt,eQ as we,cB as ye,$ as wt,a4 as xe,aO as it,aR as Xt,K as Rt,bI as ve,bK as be,bJ as Re,eR as Se,B as Ie,cE as Ce,dH as Pe,eA as Te,aT as _e,eH as Be,e as pt,bN as Yt,q as yt,aF as ke,aX as Fe,N as Zt,j as Me,eS as Nt,a9 as Ee,_ as Oe,C as O,cb as Ae,aJ as je,p as Y,m as Z,f as Le,v as De,aL as ze,n as Ne,o as Ht,c7 as He,bR as $e,cd as We,cc as $t}from"./index-aec7e708.js";import{u as qe,F as Ue}from"./index-e8a45e82.js";import{A as Ve}from"./AssetViewer-64cd01fa.js";import"./meshopt_simplifier.module-cd99529d.js";import{c as Je}from"./bundlers-9b0d37fc.js";import{b as Ge,a as te}from"./TextureAsset-39fb07fe.js";function Ke(r,e){const t={};for(let i=0;i<r.length;i++){const n=r[i],a=e(n);Object.hasOwn(t,a)||(t[a]=[]),t[a].push(n)}return t}function Qe(r,e){const t=[],i=[];for(let n=0;n<r.length;n++){const a=r[n];e(a)?t.push(a):i.push(a)}return[t,i]}/**
1
+ var fe=Object.defineProperty;var pe=(r,e,t)=>e in r?fe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var p=(r,e,t)=>(pe(r,typeof e!="symbol"?e+"":e,t),t);import{aG as de,aQ as mt,aU as v,aS as R,aW as zt,bM as me,aP as tt,eQ as we,cB as ye,$ as wt,a4 as xe,aO as it,aR as Xt,K as Rt,bI as ve,bK as be,bJ as Re,eR as Se,B as Ie,cE as Ce,dH as Pe,eA as Te,aT as _e,eH as Be,e as pt,bN as Yt,q as yt,aF as ke,aX as Fe,N as Zt,j as Me,eS as Nt,a9 as Ee,_ as Oe,C as O,cb as Ae,aJ as je,p as Y,m as Z,f as Le,v as De,aL as ze,n as Ne,o as Ht,c7 as He,bR as $e,cd as We,cc as $t}from"./index-1e23212d.js";import{u as qe,F as Ue}from"./index-92830754.js";import{A as Ve}from"./AssetViewer-0ce46fa1.js";import"./meshopt_simplifier.module-cd99529d.js";import{c as Je}from"./bundlers-9b0d37fc.js";import{b as Ge,a as te}from"./TextureAsset-93475ade.js";function Ke(r,e){const t={};for(let i=0;i<r.length;i++){const n=r[i],a=e(n);Object.hasOwn(t,a)||(t[a]=[]),t[a].push(n)}return t}function Qe(r,e){const t=[],i=[];for(let n=0;n<r.length;n++){const a=r[n];e(a)?t.push(a):i.push(a)}return[t,i]}/**
2
2
  * @license @tabler/icons-react v3.24.0 - MIT
3
3
  *
4
4
  * This source code is licensed under the MIT license.
@@ -1 +1 @@
1
- var K=Object.defineProperty;var Q=(e,t,s)=>t in e?K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var h=(e,t,s)=>(Q(e,typeof t!="symbol"?t+"":t,s),s);import{aO as W,aU as F,aS as d,aP as C,aX as B,aQ as z,aR as H,bN as J,q as R,dU as X,bl as Y,dK as Z,dH as ee,dC as te,dV as L,j as _,cb as se,cd as O,an as j,a0 as y,bI as ae,e as k,dW as U,p as w,C as S,m as x,s as re,aL as ie,n as oe,o as ne}from"./index-aec7e708.js";import{F as N}from"./index-e8a45e82.js";import{u as $,h as le,d as E,r as pe,S as V,a as D,g as ce,p as de,b as ue}from"./SpriteAsset-558ffca8.js";import{F as ge}from"./FormItemArray-6d69acd4.js";import{b as fe}from"./TextureAsset-39fb07fe.js";function he(e,t){const s=new Map;for(let r=0;r<e.length;r++){const a=e[r],i=t(a);s.has(i)||s.set(i,a)}return Array.from(s.values())}const me=W("div",{position:"relative",width:"100%",marginBottom:"$2",aspectRatio:"1/1"}),be=W("div",{position:"absolute",width:"100%",height:"100%",padding:"$1",boxSizing:"border-box","& canvas":{width:"100%",height:"100%",border:"1px solid $grayA4",borderRadius:"$3",overflow:"hidden"}}),ve=F.forwardRef(function(t,s){const{buttonContent:r,onClick:a}=t;return d.jsxs(C,{direction:"column",fullWidth:!0,children:[d.jsx(me,{children:d.jsx(be,{children:d.jsx("canvas",{ref:s,width:"400",height:"400"})})}),r&&d.jsx(C,{align:"h",css:{margin:"$0 auto"},children:d.jsx(B,{size:"sm",variant:"solid",css:{padding:"0 $14"},onClick:a,children:r})})]})});function we(e){let t=!1;return e.textureRef?e.assetStore.getAssetByRef(e.textureRef).then(s=>{t||e.setTextureAsset(s??null)}).catch(()=>{t||e.setTextureAsset(null)}):e.setTextureAsset(null),()=>{t=!0}}function xe(e,t){return new Promise((s,r)=>{const a=new window.Blob([e],{type:t}),i=new window.Image,n=URL.createObjectURL(a);let c=!1;const m=()=>{c||(c=!0,URL.revokeObjectURL(n))};i.crossOrigin="anonymous",i.onerror=()=>{m(),r(new Error("Failed to load image buffer"))},i.onload=()=>{requestAnimationFrame(()=>{m(),s(i)})},i.src=n})}const ye=z(({item:e})=>{const[t,s]=F.useState(null),{assetStore:r}=e.root,{t:a}=H(),i=Object.values(r.assets).filter(n=>!n.isSubAsset&&n.getMetaConfig().type==="Texture");return F.useEffect(()=>we({assetStore:r,textureRef:e.texture,setTextureAsset:s}),[r,e.texture]),d.jsxs(d.Fragment,{children:[d.jsx(J,{dropLayer:R.Sprite,assets:i,onSelect:n=>{$(e,n)},onDelete:()=>{$(e,null)},onLocate:()=>{var n;(n=e.texture)!=null&&n.refId&&r.selectAsset(e.texture.refId)},label:a("sprite.texture.label"),value:t&&t.name,asset:t}),d.jsx(X,{label:a("sprite.region.label"),value:{x:e.region.x,y:e.region.y,width:e.region.width,height:e.region.height},onChange:(n,c)=>{e.root.inspectorFacade.assetChange(e.id,"region",{...e.region,[c]:n[c]})},min:0,max:1}),d.jsx(Y,{label:a("sprite.quick-pivot.label"),value:e.quickPivot,options:[{label:a("sprite.quick-pivot.center"),value:0},{label:a("sprite.quick-pivot.top-left"),value:1},{label:a("sprite.quick-pivot.top"),value:2},{label:a("sprite.quick-pivot.top-right"),value:3},{label:a("sprite.quick-pivot.left"),value:4},{label:a("sprite.quick-pivot.right"),value:5},{label:a("sprite.quick-pivot.bottom-left"),value:6},{label:a("sprite.quick-pivot.bottom"),value:7},{label:a("sprite.quick-pivot.bottom-right"),value:8},{label:a("sprite.quick-pivot.custom"),value:9}],onChange:n=>{e.root.inspectorFacade.assetChange(e.id,"quickPivot",n)}}),e.quickPivot===9&&d.jsx(Z,{label:"",value:{x:0,y:0}}),d.jsx(ee,{label:a("sprite.border.label"),value:{x:e.border.x,y:e.border.y,z:e.border.z,w:e.border.w},onChange:(n,c)=>{e.root.inspectorFacade.assetChange(e.id,"border",{...e.border,[c]:n[c]})},min:0,max:1})]})}),Se=z(({model:e,inspectorConfig:t})=>{const{label:s}=t,r=e.sprites,{assetStore:a}=e.root,i=le(e),{t:n}=H();Ie(e);const c=Object.values(a.assets).filter(o=>{switch(o.getMetaConfig().type){case"sprite":return!r.find(l=>l.refId===o.id);case"Folder":return!0}return!1}),m=F.useRef(null);let u,g;F.useLayoutEffect(()=>{u=m.current,g=u==null?void 0:u.getContext("2d"),e.previewImage&&g&&E(e.usage,e.previewImage,u,g)});async function b(){var o;if(i){if(g){const p=await de(e),l=((o=p.info)==null?void 0:o.atlasItems)??[],I=l.reduce((T,P)=>T+P.sprites.reduce((G,q)=>G+q.width*q.height,0),0),A=l.reduce((T,P)=>T+P.width*P.height,0),M=A>0?Number((I/A*100).toFixed(2)):0;p.code===0?xe(p.imageFiles[0],"image/png").then(T=>{e.replacePreview(T),E(M,T,u,g)}):L({title:n("sprite.atlas.pack-error.title"),description:p.msg})}}else L({title:n("sprite.atlas.pack-error.title"),description:n("sprite.atlas.pack-error.no-sprite")})}return d.jsxs(d.Fragment,{children:[d.jsx(ge,{label:s,items:r.map((o,p)=>{const l=a.assets[o.refId];return{removable:!0,children:d.jsx(ye,{item:l}),id:`${p}`,name:l.getRouteString()}}),onDelete:async o=>{const p=await a.getAssetByRef(r[o.id]);await pe(e,p)}}),d.jsxs(C,{align:"both",direction:"column",children:[d.jsx(J,{assets:c,dropLayer:R.Sprite|R.Folder,customFilter:o=>o instanceof V||o instanceof N,onSelect:o=>{if(o instanceof V)D(e,o);else if(o instanceof N){const p=ce(o);for(let l=p.length-1;l>=0;l--)D(e,p[l])}},trigger:d.jsx(B,{size:"sm",variant:"solid",css:{flex:1},startSlot:d.jsx(te,{}),children:n("sprite.atlas.add-object.label")}),label:n("sprite.atlas.add-sprite"),value:null,asset:null}),d.jsx(B,{size:"sm",variant:"solid",positive:!0,fullWidth:!0,css:{margin:"$1"},onClick:b,children:n("sprite.atlas.pack-preview.label")})]}),i&&d.jsx(ve,{ref:m})]})});async function Ie(e){var a;const t=e.root.assetStore.assets,s=e.sprites,r=[];for(let i=0;i<s.length;i++){const n=s[i],c=t[n.refId];c&&(r.push(n),((a=c.belongToAtlas)==null?void 0:a.refId)!==e.id&&await D(e,c))}r.length!==s.length&&await e.root.assetFacade.updateAssetProps(e.id,{sprites:r})}function Ae(e,t,s,r={}){return{id:e,type:t,version:s.engineVersion??"",extraData:{},dependencies:[],...r}}var Te=Object.defineProperty,je=Object.getOwnPropertyDescriptor,v=(e,t,s,r)=>{for(var a=r>1?void 0:r?je(t,s):t,i=e.length-1,n;i>=0;i--)(n=e[i])&&(a=(r?n(t,s,a):n(a))||a);return r&&a&&Te(t,s,a),a};let f=class extends _{constructor(t){super(t);h(this,"acceptDragLayer",R.Sprite);h(this,"previewTexture2D");h(this,"previewImage");h(this,"usage",0);h(this,"maxWidth",1024);h(this,"maxHeight",1024);h(this,"padding",2);h(this,"allowRotation",!1);h(this,"tightPacking",!1);h(this,"mipmap",!1);h(this,"filterMode",j.Bilinear);h(this,"wrapModeU",y.Repeat);h(this,"wrapModeV",y.Repeat);h(this,"anisoLevel",1);h(this,"sprites",[]);this.setNameByIncrease("SpriteAtlas");const s=this.formSchema;s.addGroup(k("sprite.atlas.packing"),["maxWidth","maxHeight","padding","allowRotation","tightPacking"]),s.addGroup(k("sprite.atlas.export"),["filterMode","wrapModeU","wrapModeV","anisoLevel","mipmap"]),s.addGroup(k("sprite.atlas.list"),["sprites"])}static async updateSubTextureAssets(t,s,r,a,i){var p;const n=t.meta,c=i.vfs,m=t.dependencies||(t.dependencies=[]),u=((p=m[s])==null?void 0:p.ref.refId)??se(),g=O(t.name).split(".")[0];m[s]||(m[s]={key:"atlasItems["+s+"].img",ref:{refId:u}});let b=c.getFileById(u),o;return b?o=b.meta:(o=Ae(u,_.getRegisteredAssetMeta(fe).type,a),i.addFile({name:g+"_image_"+s,assetId:u,url:null,parentId:t.parentId,main:null,meta:o}),b=c.getFileById(u),b.ignoreBundle=!0),o.colorDilate=n.colorDilate??!1,o.filterMode=n.filterMode??j.Bilinear,o.wrapModeU=n.wrapModeU??y.Repeat,o.wrapModeV=n.wrapModeV??y.Repeat,o.anisoLevel=n.anisoLevel??1,o.runtimeOptions=n.runtimeOptions??{},i.updateFile(u,{main:new Blob([r],{type:"image/png"}),meta:o}),await i.bundleSingleFile(b,a),b}replacePreview(t){this.previewImage=t;const s=this.previewTexture2D;this.previewTexture2D=new ae(this.engineObject.engine,t.width,t.height),this.previewTexture2D.setImageSource(t),s&&s.destroy(!0)}async afterDelete(){this.engineObject.destroy(!0);const{sprites:t,id:s}=this,r=this.root.assetStore,i=[...t].map(async n=>{var c;try{const u=await r.getAssetByRef(n);((c=u==null?void 0:u.belongToAtlas)==null?void 0:c.refId)===s&&await this.root.assetFacade.updateAssetProps(u.id,{belongToAtlas:null})}catch(m){console.warn(`[SpriteAtlasAsset] Failed to cleanup sprite relation: ${(n==null?void 0:n.refId)??"unknown"}`,m)}});await Promise.allSettled(i),t.length=0}addSprites(t){const s=he([...this.sprites,...t.map(a=>({refId:a.id}))],a=>a.refId),r=t.map(a=>this.root.assetFacade.updateAssetProps(a.id,{belongToAtlas:{refId:this.id}}));return r.push(this.root.assetFacade.updateAssetProps(this.id,{sprites:s})),Promise.all(r)}async initByMain(t){const{engine:s}=this,r=JSON.parse(await t.text());for(const i in r)this[i]=r[i];const a=new U(s);this.bindEngineObject(a),a.asset=this}async initByCreation(){this.setNameByIncrease("SpriteAtlas");const t=new U(this.engine);return this.bindEngineObject(t),t.asset=this,this.getMainData()}async _onDrop(t,s){this.dropping=!1,!this.sprites.find(r=>r.refId===s.id)&&await this.addSprites([s])}};v([w({info:"sprite.atlas.max-width.info",label:"sprite.atlas.max-width.label",type:S.Input}),x()],f.prototype,"maxWidth",2);v([w({info:"sprite.atlas.max-height.info",label:"sprite.atlas.max-height.label",type:S.Input}),x()],f.prototype,"maxHeight",2);v([w({info:"sprite.atlas.padding.info",label:"sprite.atlas.padding.label",type:S.Number,min:0,max:5,dragStep:1}),x()],f.prototype,"padding",2);v([w({info:"sprite.atlas.rotation.info",label:"sprite.atlas.rotation.label",type:S.Toggle}),x()],f.prototype,"allowRotation",2);v([w({info:"sprite.atlas.tight-packing.info",label:"sprite.atlas.tight-packing.label",type:S.Toggle}),x()],f.prototype,"tightPacking",2);v([w({label:"sprite.atlas.mipmap.label",type:S.Toggle}),x()],f.prototype,"mipmap",2);v([w({label:"sprite.atlas.filter-mode.label",type:S.Select,value:j.Bilinear,options:[{label:"sprite.atlas.filter-mode.point",value:j.Point},{label:"sprite.atlas.filter-mode.bilinear",value:j.Bilinear},{label:"sprite.atlas.filter-mode.trilinear",value:j.Trilinear}]}),x()],f.prototype,"filterMode",2);v([w({label:"sprite.atlas.wrap-mode-u.label",type:S.Select,options:[{label:"sprite.atlas.wrap-mode.clamp",value:y.Clamp},{label:"sprite.atlas.wrap-mode.repeat",value:y.Repeat},{label:"sprite.atlas.wrap-mode.mirror",value:y.Mirror}]}),x()],f.prototype,"wrapModeU",2);v([w({label:"sprite.atlas.wrap-mode-v.label",type:S.Select,options:[{label:"sprite.atlas.wrap-mode.clamp",value:y.Clamp},{label:"sprite.atlas.wrap-mode.repeat",value:y.Repeat},{label:"sprite.atlas.wrap-mode.mirror",value:y.Mirror}]}),x()],f.prototype,"wrapModeV",2);v([w({label:"sprite.atlas.aniso-level.label",type:S.Slider,dragStep:1,max:16,min:1}),x()],f.prototype,"anisoLevel",2);v([re({type:"methods",key:"addSprite"}),w({label:k("sprite.atlas.sprite-list.label"),customComponent:Se}),x()],f.prototype,"sprites",2);v([ie],f.prototype,"addSprites",1);f=v([oe({type:"SpriteAtlas",label:k("asset.sprite-atlas.title"),loaderType:"SpriteAtlas",extname:"atlas",importMenuConfig:{type:ne.Add},async bundle(e,t,s){var m;const r=s.vfs,a=e.content??await r.loadFile(e.id),i=JSON.parse(await a.text()),n=e.meta,c=e.dependencies||(e.dependencies=[]);if(n.ignorePack){const u=i.atlasItems;for(let g=0,b=u.length;g<b;g++){const o=i.atlasItems[g],p=await fetch(o.img).then(I=>I.arrayBuffer()),l=await f.updateSubTextureAssets(e,g,p,t,s);o.type=l.exportType,o.img="./"+O(l.path)}}else{const u=e.id,g=i.sprites;for(let o=g.length-1;o>=0;o--){const p=g[o].refId,l=r.getFileById(p);if(l){const I=l.content??await r.loadFile(l.id);((m=JSON.parse(await I.text()).belongToAtlas)==null?void 0:m.refId)!==u&&(g.splice(o,1),console.warn("Sprite.belongToAtlas is not equal to this asset."))}else g.splice(o,1),console.warn("SpriteAsset[refId:",p,"] not found")}const b=await ue(i,r);if(b.code===0){const o=b.info;for(const l in o)i[l]=o[l];const p=b.imageFiles;for(let l=0,I=p.length;l<I;l++){const A=await f.updateSubTextureAssets(e,l,p[l],t,s),M=i.atlasItems[l];M.type=A.exportType,M.img="./"+O(A.path)}}else{for(let o=0,p=c.length;o<p;o++){const l=c[o].ref.refId;r.deleteFile(l)}c.length=0}}return delete i.usage,delete i.allowRotation,delete i.maxHeight,delete i.maxWidth,delete i.padding,delete i.sprites,delete i.tightPacking,{content:new Blob([JSON.stringify(i)])}}})],f);const Be=Object.freeze(Object.defineProperty({__proto__:null,get SpriteAtlasAsset(){return f}},Symbol.toStringTag,{value:"Module"}));export{f as S,Be as a,Ae as c};
1
+ var K=Object.defineProperty;var Q=(e,t,s)=>t in e?K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var h=(e,t,s)=>(Q(e,typeof t!="symbol"?t+"":t,s),s);import{aO as W,aU as F,aS as d,aP as C,aX as B,aQ as z,aR as H,bN as J,q as R,dU as X,bl as Y,dK as Z,dH as ee,dC as te,dV as L,j as _,cb as se,cd as O,an as j,a0 as y,bI as ae,e as k,dW as U,p as w,C as S,m as x,s as re,aL as ie,n as oe,o as ne}from"./index-1e23212d.js";import{F as N}from"./index-92830754.js";import{u as $,h as le,d as E,r as pe,S as V,a as D,g as ce,p as de,b as ue}from"./SpriteAsset-4e895da5.js";import{F as ge}from"./FormItemArray-a2f72cf1.js";import{b as fe}from"./TextureAsset-93475ade.js";function he(e,t){const s=new Map;for(let r=0;r<e.length;r++){const a=e[r],i=t(a);s.has(i)||s.set(i,a)}return Array.from(s.values())}const me=W("div",{position:"relative",width:"100%",marginBottom:"$2",aspectRatio:"1/1"}),be=W("div",{position:"absolute",width:"100%",height:"100%",padding:"$1",boxSizing:"border-box","& canvas":{width:"100%",height:"100%",border:"1px solid $grayA4",borderRadius:"$3",overflow:"hidden"}}),ve=F.forwardRef(function(t,s){const{buttonContent:r,onClick:a}=t;return d.jsxs(C,{direction:"column",fullWidth:!0,children:[d.jsx(me,{children:d.jsx(be,{children:d.jsx("canvas",{ref:s,width:"400",height:"400"})})}),r&&d.jsx(C,{align:"h",css:{margin:"$0 auto"},children:d.jsx(B,{size:"sm",variant:"solid",css:{padding:"0 $14"},onClick:a,children:r})})]})});function we(e){let t=!1;return e.textureRef?e.assetStore.getAssetByRef(e.textureRef).then(s=>{t||e.setTextureAsset(s??null)}).catch(()=>{t||e.setTextureAsset(null)}):e.setTextureAsset(null),()=>{t=!0}}function xe(e,t){return new Promise((s,r)=>{const a=new window.Blob([e],{type:t}),i=new window.Image,n=URL.createObjectURL(a);let c=!1;const m=()=>{c||(c=!0,URL.revokeObjectURL(n))};i.crossOrigin="anonymous",i.onerror=()=>{m(),r(new Error("Failed to load image buffer"))},i.onload=()=>{requestAnimationFrame(()=>{m(),s(i)})},i.src=n})}const ye=z(({item:e})=>{const[t,s]=F.useState(null),{assetStore:r}=e.root,{t:a}=H(),i=Object.values(r.assets).filter(n=>!n.isSubAsset&&n.getMetaConfig().type==="Texture");return F.useEffect(()=>we({assetStore:r,textureRef:e.texture,setTextureAsset:s}),[r,e.texture]),d.jsxs(d.Fragment,{children:[d.jsx(J,{dropLayer:R.Sprite,assets:i,onSelect:n=>{$(e,n)},onDelete:()=>{$(e,null)},onLocate:()=>{var n;(n=e.texture)!=null&&n.refId&&r.selectAsset(e.texture.refId)},label:a("sprite.texture.label"),value:t&&t.name,asset:t}),d.jsx(X,{label:a("sprite.region.label"),value:{x:e.region.x,y:e.region.y,width:e.region.width,height:e.region.height},onChange:(n,c)=>{e.root.inspectorFacade.assetChange(e.id,"region",{...e.region,[c]:n[c]})},min:0,max:1}),d.jsx(Y,{label:a("sprite.quick-pivot.label"),value:e.quickPivot,options:[{label:a("sprite.quick-pivot.center"),value:0},{label:a("sprite.quick-pivot.top-left"),value:1},{label:a("sprite.quick-pivot.top"),value:2},{label:a("sprite.quick-pivot.top-right"),value:3},{label:a("sprite.quick-pivot.left"),value:4},{label:a("sprite.quick-pivot.right"),value:5},{label:a("sprite.quick-pivot.bottom-left"),value:6},{label:a("sprite.quick-pivot.bottom"),value:7},{label:a("sprite.quick-pivot.bottom-right"),value:8},{label:a("sprite.quick-pivot.custom"),value:9}],onChange:n=>{e.root.inspectorFacade.assetChange(e.id,"quickPivot",n)}}),e.quickPivot===9&&d.jsx(Z,{label:"",value:{x:0,y:0}}),d.jsx(ee,{label:a("sprite.border.label"),value:{x:e.border.x,y:e.border.y,z:e.border.z,w:e.border.w},onChange:(n,c)=>{e.root.inspectorFacade.assetChange(e.id,"border",{...e.border,[c]:n[c]})},min:0,max:1})]})}),Se=z(({model:e,inspectorConfig:t})=>{const{label:s}=t,r=e.sprites,{assetStore:a}=e.root,i=le(e),{t:n}=H();Ie(e);const c=Object.values(a.assets).filter(o=>{switch(o.getMetaConfig().type){case"sprite":return!r.find(l=>l.refId===o.id);case"Folder":return!0}return!1}),m=F.useRef(null);let u,g;F.useLayoutEffect(()=>{u=m.current,g=u==null?void 0:u.getContext("2d"),e.previewImage&&g&&E(e.usage,e.previewImage,u,g)});async function b(){var o;if(i){if(g){const p=await de(e),l=((o=p.info)==null?void 0:o.atlasItems)??[],I=l.reduce((T,P)=>T+P.sprites.reduce((G,q)=>G+q.width*q.height,0),0),A=l.reduce((T,P)=>T+P.width*P.height,0),M=A>0?Number((I/A*100).toFixed(2)):0;p.code===0?xe(p.imageFiles[0],"image/png").then(T=>{e.replacePreview(T),E(M,T,u,g)}):L({title:n("sprite.atlas.pack-error.title"),description:p.msg})}}else L({title:n("sprite.atlas.pack-error.title"),description:n("sprite.atlas.pack-error.no-sprite")})}return d.jsxs(d.Fragment,{children:[d.jsx(ge,{label:s,items:r.map((o,p)=>{const l=a.assets[o.refId];return{removable:!0,children:d.jsx(ye,{item:l}),id:`${p}`,name:l.getRouteString()}}),onDelete:async o=>{const p=await a.getAssetByRef(r[o.id]);await pe(e,p)}}),d.jsxs(C,{align:"both",direction:"column",children:[d.jsx(J,{assets:c,dropLayer:R.Sprite|R.Folder,customFilter:o=>o instanceof V||o instanceof N,onSelect:o=>{if(o instanceof V)D(e,o);else if(o instanceof N){const p=ce(o);for(let l=p.length-1;l>=0;l--)D(e,p[l])}},trigger:d.jsx(B,{size:"sm",variant:"solid",css:{flex:1},startSlot:d.jsx(te,{}),children:n("sprite.atlas.add-object.label")}),label:n("sprite.atlas.add-sprite"),value:null,asset:null}),d.jsx(B,{size:"sm",variant:"solid",positive:!0,fullWidth:!0,css:{margin:"$1"},onClick:b,children:n("sprite.atlas.pack-preview.label")})]}),i&&d.jsx(ve,{ref:m})]})});async function Ie(e){var a;const t=e.root.assetStore.assets,s=e.sprites,r=[];for(let i=0;i<s.length;i++){const n=s[i],c=t[n.refId];c&&(r.push(n),((a=c.belongToAtlas)==null?void 0:a.refId)!==e.id&&await D(e,c))}r.length!==s.length&&await e.root.assetFacade.updateAssetProps(e.id,{sprites:r})}function Ae(e,t,s,r={}){return{id:e,type:t,version:s.engineVersion??"",extraData:{},dependencies:[],...r}}var Te=Object.defineProperty,je=Object.getOwnPropertyDescriptor,v=(e,t,s,r)=>{for(var a=r>1?void 0:r?je(t,s):t,i=e.length-1,n;i>=0;i--)(n=e[i])&&(a=(r?n(t,s,a):n(a))||a);return r&&a&&Te(t,s,a),a};let f=class extends _{constructor(t){super(t);h(this,"acceptDragLayer",R.Sprite);h(this,"previewTexture2D");h(this,"previewImage");h(this,"usage",0);h(this,"maxWidth",1024);h(this,"maxHeight",1024);h(this,"padding",2);h(this,"allowRotation",!1);h(this,"tightPacking",!1);h(this,"mipmap",!1);h(this,"filterMode",j.Bilinear);h(this,"wrapModeU",y.Repeat);h(this,"wrapModeV",y.Repeat);h(this,"anisoLevel",1);h(this,"sprites",[]);this.setNameByIncrease("SpriteAtlas");const s=this.formSchema;s.addGroup(k("sprite.atlas.packing"),["maxWidth","maxHeight","padding","allowRotation","tightPacking"]),s.addGroup(k("sprite.atlas.export"),["filterMode","wrapModeU","wrapModeV","anisoLevel","mipmap"]),s.addGroup(k("sprite.atlas.list"),["sprites"])}static async updateSubTextureAssets(t,s,r,a,i){var p;const n=t.meta,c=i.vfs,m=t.dependencies||(t.dependencies=[]),u=((p=m[s])==null?void 0:p.ref.refId)??se(),g=O(t.name).split(".")[0];m[s]||(m[s]={key:"atlasItems["+s+"].img",ref:{refId:u}});let b=c.getFileById(u),o;return b?o=b.meta:(o=Ae(u,_.getRegisteredAssetMeta(fe).type,a),i.addFile({name:g+"_image_"+s,assetId:u,url:null,parentId:t.parentId,main:null,meta:o}),b=c.getFileById(u),b.ignoreBundle=!0),o.colorDilate=n.colorDilate??!1,o.filterMode=n.filterMode??j.Bilinear,o.wrapModeU=n.wrapModeU??y.Repeat,o.wrapModeV=n.wrapModeV??y.Repeat,o.anisoLevel=n.anisoLevel??1,o.runtimeOptions=n.runtimeOptions??{},i.updateFile(u,{main:new Blob([r],{type:"image/png"}),meta:o}),await i.bundleSingleFile(b,a),b}replacePreview(t){this.previewImage=t;const s=this.previewTexture2D;this.previewTexture2D=new ae(this.engineObject.engine,t.width,t.height),this.previewTexture2D.setImageSource(t),s&&s.destroy(!0)}async afterDelete(){this.engineObject.destroy(!0);const{sprites:t,id:s}=this,r=this.root.assetStore,i=[...t].map(async n=>{var c;try{const u=await r.getAssetByRef(n);((c=u==null?void 0:u.belongToAtlas)==null?void 0:c.refId)===s&&await this.root.assetFacade.updateAssetProps(u.id,{belongToAtlas:null})}catch(m){console.warn(`[SpriteAtlasAsset] Failed to cleanup sprite relation: ${(n==null?void 0:n.refId)??"unknown"}`,m)}});await Promise.allSettled(i),t.length=0}addSprites(t){const s=he([...this.sprites,...t.map(a=>({refId:a.id}))],a=>a.refId),r=t.map(a=>this.root.assetFacade.updateAssetProps(a.id,{belongToAtlas:{refId:this.id}}));return r.push(this.root.assetFacade.updateAssetProps(this.id,{sprites:s})),Promise.all(r)}async initByMain(t){const{engine:s}=this,r=JSON.parse(await t.text());for(const i in r)this[i]=r[i];const a=new U(s);this.bindEngineObject(a),a.asset=this}async initByCreation(){this.setNameByIncrease("SpriteAtlas");const t=new U(this.engine);return this.bindEngineObject(t),t.asset=this,this.getMainData()}async _onDrop(t,s){this.dropping=!1,!this.sprites.find(r=>r.refId===s.id)&&await this.addSprites([s])}};v([w({info:"sprite.atlas.max-width.info",label:"sprite.atlas.max-width.label",type:S.Input}),x()],f.prototype,"maxWidth",2);v([w({info:"sprite.atlas.max-height.info",label:"sprite.atlas.max-height.label",type:S.Input}),x()],f.prototype,"maxHeight",2);v([w({info:"sprite.atlas.padding.info",label:"sprite.atlas.padding.label",type:S.Number,min:0,max:5,dragStep:1}),x()],f.prototype,"padding",2);v([w({info:"sprite.atlas.rotation.info",label:"sprite.atlas.rotation.label",type:S.Toggle}),x()],f.prototype,"allowRotation",2);v([w({info:"sprite.atlas.tight-packing.info",label:"sprite.atlas.tight-packing.label",type:S.Toggle}),x()],f.prototype,"tightPacking",2);v([w({label:"sprite.atlas.mipmap.label",type:S.Toggle}),x()],f.prototype,"mipmap",2);v([w({label:"sprite.atlas.filter-mode.label",type:S.Select,value:j.Bilinear,options:[{label:"sprite.atlas.filter-mode.point",value:j.Point},{label:"sprite.atlas.filter-mode.bilinear",value:j.Bilinear},{label:"sprite.atlas.filter-mode.trilinear",value:j.Trilinear}]}),x()],f.prototype,"filterMode",2);v([w({label:"sprite.atlas.wrap-mode-u.label",type:S.Select,options:[{label:"sprite.atlas.wrap-mode.clamp",value:y.Clamp},{label:"sprite.atlas.wrap-mode.repeat",value:y.Repeat},{label:"sprite.atlas.wrap-mode.mirror",value:y.Mirror}]}),x()],f.prototype,"wrapModeU",2);v([w({label:"sprite.atlas.wrap-mode-v.label",type:S.Select,options:[{label:"sprite.atlas.wrap-mode.clamp",value:y.Clamp},{label:"sprite.atlas.wrap-mode.repeat",value:y.Repeat},{label:"sprite.atlas.wrap-mode.mirror",value:y.Mirror}]}),x()],f.prototype,"wrapModeV",2);v([w({label:"sprite.atlas.aniso-level.label",type:S.Slider,dragStep:1,max:16,min:1}),x()],f.prototype,"anisoLevel",2);v([re({type:"methods",key:"addSprite"}),w({label:k("sprite.atlas.sprite-list.label"),customComponent:Se}),x()],f.prototype,"sprites",2);v([ie],f.prototype,"addSprites",1);f=v([oe({type:"SpriteAtlas",label:k("asset.sprite-atlas.title"),loaderType:"SpriteAtlas",extname:"atlas",importMenuConfig:{type:ne.Add},async bundle(e,t,s){var m;const r=s.vfs,a=e.content??await r.loadFile(e.id),i=JSON.parse(await a.text()),n=e.meta,c=e.dependencies||(e.dependencies=[]);if(n.ignorePack){const u=i.atlasItems;for(let g=0,b=u.length;g<b;g++){const o=i.atlasItems[g],p=await fetch(o.img).then(I=>I.arrayBuffer()),l=await f.updateSubTextureAssets(e,g,p,t,s);o.type=l.exportType,o.img="./"+O(l.path)}}else{const u=e.id,g=i.sprites;for(let o=g.length-1;o>=0;o--){const p=g[o].refId,l=r.getFileById(p);if(l){const I=l.content??await r.loadFile(l.id);((m=JSON.parse(await I.text()).belongToAtlas)==null?void 0:m.refId)!==u&&(g.splice(o,1),console.warn("Sprite.belongToAtlas is not equal to this asset."))}else g.splice(o,1),console.warn("SpriteAsset[refId:",p,"] not found")}const b=await ue(i,r);if(b.code===0){const o=b.info;for(const l in o)i[l]=o[l];const p=b.imageFiles;for(let l=0,I=p.length;l<I;l++){const A=await f.updateSubTextureAssets(e,l,p[l],t,s),M=i.atlasItems[l];M.type=A.exportType,M.img="./"+O(A.path)}}else{for(let o=0,p=c.length;o<p;o++){const l=c[o].ref.refId;r.deleteFile(l)}c.length=0}}return delete i.usage,delete i.allowRotation,delete i.maxHeight,delete i.maxWidth,delete i.padding,delete i.sprites,delete i.tightPacking,{content:new Blob([JSON.stringify(i)])}}})],f);const Be=Object.freeze(Object.defineProperty({__proto__:null,get SpriteAtlasAsset(){return f}},Symbol.toStringTag,{value:"Module"}));export{f as S,Be as a,Ae as c};
@@ -1 +1 @@
1
- var f=Object.defineProperty;var y=(e,r,p)=>r in e?f(e,r,{enumerable:!0,configurable:!0,writable:!0,value:p}):e[r]=p;var s=(e,r,p)=>(y(e,typeof r!="symbol"?r+"":r,p),p);import{p as d,C as a,s as c,aN as o,E as w}from"./index-aec7e708.js";import"./index-e8a45e82.js";import"./postmen-2f47f6bb.js";var C=Object.defineProperty,P=Object.getOwnPropertyDescriptor,b=(e,r,p,i)=>{for(var t=i>1?void 0:i?P(r,p):r,l=e.length-1,n;l>=0;l--)(n=e[l])&&(t=(i?n(r,p,t):n(t))||t);return i&&t&&C(r,p,t),t};class m extends w{constructor(){super(...arguments);s(this,"sprite",null);s(this,"color",{r:1,g:1,b:1,a:1});s(this,"drawMode",o.Simple)}}b([d({label:"sprite.renderer.sprite.label",info:"sprite.renderer.sprite.info",type:a.AssetPicker,assetType:"sprite",onChange:async(e,r,p)=>{e.sprite=p?p.getCurrentRef():null,await e.applyBoundPathChange("sprite",a.AssetPicker,e.sprite),e.emit("propertychange","sprite",p)}}),c()],m.prototype,"sprite",2);b([d({bindPath:"color",label:"sprite.renderer.color.label",info:"sprite.renderer.color.info",type:a.Color}),c()],m.prototype,"color",2);b([d({label:"sprite.renderer.draw-mode.label",info:"sprite.renderer.draw-mode.info",type:a.Select,bindPath:"drawMode",value:o.Simple,options:[{label:"sprite.renderer.draw-mode.simple",value:o.Simple},{label:"sprite.renderer.draw-mode.sliced",value:o.Sliced},{label:"sprite.renderer.draw-mode.tiled",value:o.Tiled}]}),c()],m.prototype,"drawMode",2);export{m as S};
1
+ var f=Object.defineProperty;var y=(e,r,p)=>r in e?f(e,r,{enumerable:!0,configurable:!0,writable:!0,value:p}):e[r]=p;var s=(e,r,p)=>(y(e,typeof r!="symbol"?r+"":r,p),p);import{p as d,C as a,s as c,aN as o,E as w}from"./index-1e23212d.js";import"./index-92830754.js";import"./postmen-9e1e15bd.js";var C=Object.defineProperty,P=Object.getOwnPropertyDescriptor,b=(e,r,p,i)=>{for(var t=i>1?void 0:i?P(r,p):r,l=e.length-1,n;l>=0;l--)(n=e[l])&&(t=(i?n(r,p,t):n(t))||t);return i&&t&&C(r,p,t),t};class m extends w{constructor(){super(...arguments);s(this,"sprite",null);s(this,"color",{r:1,g:1,b:1,a:1});s(this,"drawMode",o.Simple)}}b([d({label:"sprite.renderer.sprite.label",info:"sprite.renderer.sprite.info",type:a.AssetPicker,assetType:"sprite",onChange:async(e,r,p)=>{e.sprite=p?p.getCurrentRef():null,await e.applyBoundPathChange("sprite",a.AssetPicker,e.sprite),e.emit("propertychange","sprite",p)}}),c()],m.prototype,"sprite",2);b([d({bindPath:"color",label:"sprite.renderer.color.label",info:"sprite.renderer.color.info",type:a.Color}),c()],m.prototype,"color",2);b([d({label:"sprite.renderer.draw-mode.label",info:"sprite.renderer.draw-mode.info",type:a.Select,bindPath:"drawMode",value:o.Simple,options:[{label:"sprite.renderer.draw-mode.simple",value:o.Simple},{label:"sprite.renderer.draw-mode.sliced",value:o.Sliced},{label:"sprite.renderer.draw-mode.tiled",value:o.Tiled}]}),c()],m.prototype,"drawMode",2);export{m as S};
@@ -1 +1 @@
1
- var u=Object.defineProperty;var b=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var i=(r,e,t)=>(b(r,typeof e!="symbol"?e+"":e,t),t);import{E as h,aJ as f,p as m,C as y,s as c,l as v,g as C}from"./index-aec7e708.js";import"./index-e8a45e82.js";import{c as P}from"./Component-ed7aa0ab.js";import"./postmen-2f47f6bb.js";var g=Object.defineProperty,S=Object.getOwnPropertyDescriptor,o=(r,e,t,s)=>{for(var p=s>1?void 0:s?S(e,t):e,l=r.length-1,n;l>=0;l--)(n=r[l])&&(p=(s?n(e,t,p):n(p))||p);return s&&p&&g(e,t,p),p};let a=class extends h{constructor(e,t){super(e,t);i(this,"sprite",null);i(this,"alphaCutoff",.5);i(this,"influenceLayers",[f.Everything])}};o([m({label:"sprite.mask.sprite.label",info:"sprite.mask.sprite.info",type:y.AssetPicker,assetType:"sprite",bindPath:"sprite"}),c()],a.prototype,"sprite",2);o([m({label:"sprite.mask.alpha-cutoff.label",info:"sprite.mask.alpha-cutoff.info",dragStep:.01,min:0,max:1,type:y.Slider,bindPath:"alphaCutoff"}),c()],a.prototype,"alphaCutoff",2);o([c(v()),m({label:"sprite.mask.influence-layers.label",info:"sprite.mask.influence-layers.info",type:y.Select,...C([f.Nothing,f.Everything]),bindPath:"influenceLayers"})],a.prototype,"influenceLayers",2);a=o([P({type:"SpriteMask",componentsMenu:{group:"2D",label:"component.sprite-mask.title"}})],a);export{a as SpriteMaskComponent};
1
+ var u=Object.defineProperty;var b=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var i=(r,e,t)=>(b(r,typeof e!="symbol"?e+"":e,t),t);import{E as h,aJ as f,p as m,C as y,s as c,l as v,g as C}from"./index-1e23212d.js";import"./index-92830754.js";import{c as P}from"./Component-746be670.js";import"./postmen-9e1e15bd.js";var g=Object.defineProperty,S=Object.getOwnPropertyDescriptor,o=(r,e,t,s)=>{for(var p=s>1?void 0:s?S(e,t):e,l=r.length-1,n;l>=0;l--)(n=r[l])&&(p=(s?n(e,t,p):n(p))||p);return s&&p&&g(e,t,p),p};let a=class extends h{constructor(e,t){super(e,t);i(this,"sprite",null);i(this,"alphaCutoff",.5);i(this,"influenceLayers",[f.Everything])}};o([m({label:"sprite.mask.sprite.label",info:"sprite.mask.sprite.info",type:y.AssetPicker,assetType:"sprite",bindPath:"sprite"}),c()],a.prototype,"sprite",2);o([m({label:"sprite.mask.alpha-cutoff.label",info:"sprite.mask.alpha-cutoff.info",dragStep:.01,min:0,max:1,type:y.Slider,bindPath:"alphaCutoff"}),c()],a.prototype,"alphaCutoff",2);o([c(v()),m({label:"sprite.mask.influence-layers.label",info:"sprite.mask.influence-layers.info",type:y.Select,...C([f.Nothing,f.Everything]),bindPath:"influenceLayers"})],a.prototype,"influenceLayers",2);a=o([P({type:"SpriteMask",componentsMenu:{group:"2D",label:"component.sprite-mask.title"}})],a);export{a as SpriteMaskComponent};
@@ -1 +1 @@
1
- var x=Object.defineProperty;var M=(i,t,e)=>t in i?x(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var l=(i,t,e)=>(M(i,typeof t!="symbol"?t+"":t,e),e);import{aO as _,aP as C,aQ as S,aR as w,aS as p,bk as P,aU as g,aW as y,aV as O,aK as u,aJ as m,C as o,p as c,s as h,l as v,g as I,f as j}from"./index-aec7e708.js";import{u as R}from"./index-e8a45e82.js";import{c as k}from"./Component-ed7aa0ab.js";import"./postmen-2f47f6bb.js";import{c as b}from"./createOnModelChange-b57a0da8.js";import{S as B}from"./SpriteBaseComponent-3edafa31.js";const H=_("div",{marginLeft:"5px"}),z=_(C,{border:"1px solid $gray6",borderRadius:"$2",padding:"$0_5",color:"$gray11",cursor:"pointer"}),W=S(function(i){const t=i.data,{t:e}=w();return p.jsxs(z,{align:"v",children:[t.loadingStatus==="loading"&&p.jsx(P,{size:"xs"}),t.loadingStatus==="success"&&p.jsx("img",{src:t.thumbnailUrl,alt:e("sprite.inspector.thumbnail"),width:"20px",height:"20px"}),p.jsxs(H,{children:[e("sprite.inspector.title"),"(",t.name,")"]})]})}),X=S(function(i){const[t,e]=g.useState(null),r=i.data,{assetStore:s,inspectorFacade:n}=R();return g.useEffect(()=>{s.getAssetByRef(r.sprite).then(f=>{e(f)})},[r.sprite]),p.jsxs(p.Fragment,{children:[p.jsx(y.List,{model:r,configs:r.formSchema.items,onModelChange:b("component",r.id,n,r)}),t?p.jsx(O,{nesting:!0,title:p.jsx(W,{data:t}),defaultOpen:!1,children:p.jsx(y.List,{model:t,configs:t.formSchema.items,onModelChange:b("asset",t.id,n,t)})}):null]})});var N=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,E=(i,t,e)=>t in i?N(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,d=(i,t,e,r)=>{for(var s=r>1?void 0:r?Y(t,e):t,n=i.length-1,f;n>=0;n--)(f=i[n])&&(s=(r?f(t,e,s):f(s))||s);return r&&s&&N(t,e,s),s},L=(i,t,e)=>(E(i,typeof t!="symbol"?t+"":t,e),e);let a=class extends B{constructor(t,e){super(t,e);l(this,"width",0);l(this,"height",0);l(this,"flip",[]);l(this,"maskInteraction",u.None);l(this,"maskLayer",[m.Everything]);l(this,"material",{refId:a._internalSpriteMaterialRefId});l(this,"priority",0);l(this,"_customWidth");l(this,"_customHeight");this.on("propertychange",(r,s)=>{if(r==="sprite"){const n=this.engineObject;isNaN(this._customWidth)?this.width=n.width:(this.width=this._customWidth,this.applyBoundPathChange("width",o.Number,this._customWidth)),isNaN(this._customHeight)?this.height=n.height:(this.height=this._customHeight,this.applyBoundPathChange("height",o.Number,this._customHeight))}})}async applyBoundPathChange(t,e,r){if(t==="flip"){const s=Array.isArray(r)?r:[];await super.applyBoundPathChange("flipX",o.Toggle,s.includes("flipX")),await super.applyBoundPathChange("flipY",o.Toggle,s.includes("flipY"));return}await super.applyBoundPathChange(t,e,r)}deserializeByEngineObject(t){var r;super.deserializeByEngineObject(t);const e=[];t.flipX&&e.push("flipX"),t.flipY&&e.push("flipY"),this.flip=e,(r=this._originValueMap)==null||r.set("flip",[...e])}deserialize(t){super.deserialize(t);const{props:e}=t;e!=null&&e.flipX&&this.flip.push("flipX"),e!=null&&e.flipY&&this.flip.push("flipY"),isNaN(e==null?void 0:e.width)||(this._customWidth=e.width),isNaN(e==null?void 0:e.height)||(this._customHeight=e.height)}toJSON(){const t=super.toJSON(),e=this.flip;return e&&(t.props.flipX=e.indexOf("flipX")!==-1,t.props.flipY=e.indexOf("flipY")!==-1),isNaN(this._customWidth)||(t.props.width=this._customWidth),isNaN(this._customHeight)||(t.props.height=this._customHeight),t}};L(a,"_internalSpriteMaterialRefId","0000203");d([c({label:"sprite.renderer.width.label",info:"sprite.renderer.width.info",type:o.Number,bindPath:"width",triggerAfterInit:!1,onChange(i,t,e){isNaN(e)||(i._customWidth=e)}}),h()],a.prototype,"width",2);d([c({label:"sprite.renderer.height.label",info:"sprite.renderer.height.info",type:o.Number,bindPath:"height",triggerAfterInit:!1,onChange(i,t,e){isNaN(e)||(i._customHeight=e)}}),h()],a.prototype,"height",2);d([c({label:"sprite.renderer.flip.label",info:"sprite.renderer.flip.info",type:o.ToggleGroup,bindPath:"flip",multiple:!0,options:[{label:"sprite.renderer.flip.x",value:"flipX"},{label:"sprite.renderer.flip.y",value:"flipY"}]}),h()],a.prototype,"flip",2);d([c({label:"sprite.renderer.mask-interaction.label",info:"sprite.renderer.mask-interaction.info",type:o.Select,bindPath:"maskInteraction",value:u.None,options:[{label:"sprite.renderer.mask-interaction.none",value:u.None},{label:"sprite.renderer.mask-interaction.visible-inside",value:u.VisibleInsideMask},{label:"sprite.renderer.mask-interaction.visible-outside",value:u.VisibleOutsideMask}]}),h()],a.prototype,"maskInteraction",2);d([h(v()),c({label:"sprite.renderer.mask-layer.label",info:"sprite.renderer.mask-layer.info",type:o.Select,...I([m.Nothing,m.Everything]),bindPath:"maskLayer"}),h()],a.prototype,"maskLayer",2);d([c({label:"sprite.renderer.material.label",info:"sprite.renderer.material.info",type:o.AssetPicker,assetType:"Material",customFilter:i=>{var t;return((t=i.engineObject.shader)==null?void 0:t.name)!=="particle-shader"},onChange:async(i,t,e)=>{const{material:r}=i,s=i.engineObject;if(!r){s.setMaterial(null);return}const{refId:n}=r;n===a._internalSpriteMaterialRefId?s.setMaterial(s.engine._basicResources.spriteDefaultMaterial):e?i.engineObject.setMaterial(e.engineObject):console.error(`Material asset not found: ${r.refId}`)}}),j({engineKey:"setMaterial",getEngineValue:i=>i.getMaterial()}),h({type:"methods",key:"setMaterial",onSerialize:i=>i?[[i]]:void 0,onDeserialize(i){return i?i[0][0]:void 0}})],a.prototype,"material",2);d([c({label:"sprite.renderer.priority.label",info:"sprite.renderer.priority.info",type:o.Number,bindPath:"priority"}),h()],a.prototype,"priority",2);a=d([k({type:"SpriteRenderer",componentsMenu:{group:"2D",label:"component.renderer.sprite.title"},customInspector:X})],a);export{a as SpriteRendererComponent};
1
+ var x=Object.defineProperty;var M=(i,t,e)=>t in i?x(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var l=(i,t,e)=>(M(i,typeof t!="symbol"?t+"":t,e),e);import{aO as _,aP as C,aQ as S,aR as w,aS as p,bk as P,aU as g,aW as y,aV as O,aK as u,aJ as m,C as o,p as c,s as h,l as v,g as I,f as j}from"./index-1e23212d.js";import{u as R}from"./index-92830754.js";import{c as k}from"./Component-746be670.js";import"./postmen-9e1e15bd.js";import{c as b}from"./createOnModelChange-b57a0da8.js";import{S as B}from"./SpriteBaseComponent-a75e84c1.js";const H=_("div",{marginLeft:"5px"}),z=_(C,{border:"1px solid $gray6",borderRadius:"$2",padding:"$0_5",color:"$gray11",cursor:"pointer"}),W=S(function(i){const t=i.data,{t:e}=w();return p.jsxs(z,{align:"v",children:[t.loadingStatus==="loading"&&p.jsx(P,{size:"xs"}),t.loadingStatus==="success"&&p.jsx("img",{src:t.thumbnailUrl,alt:e("sprite.inspector.thumbnail"),width:"20px",height:"20px"}),p.jsxs(H,{children:[e("sprite.inspector.title"),"(",t.name,")"]})]})}),X=S(function(i){const[t,e]=g.useState(null),r=i.data,{assetStore:s,inspectorFacade:n}=R();return g.useEffect(()=>{s.getAssetByRef(r.sprite).then(f=>{e(f)})},[r.sprite]),p.jsxs(p.Fragment,{children:[p.jsx(y.List,{model:r,configs:r.formSchema.items,onModelChange:b("component",r.id,n,r)}),t?p.jsx(O,{nesting:!0,title:p.jsx(W,{data:t}),defaultOpen:!1,children:p.jsx(y.List,{model:t,configs:t.formSchema.items,onModelChange:b("asset",t.id,n,t)})}):null]})});var N=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,E=(i,t,e)=>t in i?N(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,d=(i,t,e,r)=>{for(var s=r>1?void 0:r?Y(t,e):t,n=i.length-1,f;n>=0;n--)(f=i[n])&&(s=(r?f(t,e,s):f(s))||s);return r&&s&&N(t,e,s),s},L=(i,t,e)=>(E(i,typeof t!="symbol"?t+"":t,e),e);let a=class extends B{constructor(t,e){super(t,e);l(this,"width",0);l(this,"height",0);l(this,"flip",[]);l(this,"maskInteraction",u.None);l(this,"maskLayer",[m.Everything]);l(this,"material",{refId:a._internalSpriteMaterialRefId});l(this,"priority",0);l(this,"_customWidth");l(this,"_customHeight");this.on("propertychange",(r,s)=>{if(r==="sprite"){const n=this.engineObject;isNaN(this._customWidth)?this.width=n.width:(this.width=this._customWidth,this.applyBoundPathChange("width",o.Number,this._customWidth)),isNaN(this._customHeight)?this.height=n.height:(this.height=this._customHeight,this.applyBoundPathChange("height",o.Number,this._customHeight))}})}async applyBoundPathChange(t,e,r){if(t==="flip"){const s=Array.isArray(r)?r:[];await super.applyBoundPathChange("flipX",o.Toggle,s.includes("flipX")),await super.applyBoundPathChange("flipY",o.Toggle,s.includes("flipY"));return}await super.applyBoundPathChange(t,e,r)}deserializeByEngineObject(t){var r;super.deserializeByEngineObject(t);const e=[];t.flipX&&e.push("flipX"),t.flipY&&e.push("flipY"),this.flip=e,(r=this._originValueMap)==null||r.set("flip",[...e])}deserialize(t){super.deserialize(t);const{props:e}=t;e!=null&&e.flipX&&this.flip.push("flipX"),e!=null&&e.flipY&&this.flip.push("flipY"),isNaN(e==null?void 0:e.width)||(this._customWidth=e.width),isNaN(e==null?void 0:e.height)||(this._customHeight=e.height)}toJSON(){const t=super.toJSON(),e=this.flip;return e&&(t.props.flipX=e.indexOf("flipX")!==-1,t.props.flipY=e.indexOf("flipY")!==-1),isNaN(this._customWidth)||(t.props.width=this._customWidth),isNaN(this._customHeight)||(t.props.height=this._customHeight),t}};L(a,"_internalSpriteMaterialRefId","0000203");d([c({label:"sprite.renderer.width.label",info:"sprite.renderer.width.info",type:o.Number,bindPath:"width",triggerAfterInit:!1,onChange(i,t,e){isNaN(e)||(i._customWidth=e)}}),h()],a.prototype,"width",2);d([c({label:"sprite.renderer.height.label",info:"sprite.renderer.height.info",type:o.Number,bindPath:"height",triggerAfterInit:!1,onChange(i,t,e){isNaN(e)||(i._customHeight=e)}}),h()],a.prototype,"height",2);d([c({label:"sprite.renderer.flip.label",info:"sprite.renderer.flip.info",type:o.ToggleGroup,bindPath:"flip",multiple:!0,options:[{label:"sprite.renderer.flip.x",value:"flipX"},{label:"sprite.renderer.flip.y",value:"flipY"}]}),h()],a.prototype,"flip",2);d([c({label:"sprite.renderer.mask-interaction.label",info:"sprite.renderer.mask-interaction.info",type:o.Select,bindPath:"maskInteraction",value:u.None,options:[{label:"sprite.renderer.mask-interaction.none",value:u.None},{label:"sprite.renderer.mask-interaction.visible-inside",value:u.VisibleInsideMask},{label:"sprite.renderer.mask-interaction.visible-outside",value:u.VisibleOutsideMask}]}),h()],a.prototype,"maskInteraction",2);d([h(v()),c({label:"sprite.renderer.mask-layer.label",info:"sprite.renderer.mask-layer.info",type:o.Select,...I([m.Nothing,m.Everything]),bindPath:"maskLayer"}),h()],a.prototype,"maskLayer",2);d([c({label:"sprite.renderer.material.label",info:"sprite.renderer.material.info",type:o.AssetPicker,assetType:"Material",customFilter:i=>{var t;return((t=i.engineObject.shader)==null?void 0:t.name)!=="particle-shader"},onChange:async(i,t,e)=>{const{material:r}=i,s=i.engineObject;if(!r){s.setMaterial(null);return}const{refId:n}=r;n===a._internalSpriteMaterialRefId?s.setMaterial(s.engine._basicResources.spriteDefaultMaterial):e?i.engineObject.setMaterial(e.engineObject):console.error(`Material asset not found: ${r.refId}`)}}),j({engineKey:"setMaterial",getEngineValue:i=>i.getMaterial()}),h({type:"methods",key:"setMaterial",onSerialize:i=>i?[[i]]:void 0,onDeserialize(i){return i?i[0][0]:void 0}})],a.prototype,"material",2);d([c({label:"sprite.renderer.priority.label",info:"sprite.renderer.priority.info",type:o.Number,bindPath:"priority"}),h()],a.prototype,"priority",2);a=d([k({type:"SpriteRenderer",componentsMenu:{group:"2D",label:"component.renderer.sprite.title"},customInspector:X})],a);export{a as SpriteRendererComponent};
@@ -1,4 +1,4 @@
1
- var m=Object.defineProperty;var w=(e,n,t)=>n in e?m(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var l=(e,n,t)=>(w(e,typeof n!="symbol"?n+"":n,t),t);import{aG as v,co as T,aS as o,cp as g,p,C as i,s as c,cq as a,f as y,z as b,cr as u,cs as d,e as C,E as A}from"./index-aec7e708.js";import"./index-e8a45e82.js";import"./postmen-2f47f6bb.js";/**
1
+ var m=Object.defineProperty;var w=(e,n,t)=>n in e?m(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var l=(e,n,t)=>(w(e,typeof n!="symbol"?n+"":n,t),t);import{aG as v,co as T,aS as o,cp as g,p,C as i,s as c,cq as a,f as y,z as b,cr as u,cs as d,e as C,E as A}from"./index-1e23212d.js";import"./index-92830754.js";import"./postmen-9e1e15bd.js";/**
2
2
  * @license @tabler/icons-react v3.24.0 - MIT
3
3
  *
4
4
  * This source code is licensed under the MIT license.
@@ -1 +1 @@
1
- var c=Object.defineProperty;var x=(r,e,t)=>e in r?c(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var a=(r,e,t)=>(x(r,typeof e!="symbol"?e+"":e,t),t);import{aK as l,aJ as h,p,C as s,s as d,g as f,l as u}from"./index-aec7e708.js";import"./index-e8a45e82.js";import{c as v}from"./Component-ed7aa0ab.js";import"./postmen-2f47f6bb.js";import{T as k}from"./TextBaseComponent-ce1402c3.js";var g=Object.defineProperty,P=Object.getOwnPropertyDescriptor,o=(r,e,t,m)=>{for(var i=m>1?void 0:m?P(e,t):e,b=r.length-1,y;b>=0;b--)(y=r[b])&&(i=(m?y(e,t,i):y(i))||i);return m&&i&&g(e,t,i),i};let n=class extends k{constructor(e,t){super(e,t);a(this,"width",0);a(this,"height",0);a(this,"maskInteraction",l.None);a(this,"maskLayer",[h.Layer0]);a(this,"priority",0)}};o([p({label:"text-renderer.width.label",info:"text-renderer.width.info",type:s.Number,bindPath:"width"}),d()],n.prototype,"width",2);o([p({label:"text-renderer.height.label",info:"text-renderer.height.info",type:s.Number,bindPath:"height"}),d()],n.prototype,"height",2);o([p({label:"text-renderer.mask-interaction.label",info:"text-renderer.mask-interaction.info",type:s.Select,bindPath:"maskInteraction",value:l.None,options:[{label:"text-renderer.mask-interaction.none",value:l.None},{label:"text-renderer.mask-interaction.visible-inside",value:l.VisibleInsideMask},{label:"text-renderer.mask-interaction.visible-outside",value:l.VisibleOutsideMask}]}),d()],n.prototype,"maskInteraction",2);o([p({label:"text-renderer.mask-layer.label",info:"text-renderer.mask-layer.info",type:s.Select,bindPath:"maskLayer",...f([h.Nothing,h.Everything])}),d(u())],n.prototype,"maskLayer",2);o([p({label:"text-renderer.priority.label",info:"text-renderer.priority.info",type:s.Number,bindPath:"priority"}),d()],n.prototype,"priority",2);n=o([v({type:"TextRenderer",componentsMenu:{group:"2D",label:"component.text-renderer.title"}})],n);export{n as TextRendererComponent};
1
+ var c=Object.defineProperty;var x=(r,e,t)=>e in r?c(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var a=(r,e,t)=>(x(r,typeof e!="symbol"?e+"":e,t),t);import{aK as l,aJ as h,p,C as s,s as d,g as f,l as u}from"./index-1e23212d.js";import"./index-92830754.js";import{c as v}from"./Component-746be670.js";import"./postmen-9e1e15bd.js";import{T as k}from"./TextBaseComponent-95846acf.js";var g=Object.defineProperty,P=Object.getOwnPropertyDescriptor,o=(r,e,t,m)=>{for(var i=m>1?void 0:m?P(e,t):e,b=r.length-1,y;b>=0;b--)(y=r[b])&&(i=(m?y(e,t,i):y(i))||i);return m&&i&&g(e,t,i),i};let n=class extends k{constructor(e,t){super(e,t);a(this,"width",0);a(this,"height",0);a(this,"maskInteraction",l.None);a(this,"maskLayer",[h.Layer0]);a(this,"priority",0)}};o([p({label:"text-renderer.width.label",info:"text-renderer.width.info",type:s.Number,bindPath:"width"}),d()],n.prototype,"width",2);o([p({label:"text-renderer.height.label",info:"text-renderer.height.info",type:s.Number,bindPath:"height"}),d()],n.prototype,"height",2);o([p({label:"text-renderer.mask-interaction.label",info:"text-renderer.mask-interaction.info",type:s.Select,bindPath:"maskInteraction",value:l.None,options:[{label:"text-renderer.mask-interaction.none",value:l.None},{label:"text-renderer.mask-interaction.visible-inside",value:l.VisibleInsideMask},{label:"text-renderer.mask-interaction.visible-outside",value:l.VisibleOutsideMask}]}),d()],n.prototype,"maskInteraction",2);o([p({label:"text-renderer.mask-layer.label",info:"text-renderer.mask-layer.info",type:s.Select,bindPath:"maskLayer",...f([h.Nothing,h.Everything])}),d(u())],n.prototype,"maskLayer",2);o([p({label:"text-renderer.priority.label",info:"text-renderer.priority.info",type:s.Number,bindPath:"priority"}),d()],n.prototype,"priority",2);n=o([v({type:"TextRenderer",componentsMenu:{group:"2D",label:"component.text-renderer.title"}})],n);export{n as TextRendererComponent};