@volter/editor 0.5.59 → 0.5.60
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.
- package/BUNDLED_NOTICES +6 -6
- package/dist/.vite/manifest.json +206 -232
- package/dist/assets/{AudioViewer-C5C4xeUl.js → AudioViewer-C9JP7n49.js} +1 -1
- package/dist/assets/{EntityModelDocument-DyhU8umO.js → EntityModelDocument-SFgsuX4_.js} +1 -1
- package/dist/assets/{EnvironmentAssetDocument-D_VZ2iFj.js → EnvironmentAssetDocument-DEqKuki2.js} +1 -1
- package/dist/assets/{GameplaySessionTimeline-kIIuhFBI.js → GameplaySessionTimeline-BtEPIu2F.js} +1 -1
- package/dist/assets/{ImageViewer-Crv-yzT_.js → ImageViewer-CyIXlQTG.js} +1 -1
- package/dist/assets/{InspectorObjectPreview-CO-GVXfu.js → InspectorObjectPreview-MDmTPFBT.js} +1 -1
- package/dist/assets/{JsonAssetDocument-Dtg2QwPN.js → JsonAssetDocument-Zyv_CDpC.js} +1 -1
- package/dist/assets/{ModelAssetDocument-BpZ8SZXe.js → ModelAssetDocument-BKdnWaJL.js} +1 -1
- package/dist/assets/{NonThreeAuthoringBootstrap-0nm5Hl3v.js → NonThreeAuthoringBootstrap-ab96Xbnn.js} +2 -2
- package/dist/assets/{Object3DPreview-dHzSO5Ym.js → Object3DPreview-ChopdNF4.js} +2 -2
- package/dist/assets/{OnlineAssetDetail-DAdWXnmZ.js → OnlineAssetDetail-B_l8XkeE.js} +2 -2
- package/dist/assets/{SourceAssetViewer-D3m0wF8T.js → SourceAssetViewer-zpxF5DOe.js} +2 -2
- package/dist/assets/{StageHost-DD_m8W0k.js → StageHost-B4P-uvV9.js} +4 -4
- package/dist/assets/{ToolObject3DPreview-CWdklUZ1.js → ToolObject3DPreview-DGcT5dDK.js} +1 -1
- package/dist/assets/{TransientHint-aFFUtbSY.js → TransientHint-9_u15mth.js} +1 -1
- package/dist/assets/{VideoViewer-BhH8aSzx.js → VideoViewer-3I_zUWEC.js} +1 -1
- package/dist/assets/{asset-editor-persistence-D5wYXQEL.js → asset-editor-persistence-B6Yg7dTC.js} +1 -1
- package/dist/assets/{blender-node-editor.document-D-hrVHmR.js → blender-node-editor.document-DGn6U6Kf.js} +1 -1
- package/dist/assets/blender-properties-tab-DkE9ensL.js +3 -0
- package/dist/assets/blender-runtime-host-JKPuUKtZ.js +4 -0
- package/dist/assets/{blender-runtime-skin-AJdtKKnf.js → blender-runtime-skin-BFLh4nHG.js} +1 -1
- package/dist/assets/{blender-runtime.document-JlYY0bb7.js → blender-runtime.document-C60VEa1_.js} +3 -3
- package/dist/assets/{blender-timeline.document-5UN8V20F.js → blender-timeline.document-D9BOYb0q.js} +1 -1
- package/dist/assets/{blender-uv-editor.document-maFJQzgA.js → blender-uv-editor.document-BK2pP2sR.js} +1 -1
- package/dist/assets/{blender-version.status-CukRH8K3.js → blender-version.status-ZqfW0upF.js} +1 -1
- package/dist/assets/{blender.command-CY6QiXxp.js → blender.command-BLtAEuIZ.js} +1 -1
- package/dist/assets/{browserAll-BQIn-DRw.js → browserAll-DTuU4PmC.js} +1 -1
- package/dist/assets/{edit-mode-authoring-CWTeROGv.js → edit-mode-authoring-DBEoND0w.js} +1 -1
- package/dist/assets/{hosted-asset-materialization-DcthzsYS.js → hosted-asset-materialization-6HtWQ0od.js} +1 -1
- package/dist/assets/{index-DmtPt6RQ.js → index-DuB3wHKD.js} +12 -12
- package/dist/assets/{models.finder-CrDJ41Cp.js → models.finder-Bs46IncP.js} +1 -1
- package/dist/assets/{product-CqAh01LU.js → product-FSoI1WhZ.js} +1 -1
- package/dist/assets/properties-bone-constraints.inspector-QML_-0yQ.js +1 -0
- package/dist/assets/properties-bone.inspector-DSDyP6-P.js +1 -0
- package/dist/assets/properties-collection.inspector-jic5mzgz.js +1 -0
- package/dist/assets/properties-constraints.inspector-TLHv00p7.js +1 -0
- package/dist/assets/properties-data.inspector-BJBPl88V.js +1 -0
- package/dist/assets/properties-material.inspector-xxWuVjrx.js +1 -0
- package/dist/assets/properties-modifiers.inspector-CWjdmu_J.js +1 -0
- package/dist/assets/properties-object.inspector-D15l44Tq.js +1 -0
- package/dist/assets/properties-output.inspector-DVuGGSBb.js +1 -0
- package/dist/assets/properties-particles.inspector-B94x32Ez.js +1 -0
- package/dist/assets/properties-physics.inspector-9EYMjwFP.js +1 -0
- package/dist/assets/properties-render.inspector-8yA_8luD.js +1 -0
- package/dist/assets/properties-scene.inspector-WM7qZhJ4.js +1 -0
- package/dist/assets/properties-texture.inspector-Cno5lCIz.js +1 -0
- package/dist/assets/properties-view-layer.inspector--PX0c9h6.js +1 -0
- package/dist/assets/properties-world.inspector-C3EuydM_.js +1 -0
- package/dist/assets/{react-story-board-CnCZAhn6.js → react-story-board-d_OfX68Z.js} +1 -1
- package/dist/assets/{react-three-rapier.esm-DsJqtzy_.js → react-three-rapier.esm-Ch_Gf2qR.js} +1 -1
- package/dist/assets/{spark.module-uQlq--TY.js → spark.module-B_-x7Z29.js} +1 -1
- package/dist/assets/{stage-keyboard-DzZMNYAr.js → stage-keyboard-C9wzGFxu.js} +1 -1
- package/dist/assets/{stage-overlay-set-D6OOz1L9.js → stage-overlay-set-D7J-N5eX.js} +1 -1
- package/dist/assets/{stage-presence-markers-BUaSzKCv.js → stage-presence-markers-DvbNl1W4.js} +1 -1
- package/dist/assets/{story-capture-C2ExQiuI.js → story-capture-D0H-H2_b.js} +1 -1
- package/dist/assets/{story-pixi-preview-C6n-a2_M.js → story-pixi-preview-Cafk1Xbk.js} +1 -1
- package/dist/assets/{story-three-preview-BazrPMDu.js → story-three-preview-ByMTQc8w.js} +2 -2
- package/dist/assets/{webworkerAll-FJN9IDir.js → webworkerAll-CS1yjkoi.js} +1 -1
- package/dist/assets/{world-documents-B6usBw3s.js → world-documents-CWiw361z.js} +1 -1
- package/dist-node/cli.js +7 -7
- package/package.json +7 -7
- package/dist/assets/blender-outliner-model-FscHWpfW.js +0 -1
- package/dist/assets/blender-properties-tab-Czi3_yYZ.js +0 -3
- package/dist/assets/blender-runtime-host-C3rVDyG8.js +0 -4
- package/dist/assets/properties-bone-constraints.inspector-BPN6BRJV.js +0 -1
- package/dist/assets/properties-bone.inspector-C4xD61mX.js +0 -1
- package/dist/assets/properties-collection.inspector-BTps8t6G.js +0 -1
- package/dist/assets/properties-constraints.inspector-BVvP6esW.js +0 -1
- package/dist/assets/properties-data.inspector-CKKO8DVT.js +0 -1
- package/dist/assets/properties-material.inspector-BGfT8kHT.js +0 -1
- package/dist/assets/properties-modifiers.inspector-DJRANpOY.js +0 -1
- package/dist/assets/properties-object.inspector-CgVfWmw2.js +0 -1
- package/dist/assets/properties-output.inspector-CBl5xEMZ.js +0 -1
- package/dist/assets/properties-particles.inspector-CxVZ09ZY.js +0 -1
- package/dist/assets/properties-physics.inspector-DmG3i3vY.js +0 -1
- package/dist/assets/properties-render.inspector-TCoPfEn0.js +0 -1
- package/dist/assets/properties-scene.inspector-BjsTOBiY.js +0 -1
- package/dist/assets/properties-texture.inspector-D1X9iyVV.js +0 -1
- package/dist/assets/properties-view-layer.inspector-dXTVxzzk.js +0 -1
- package/dist/assets/properties-world.inspector-CRxJK930.js +0 -1
package/dist/assets/{blender-runtime.document-JlYY0bb7.js → blender-runtime.document-C60VEa1_.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{a as u}from"./jsx-runtime-DPjLkJKQ.js";import{c as de,a as ue}from"./blender-runtime-skin-AJdtKKnf.js";import{e as V,ai as be,aj as S,ak as B,al as z,am as pe,an as fe}from"./index-DmtPt6RQ.js";import{r as O}from"./index-DaQZGF7d.js";import{p as te,q as me,t as ge,u as oe,v as he,w as re}from"./blender-runtime-host-C3rVDyG8.js";import"./index-CtzuWnCS.js";import"./index-D2LwEE0L.js";import{o as ye,s as $,r as D,b as je,a as q,c as Y,w as le,d as _e,e as P}from"./blender-outliner-model-FscHWpfW.js";import{bf as ve}from"./three.module-BynznMJN.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./LineSegments2-vfeDUBfs.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./clip-planes-CnAI6DZn.js";function ke(l){return`blender-${l.toLowerCase().replace(/_/g,"-")}`}function x(l){return l?.type==="TSE_SOME_ID"&&l.struct==="Object"&&l.object!==void 0}function ne(l){if(l.struct)return l.struct}function ae(l,o){return{id:l.id,label:l.name,role:"entity",kind:ke(l.icon),...ne(l)?{typeLabel:ne(l)}:{},parentId:o,childIds:l.children.map(n=>n.id),defaultExpanded:l.expanded}}const we={transform:!0,inspectorFields:!1,persist:!0},L=new Set;function Ee(l){for(const o of L)if(o.documentId===l)return o;return L.size===1?[...L][0]:null}const Oe=()=>({position:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1]});function Se(l,o){l.updateWorldMatrix(!0,!1);const n=o.matrixWorld.clone().invert().multiply(l.matrixWorld).elements;return[[n[0],n[1],n[2],n[3]],[n[4],n[5],n[6],n[7]],[n[8],n[9],n[10],n[11]],[n[12],n[13],n[14],n[15]]]}function M(l,o){return`${l} needs a file, and this editor has no door to ask for one: the host's file door (\`EditorHost.files\`, \`@volter/editor-sdk/host\`) reads and writes project-relative paths and has no file-picker member, so there is nothing to open the workbench's own dialog through. Blender's row opens a file browser; run without one, the engine answers "${o}".`}const Ce=[{kind:"mesh.plane",label:"Plane",group:"Mesh",call:"mesh.primitive_plane_add"},{kind:"mesh.cube",label:"Cube",group:"Mesh",call:"mesh.primitive_cube_add"},{kind:"mesh.circle",label:"Circle",group:"Mesh",call:"mesh.primitive_circle_add"},{kind:"mesh.uv-sphere",label:"UV Sphere",group:"Mesh",call:"mesh.primitive_uv_sphere_add"},{kind:"mesh.ico-sphere",label:"Ico Sphere",group:"Mesh",call:"mesh.primitive_ico_sphere_add"},{kind:"mesh.cylinder",label:"Cylinder",group:"Mesh",call:"mesh.primitive_cylinder_add"},{kind:"mesh.cone",label:"Cone",group:"Mesh",call:"mesh.primitive_cone_add"},{kind:"mesh.torus",label:"Torus",group:"Mesh",call:"mesh.primitive_torus_add"},{kind:"mesh.grid",label:"Grid",group:"Mesh",call:"mesh.primitive_grid_add",separatorBefore:!0},{kind:"mesh.monkey",label:"Monkey",group:"Mesh",call:"mesh.primitive_monkey_add"},{kind:"curve.bezier",label:"Bézier",group:"Curve",call:"curve.primitive_bezier_curve_add"},{kind:"curve.bezier-circle",label:"Circle",group:"Curve",call:"curve.primitive_bezier_circle_add"},{kind:"curve.nurbs-curve",label:"Nurbs Curve",group:"Curve",call:"curve.primitive_nurbs_curve_add",separatorBefore:!0},{kind:"curve.nurbs-circle",label:"Nurbs Circle",group:"Curve",call:"curve.primitive_nurbs_circle_add"},{kind:"curve.path",label:"Path",group:"Curve",call:"curve.primitive_nurbs_path_add"},{kind:"curve.empty-hair",label:"Empty Hair",group:"Curve",call:"object.curves_empty_hair_add",separatorBefore:!0},{kind:"curve.fur",label:"Fur",group:"Curve",call:"object.quick_fur",placesAtOrigin:!1},{kind:"surface.nurbs-curve",label:"Nurbs Curve",group:"Surface",call:"surface.primitive_nurbs_surface_curve_add"},{kind:"surface.nurbs-circle",label:"Nurbs Circle",group:"Surface",call:"surface.primitive_nurbs_surface_circle_add"},{kind:"surface.nurbs-surface",label:"Nurbs Surface",group:"Surface",call:"surface.primitive_nurbs_surface_surface_add"},{kind:"surface.nurbs-cylinder",label:"Nurbs Cylinder",group:"Surface",call:"surface.primitive_nurbs_surface_cylinder_add"},{kind:"surface.nurbs-sphere",label:"Nurbs Sphere",group:"Surface",call:"surface.primitive_nurbs_surface_sphere_add"},{kind:"surface.nurbs-torus",label:"Nurbs Torus",group:"Surface",call:"surface.primitive_nurbs_surface_torus_add"},{kind:"metaball.ball",label:"Ball",group:"Metaball",call:"object.metaball_add, type='BALL'"},{kind:"metaball.capsule",label:"Capsule",group:"Metaball",call:"object.metaball_add, type='CAPSULE'"},{kind:"metaball.plane",label:"Plane",group:"Metaball",call:"object.metaball_add, type='PLANE'"},{kind:"metaball.ellipsoid",label:"Ellipsoid",group:"Metaball",call:"object.metaball_add, type='ELLIPSOID'"},{kind:"metaball.cube",label:"Cube",group:"Metaball",call:"object.metaball_add, type='CUBE'"},{kind:"text",label:"Text",group:null,call:"object.text_add"},{kind:"point-cloud",label:"Point Cloud",group:null,call:"object.pointcloud_random_add"},{kind:"volume.import",label:"Import OpenVDB...",group:"Volume",call:"object.volume_import",refusal:`${M("Importing an OpenVDB volume","CANCELLED, with nothing created")} This build also has no OpenVDB at all (\`bpy.app.build_options.openvdb\` is False), so a file would not be read even with a picker.`},{kind:"volume.empty",label:"Empty",group:"Volume",call:"object.volume_add"},{kind:"grease-pencil.blank",label:"Blank",group:"Grease Pencil",call:"object.grease_pencil_add, type='EMPTY'"},{kind:"grease-pencil.stroke",label:"Stroke",group:"Grease Pencil",call:"object.grease_pencil_add, type='STROKE'"},{kind:"grease-pencil.monkey",label:"Monkey",group:"Grease Pencil",call:"object.grease_pencil_add, type='MONKEY'"},{kind:"grease-pencil.lineart-scene",label:"Scene Line Art",group:"Grease Pencil",call:"object.grease_pencil_add, type='LINEART_SCENE'",separatorBefore:!0},{kind:"grease-pencil.lineart-collection",label:"Collection Line Art",group:"Grease Pencil",call:"object.grease_pencil_add, type='LINEART_COLLECTION'"},{kind:"grease-pencil.lineart-object",label:"Object Line Art",group:"Grease Pencil",call:"object.grease_pencil_add, type='LINEART_OBJECT'"},{kind:"armature",label:"Armature",group:null,call:"object.armature_add"},{kind:"lattice.lattice",label:"Lattice",group:"Lattice",call:"object.add, type='LATTICE'"},{kind:"lattice.deform-selected",label:"Lattice Deform Selected",group:"Lattice",call:"object.lattice_add_to_selected"},{kind:"empty.plain-axes",label:"Plain Axes",group:"Empty",call:"object.empty_add, type='PLAIN_AXES'"},{kind:"empty.arrows",label:"Arrows",group:"Empty",call:"object.empty_add, type='ARROWS'"},{kind:"empty.single-arrow",label:"Single Arrow",group:"Empty",call:"object.empty_add, type='SINGLE_ARROW'"},{kind:"empty.circle",label:"Circle",group:"Empty",call:"object.empty_add, type='CIRCLE'"},{kind:"empty.cube",label:"Cube",group:"Empty",call:"object.empty_add, type='CUBE'"},{kind:"empty.sphere",label:"Sphere",group:"Empty",call:"object.empty_add, type='SPHERE'"},{kind:"empty.cone",label:"Cone",group:"Empty",call:"object.empty_add, type='CONE'"},{kind:"image.reference",label:"Reference...",group:"Image",call:"object.empty_image_add, background=False",refusal:M("A reference image","poll() failed, context is incorrect / Please select at least one image")},{kind:"image.background",label:"Background...",group:"Image",call:"object.empty_image_add, background=True",refusal:M("A background image","poll() failed, context is incorrect / Please select at least one image")},{kind:"image.mesh-plane",label:"Mesh Plane...",group:"Image",call:"image.import_as_mesh_planes",placesAtOrigin:!1,refusal:M("An image as a mesh plane","CANCELLED, with nothing created")},{kind:"image.empty-image",label:"Empty Image",group:"Image",call:"object.empty_add, type='IMAGE'"},{kind:"light.point",label:"Point",group:"Light",call:"object.light_add, type='POINT'"},{kind:"light.sun",label:"Sun",group:"Light",call:"object.light_add, type='SUN'"},{kind:"light.spot",label:"Spot",group:"Light",call:"object.light_add, type='SPOT'"},{kind:"light.area",label:"Area",group:"Light",call:"object.light_add, type='AREA'"},{kind:"light-probe.sphere",label:"Sphere",group:"Light Probe",call:"object.lightprobe_add, type='SPHERE'"},{kind:"light-probe.plane",label:"Plane",group:"Light Probe",call:"object.lightprobe_add, type='PLANE'"},{kind:"light-probe.volume",label:"Volume",group:"Light Probe",call:"object.lightprobe_add, type='VOLUME'"},{kind:"camera",label:"Camera",group:null,call:"object.camera_add"},{kind:"speaker",label:"Speaker",group:null,call:"object.speaker_add"},{kind:"force-field.force",label:"Force",group:"Force Field",call:"object.effector_add, type='FORCE'"},{kind:"force-field.wind",label:"Wind",group:"Force Field",call:"object.effector_add, type='WIND'"},{kind:"force-field.vortex",label:"Vortex",group:"Force Field",call:"object.effector_add, type='VORTEX'"},{kind:"force-field.magnetic",label:"Magnetic",group:"Force Field",call:"object.effector_add, type='MAGNET'"},{kind:"force-field.harmonic",label:"Harmonic",group:"Force Field",call:"object.effector_add, type='HARMONIC'"},{kind:"force-field.charge",label:"Charge",group:"Force Field",call:"object.effector_add, type='CHARGE'"},{kind:"force-field.lennard-jones",label:"Lennard-Jones",group:"Force Field",call:"object.effector_add, type='LENNARDJ'"},{kind:"force-field.texture",label:"Texture",group:"Force Field",call:"object.effector_add, type='TEXTURE'"},{kind:"force-field.curve-guide",label:"Curve Guide",group:"Force Field",call:"object.effector_add, type='GUIDE'"},{kind:"force-field.boid",label:"Boid",group:"Force Field",call:"object.effector_add, type='BOID'"},{kind:"force-field.turbulence",label:"Turbulence",group:"Force Field",call:"object.effector_add, type='TURBULENCE'"},{kind:"force-field.drag",label:"Drag",group:"Force Field",call:"object.effector_add, type='DRAG'"},{kind:"force-field.fluid-flow",label:"Fluid Flow",group:"Force Field",call:"object.effector_add, type='FLUID'"}],xe="collection-instance:";function Ne(){const l=new Map;for(const o of P().byId.values()){if(o.type!=="TSE_LAYER_COLLECTION")continue;const n=o.data;n===void 0||!n.startsWith("bpy.data.collections[")||l.has(o.name)||l.set(o.name,{kind:`${xe}${o.name}`,label:o.name,group:"Collection Instance",call:`object.collection_instance_add, collection=${N(o.name)}`})}return[...l.values()]}function G(){return[...Ce,...Ne()]}function Fe(l){const[o,...n]=l.call.split(", "),c=l.placesAtOrigin===!1?n:[...n,"location=(0, 0, 0)"];return`bpy.ops.${o}(${c.join(", ")})`}function N(l){return JSON.stringify(l)}async function A(l,o="Blender Python"){const n=["before = {o.name for o in bpy.data.objects}",l,"made = [o.name for o in bpy.data.objects if o.name not in before]",'print("\\n".join(made))'].join(`
|
|
1
|
+
import{a as u}from"./jsx-runtime-DPjLkJKQ.js";import{c as de,a as ue}from"./blender-runtime-skin-BFLh4nHG.js";import{e as V,ai as be,aj as S,ak as B,al as z,am as pe,an as fe}from"./index-DuB3wHKD.js";import{r as O}from"./index-DaQZGF7d.js";import{o as me,k as $,l as D,m as ge,p as q,q as Y,t as te,u as he,v as ye,w as re,x as je,y as P,z as oe,A as _e,B as le}from"./blender-runtime-host-JKPuUKtZ.js";import"./index-CtzuWnCS.js";import"./index-D2LwEE0L.js";import{bf as ve}from"./three.module-BynznMJN.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./LineSegments2-vfeDUBfs.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./clip-planes-CnAI6DZn.js";function ke(l){return`blender-${l.toLowerCase().replace(/_/g,"-")}`}function x(l){return l?.type==="TSE_SOME_ID"&&l.struct==="Object"&&l.object!==void 0}function ne(l){if(l.struct)return l.struct}function ae(l,o){return{id:l.id,label:l.name,role:"entity",kind:ke(l.icon),...ne(l)?{typeLabel:ne(l)}:{},parentId:o,childIds:l.children.map(n=>n.id),defaultExpanded:l.expanded}}const we={transform:!0,inspectorFields:!1,persist:!0},L=new Set;function Ee(l){for(const o of L)if(o.documentId===l)return o;return L.size===1?[...L][0]:null}const Oe=()=>({position:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1]});function Se(l,o){l.updateWorldMatrix(!0,!1);const n=o.matrixWorld.clone().invert().multiply(l.matrixWorld).elements;return[[n[0],n[1],n[2],n[3]],[n[4],n[5],n[6],n[7]],[n[8],n[9],n[10],n[11]],[n[12],n[13],n[14],n[15]]]}function M(l,o){return`${l} needs a file, and this editor has no door to ask for one: the host's file door (\`EditorHost.files\`, \`@volter/editor-sdk/host\`) reads and writes project-relative paths and has no file-picker member, so there is nothing to open the workbench's own dialog through. Blender's row opens a file browser; run without one, the engine answers "${o}".`}const Ce=[{kind:"mesh.plane",label:"Plane",group:"Mesh",call:"mesh.primitive_plane_add"},{kind:"mesh.cube",label:"Cube",group:"Mesh",call:"mesh.primitive_cube_add"},{kind:"mesh.circle",label:"Circle",group:"Mesh",call:"mesh.primitive_circle_add"},{kind:"mesh.uv-sphere",label:"UV Sphere",group:"Mesh",call:"mesh.primitive_uv_sphere_add"},{kind:"mesh.ico-sphere",label:"Ico Sphere",group:"Mesh",call:"mesh.primitive_ico_sphere_add"},{kind:"mesh.cylinder",label:"Cylinder",group:"Mesh",call:"mesh.primitive_cylinder_add"},{kind:"mesh.cone",label:"Cone",group:"Mesh",call:"mesh.primitive_cone_add"},{kind:"mesh.torus",label:"Torus",group:"Mesh",call:"mesh.primitive_torus_add"},{kind:"mesh.grid",label:"Grid",group:"Mesh",call:"mesh.primitive_grid_add",separatorBefore:!0},{kind:"mesh.monkey",label:"Monkey",group:"Mesh",call:"mesh.primitive_monkey_add"},{kind:"curve.bezier",label:"Bézier",group:"Curve",call:"curve.primitive_bezier_curve_add"},{kind:"curve.bezier-circle",label:"Circle",group:"Curve",call:"curve.primitive_bezier_circle_add"},{kind:"curve.nurbs-curve",label:"Nurbs Curve",group:"Curve",call:"curve.primitive_nurbs_curve_add",separatorBefore:!0},{kind:"curve.nurbs-circle",label:"Nurbs Circle",group:"Curve",call:"curve.primitive_nurbs_circle_add"},{kind:"curve.path",label:"Path",group:"Curve",call:"curve.primitive_nurbs_path_add"},{kind:"curve.empty-hair",label:"Empty Hair",group:"Curve",call:"object.curves_empty_hair_add",separatorBefore:!0},{kind:"curve.fur",label:"Fur",group:"Curve",call:"object.quick_fur",placesAtOrigin:!1},{kind:"surface.nurbs-curve",label:"Nurbs Curve",group:"Surface",call:"surface.primitive_nurbs_surface_curve_add"},{kind:"surface.nurbs-circle",label:"Nurbs Circle",group:"Surface",call:"surface.primitive_nurbs_surface_circle_add"},{kind:"surface.nurbs-surface",label:"Nurbs Surface",group:"Surface",call:"surface.primitive_nurbs_surface_surface_add"},{kind:"surface.nurbs-cylinder",label:"Nurbs Cylinder",group:"Surface",call:"surface.primitive_nurbs_surface_cylinder_add"},{kind:"surface.nurbs-sphere",label:"Nurbs Sphere",group:"Surface",call:"surface.primitive_nurbs_surface_sphere_add"},{kind:"surface.nurbs-torus",label:"Nurbs Torus",group:"Surface",call:"surface.primitive_nurbs_surface_torus_add"},{kind:"metaball.ball",label:"Ball",group:"Metaball",call:"object.metaball_add, type='BALL'"},{kind:"metaball.capsule",label:"Capsule",group:"Metaball",call:"object.metaball_add, type='CAPSULE'"},{kind:"metaball.plane",label:"Plane",group:"Metaball",call:"object.metaball_add, type='PLANE'"},{kind:"metaball.ellipsoid",label:"Ellipsoid",group:"Metaball",call:"object.metaball_add, type='ELLIPSOID'"},{kind:"metaball.cube",label:"Cube",group:"Metaball",call:"object.metaball_add, type='CUBE'"},{kind:"text",label:"Text",group:null,call:"object.text_add"},{kind:"point-cloud",label:"Point Cloud",group:null,call:"object.pointcloud_random_add"},{kind:"volume.import",label:"Import OpenVDB...",group:"Volume",call:"object.volume_import",refusal:`${M("Importing an OpenVDB volume","CANCELLED, with nothing created")} This build also has no OpenVDB at all (\`bpy.app.build_options.openvdb\` is False), so a file would not be read even with a picker.`},{kind:"volume.empty",label:"Empty",group:"Volume",call:"object.volume_add"},{kind:"grease-pencil.blank",label:"Blank",group:"Grease Pencil",call:"object.grease_pencil_add, type='EMPTY'"},{kind:"grease-pencil.stroke",label:"Stroke",group:"Grease Pencil",call:"object.grease_pencil_add, type='STROKE'"},{kind:"grease-pencil.monkey",label:"Monkey",group:"Grease Pencil",call:"object.grease_pencil_add, type='MONKEY'"},{kind:"grease-pencil.lineart-scene",label:"Scene Line Art",group:"Grease Pencil",call:"object.grease_pencil_add, type='LINEART_SCENE'",separatorBefore:!0},{kind:"grease-pencil.lineart-collection",label:"Collection Line Art",group:"Grease Pencil",call:"object.grease_pencil_add, type='LINEART_COLLECTION'"},{kind:"grease-pencil.lineart-object",label:"Object Line Art",group:"Grease Pencil",call:"object.grease_pencil_add, type='LINEART_OBJECT'"},{kind:"armature",label:"Armature",group:null,call:"object.armature_add"},{kind:"lattice.lattice",label:"Lattice",group:"Lattice",call:"object.add, type='LATTICE'"},{kind:"lattice.deform-selected",label:"Lattice Deform Selected",group:"Lattice",call:"object.lattice_add_to_selected"},{kind:"empty.plain-axes",label:"Plain Axes",group:"Empty",call:"object.empty_add, type='PLAIN_AXES'"},{kind:"empty.arrows",label:"Arrows",group:"Empty",call:"object.empty_add, type='ARROWS'"},{kind:"empty.single-arrow",label:"Single Arrow",group:"Empty",call:"object.empty_add, type='SINGLE_ARROW'"},{kind:"empty.circle",label:"Circle",group:"Empty",call:"object.empty_add, type='CIRCLE'"},{kind:"empty.cube",label:"Cube",group:"Empty",call:"object.empty_add, type='CUBE'"},{kind:"empty.sphere",label:"Sphere",group:"Empty",call:"object.empty_add, type='SPHERE'"},{kind:"empty.cone",label:"Cone",group:"Empty",call:"object.empty_add, type='CONE'"},{kind:"image.reference",label:"Reference...",group:"Image",call:"object.empty_image_add, background=False",refusal:M("A reference image","poll() failed, context is incorrect / Please select at least one image")},{kind:"image.background",label:"Background...",group:"Image",call:"object.empty_image_add, background=True",refusal:M("A background image","poll() failed, context is incorrect / Please select at least one image")},{kind:"image.mesh-plane",label:"Mesh Plane...",group:"Image",call:"image.import_as_mesh_planes",placesAtOrigin:!1,refusal:M("An image as a mesh plane","CANCELLED, with nothing created")},{kind:"image.empty-image",label:"Empty Image",group:"Image",call:"object.empty_add, type='IMAGE'"},{kind:"light.point",label:"Point",group:"Light",call:"object.light_add, type='POINT'"},{kind:"light.sun",label:"Sun",group:"Light",call:"object.light_add, type='SUN'"},{kind:"light.spot",label:"Spot",group:"Light",call:"object.light_add, type='SPOT'"},{kind:"light.area",label:"Area",group:"Light",call:"object.light_add, type='AREA'"},{kind:"light-probe.sphere",label:"Sphere",group:"Light Probe",call:"object.lightprobe_add, type='SPHERE'"},{kind:"light-probe.plane",label:"Plane",group:"Light Probe",call:"object.lightprobe_add, type='PLANE'"},{kind:"light-probe.volume",label:"Volume",group:"Light Probe",call:"object.lightprobe_add, type='VOLUME'"},{kind:"camera",label:"Camera",group:null,call:"object.camera_add"},{kind:"speaker",label:"Speaker",group:null,call:"object.speaker_add"},{kind:"force-field.force",label:"Force",group:"Force Field",call:"object.effector_add, type='FORCE'"},{kind:"force-field.wind",label:"Wind",group:"Force Field",call:"object.effector_add, type='WIND'"},{kind:"force-field.vortex",label:"Vortex",group:"Force Field",call:"object.effector_add, type='VORTEX'"},{kind:"force-field.magnetic",label:"Magnetic",group:"Force Field",call:"object.effector_add, type='MAGNET'"},{kind:"force-field.harmonic",label:"Harmonic",group:"Force Field",call:"object.effector_add, type='HARMONIC'"},{kind:"force-field.charge",label:"Charge",group:"Force Field",call:"object.effector_add, type='CHARGE'"},{kind:"force-field.lennard-jones",label:"Lennard-Jones",group:"Force Field",call:"object.effector_add, type='LENNARDJ'"},{kind:"force-field.texture",label:"Texture",group:"Force Field",call:"object.effector_add, type='TEXTURE'"},{kind:"force-field.curve-guide",label:"Curve Guide",group:"Force Field",call:"object.effector_add, type='GUIDE'"},{kind:"force-field.boid",label:"Boid",group:"Force Field",call:"object.effector_add, type='BOID'"},{kind:"force-field.turbulence",label:"Turbulence",group:"Force Field",call:"object.effector_add, type='TURBULENCE'"},{kind:"force-field.drag",label:"Drag",group:"Force Field",call:"object.effector_add, type='DRAG'"},{kind:"force-field.fluid-flow",label:"Fluid Flow",group:"Force Field",call:"object.effector_add, type='FLUID'"}],xe="collection-instance:";function Ne(){const l=new Map;for(const o of P().byId.values()){if(o.type!=="TSE_LAYER_COLLECTION")continue;const n=o.data;n===void 0||!n.startsWith("bpy.data.collections[")||l.has(o.name)||l.set(o.name,{kind:`${xe}${o.name}`,label:o.name,group:"Collection Instance",call:`object.collection_instance_add, collection=${N(o.name)}`})}return[...l.values()]}function G(){return[...Ce,...Ne()]}function Fe(l){const[o,...n]=l.call.split(", "),c=l.placesAtOrigin===!1?n:[...n,"location=(0, 0, 0)"];return`bpy.ops.${o}(${c.join(", ")})`}function N(l){return JSON.stringify(l)}async function A(l,o="Blender Python"){const n=["before = {o.name for o in bpy.data.objects}",l,"made = [o.name for o in bpy.data.objects if o.name not in before]",'print("\\n".join(made))'].join(`
|
|
2
2
|
`),c=await oe(n,!0,o);return c.error!==null?{made:[],error:c.error}:{made:c.result.split(`
|
|
3
3
|
`).map(v=>v.trim()).filter(v=>v.length>0),error:null}}async function Ie(l,o){const n=[`_sel = {${l.map(N).join(", ")}}`,"_vl = bpy.context.view_layer","for _o in _vl.objects:"," _o.select_set(_o.name in _sel)",o===null?"_vl.objects.active = None":`_vl.objects.active = bpy.data.objects.get(${N(o)})`].join(`
|
|
4
4
|
`),c=await oe(n,!1);c.error!==null&&V().console.error(`Blender refused the selection write: ${c.error}`,"blender-outliner")}async function J(l,o){if(l.length===0)return{destination:"Nothing is selected, so there was nothing to run it on.",persisted:!1};const n=[`targets = [bpy.data.objects[n] for n in [${l.map(N).join(", ")}]]`,"with bpy.context.temp_override(selected_objects=targets, selected_editable_objects=targets, active_object=targets[0], object=targets[0]):",` ${o}`].join(`
|
|
5
|
-
`),{error:c}=await A(n);return c!==null?{destination:c,persisted:!1}:(await D(l),{destination:`Blender — ${o}; the session saves the .blend`,persisted:!0})}const Ae={source:"document",label:"blender",detail:"These rows are Blender's own View Layer tree, read from the engine through RNA. Editing the model is a bpy call; the eye and render columns write the engine directly."},Le="This collection is excluded from the view layer (LayerCollection.exclude), so its viewport visibility is not what is hiding it. Clear the Exclude checkbox on this row first.",Re=({defaultAdapter:l})=>{const o=new Set;let n=[],c=null;const _=new Map,v=new Map,I=()=>{for(const t of[...o])t()},b=()=>P().byId,C=t=>{const e=b().get(t),r=Y();return e===void 0||r===null?null:e.type==="TSE_VIEW_COLLECTION_BASE"?r.root:e.object===void 0?null:r.objectForBlenderName(e.object)},p=t=>{const e=Y();if(e===null)return null;for(const r of b().values())if(x(r)&&e.objectForBlenderName(r.object)===t)return r.id;return null},f=t=>{for(const e of b().values())if(x(e)&&e.object===t)return e.id;return null},g=t=>{if(b().has(t))return t;const e=l.hierarchy.object3D?.(t)??null;return e===null?null:p(e)},h=t=>{const e=g(t);return e===null?null:C(e)},k=t=>{const e=h(t);return e===null?null:l.hierarchy.idForObject3D?.(e)??null},y={roots:()=>(
|
|
5
|
+
`),{error:c}=await A(n);return c!==null?{destination:c,persisted:!1}:(await D(l),{destination:`Blender — ${o}; the session saves the .blend`,persisted:!0})}const Ae={source:"document",label:"blender",detail:"These rows are Blender's own View Layer tree, read from the engine through RNA. Editing the model is a bpy call; the eye and render columns write the engine directly."},Le="This collection is excluded from the view layer (LayerCollection.exclude), so its viewport visibility is not what is hiding it. Clear the Exclude checkbox on this row first.",Re=({defaultAdapter:l})=>{const o=new Set;let n=[],c=null;const _=new Map,v=new Map,I=()=>{for(const t of[...o])t()},b=()=>P().byId,C=t=>{const e=b().get(t),r=Y();return e===void 0||r===null?null:e.type==="TSE_VIEW_COLLECTION_BASE"?r.root:e.object===void 0?null:r.objectForBlenderName(e.object)},p=t=>{const e=Y();if(e===null)return null;for(const r of b().values())if(x(r)&&e.objectForBlenderName(r.object)===t)return r.id;return null},f=t=>{for(const e of b().values())if(x(e)&&e.object===t)return e.id;return null},g=t=>{if(b().has(t))return t;const e=l.hierarchy.object3D?.(t)??null;return e===null?null:p(e)},h=t=>{const e=g(t);return e===null?null:C(e)},k=t=>{const e=h(t);return e===null?null:l.hierarchy.idForObject3D?.(e)??null},y={roots:()=>(je(F()),(P().tree?.rows??[]).map(e=>ae(e,null))),node:t=>{const e=P(),r=e.byId.has(t)?t:g(t),i=r===null?void 0:e.byId.get(r);return i===void 0?null:ae(i,e.parentOf.get(i.id)??null)},object3D:t=>h(t),idForObject3D:t=>p(t)};function F(){const t=b(),e=new Set;for(const r of n){const i=t.get(r)?.object;i!==void 0&&e.add(i)}return[...e]}const R=()=>{const t=[];for(const e of n){const r=h(e),i=r===null?null:l.hierarchy.idForObject3D?.(r);i&&t.push(i)}l.selection?.set(t,{intent:"exact"}),I()},a=()=>{const t=ge(),e=`${q()}\0${t.active??""}\0${[...t.selected].sort().join("")}`;if(e===c)return;c=e;const r=t.selected.filter(d=>d!==t.active);t.active!==null&&r.push(t.active);const i=r.map(f).filter(d=>d!==null);i.length===n.length&&i.every((d,m)=>d===n[m])||(n=i,R())},s={get:()=>[...n],set:t=>{n=t.map(g).filter(d=>d!==null),R();const e=b(),r=[],i=[];for(const d of n){const m=e.get(d),j=m?.object;j===void 0?i.push(m?.name??d):r.includes(j)||r.push(j)}i.length>0&&V().console.warn(`${i.join(", ")} ${i.length===1?"is":"are"} not an object, so Blender's object selection does not carry ${i.length===1?"it":"them"}. Selecting a collection sets the ACTIVE COLLECTION in Blender, which is its own gesture and not in this editor yet.`,"blender-outliner"),Ie(r,r.length===0?null:r[r.length-1])}},w=t=>b().get(t)?.restrict,W={properties:t=>{const e=w(t);if(e===void 0)return[];const r=b().get(t),i=[{path:"name",label:"Name",type:"string",readonly:!x(r)}];return e.hide!==void 0&&i.push({path:"visible",label:"Show in Viewport",type:"boolean"}),e.render!==void 0&&i.push({path:"renderVisible",label:"Show in Renders",type:"boolean"}),e.exclude!==void 0&&i.push({path:"exclude",label:"Exclude from View Layer",type:"boolean"}),i},get:(t,e)=>{const r=b().get(t);if(r!==void 0){if(e==="name")return r.name;if(e==="visible")return r.restrict?.hide===void 0?void 0:!r.restrict.hide;if(e==="renderVisible")return r.restrict?.render===void 0?void 0:!r.restrict.render;if(e==="exclude")return r.restrict?.exclude}},editability:(t,e)=>{const r=b().get(t);return r===void 0?{writable:!1}:e==="name"?x(r)?{writable:!0}:{writable:!1,reason:`Renaming a ${r.struct??r.type} is not in this Outliner yet — only an object row renames here. Rename it with bpy.`}:r.notInCollection?{writable:!1,reason:"This row is a child drawn under its parent although it is not in that collection, and Blender's Outliner draws it no restriction columns."}:e==="visible"&&r.restrict?.exclude===!0?{writable:!1,reason:Le}:{writable:!0}},set:async(t,e,r)=>{const i=b().get(t);if(i===void 0)return;if(e==="name"){if(!x(i))return;const m=String(r);if(m===i.name||m.length===0)return;await te(`bpy.data.objects[${N(i.object)}]`,"name",m),await D([m]);const j=f(m);j!==null&&s.set([j]);return}if(e==="exclude"){await re(i.path,"exclude",r===!0);return}const d=e==="visible"?"hide":e==="renderVisible"?"render":null;d!==null&&await re(i.path,d,r===!1)}},ie={get:t=>{const e=k(t);return(e===null?void 0:l.transforms?.get(e))??Oe()},editability:t=>{const e=g(t),r=e===null?void 0:b().get(e);return x(r)&&C(r.id)!==null?{writable:!0}:{writable:!1,reason:`Only an object has a transform; this row is a ${r?.struct??r?.type??"row"}.`}},beginEdit:t=>{const e=h(t);e!==null&&!_.has(e)&&(_.set(e,e.matrixWorld.clone()),v.set(t,e),ye())},apply:(t,e)=>{const r=h(t);r!==null&&(r.position.fromArray(e.position),r.quaternion.fromArray(e.rotation),r.scale.fromArray(e.scale),r.updateMatrix(),r.updateMatrixWorld(!0))},endEdit:async t=>{const e=v.get(t)??h(t);v.delete(t);const r=Y();if(e===null)return;const i=_.get(e);_.delete(e);try{if(r===null||(e.updateWorldMatrix(!0,!1),i?.equals(e.matrixWorld)===!0))return;const d=r.blenderObjectName(e);if(d===null)return;const m=`bpy.data.objects[${JSON.stringify(d)}]`;try{return await te(m,"matrix_world",Se(e,r.root)),{destination:`Blender — ${m}.matrix_world; the session saves the .blend`,persisted:!0}}catch(j){return{destination:j instanceof Error?j.message:String(j),persisted:!1}}}finally{i&&await he()}}},H=t=>{const e=g(t),r=e===null?void 0:b().get(e);return x(r)?r.object:null},E=t=>({destination:t,persisted:!1}),U=async t=>{await D(t);const e=t.map(f).filter(r=>r!==null);return e.length>0&&s.set(e),e[0]??""},K={creatableKinds:()=>G().map(({kind:t,label:e})=>({kind:t,label:e})),create:t=>{const e=G().find(i=>i.kind===t);if(e===void 0)return{id:"",ack:E(`${t} is not a row of Blender's Add menu that this editor adds. Its rows are: ${G().map(i=>i.label).join(", ")}.`)};if(e.refusal!==void 0)return{id:"",ack:E(e.refusal)};const r=Fe(e);return{id:"",ack:(async()=>{const{made:i,error:d}=await A(r);return d!==null?E(d):i.length===0?E(`Blender ran ${r} and created nothing. The operator reported no error, so it cancelled — most often because it wanted a file browser or a context this headless engine has no window for.`):(await U(i),{destination:`Blender — ${r}; the session saves the .blend`,persisted:!0})})()}},remove:t=>K.removeMany?.([t])??void 0,removeMany:async t=>{const e=[];for(const m of t){const j=H(m);if(j===null){const ee=g(m)===null?void 0:b().get(g(m));return E(`Only an object can be deleted here; this row is a ${ee?.struct??ee?.type??"row"}. Deleting a collection, a modifier or a vertex group is that datablock’s own bpy call.`)}e.push(j)}if(e.length===0)return E("Nothing selected to delete.");const i=[`targets = ${`[bpy.data.objects[n] for n in [${e.map(N).join(", ")}]]`}`,"with bpy.context.temp_override(selected_objects=targets, active_object=targets[0]):"," result = bpy.ops.object.delete(use_global=False)",'if "FINISHED" not in result: raise RuntimeError("Blender cancelled deleting the selected objects")'].join(`
|
|
6
6
|
`),{error:d}=await A(i,"Delete Objects");return d!==null?E(d):(s.set([]),await D([]),{destination:"Blender — bpy.ops.object.delete(use_global=False); the session saves the .blend",persisted:!0})},duplicate:t=>{const e=H(t);if(e===null)return{id:t,ack:E("Only an object can be duplicated here. Duplicating a collection is `bpy.ops.object.collection_instance_add`, its own gesture.")};const r=[`source = bpy.data.objects[${N(e)}]`,"with bpy.context.temp_override(selected_objects=[source], active_object=source):"," result = bpy.ops.object.duplicate(linked=False)",'if "FINISHED" not in result: raise RuntimeError("Blender cancelled duplicating the selected object")'].join(`
|
|
7
7
|
`);return{id:t,ack:(async()=>{const{made:i,error:d}=await A(r,"Duplicate Object");return d!==null?E(d):(await U(i),{destination:`Blender — bpy.ops.object.duplicate(linked=False) on ${e}; the session saves the .blend`,persisted:!0})})()}},duplicateMany:async t=>{const e=[...new Set(t.map(H))];if(e.length===0||e.some(m=>m===null))return E("Select objects to duplicate; collections and data rows cannot be duplicated here.");const r=[`sources = [bpy.data.objects[name] for name in ${JSON.stringify(e)}]`,"with bpy.context.temp_override(selected_objects=sources, active_object=sources[0]):"," result = bpy.ops.object.duplicate(linked=False)",'if "FINISHED" not in result: raise RuntimeError("Blender cancelled duplicating the selected objects")'].join(`
|
|
8
|
-
`),{made:i,error:d}=await A(r,"Duplicate Objects");return d!==null?E(d):(await U(i),{destination:"Blender — duplicate selected objects as one native operation; the session saves the .blend",persisted:!0})},reparent:()=>E("Reparenting is Blender's `bpy.ops.object.parent_set`, which needs a parent TYPE (Object, Object Keep Transform, Armature Deform, …) that a drag does not say. Set the parent on the object’s Relations panel, or with bpy.")},Q={get documentId(){return l.documentId},get documentRootObject(){return l.documentRootObject},capabilities:we,provenance:Ae,hierarchy:y,selection:s,inspector:W,transforms:ie,structure:K,subscribe:t=>{o.add(t);const e=$(t),r=l.subscribe?.(t)??(()=>{});return()=>{o.delete(t),e(),r()}}},Z={get documentId(){return Q.documentId},selectedObjectNames:()=>F(),allObjectNames:()=>{const t=[];for(const e of b().values())x(e)&&t.push(e.object);return t},selectObjects:t=>{const e=t.map(f).filter(r=>r!==null);s.set(e)},rowIdForObject:t=>f(t),structure:K,subscribe:t=>{o.add(t);const e=$(t);return()=>{o.delete(t),e()}}};L.add(Z);const se=
|
|
8
|
+
`),{made:i,error:d}=await A(r,"Duplicate Objects");return d!==null?E(d):(await U(i),{destination:"Blender — duplicate selected objects as one native operation; the session saves the .blend",persisted:!0})},reparent:()=>E("Reparenting is Blender's `bpy.ops.object.parent_set`, which needs a parent TYPE (Object, Object Keep Transform, Armature Deform, …) that a drag does not say. Set the parent on the object’s Relations panel, or with bpy.")},Q={get documentId(){return l.documentId},get documentRootObject(){return l.documentRootObject},capabilities:we,provenance:Ae,hierarchy:y,selection:s,inspector:W,transforms:ie,structure:K,subscribe:t=>{o.add(t);const e=$(t),r=l.subscribe?.(t)??(()=>{});return()=>{o.delete(t),e(),r()}}},Z={get documentId(){return Q.documentId},selectedObjectNames:()=>F(),allObjectNames:()=>{const t=[];for(const e of b().values())x(e)&&t.push(e.object);return t},selectObjects:t=>{const e=t.map(f).filter(r=>r!==null);s.set(e)},rowIdForObject:t=>f(t),structure:K,subscribe:t=>{o.add(t);const e=$(t);return()=>{o.delete(t),e()}}};L.add(Z);const se=me(a),ce=$(a);return a(),{adapter:Q,dispose:()=>{se(),ce(),L.delete(Z),o.clear()}}},Be=[{label:"Location",call:"location=True, rotation=False, scale=False"},{label:"Rotation",call:"location=False, rotation=True, scale=False"},{label:"Scale",call:"location=False, rotation=False, scale=True"},{label:"All Transforms",call:"location=True, rotation=True, scale=True"}],Me=[{label:"Location",call:"bpy.ops.object.location_clear(clear_delta=False)"},{label:"Rotation",call:"bpy.ops.object.rotation_clear(clear_delta=False)"},{label:"Scale",call:"bpy.ops.object.scale_clear(clear_delta=False)"}],Te=[{label:"Geometry to Origin",type:"GEOMETRY_ORIGIN"},{label:"Origin to Geometry",type:"ORIGIN_GEOMETRY"},{label:"Origin to 3D Cursor",type:"ORIGIN_CURSOR",refusal:"There is no 3D cursor in this editor yet, so there is no point to move the origin to. Blender places it with Shift+Right-click; that gesture is not built here."}],$e=[{submenu:"Mesh",at:"2699"},{submenu:"Curve",at:"2702"},{submenu:"Surface",at:"2704"},{submenu:"Metaball",at:"2705"},{kind:"text",at:"2706"},{kind:"point-cloud",at:"2707"},{submenu:"Volume",at:"2708"},{submenu:"Grease Pencil",at:"2709"},{separatorAt:"2711"},{kind:"armature",at:"2716"},{submenu:"Lattice",at:"2718"},{separatorAt:"2720"},{submenu:"Empty",at:"2722"},{submenu:"Image",at:"2723"},{separatorAt:"2725"},{submenu:"Light",at:"2727"},{submenu:"Light Probe",at:"2728"},{separatorAt:"2730"},{kind:"camera",at:"2735"},{separatorAt:"2737"},{kind:"speaker",at:"2739"},{separatorAt:"2741"},{submenu:"Force Field",at:"2743"},{separatorAt:"2745"},{submenu:"Collection Instance",at:"2759"}],De="No Collections to Instance";function X({id:l,open:o,setOpen:n,anchorRef:c,children:_}){return u.jsxs("div",{ref:c,style:{position:"relative"},children:[u.jsx(pe,{"data-testid":`blender-menu-${l}`,"aria-expanded":o===l,onClick:()=>n(o===l?null:l),onPointerEnter:()=>{o&&n(l)},style:{textTransform:"capitalize"},children:l}),o===l&&u.jsx(fe,{anchorRef:c,dismissBoundaryRef:c,align:"start",gap:0,clamp:!0,"aria-label":l,onDismiss:()=>n(null),children:_})]})}function Pe(l,o,n){(async()=>{const c=await n;c===void 0||typeof c.destination!="string"||c.persisted!==!0&&l?.({tone:"error",title:`${o} was refused`,detail:c.destination})})()}function Ge({documentId:l,notify:o}){O.useSyncExternalStore($,q,q);const[n,c]=O.useState(null),_=O.useRef(null),v=O.useRef(null),I=O.useRef(null),b=O.useRef(null),C=Ee(l);if(C===null)return null;const p=(a,s)=>()=>{c(null),Pe(o,a,s(C))},f=C.selectedObjectNames(),g=C.allObjectNames(),h=f.length===0?"Nothing is selected.":void 0,k=G(),y=a=>u.jsx(S,{"data-testid":`blender-add-${a.kind}`,disabled:a.refusal!==void 0,title:a.refusal,onSelect:p(`Add ${a.label}`,s=>s.structure.create(a.kind).ack),children:a.label},a.kind),F=a=>k.filter(s=>s.group===a).flatMap(s=>s.separatorBefore===!0?[u.jsx(z,{},`${s.kind}-separator`),y(s)]:[y(s)]),R=a=>{if("separatorAt"in a)return u.jsx(z,{},`separator-${a.separatorAt}`);if("kind"in a){const w=k.find(W=>W.kind===a.kind);return w===void 0?null:y(w)}const s=F(a.submenu);return s.length===0?u.jsx(S,{"data-testid":"blender-add-collection-instance",disabled:!0,children:De},a.submenu):u.jsx(B,{label:a.submenu,"data-testid":`blender-add-${a.submenu.toLowerCase().replaceAll(" ","-")}`,children:s},a.submenu)};return u.jsxs(be,{compact:!0,label:"Blender Object Mode menus","data-testid":"blender-object-mode-menus",ref:_,children:[u.jsxs(X,{id:"select",open:n,setOpen:c,anchorRef:v,children:[u.jsx(S,{"data-testid":"blender-select-all",onSelect:p("Select All",a=>a.selectObjects(g)),children:"All"}),u.jsx(S,{"data-testid":"blender-select-none",onSelect:p("Select None",a=>a.selectObjects([])),children:"None"}),u.jsx(S,{"data-testid":"blender-select-invert",onSelect:p("Select Invert",a=>a.selectObjects(g.filter(s=>!f.includes(s)))),children:"Invert"})]}),u.jsx(X,{id:"add",open:n,setOpen:c,anchorRef:I,children:$e.map(a=>R(a))}),u.jsxs(X,{id:"object",open:n,setOpen:c,anchorRef:b,children:[u.jsx(B,{label:"Set Origin","data-testid":"blender-object-origin",children:Te.map(a=>u.jsx(S,{"data-testid":`blender-origin-${a.type}`,disabled:a.refusal!==void 0||f.length===0,title:a.refusal??h,onSelect:p(`Set Origin ▸ ${a.label}`,s=>J(s.selectedObjectNames(),`bpy.ops.object.origin_set(type='${a.type}')`)),children:a.label},a.type))}),u.jsx(B,{label:"Clear","data-testid":"blender-object-clear",children:Me.map(a=>u.jsx(S,{"data-testid":`blender-clear-${a.label.toLowerCase()}`,disabled:f.length===0,title:h,onSelect:p(`Clear ▸ ${a.label}`,s=>J(s.selectedObjectNames(),a.call)),children:a.label},a.label))}),u.jsx(B,{label:"Apply","data-testid":"blender-object-apply",children:Be.map(a=>u.jsx(S,{"data-testid":`blender-apply-${a.label.toLowerCase().replace(/ /g,"-")}`,disabled:f.length===0,title:h,onSelect:p(`Apply ▸ ${a.label}`,s=>J(s.selectedObjectNames(),`bpy.ops.object.transform_apply(${a.call})`)),children:a.label},a.label))}),u.jsx(z,{}),u.jsx(S,{"data-testid":"blender-object-duplicate",disabled:f.length===0,title:h,onSelect:p("Duplicate Objects",async a=>{const s=a.selectedObjectNames().map(w=>a.rowIdForObject(w)).filter(w=>w!==null);return a.structure.duplicateMany?.(s)}),children:"Duplicate Objects"}),u.jsx(S,{"data-testid":"blender-object-delete",disabled:f.length===0,title:h,onSelect:p("Delete",a=>{const s=a.selectedObjectNames().map(w=>a.rowIdForObject(w)).filter(w=>w!==null);return a.structure.removeMany?.(s)}),children:"Delete"})]})]})}const rt="workspace.document",lt="Blender Model",nt=({documentId:l,notify:o})=>u.jsx(Ge,{documentId:l,notify:o}),at="model",ot="owned",it=[],T=de;function st({active:l,document:o,documentId:n,surfaces:c,notify:_,publishContext:v}){const I=O.useCallback(()=>({root:T.root,dispose(){}}),[]),b=o?.source?.path;if(O.useEffect(()=>v?.(T),[v]),O.useEffect(()=>{if(!n)return;const{viewport:p}=V(),f=T.overlayGroups(),g=()=>{const k=p.stages().find(y=>y.documentId===n);if(k)for(const{kind:y,object:F}of f)k.setHelper(y,F)};g();const h=p.onStages(g);return()=>{h();const k=p.stages().find(y=>y.documentId===n);for(const{kind:y}of f)k?.setHelper(y,null)}},[n]),O.useEffect(()=>{if(!n)return;const{transport:p}=V();let f=null;const g=()=>{if(f)return;const k=p.for(n);k&&(f=ue.attachTo(k))};g();const h=p.subscribe(g);return()=>{h(),f?.()}},[n]),O.useEffect(()=>{if(n){if(b===void 0){le(null);return}return _e(n,b,o.id).catch(p=>{_?.({tone:"error",title:`Blender could not open ${b}`,detail:p instanceof Error?p.message:String(p)})}),()=>le(null)}},[b,o?.id,n,_]),!n)return null;const C=c.Object3DAuthoring;return u.jsx(C,{active:l??!0,documentId:n,sourcePath:b??"blender:runtime",displayName:o?.label??"Model",build:I,audit:!1,authoring:Re,cameraDirection:[.8187,.4458,.3617],openingFit:3,dressing:{environment:!1,keyLight:!1,toneMapping:ve,viewLocked:T.studioLights()}})}export{nt as Toolbar,st as default,at as documentKind,it as inspectorBuiltins,ot as inspectorRail,rt as point,lt as title};
|
package/dist/assets/{blender-timeline.document-5UN8V20F.js → blender-timeline.document-D9BOYb0q.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./jsx-runtime-DPjLkJKQ.js";import{s as ae,b as L,a as p,c as he}from"./blender-runtime-skin-AJdtKKnf.js";import{ah as pe}from"./index-DmtPt6RQ.js";import{r as f}from"./index-DaQZGF7d.js";import{s as ye,e as Q,l as ge,m as xe}from"./blender-runtime-host-C3rVDyG8.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./LineSegments2-vfeDUBfs.js";import"./three.module-BynznMJN.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D_NuPfjr.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./clip-planes-CnAI6DZn.js";const we={transform:{startFrame:-5,pixelsPerFrame:8},refusal:null,size:{w:0,h:0},framedAt:0,drawn:null,onlySelected:!0};let P=we,W=0;const H=new Set;let oe=0;function M(){return P}function _(){return W}function K(e){return H.add(e),()=>{H.delete(e)}}function k(e){P={...P,...e},W+=1;for(const s of[...H])s()}function be(e){P.onlySelected!==e&&k({onlySelected:e})}function le(){oe+=1,W+=1;for(const e of[...H])e()}function Ee(){return oe}function G(e){k({refusal:e})}const ve=20,T=23,ee=26,Te=16,Me=2,ke=T+Me,te=35,Se=6;function ce(e){const s=[2,3,5],o=[];for(let r=0;r<s.length;r++){const n=s[r],i=Math.trunc(e/n),c=i*n===e;if(c&&i===2)return n;o[r]=c}for(let r=0;r<s.length;r++)if(o[r])return s[r];return e}function je(e,s,o,r){if(o===0)return 1;const n=s/o;let i=Math.max(e,1);if(n*i>r)for(;i>1;){const c=ce(i),l=Math.trunc(i/c);if(n*l<r)break;i=l}else for(;n*i<r&&i<1<<30;)i*=2;return i}function Fe(e){return e<=1?null:e/ce(Math.round(e))}const x={back:"#303030",header:"#303030",grid:"#161616",gridMinor:"#262626",scrubBack:"#1d1d1d",scrubText:"#808080",playhead:"#4772b3",playheadText:"#ffffff",keyBorder:"#000000"},re={KEYFRAME:{fill:"#bfbfbf",selected:"#ffbe33"},EXTREME:{fill:"#e8b3cc",selected:"#f28080"},BREAKDOWN:{fill:"#b3dbe8",selected:"#54bfed"},JITTER:{fill:"#94e575",selected:"#61c042"},MOVING_HOLD:{fill:"#808080",selected:"#ffaf23"},GENERATED:{fill:"#585858",selected:"#a28962"}},Ne={KEYFRAME:1,EXTREME:1.2,MOVING_HOLD:.925,BREAKDOWN:.85,JITTER:.8,GENERATED:.75},ne=5.06,Ae=2.12,_e=15,g={minPillWidth:24,textPadding:4,margin:2,radius:4,tipHalfWidth:6,tipHeight:6,stalkWidth:3},ie="#212121",d={text:"#a6a6a6",rule:"#161616",widget:"#545454",widgetText:"#e6e6e6",widgetOutline:"#3d3d3d",widgetRadius:4,unit:ve,refusal:"#ffaf23",headerPadding:"0 8px",headerGap:8,statusPadding:"2px 8px"},Xe="workspace.document",Re="Timeline",de=.25,me=200,B={"set-range":"Setting the frame range writes `scene.frame_start`/`frame_end`, which the document would save. This is Blender's Timeline as an INSPECTION surface: the range is drawn, never set. Change it in bpy and the Timeline re-reads it.","insert-key":"Inserting a keyframe writes the action. Editing parity is not the program — key it in bpy (`pose_bone.keyframe_insert`) and the Timeline re-reads the action on the next present.","move-key":"Moving a keyframe writes the F-Curve's control points. The summary row draws the keys the action HAS; the Dope Sheet that would move them is the Animation workspace's, and it is not built.","delete-key":"Deleting a keyframe writes the action. Editing parity is not the program.","set-interpolation":"Setting a key's interpolation writes the F-Curve. Note also that this view PLAYS a per-frame bake (`rna_action_clip`), so interpolation is not a thing it reads back.","select-key":"Selecting a keyframe writes `Keyframe.select_control_point`. The view draws the flags the data carries — a selected key takes `.common.anim.keyframe_selected` — and changes none of them."},z="Nothing here is playable: no object in the scene carries an action this view could bind a mixer to.";function h(){return p.transport}function V(){return h()?.snapshot().playbackState==="playing"}function $(e){return G(e),v()}const se={JITTER:1,GENERATED:2,MOVING_HOLD:3,BREAKDOWN:4,KEYFRAME:5,EXTREME:6};function ue(e,s){const o=[],r=new Map;for(const n of e)if(!(s&&!n.selected)){o.push(n.object);for(const i of n.keyframes){const c=r.get(i.frame);if(!c){r.set(i.frame,{...i});continue}c.select=c.select||i.select,(se[i.type]??0)>(se[c.type]??0)&&(c.type=i.type)}}return{columns:[...r.values()].sort((n,i)=>n.frame-i.frame),objects:o}}function D(){return ue(p.state().summary,M().onlySelected).columns.map(e=>e.frame)}function v(){const e=M();return{...p.state(),transform:e.transform,size:e.size,refusal:e.refusal,drawn:e.drawn}}function O(e){if(!p.playable)return $(z);const s=h();return s?(s.seekFrame(e),v()):$("No stage transport is attached yet; open the model document first.")}pe({view:"timeline",title:Re,verbs:[{id:"state",run:()=>v()},{id:"frame",title:"Timeline: Set Frame",run:e=>{const s=Number(e?.frame??e?.to);if(!Number.isFinite(s))throw new Error("frame needs a numeric `frame` — a Blender frame number.");return O(s)}},{id:"play",title:"Timeline: Play",run:()=>{if(!p.playable)throw new Error(z);const e=h();if(!e)throw new Error("No stage transport is attached yet; open the model document first.");return e.play(),v()}},{id:"pause",title:"Timeline: Pause",run:()=>{const e=h();return e?(e.pause(),v()):$("No stage transport is attached yet.")}},{id:"jump-start",title:"Timeline: Jump to Start",run:()=>O(p.state().start)},{id:"jump-end",title:"Timeline: Jump to End",run:()=>O(p.state().end)},{id:"next-keyframe",title:"Timeline: Next Keyframe",run:()=>{const e=p.frame(),s=D().find(o=>o>e+1e-4);return s===void 0?v():O(s)}},{id:"prev-keyframe",title:"Timeline: Previous Keyframe",run:()=>{const e=p.frame(),s=D().reverse().find(o=>o<e-1e-4);return s===void 0?v():O(s)}},{id:"view-all",title:"Timeline: View All",run:()=>(le(),v())},{id:"zoom",title:"Timeline: Zoom",run:e=>{const s=Number(e?.to??e?.zoom);if(!Number.isFinite(s))throw new Error("zoom needs a numeric `to` — CSS pixels per frame, 0.25 … 200.");const{transform:o,size:r}=M(),n=o.startFrame+r.w/2/o.pixelsPerFrame,i=Math.min(me,Math.max(de,s));return k({transform:{pixelsPerFrame:i,startFrame:n-r.w/2/i}}),v()}},{id:"pan",title:"Timeline: Pan",run:e=>{const s=Number(e?.frames??0);if(!Number.isFinite(s))throw new Error("pan needs a numeric `frames`.");const{transform:o}=M();return k({transform:{...o,startFrame:o.startFrame+s}}),v()}},...Object.keys(B).map(e=>({id:e,run:()=>$(B[e])}))]});function Ze(){const e=f.useSyncExternalStore(ye,Q,Q);f.useSyncExternalStore(ae,L,L),f.useSyncExternalStore(K,_,_);const s=f.useRef(null),o=f.useRef(-1),{transform:r,size:n,refusal:i,onlySelected:c}=M(),l=p.state();f.useEffect(()=>{let t=!0;return p.bind(he,{rig:()=>xe(),clip:()=>ge()}).catch(m=>{t&&G(`The Timeline could not read this file's rig: ${m instanceof Error?m.message:String(m)}`)}),()=>{t=!1}},[e]),f.useEffect(()=>{const t=s.current;if(!t)return;const m=new ResizeObserver(()=>{const u={w:t.clientWidth,h:t.clientHeight},y=M().size;(y.w!==u.w||y.h!==u.h)&&k({size:u})});return m.observe(t),k({size:{w:t.clientWidth,h:t.clientHeight}}),()=>m.disconnect()},[]);const S=Ee();f.useEffect(()=>{if(S===o.current)return;o.current=S;const{w:t}=M().size;if(t===0)return;const m=Math.max(1,l.end-l.start),u=Math.min(me,Math.max(de,t*.9/m));k({transform:{pixelsPerFrame:u,startFrame:l.start-t*.05/u},framedAt:Date.now()})},[S,l.start,l.end]);const b=f.useCallback(t=>(t-r.startFrame)*r.pixelsPerFrame,[r]),Y=f.useCallback(t=>r.startFrame+t/r.pixelsPerFrame,[r]),F=f.useMemo(()=>ue(l.summary,c),[l.summary,c]),E=f.useMemo(()=>{if(n.w===0)return null;const t=n.w/r.pixelsPerFrame,m=Math.max(`${Math.round(r.startFrame)}`.length,`${Math.round(r.startFrame+t)}`.length),u=Math.max(te,m*6+Se),y=je(Math.round(l.fps),n.w+1,t,u),w=Fe(y),fe=Math.ceil(r.startFrame/y)*y,Z=[];for(let R=fe;R<=r.startFrame+t;R+=y)Z.push(R);const q=[];if(w!==null&&w*r.pixelsPerFrame>=te/5){const R=Math.ceil(r.startFrame/w)*w;for(let I=R;I<=r.startFrame+t;I+=w)Math.abs(I/y-Math.round(I/y))>1e-6&&q.push(I)}return{major:y,minor:w,majors:Z,minors:q}},[n.w,r,l.fps]),N=T,j=ke+Te/2;f.useEffect(()=>{if(!E)return;const t=[...l.warnings];l.action||t.push("Nothing in this file carries an action, so the summary row is empty — which is Blender's own empty state for a Timeline over a still file."),t.push("While a clip plays, the picture is three.js evaluating the skin over the mesh columns Blender exported at the BIND frame. Anything else Blender would re-evaluate per frame — shape keys, a Displace or Cloth modifier reading the frame, a geometry driver — does not follow the playhead."),t.push("Blender puts this view's ONLY-SHOW-SELECTED toggle in the Timeline header's View MENU (`TIME_MT_view`'s `layout.prop(scene, \"show_keys_from_selected_only\")`, `space_time.py`); this header has no menu region, so the same toggle is drawn as a header button at the leading edge, where that menu sits. The filter itself is Blender's — `ADS_FILTER_ONLYSEL`, `anim_filter.cc:254-270`, tested per object at `:2307`."),c&&F.objects.length===0&&l.summary.length>0&&t.push(`The summary row is empty because nothing animated is SELECTED, which is Blender's own answer with this filter on. ${l.summary.map(u=>u.object).join(", ")} carr${l.summary.length===1?"ies":"y"} an action; select it, or turn the filter off.`),t.push("Markers, the cache bar and the preview range are drawn by Blender's Timeline and not here; the door carries none of them.");const m={drawn:{action:l.action,object:l.object,armature:l.armature,frame:l.frame,start:l.start,end:l.end,fps:l.fps,playing:V(),keyframes:F.columns.map(u=>u.frame),onlySelected:c,summaryObjects:F.objects,majorStep:E.major,minorStep:E.minor,majorLines:E.majors.length,minorLines:E.minors.length,labels:E.majors.length,diamonds:F.columns.length,diamondRadius:ne,diamondSprite:_e,bones:l.bones,tracks:l.tracks,engineCalls:l.engineCalls,warnings:t}};JSON.stringify(m.drawn)!==JSON.stringify(M().drawn)&&k(m)},[E,l,F,c]);const C=f.useRef(!1),J=f.useCallback(t=>{const m=s.current;if(!m)return;const u=m.getBoundingClientRect();h()?.seekFrame(Math.round(Y(t-u.left)))},[Y]),U=`${Math.round(l.frame)}`,X=Math.max(g.minPillWidth,U.length*6+2*g.textPadding),A=b(l.frame);return a.jsxs("div",{"data-testid":"blender-timeline",style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",overflow:"hidden",background:x.back,color:d.text,font:"11px Inter, system-ui, sans-serif"},children:[a.jsx(Oe,{}),a.jsx("div",{ref:s,style:{flex:1,minHeight:0,position:"relative"},children:a.jsxs("svg",{width:n.w,height:n.h,style:{display:"block",cursor:"ew-resize"},"aria-label":"Timeline",onPointerDown:t=>{C.current=!0,t.currentTarget.setPointerCapture(t.pointerId),J(t.clientX)},onPointerMove:t=>{C.current&&J(t.clientX)},onPointerUp:t=>{C.current=!1,t.currentTarget.releasePointerCapture(t.pointerId)},children:[a.jsx("title",{children:"Timeline"}),a.jsx("rect",{x:0,y:0,width:n.w,height:n.h,fill:x.back}),a.jsx("rect",{x:0,y:N,width:Math.max(0,b(l.start)),height:Math.max(0,n.h-N),fill:ie}),a.jsx("rect",{x:b(l.end),y:N,width:Math.max(0,n.w-b(l.end)),height:Math.max(0,n.h-N),fill:ie}),E?.minors.map(t=>a.jsx("line",{x1:b(t),y1:N,x2:b(t),y2:n.h,stroke:x.gridMinor,strokeWidth:1},`n${t}`)),E?.majors.map(t=>a.jsx("line",{x1:b(t),y1:N,x2:b(t),y2:n.h,stroke:x.grid,strokeWidth:1},`m${t}`)),a.jsx("rect",{x:0,y:0,width:n.w,height:T,fill:x.scrubBack}),E?.majors.map(t=>a.jsx("text",{x:b(t),y:15.5,textAnchor:"middle",fill:x.scrubText,fontSize:11,children:Math.round(t)},`t${t}`)),a.jsx("path",{d:`M3,${j-3.5} L6.5,${j} L3,${j+3.5} Z`,fill:x.scrubText}),F.columns.map(t=>{const m=Ne[t.type]??1,u=ne*m,y=re[t.type]??re.KEYFRAME,w=b(t.frame);return a.jsx("polygon",{points:`${w},${j-u} ${w+u},${j} ${w},${j+u} ${w-u},${j}`,fill:t.select?y.selected:y.fill,stroke:x.keyBorder,strokeWidth:Ae*m},`k${t.frame}`)}),a.jsx("rect",{x:A-g.stalkWidth/2,y:T,width:g.stalkWidth,height:Math.max(0,n.h-T),fill:x.playhead}),a.jsx("rect",{x:A-X/2,y:g.margin,width:X,height:T-2*g.margin,rx:g.radius,fill:x.playhead}),a.jsx("polygon",{points:`${A-g.tipHalfWidth},${T-g.margin} ${A+g.tipHalfWidth},${T-g.margin} ${A},${T-g.margin+g.tipHeight}`,fill:x.playhead}),a.jsx("text",{x:A,y:15.5,textAnchor:"middle",fill:x.playheadText,fontSize:11,children:U})]})}),i?a.jsx("div",{style:{borderTop:`1px solid ${d.rule}`,padding:d.statusPadding,color:d.refusal},children:i}):null]})}function Ie(){f.useSyncExternalStore(K,_,_);const{onlySelected:e}=M(),[s,o]=f.useState(!1),r=(n,i,c)=>a.jsxs("button",{type:"button",onClick:()=>{c(),o(!1)},style:{display:"flex",alignItems:"center",gap:"var(--vgai-space-2)",width:"100%",padding:"var(--vgai-space-1) var(--vgai-space-3)",border:"none",background:"transparent",color:d.widgetText,font:"inherit",textAlign:"left",cursor:"pointer"},children:[a.jsx("span",{style:{width:12,display:"inline-block"},children:i===null?"":i?"✓":""}),n]});return a.jsxs("span",{style:{position:"relative"},children:[a.jsx("button",{type:"button","aria-haspopup":"menu","aria-expanded":s,onClick:()=>o(n=>!n),style:{border:"none",background:"transparent",color:d.text,font:"inherit",padding:"0 var(--vgai-space-2)",cursor:"pointer"},children:"View"}),s?a.jsxs("span",{role:"menu",style:{position:"absolute",top:"100%",left:0,zIndex:20,minWidth:210,display:"flex",flexDirection:"column",background:d.widget,border:`1px solid ${d.widgetOutline}`,boxShadow:"0 6px 18px rgba(0,0,0,0.45)"},children:[r("Only Show Selected",e,()=>be(!e)),r("Frame All",null,()=>le())]}):null]})}function Oe(){f.useSyncExternalStore(ae,L,L),f.useSyncExternalStore(K,_,_);const e=p.state(),s=d.unit,o=p.playable,r=(i,c,l,S)=>a.jsx("button",{type:"button",title:o?S:`${S} — ${z}`,"aria-label":S,disabled:!o,onClick:l,style:{width:s,height:s,padding:0,border:`1px solid ${d.widgetOutline}`,background:d.widget,color:d.widgetText,display:"grid",placeItems:"center",cursor:o?"pointer":"not-allowed",opacity:o?1:.4},children:c},i),n=i=>a.jsx("svg",{width:12,height:12,viewBox:"0 0 12 12","aria-hidden":"true",children:a.jsx("path",{d:i,fill:d.widgetText})});return a.jsxs("div",{style:{height:ee,flex:`0 0 ${ee}px`,display:"flex",alignItems:"center",gap:d.headerGap,padding:d.headerPadding,background:x.header,borderBottom:`1px solid ${d.rule}`},children:[a.jsx("span",{style:{color:d.text},children:"Timeline"}),a.jsx(Ie,{}),a.jsx("div",{style:{flex:1}}),a.jsxs("div",{style:{display:"flex"},children:[r("jump-start",n("M2 2h1.5v8H2zM10 2v8L4.5 6z"),()=>h()?.seekFrame(e.start),"Jump to Start"),r("prev-key",n("M5 2.5v7L1.5 6zM8.5 3.2L11 6L8.5 8.8L6 6z"),()=>{const i=D().reverse().find(c=>c<p.frame()-1e-4);i!==void 0&&h()?.seekFrame(i)},"Jump to Previous Keyframe"),o&&V()?r("pause-rev",n("M3 2h2v8H3zM7 2h2v8H7z"),()=>h()?.pause(),"Pause"):r("play-reverse",n("M9 2L2 6l7 4z"),()=>h()?.play("reverse"),"Play Reverse"),o&&V()?r("pause",n("M3 2h2v8H3zM7 2h2v8H7z"),()=>h()?.pause(),"Pause"):r("play",n("M3 2l7 4-7 4z"),()=>h()?.play(),"Play"),r("next-key",n("M7 2.5v7L10.5 6zM3.5 3.2L6 6L3.5 8.8L1 6z"),()=>{const i=D().find(c=>c>p.frame()+1e-4);i!==void 0&&h()?.seekFrame(i)},"Jump to Next Keyframe"),r("jump-end",n("M10 2H8.5v8H10zM2 2v8L7.5 6z"),()=>h()?.seekFrame(e.end),"Jump to End")]}),a.jsxs("div",{style:{display:"flex"},children:[r("step-back",n("M2 2h1.5v8H2zM9.5 2v8L4.5 6z"),()=>h()?.seekFrame(Math.round(e.frame)-1),"Step Back One Frame"),r("step-forward",n("M10 2H8.5v8H10zM2.5 2v8L7.5 6z"),()=>h()?.seekFrame(Math.round(e.frame)+1),"Step Forward One Frame")]}),a.jsx("div",{style:{flex:1}}),a.jsx("input",{type:"number",value:Math.round(e.frame),onChange:i=>{const c=Number(i.target.value);Number.isFinite(c)&&h()?.seekFrame(c)},"aria-label":"Current frame",disabled:!o,title:o?void 0:z,style:{width:75,height:s,textAlign:"center",border:`1px solid ${d.widgetOutline}`,borderRadius:d.widgetRadius,background:d.widget,color:d.widgetText,font:"inherit",cursor:o?"text":"not-allowed",opacity:o?1:.4}}),a.jsxs("span",{onClick:()=>G(B["set-range"]),onKeyDown:()=>{},style:{color:d.text,cursor:"not-allowed"},children:["Start ",e.start," · End ",e.end]})]})}export{Ze as default,Xe as point,Re as title};
|
|
1
|
+
import{a}from"./jsx-runtime-DPjLkJKQ.js";import{s as ae,b as L,a as p,c as he}from"./blender-runtime-skin-BFLh4nHG.js";import{ah as pe}from"./index-DuB3wHKD.js";import{r as f}from"./index-DaQZGF7d.js";import{s as ye,b as Q,g as ge,i as xe}from"./blender-runtime-host-JKPuUKtZ.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./LineSegments2-vfeDUBfs.js";import"./three.module-BynznMJN.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D_NuPfjr.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./clip-planes-CnAI6DZn.js";const we={transform:{startFrame:-5,pixelsPerFrame:8},refusal:null,size:{w:0,h:0},framedAt:0,drawn:null,onlySelected:!0};let P=we,W=0;const H=new Set;let oe=0;function M(){return P}function _(){return W}function K(e){return H.add(e),()=>{H.delete(e)}}function k(e){P={...P,...e},W+=1;for(const s of[...H])s()}function be(e){P.onlySelected!==e&&k({onlySelected:e})}function le(){oe+=1,W+=1;for(const e of[...H])e()}function Ee(){return oe}function G(e){k({refusal:e})}const ve=20,T=23,ee=26,Te=16,Me=2,ke=T+Me,te=35,Se=6;function ce(e){const s=[2,3,5],o=[];for(let r=0;r<s.length;r++){const n=s[r],i=Math.trunc(e/n),c=i*n===e;if(c&&i===2)return n;o[r]=c}for(let r=0;r<s.length;r++)if(o[r])return s[r];return e}function je(e,s,o,r){if(o===0)return 1;const n=s/o;let i=Math.max(e,1);if(n*i>r)for(;i>1;){const c=ce(i),l=Math.trunc(i/c);if(n*l<r)break;i=l}else for(;n*i<r&&i<1<<30;)i*=2;return i}function Fe(e){return e<=1?null:e/ce(Math.round(e))}const x={back:"#303030",header:"#303030",grid:"#161616",gridMinor:"#262626",scrubBack:"#1d1d1d",scrubText:"#808080",playhead:"#4772b3",playheadText:"#ffffff",keyBorder:"#000000"},re={KEYFRAME:{fill:"#bfbfbf",selected:"#ffbe33"},EXTREME:{fill:"#e8b3cc",selected:"#f28080"},BREAKDOWN:{fill:"#b3dbe8",selected:"#54bfed"},JITTER:{fill:"#94e575",selected:"#61c042"},MOVING_HOLD:{fill:"#808080",selected:"#ffaf23"},GENERATED:{fill:"#585858",selected:"#a28962"}},Ne={KEYFRAME:1,EXTREME:1.2,MOVING_HOLD:.925,BREAKDOWN:.85,JITTER:.8,GENERATED:.75},ne=5.06,Ae=2.12,_e=15,g={minPillWidth:24,textPadding:4,margin:2,radius:4,tipHalfWidth:6,tipHeight:6,stalkWidth:3},ie="#212121",d={text:"#a6a6a6",rule:"#161616",widget:"#545454",widgetText:"#e6e6e6",widgetOutline:"#3d3d3d",widgetRadius:4,unit:ve,refusal:"#ffaf23",headerPadding:"0 8px",headerGap:8,statusPadding:"2px 8px"},Xe="workspace.document",Re="Timeline",de=.25,me=200,B={"set-range":"Setting the frame range writes `scene.frame_start`/`frame_end`, which the document would save. This is Blender's Timeline as an INSPECTION surface: the range is drawn, never set. Change it in bpy and the Timeline re-reads it.","insert-key":"Inserting a keyframe writes the action. Editing parity is not the program — key it in bpy (`pose_bone.keyframe_insert`) and the Timeline re-reads the action on the next present.","move-key":"Moving a keyframe writes the F-Curve's control points. The summary row draws the keys the action HAS; the Dope Sheet that would move them is the Animation workspace's, and it is not built.","delete-key":"Deleting a keyframe writes the action. Editing parity is not the program.","set-interpolation":"Setting a key's interpolation writes the F-Curve. Note also that this view PLAYS a per-frame bake (`rna_action_clip`), so interpolation is not a thing it reads back.","select-key":"Selecting a keyframe writes `Keyframe.select_control_point`. The view draws the flags the data carries — a selected key takes `.common.anim.keyframe_selected` — and changes none of them."},z="Nothing here is playable: no object in the scene carries an action this view could bind a mixer to.";function h(){return p.transport}function V(){return h()?.snapshot().playbackState==="playing"}function $(e){return G(e),v()}const se={JITTER:1,GENERATED:2,MOVING_HOLD:3,BREAKDOWN:4,KEYFRAME:5,EXTREME:6};function ue(e,s){const o=[],r=new Map;for(const n of e)if(!(s&&!n.selected)){o.push(n.object);for(const i of n.keyframes){const c=r.get(i.frame);if(!c){r.set(i.frame,{...i});continue}c.select=c.select||i.select,(se[i.type]??0)>(se[c.type]??0)&&(c.type=i.type)}}return{columns:[...r.values()].sort((n,i)=>n.frame-i.frame),objects:o}}function D(){return ue(p.state().summary,M().onlySelected).columns.map(e=>e.frame)}function v(){const e=M();return{...p.state(),transform:e.transform,size:e.size,refusal:e.refusal,drawn:e.drawn}}function O(e){if(!p.playable)return $(z);const s=h();return s?(s.seekFrame(e),v()):$("No stage transport is attached yet; open the model document first.")}pe({view:"timeline",title:Re,verbs:[{id:"state",run:()=>v()},{id:"frame",title:"Timeline: Set Frame",run:e=>{const s=Number(e?.frame??e?.to);if(!Number.isFinite(s))throw new Error("frame needs a numeric `frame` — a Blender frame number.");return O(s)}},{id:"play",title:"Timeline: Play",run:()=>{if(!p.playable)throw new Error(z);const e=h();if(!e)throw new Error("No stage transport is attached yet; open the model document first.");return e.play(),v()}},{id:"pause",title:"Timeline: Pause",run:()=>{const e=h();return e?(e.pause(),v()):$("No stage transport is attached yet.")}},{id:"jump-start",title:"Timeline: Jump to Start",run:()=>O(p.state().start)},{id:"jump-end",title:"Timeline: Jump to End",run:()=>O(p.state().end)},{id:"next-keyframe",title:"Timeline: Next Keyframe",run:()=>{const e=p.frame(),s=D().find(o=>o>e+1e-4);return s===void 0?v():O(s)}},{id:"prev-keyframe",title:"Timeline: Previous Keyframe",run:()=>{const e=p.frame(),s=D().reverse().find(o=>o<e-1e-4);return s===void 0?v():O(s)}},{id:"view-all",title:"Timeline: View All",run:()=>(le(),v())},{id:"zoom",title:"Timeline: Zoom",run:e=>{const s=Number(e?.to??e?.zoom);if(!Number.isFinite(s))throw new Error("zoom needs a numeric `to` — CSS pixels per frame, 0.25 … 200.");const{transform:o,size:r}=M(),n=o.startFrame+r.w/2/o.pixelsPerFrame,i=Math.min(me,Math.max(de,s));return k({transform:{pixelsPerFrame:i,startFrame:n-r.w/2/i}}),v()}},{id:"pan",title:"Timeline: Pan",run:e=>{const s=Number(e?.frames??0);if(!Number.isFinite(s))throw new Error("pan needs a numeric `frames`.");const{transform:o}=M();return k({transform:{...o,startFrame:o.startFrame+s}}),v()}},...Object.keys(B).map(e=>({id:e,run:()=>$(B[e])}))]});function Ze(){const e=f.useSyncExternalStore(ye,Q,Q);f.useSyncExternalStore(ae,L,L),f.useSyncExternalStore(K,_,_);const s=f.useRef(null),o=f.useRef(-1),{transform:r,size:n,refusal:i,onlySelected:c}=M(),l=p.state();f.useEffect(()=>{let t=!0;return p.bind(he,{rig:()=>xe(),clip:()=>ge()}).catch(m=>{t&&G(`The Timeline could not read this file's rig: ${m instanceof Error?m.message:String(m)}`)}),()=>{t=!1}},[e]),f.useEffect(()=>{const t=s.current;if(!t)return;const m=new ResizeObserver(()=>{const u={w:t.clientWidth,h:t.clientHeight},y=M().size;(y.w!==u.w||y.h!==u.h)&&k({size:u})});return m.observe(t),k({size:{w:t.clientWidth,h:t.clientHeight}}),()=>m.disconnect()},[]);const S=Ee();f.useEffect(()=>{if(S===o.current)return;o.current=S;const{w:t}=M().size;if(t===0)return;const m=Math.max(1,l.end-l.start),u=Math.min(me,Math.max(de,t*.9/m));k({transform:{pixelsPerFrame:u,startFrame:l.start-t*.05/u},framedAt:Date.now()})},[S,l.start,l.end]);const b=f.useCallback(t=>(t-r.startFrame)*r.pixelsPerFrame,[r]),Y=f.useCallback(t=>r.startFrame+t/r.pixelsPerFrame,[r]),F=f.useMemo(()=>ue(l.summary,c),[l.summary,c]),E=f.useMemo(()=>{if(n.w===0)return null;const t=n.w/r.pixelsPerFrame,m=Math.max(`${Math.round(r.startFrame)}`.length,`${Math.round(r.startFrame+t)}`.length),u=Math.max(te,m*6+Se),y=je(Math.round(l.fps),n.w+1,t,u),w=Fe(y),fe=Math.ceil(r.startFrame/y)*y,Z=[];for(let R=fe;R<=r.startFrame+t;R+=y)Z.push(R);const q=[];if(w!==null&&w*r.pixelsPerFrame>=te/5){const R=Math.ceil(r.startFrame/w)*w;for(let I=R;I<=r.startFrame+t;I+=w)Math.abs(I/y-Math.round(I/y))>1e-6&&q.push(I)}return{major:y,minor:w,majors:Z,minors:q}},[n.w,r,l.fps]),N=T,j=ke+Te/2;f.useEffect(()=>{if(!E)return;const t=[...l.warnings];l.action||t.push("Nothing in this file carries an action, so the summary row is empty — which is Blender's own empty state for a Timeline over a still file."),t.push("While a clip plays, the picture is three.js evaluating the skin over the mesh columns Blender exported at the BIND frame. Anything else Blender would re-evaluate per frame — shape keys, a Displace or Cloth modifier reading the frame, a geometry driver — does not follow the playhead."),t.push("Blender puts this view's ONLY-SHOW-SELECTED toggle in the Timeline header's View MENU (`TIME_MT_view`'s `layout.prop(scene, \"show_keys_from_selected_only\")`, `space_time.py`); this header has no menu region, so the same toggle is drawn as a header button at the leading edge, where that menu sits. The filter itself is Blender's — `ADS_FILTER_ONLYSEL`, `anim_filter.cc:254-270`, tested per object at `:2307`."),c&&F.objects.length===0&&l.summary.length>0&&t.push(`The summary row is empty because nothing animated is SELECTED, which is Blender's own answer with this filter on. ${l.summary.map(u=>u.object).join(", ")} carr${l.summary.length===1?"ies":"y"} an action; select it, or turn the filter off.`),t.push("Markers, the cache bar and the preview range are drawn by Blender's Timeline and not here; the door carries none of them.");const m={drawn:{action:l.action,object:l.object,armature:l.armature,frame:l.frame,start:l.start,end:l.end,fps:l.fps,playing:V(),keyframes:F.columns.map(u=>u.frame),onlySelected:c,summaryObjects:F.objects,majorStep:E.major,minorStep:E.minor,majorLines:E.majors.length,minorLines:E.minors.length,labels:E.majors.length,diamonds:F.columns.length,diamondRadius:ne,diamondSprite:_e,bones:l.bones,tracks:l.tracks,engineCalls:l.engineCalls,warnings:t}};JSON.stringify(m.drawn)!==JSON.stringify(M().drawn)&&k(m)},[E,l,F,c]);const C=f.useRef(!1),J=f.useCallback(t=>{const m=s.current;if(!m)return;const u=m.getBoundingClientRect();h()?.seekFrame(Math.round(Y(t-u.left)))},[Y]),U=`${Math.round(l.frame)}`,X=Math.max(g.minPillWidth,U.length*6+2*g.textPadding),A=b(l.frame);return a.jsxs("div",{"data-testid":"blender-timeline",style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",overflow:"hidden",background:x.back,color:d.text,font:"11px Inter, system-ui, sans-serif"},children:[a.jsx(Oe,{}),a.jsx("div",{ref:s,style:{flex:1,minHeight:0,position:"relative"},children:a.jsxs("svg",{width:n.w,height:n.h,style:{display:"block",cursor:"ew-resize"},"aria-label":"Timeline",onPointerDown:t=>{C.current=!0,t.currentTarget.setPointerCapture(t.pointerId),J(t.clientX)},onPointerMove:t=>{C.current&&J(t.clientX)},onPointerUp:t=>{C.current=!1,t.currentTarget.releasePointerCapture(t.pointerId)},children:[a.jsx("title",{children:"Timeline"}),a.jsx("rect",{x:0,y:0,width:n.w,height:n.h,fill:x.back}),a.jsx("rect",{x:0,y:N,width:Math.max(0,b(l.start)),height:Math.max(0,n.h-N),fill:ie}),a.jsx("rect",{x:b(l.end),y:N,width:Math.max(0,n.w-b(l.end)),height:Math.max(0,n.h-N),fill:ie}),E?.minors.map(t=>a.jsx("line",{x1:b(t),y1:N,x2:b(t),y2:n.h,stroke:x.gridMinor,strokeWidth:1},`n${t}`)),E?.majors.map(t=>a.jsx("line",{x1:b(t),y1:N,x2:b(t),y2:n.h,stroke:x.grid,strokeWidth:1},`m${t}`)),a.jsx("rect",{x:0,y:0,width:n.w,height:T,fill:x.scrubBack}),E?.majors.map(t=>a.jsx("text",{x:b(t),y:15.5,textAnchor:"middle",fill:x.scrubText,fontSize:11,children:Math.round(t)},`t${t}`)),a.jsx("path",{d:`M3,${j-3.5} L6.5,${j} L3,${j+3.5} Z`,fill:x.scrubText}),F.columns.map(t=>{const m=Ne[t.type]??1,u=ne*m,y=re[t.type]??re.KEYFRAME,w=b(t.frame);return a.jsx("polygon",{points:`${w},${j-u} ${w+u},${j} ${w},${j+u} ${w-u},${j}`,fill:t.select?y.selected:y.fill,stroke:x.keyBorder,strokeWidth:Ae*m},`k${t.frame}`)}),a.jsx("rect",{x:A-g.stalkWidth/2,y:T,width:g.stalkWidth,height:Math.max(0,n.h-T),fill:x.playhead}),a.jsx("rect",{x:A-X/2,y:g.margin,width:X,height:T-2*g.margin,rx:g.radius,fill:x.playhead}),a.jsx("polygon",{points:`${A-g.tipHalfWidth},${T-g.margin} ${A+g.tipHalfWidth},${T-g.margin} ${A},${T-g.margin+g.tipHeight}`,fill:x.playhead}),a.jsx("text",{x:A,y:15.5,textAnchor:"middle",fill:x.playheadText,fontSize:11,children:U})]})}),i?a.jsx("div",{style:{borderTop:`1px solid ${d.rule}`,padding:d.statusPadding,color:d.refusal},children:i}):null]})}function Ie(){f.useSyncExternalStore(K,_,_);const{onlySelected:e}=M(),[s,o]=f.useState(!1),r=(n,i,c)=>a.jsxs("button",{type:"button",onClick:()=>{c(),o(!1)},style:{display:"flex",alignItems:"center",gap:"var(--vgai-space-2)",width:"100%",padding:"var(--vgai-space-1) var(--vgai-space-3)",border:"none",background:"transparent",color:d.widgetText,font:"inherit",textAlign:"left",cursor:"pointer"},children:[a.jsx("span",{style:{width:12,display:"inline-block"},children:i===null?"":i?"✓":""}),n]});return a.jsxs("span",{style:{position:"relative"},children:[a.jsx("button",{type:"button","aria-haspopup":"menu","aria-expanded":s,onClick:()=>o(n=>!n),style:{border:"none",background:"transparent",color:d.text,font:"inherit",padding:"0 var(--vgai-space-2)",cursor:"pointer"},children:"View"}),s?a.jsxs("span",{role:"menu",style:{position:"absolute",top:"100%",left:0,zIndex:20,minWidth:210,display:"flex",flexDirection:"column",background:d.widget,border:`1px solid ${d.widgetOutline}`,boxShadow:"0 6px 18px rgba(0,0,0,0.45)"},children:[r("Only Show Selected",e,()=>be(!e)),r("Frame All",null,()=>le())]}):null]})}function Oe(){f.useSyncExternalStore(ae,L,L),f.useSyncExternalStore(K,_,_);const e=p.state(),s=d.unit,o=p.playable,r=(i,c,l,S)=>a.jsx("button",{type:"button",title:o?S:`${S} — ${z}`,"aria-label":S,disabled:!o,onClick:l,style:{width:s,height:s,padding:0,border:`1px solid ${d.widgetOutline}`,background:d.widget,color:d.widgetText,display:"grid",placeItems:"center",cursor:o?"pointer":"not-allowed",opacity:o?1:.4},children:c},i),n=i=>a.jsx("svg",{width:12,height:12,viewBox:"0 0 12 12","aria-hidden":"true",children:a.jsx("path",{d:i,fill:d.widgetText})});return a.jsxs("div",{style:{height:ee,flex:`0 0 ${ee}px`,display:"flex",alignItems:"center",gap:d.headerGap,padding:d.headerPadding,background:x.header,borderBottom:`1px solid ${d.rule}`},children:[a.jsx("span",{style:{color:d.text},children:"Timeline"}),a.jsx(Ie,{}),a.jsx("div",{style:{flex:1}}),a.jsxs("div",{style:{display:"flex"},children:[r("jump-start",n("M2 2h1.5v8H2zM10 2v8L4.5 6z"),()=>h()?.seekFrame(e.start),"Jump to Start"),r("prev-key",n("M5 2.5v7L1.5 6zM8.5 3.2L11 6L8.5 8.8L6 6z"),()=>{const i=D().reverse().find(c=>c<p.frame()-1e-4);i!==void 0&&h()?.seekFrame(i)},"Jump to Previous Keyframe"),o&&V()?r("pause-rev",n("M3 2h2v8H3zM7 2h2v8H7z"),()=>h()?.pause(),"Pause"):r("play-reverse",n("M9 2L2 6l7 4z"),()=>h()?.play("reverse"),"Play Reverse"),o&&V()?r("pause",n("M3 2h2v8H3zM7 2h2v8H7z"),()=>h()?.pause(),"Pause"):r("play",n("M3 2l7 4-7 4z"),()=>h()?.play(),"Play"),r("next-key",n("M7 2.5v7L10.5 6zM3.5 3.2L6 6L3.5 8.8L1 6z"),()=>{const i=D().find(c=>c>p.frame()+1e-4);i!==void 0&&h()?.seekFrame(i)},"Jump to Next Keyframe"),r("jump-end",n("M10 2H8.5v8H10zM2 2v8L7.5 6z"),()=>h()?.seekFrame(e.end),"Jump to End")]}),a.jsxs("div",{style:{display:"flex"},children:[r("step-back",n("M2 2h1.5v8H2zM9.5 2v8L4.5 6z"),()=>h()?.seekFrame(Math.round(e.frame)-1),"Step Back One Frame"),r("step-forward",n("M10 2H8.5v8H10zM2.5 2v8L7.5 6z"),()=>h()?.seekFrame(Math.round(e.frame)+1),"Step Forward One Frame")]}),a.jsx("div",{style:{flex:1}}),a.jsx("input",{type:"number",value:Math.round(e.frame),onChange:i=>{const c=Number(i.target.value);Number.isFinite(c)&&h()?.seekFrame(c)},"aria-label":"Current frame",disabled:!o,title:o?void 0:z,style:{width:75,height:s,textAlign:"center",border:`1px solid ${d.widgetOutline}`,borderRadius:d.widgetRadius,background:d.widget,color:d.widgetText,font:"inherit",cursor:o?"text":"not-allowed",opacity:o?1:.4}}),a.jsxs("span",{onClick:()=>G(B["set-range"]),onKeyDown:()=>{},style:{color:d.text,cursor:"not-allowed"},children:["Start ",e.start," · End ",e.end]})]})}export{Ze as default,Xe as point,Re as title};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as u}from"./jsx-runtime-DPjLkJKQ.js";import{ah as le}from"./index-
|
|
1
|
+
import{a as u}from"./jsx-runtime-DPjLkJKQ.js";import{ah as le}from"./index-DuB3wHKD.js";import{r as c}from"./index-DaQZGF7d.js";import{s as ue,b as X,j as de}from"./blender-runtime-host-JKPuUKtZ.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D_NuPfjr.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";import"./clip-planes-CnAI6DZn.js";const he={transform:{cx:.5,cy:.5,zoom:512},refusal:null,size:{w:0,h:0},framedAt:0,drawn:null};let L=he,N=0;const T=new Set;let te=0;function m(){return L}function Q(){return N}function fe(t){return T.add(t),()=>{T.delete(t)}}function v(t){L={...L,...t},N+=1;for(const r of[...T])r()}function pe(){te+=1,N+=1;for(const t of[...T])t()}function me(){return te}function ne(t){v({refusal:t})}const x={back:"#303030",grid:"#303030",face:"#ffffff",faceAlpha:10/255,uvShadow:"#707070",vertex:"#000000",faceDot:"#000000"},B={vertexSize:3,edgeWidth:1,facedotSize:3},se=1,ge=(B.vertexSize*se+1.5)*Math.SQRT2,ve=.75,we=B.facedotSize*se,ye=1,J=[1,1],K=[10,10],xe="Blender's `.space_image.grid` is #303030 at full alpha (userdef_default_theme.c:586) and this view's surface is #303030, so the tile grid draws at the theme's colour and is invisible against it. The image region's own clear is the overlay engine's (DRW_draw_view, space_image.cc:758), which is not in the source checkout — the sighted read settles the contrast.",be={shadow:{inner:x.uvShadow}},Ue=Math.max(B.edgeWidth,1),ee="#ff0000";function W(t){const r=atob(t),a=new Uint8Array(r.length);for(let d=0;d<r.length;d++)a[d]=r.charCodeAt(d);return a}function Ve(t){const r=W(t);return new Float32Array(r.buffer,r.byteOffset,r.byteLength>>2)}function z(t){const r=W(t);return new Uint32Array(r.buffer,r.byteOffset,r.byteLength>>2)}function Ee(t,r){const a=Number.parseInt(t.slice(1),16);return`rgba(${a>>16&255}, ${a>>8&255}, ${a&255}, ${Math.round(r*1e3)/1e3})`}const E={text:"#e6e6e6",refusal:"#ed5700",rule:"#232323",statusPadding:"3px 8px",statusGap:12},Ne="workspace.document",_e="UV Editor",D=8e3,re=16,oe=8192,_={move:t=>`Dragging a UV in "${t}" writes the mesh's UV attribute, which the document would save. This is Blender's UV editor as an INSPECTION surface: editing parity is not the program.`,select:"Selecting a UV writes the mesh's selection state. This view draws what the DATA carries — and at this pin a mesh outside edit mode carries no UV selection at all (MeshUVLoopLayer declares uv, pin, name, active, active_render, active_clone and nothing else), so everything draws unselected. Editing parity is not the program.",pin:"Pinning a UV writes `MeshUVLoopLayer.pin`, which the document would save. Existing pins ARE drawn, in Blender's own hard red. Editing parity is not the program.",unwrap:"Unwrapping runs `bpy.ops.uv.unwrap`, which rewrites every UV on the mesh. Editing parity is not the program."};le({view:"blender-uv-view",title:_e,verbs:[{id:"state",run:()=>m()},{id:"view-all",title:"UV Editor: View All",run:()=>(pe(),m())},{id:"zoom",title:"UV Editor: Zoom",run:t=>{const r=Number(t?.to??t?.zoom);if(!Number.isFinite(r))throw new Error("zoom needs a numeric `to` — CSS pixels per UV unit, 16 … 8192.");const{transform:a}=m();return v({transform:{...a,zoom:Math.min(oe,Math.max(re,r))}}),m()}},{id:"pan",title:"UV Editor: Pan",run:t=>{const r=Number(t?.u??0),a=Number(t?.v??0);if(!Number.isFinite(r)||!Number.isFinite(a))throw new Error("pan needs numeric `u` and `v`, in UV units.");const{transform:d}=m();return v({transform:{...d,cx:d.cx+r,cy:d.cy+a}}),m()}},{id:"move-uv",run:()=>R(_.move("the active UV map"))},{id:"select",run:()=>R(_.select)},{id:"pin",run:()=>R(_.pin)},{id:"unwrap",run:()=>R(_.unwrap)}]});function R(t){return ne(t),m()}function Se(t){return!t?.uvBase64||!t.triangleBase64?null:{uv:Ve(t.uvBase64),tris:z(t.triangleBase64),starts:z(t.loopStartBase64??""),totals:z(t.loopTotalBase64??""),pins:t.pinBase64?W(t.pinBase64):null}}function Be(){const t=c.useSyncExternalStore(ue,X,X);c.useSyncExternalStore(fe,Q,Q);const r=c.useRef(0),a=c.useRef(null),d=c.useRef(null),j=c.useRef(null),{transform:b,refusal:C,size:U}=m(),[,F]=[0,c.useCallback(()=>v({}),[])];c.useEffect(()=>{let e=!0;return(async()=>{try{const s=await de();if(!e)return;d.current=s,j.current=null}catch(s){if(!e)return;j.current=s instanceof Error?s.message:String(s)}F()})(),()=>{e=!1}},[t,F]),c.useEffect(()=>{const e=a.current;if(!e)return;const s=new ResizeObserver(()=>{const l={w:e.clientWidth,h:e.clientHeight},h=m().size;(h.w!==l.w||h.h!==l.h)&&v({size:l})});return s.observe(e),v({size:{w:e.clientWidth,h:e.clientHeight}}),()=>s.disconnect()},[]);const n=d.current,M=c.useMemo(()=>Se(n),[n]),O=me();c.useEffect(()=>{if(O===r.current)return;r.current=O;const e=n?.bounds??[0,0,1,1],{w:s,h:l}=m().size;if(s===0||l===0)return;const[h,g,o,f]=e,V=Math.max(o-h,.001),S=Math.max(f-g,.001),k=Math.min(oe,Math.max(re,Math.min(s/V,l/S)*.9));v({transform:{cx:(h+o)/2,cy:(g+f)/2,zoom:k},framedAt:Date.now()})},[O,n]);const w=e=>(e-b.cx)*b.zoom+U.w/2,y=e=>U.h/2-(e-b.cy)*b.zoom,i=c.useMemo(()=>{if(!n||!M)return null;const{uv:e,tris:s,starts:l,totals:h,pins:g}=M,o=[],f=[],V=[],S=[],k=l.length;for(let p=0;p<k;p++){const ce=l[p],I=h[p];if(I<3)continue;let $="",H=0,G=0;for(let A=0;A<I;A++){const Z=ce+A,q=e[Z*2],Y=e[Z*2+1];H+=q,G+=Y,$+=`${A===0?"M":"L"}${w(q).toFixed(2)} ${y(Y).toFixed(2)}`}$+="Z",o.push($),f.push($),S.push({x:w(H/I),y:y(G/I)})}const P=e.length>>1;for(let p=0;p<P&&V.length<D;p++)V.push({x:w(e[p*2]),y:y(e[p*2+1]),pinned:g?g[p]!==0:!1});return{faces:o,outlines:f,dots:V,faceDots:S,corners:P,triangles:s.length/3}},[n,M,b,U]);c.useEffect(()=>{if(!n)return;const e=[];n.layers.length===0&&n.object&&e.push(`"${n.object}" has no UV map — Blender's UV editor draws an empty tile.`),i&&i.corners>D&&e.push(`${i.corners} UV corners exceed this view's ${D}-dot budget; ${i.corners-D} corner marks are not drawn. The islands, their edges and the face dots are all drawn.`),n.image||e.push("No image behind the tile: the active material's node tree has no image texture with an image, so there is nothing for Blender's backdrop to show."),e.push(xe),e.push("The line style is SHADOW (#707070), not Blender's stock OUTLINE: `edit_uv_line_style_from_space_image` returns OUTLINE only when `SpaceImage.mode == SI_MODE_UV`, and there is no SpaceImage here."),v({drawn:{object:n.object,mesh:n.mesh,layer:n.active,layers:n.layers,mode:n.mode,loops:n.loops,polygons:n.polygons,triangles:i?.triangles??0,faces:i?.faces.length??0,edges:i?.outlines.length??0,verts:i?.dots.length??0,faceDots:i?.faceDots.length??0,pinned:i?.dots.filter(s=>s.pinned).length??0,bounds:n.bounds??null,tiles:J,subdiv:K,image:n.image?.name??null,warnings:e}})},[n,i]);const ie=c.useMemo(()=>{const e=[],[s,l]=J,[h,g]=K;for(let o=0;o<=s*h;o++){const f=o/h;e.push({key:`u${o}`,x1:w(f),y1:y(0),x2:w(f),y2:y(l),major:o%h===0})}for(let o=0;o<=l*g;o++){const f=o/g;e.push({key:`v${o}`,x1:w(0),y1:y(f),x2:w(s),y2:y(f),major:o%g===0})}return e},[b,U]),ae=n?n.active?`UV Editor · ${n.object} · ${n.active} · ${n.polygons} faces, ${n.loops} corners · ${n.mode}`:`UV Editor · ${n.object??"no mesh selected"} · no UV map · ${n.mode}`:j.current??"UV Editor · reading…";return u.jsxs("div",{"data-testid":"blender-uv-editor",style:{display:"flex",flexDirection:"column",position:"absolute",inset:0,overflow:"hidden",background:x.back,color:E.text,font:"11px Inter, system-ui, sans-serif"},children:[u.jsx("div",{ref:a,style:{flex:1,minHeight:0,position:"relative"},children:u.jsxs("svg",{width:U.w,height:U.h,style:{display:"block"},onPointerDown:()=>ne(_.select),"aria-label":"UV layout",children:[u.jsx("title",{children:"UV layout"}),ie.map(e=>u.jsx("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:x.grid,strokeWidth:e.major?2:1},e.key)),i?.faces.map((e,s)=>u.jsx("path",{d:e,fill:Ee(x.face,x.faceAlpha*ye)},`f${s}`)),i?.outlines.map((e,s)=>u.jsx("path",{d:e,fill:"none",stroke:be.shadow.inner,strokeWidth:Ue},`e${s}`)),i?.faceDots.map((e,s)=>u.jsx("circle",{cx:e.x,cy:e.y,r:we/2,fill:x.faceDot},`fd${s}`)),i?.dots.map((e,s)=>u.jsx("circle",{cx:e.x,cy:e.y,r:ge/2,fill:e.pinned?ee:x.vertex,stroke:e.pinned?ee:"none",strokeWidth:e.pinned?ve:0},`v${s}`))]})}),u.jsxs("div",{style:{borderTop:`1px solid ${E.rule}`,padding:E.statusPadding,display:"flex",gap:E.statusGap,alignItems:"center"},children:[u.jsx("span",{children:ae}),C?u.jsx("span",{style:{color:E.refusal},children:C}):null]})]})}export{Be as default,Ne as point,_e as title};
|
package/dist/assets/{blender-version.status-CukRH8K3.js → blender-version.status-ZqfW0upF.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"./jsx-runtime-DPjLkJKQ.js";import{e as i}from"./index-
|
|
1
|
+
import{a as r}from"./jsx-runtime-DPjLkJKQ.js";import{e as i}from"./index-DuB3wHKD.js";import{r as s}from"./index-DaQZGF7d.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D_NuPfjr.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";const v="workspace.status",f="Version",x="right",h=998;function b(){const{project:e}=i(),t=s.useSyncExternalStore(e.subscribe,e.engineVersion,e.engineVersion);return t===null?null:r.jsxs("span",{className:"vgai-status-copy","data-testid":"status-blender-version","data-engine-version":t,style:{display:"inline-flex",alignItems:"center",gap:"var(--vgai-space-2)",fontSize:"var(--vgai-font-md)"},title:`This project is built against engine ${t}`,children:[r.jsx("span",{"aria-hidden":"true",style:{width:"var(--vgai-stroke-resting)",height:"var(--vgai-icon-md)",background:"currentColor"}}),t]})}export{x as align,b as default,h as order,v as point,f as title};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as l}from"./blender-runtime-host-
|
|
1
|
+
import{h as l}from"./blender-runtime-host-JKPuUKtZ.js";import"./index-DuB3wHKD.js";import"./index-DaQZGF7d.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";import"./clip-planes-CnAI6DZn.js";const v="workspace.command",e=(o,n)=>({...n===void 0?{}:{timeoutMs:n},derivedRefresh:o,handle:r=>l(r)}),y={"blender-start":e("none",12e4),"blender-stop":e("none",30*6e4),"blender-execute":e("always",30*6e4),"blender-scene-info":e("none",6e4),"blender-object-info":e("none",6e4),"blender-screenshot-view":e("always",6e4),"blender-read-file":e("none",6e4),"blender-write-file":e("none",6e4),"blender-list-files":e("none"),"blender-rna":e("none",6e4),"blender-rna-context":e("none",6e4),"blender-rna-set":e("always",6e4),"blender-outliner":e("none",6e4),"blender-node-tree":e("none",6e4),"blender-uv-layout":e("none",6e4),"blender-rig":e("none",6e4),"blender-action-clip":e("none",12e4),"blender-node-view":e("none"),"blender-outliner-set":e("always",6e4),"blender-status":e("none")};export{y as commands,v as point};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{bV as M,bW as Z,bX as m,bY as te,bZ as y,b_ as ie,b$ as g,c0 as P,c1 as V}from"./index-DmtPt6RQ.js";import"./webworkerAll-FJN9IDir.js";import"./index-DaQZGF7d.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";class q{constructor(e){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;const t=this._canvas.getBoundingClientRect(),i=this._canvas.width,n=this._canvas.height,s=t.width/i*this._renderer.resolution,o=t.height/n*this._renderer.resolution,r=t.left,l=t.top,d=`translate(${r}px, ${l}px) scale(${s}, ${o})`;d!==this._lastTransform&&(this._domElement.style.transform=d,this._lastTransform=d)},this._domElement=e.domElement,this._renderer=e.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(e=>{for(const t of e){if(t.target!==this._canvas)continue;const i=this.canvas.width,n=this.canvas.height,s=t.contentRect.width/i*this._renderer.resolution,o=t.contentRect.height/n*this._renderer.resolution;(this._lastScaleX!==s||this._lastScaleY!==o)&&(this.updateTranslation(),this._lastScaleX=s,this._lastScaleY=o)}}),this._observer.observe(this._canvas)):this._tickerAttached||M.shared.add(this.updateTranslation,this,Z.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&M.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}class w{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=w.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new m,this.page=new m,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}var I=/iPhone/i,B=/iPod/i,C=/iPad/i,U=/\biOS-universal(?:.+)Mac\b/i,k=/\bAndroid(?:.+)Mobile\b/i,R=/Android/i,b=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,O=/Silk/i,v=/Windows Phone/i,X=/\bWindows(?:.+)ARM\b/i,K=/BlackBerry/i,Y=/BB10/i,H=/Opera Mini/i,F=/\b(CriOS|Chrome)(?:.+)Mobile/i,$=/Mobile(?:.+)Firefox\b/i,N=function(a){return typeof a<"u"&&a.platform==="MacIntel"&&typeof a.maxTouchPoints=="number"&&a.maxTouchPoints>1&&typeof MSStream>"u"};function ne(a){return function(e){return e.test(a)}}function W(a){var e={userAgent:"",platform:"",maxTouchPoints:0};!a&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof a=="string"?e.userAgent=a:a&&a.userAgent&&(e={userAgent:a.userAgent,platform:a.platform,maxTouchPoints:a.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=ne(t),s={apple:{phone:n(I)&&!n(v),ipod:n(B),tablet:!n(I)&&(n(C)||N(e))&&!n(v),universal:n(U),device:(n(I)||n(B)||n(C)||n(U)||N(e))&&!n(v)},amazon:{phone:n(b),tablet:!n(b)&&n(O),device:n(b)||n(O)},android:{phone:!n(v)&&n(b)||!n(v)&&n(k),tablet:!n(v)&&!n(b)&&!n(k)&&(n(O)||n(R)),device:!n(v)&&(n(b)||n(O)||n(k)||n(R))||n(/\bokhttp\b/i)},windows:{phone:n(v),tablet:n(X),device:n(v)||n(X)},other:{blackberry:n(K),blackberry10:n(Y),opera:n(H),firefox:n($),chrome:n(F),device:n(K)||n(Y)||n(H)||n($)||n(F)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}const se=W.default??W,oe=se(globalThis.navigator),re=9,G=100,ae=0,le=0,j=2,z=1,he=-1e3,ce=-1e3,de=2,L=class J{constructor(e,t=oe){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){const e=document.createElement("button");e.style.width=`${z}px`,e.style.height=`${z}px`,e.style.position="absolute",e.style.top=`${he}px`,e.style.left=`${ce}px`,e.style.zIndex=de.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${ae}px`,this._div.style.left=`${le}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=j.toString(),this._canvasObserver=new q({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);const e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{const t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const e of this._children)e._accessibleDiv?.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;for(const e in this._pools)this._pools[e].forEach(i=>{i.parentNode&&i.parentNode.removeChild(i)}),delete this._pools[e];this._div?.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let i=0;i<t.length;i++)this._updateAccessibleObjects(t[i])}init(e){const i={accessibilityOptions:{...J.defaultOptions,...e?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){const e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;const t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(const i of this._children)i._renderId===this._renderId&&t.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){const n=this._children[i];t.has(i)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._getPool(n.accessibleType).push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,te(this._children,i,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let i=0;i<this._children.length;i++){const n=this._children[i];if(!n._accessibleActive||!n._accessibleDiv)continue;const s=n._accessibleDiv,o=n.hitArea||n.getBounds().rectangle;if(n.hitArea){const r=n.worldTransform;s.style.left=`${r.tx+o.x*r.a}px`,s.style.top=`${r.ty+o.y*r.d}px`,s.style.width=`${o.width*r.a}px`,s.style.height=`${o.height*r.d}px`}else this._capHitArea(o),s.style.left=`${o.x}px`,s.style.top=`${o.y}px`,s.style.width=`${o.width}px`,s.style.height=`${o.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let i=this._getPool(e.accessibleType).pop();i?(i.innerHTML="",i.removeAttribute("title"),i.removeAttribute("aria-label"),i.tabIndex=0):(e.accessibleType==="button"?i=document.createElement("button"):(i=document.createElement(e.accessibleType),i.style.cssText=`
|
|
1
|
+
import{bV as M,bW as Z,bX as m,bY as te,bZ as y,b_ as ie,b$ as g,c0 as P,c1 as V}from"./index-DuB3wHKD.js";import"./webworkerAll-CS1yjkoi.js";import"./index-DaQZGF7d.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";class q{constructor(e){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;const t=this._canvas.getBoundingClientRect(),i=this._canvas.width,n=this._canvas.height,s=t.width/i*this._renderer.resolution,o=t.height/n*this._renderer.resolution,r=t.left,l=t.top,d=`translate(${r}px, ${l}px) scale(${s}, ${o})`;d!==this._lastTransform&&(this._domElement.style.transform=d,this._lastTransform=d)},this._domElement=e.domElement,this._renderer=e.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(e=>{for(const t of e){if(t.target!==this._canvas)continue;const i=this.canvas.width,n=this.canvas.height,s=t.contentRect.width/i*this._renderer.resolution,o=t.contentRect.height/n*this._renderer.resolution;(this._lastScaleX!==s||this._lastScaleY!==o)&&(this.updateTranslation(),this._lastScaleX=s,this._lastScaleY=o)}}),this._observer.observe(this._canvas)):this._tickerAttached||M.shared.add(this.updateTranslation,this,Z.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&M.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}class w{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=w.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new m,this.page=new m,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}var I=/iPhone/i,B=/iPod/i,C=/iPad/i,U=/\biOS-universal(?:.+)Mac\b/i,k=/\bAndroid(?:.+)Mobile\b/i,R=/Android/i,b=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,O=/Silk/i,v=/Windows Phone/i,X=/\bWindows(?:.+)ARM\b/i,K=/BlackBerry/i,Y=/BB10/i,H=/Opera Mini/i,F=/\b(CriOS|Chrome)(?:.+)Mobile/i,$=/Mobile(?:.+)Firefox\b/i,N=function(a){return typeof a<"u"&&a.platform==="MacIntel"&&typeof a.maxTouchPoints=="number"&&a.maxTouchPoints>1&&typeof MSStream>"u"};function ne(a){return function(e){return e.test(a)}}function W(a){var e={userAgent:"",platform:"",maxTouchPoints:0};!a&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof a=="string"?e.userAgent=a:a&&a.userAgent&&(e={userAgent:a.userAgent,platform:a.platform,maxTouchPoints:a.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=ne(t),s={apple:{phone:n(I)&&!n(v),ipod:n(B),tablet:!n(I)&&(n(C)||N(e))&&!n(v),universal:n(U),device:(n(I)||n(B)||n(C)||n(U)||N(e))&&!n(v)},amazon:{phone:n(b),tablet:!n(b)&&n(O),device:n(b)||n(O)},android:{phone:!n(v)&&n(b)||!n(v)&&n(k),tablet:!n(v)&&!n(b)&&!n(k)&&(n(O)||n(R)),device:!n(v)&&(n(b)||n(O)||n(k)||n(R))||n(/\bokhttp\b/i)},windows:{phone:n(v),tablet:n(X),device:n(v)||n(X)},other:{blackberry:n(K),blackberry10:n(Y),opera:n(H),firefox:n($),chrome:n(F),device:n(K)||n(Y)||n(H)||n($)||n(F)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}const se=W.default??W,oe=se(globalThis.navigator),re=9,G=100,ae=0,le=0,j=2,z=1,he=-1e3,ce=-1e3,de=2,L=class J{constructor(e,t=oe){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){const e=document.createElement("button");e.style.width=`${z}px`,e.style.height=`${z}px`,e.style.position="absolute",e.style.top=`${he}px`,e.style.left=`${ce}px`,e.style.zIndex=de.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${ae}px`,this._div.style.left=`${le}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=j.toString(),this._canvasObserver=new q({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);const e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{const t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const e of this._children)e._accessibleDiv?.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;for(const e in this._pools)this._pools[e].forEach(i=>{i.parentNode&&i.parentNode.removeChild(i)}),delete this._pools[e];this._div?.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let i=0;i<t.length;i++)this._updateAccessibleObjects(t[i])}init(e){const i={accessibilityOptions:{...J.defaultOptions,...e?.accessibilityOptions||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){const e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;const t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(const i of this._children)i._renderId===this._renderId&&t.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){const n=this._children[i];t.has(i)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._getPool(n.accessibleType).push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,te(this._children,i,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let i=0;i<this._children.length;i++){const n=this._children[i];if(!n._accessibleActive||!n._accessibleDiv)continue;const s=n._accessibleDiv,o=n.hitArea||n.getBounds().rectangle;if(n.hitArea){const r=n.worldTransform;s.style.left=`${r.tx+o.x*r.a}px`,s.style.top=`${r.ty+o.y*r.d}px`,s.style.width=`${o.width*r.a}px`,s.style.height=`${o.height*r.d}px`}else this._capHitArea(o),s.style.left=`${o.x}px`,s.style.top=`${o.y}px`,s.style.width=`${o.width}px`,s.style.height=`${o.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let i=this._getPool(e.accessibleType).pop();i?(i.innerHTML="",i.removeAttribute("title"),i.removeAttribute("aria-label"),i.tabIndex=0):(e.accessibleType==="button"?i=document.createElement("button"):(i=document.createElement(e.accessibleType),i.style.cssText=`
|
|
2
2
|
color: transparent;
|
|
3
3
|
pointer-events: none;
|
|
4
4
|
padding: 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ao as M,Z as h,ap as S,aq as z,ar as k,as as I,at as P,au as A,h as H,av as y,aw as C,ax as N,ay as F,az as _,aA as B,aB as W,aC as $}from"./index-
|
|
1
|
+
import{ao as M,Z as h,ap as S,aq as z,ar as k,as as I,at as P,au as A,h as H,av as y,aw as C,ax as N,ay as F,az as _,aA as B,aB as W,aC as $}from"./index-DuB3wHKD.js";const x={transform:!1,inspectorFields:!1,persist:!1};class D{capabilities=x;provenance={source:"boundary",label:"read-only",detail:"Declared world without a live editing surface in this viewport — disclosed, not simulated; rows are read-only."};world;reason;store;pickable;constructor(e,t,i,n){this.store=e,this.world=t,this.reason=i??null,n&&(this.pickable={pick:n})}get label(){return this.world.entryOrScenePath?.split("/").pop()??this.world.id}get node(){return{id:this.world.id,label:this.label,secondaryLabel:this.reason?"Unavailable":"Read-only",role:"boundary",kind:this.world.kind,parentId:null,childIds:[]}}hierarchy={roots:()=>[this.node],node:e=>e===this.world.id?this.node:null};selection={get:()=>[...this.store.selectedEntityIds],set:e=>this.store.selectMultiple(e)};inspector={properties:e=>{if(e!==this.world.id)return[];const t=[{path:"kind",label:"Kind",type:"string",readonly:!0}];return this.world.adapter!==void 0&&t.push({path:"adapter",label:"Adapter",type:"string",readonly:!0}),this.world.entryOrScenePath!==void 0&&t.push({path:"path",label:"Entry / Scene",type:"string",readonly:!0}),t.push({path:"zOrder",label:"Z Order",type:"number",readonly:!0},{path:"pausable",label:"Pausable",type:"boolean",readonly:!0}),this.reason&&t.push({path:"reason",label:"Reason",type:"string",readonly:!0}),t},get:(e,t)=>{if(e===this.world.id)switch(t){case"kind":return this.world.kind;case"adapter":return this.world.adapter;case"path":return this.world.entryOrScenePath;case"zOrder":return this.world.zOrder;case"pausable":return this.world.pausable;case"reason":return this.reason??void 0;default:return}},set:(e,t,i)=>{}}}const u=new WeakMap,T=new Set;function j(){for(const r of T)r()}function q(r){const e=(u.get(r)?.generation??0)+1;return u.set(r,{generation:e,settled:!1}),j(),()=>{const t=u.get(r);!t||t.generation!==e||t.settled||(u.set(r,{generation:e,settled:!0}),j())}}const G="(invalid manifest)";let w=!1,g=!1,b=!1,l=null;function f(){if(g||b||!w||!l)return;g=!0;const r=l;queueMicrotask(()=>{if(g=!1,l!==r){f();return}w=!1,b=!0,Promise.resolve().then(r).catch(e=>{h.error(`Edit-mode rebuild failed: ${e instanceof Error?e.message:String(e)}`,"authoring")}).finally(()=>{b=!1,f()})})}function Y(r){return l=r,f(),()=>{l===r&&(l=null)}}function ee(){w=!0,f()}const V=new Set(["three","canvas","dom"]);function d(r){return typeof r=="string"?r:void 0}function J(r){const e=r.world;if(!e||typeof e!="object")return;const t=d(e.entry);if(t)return{entry:t,export:d(e.export)}}function L(r){if(r!=null){if(typeof r=="string")return r;if(typeof r=="object"){const e=r;if(typeof e.module=="string")return`module:${e.module}`;const t=e.ingest;if(t&&typeof t=="object")return"ingest"}}}function Z(r){if(!r||typeof r!="object")return null;const e=r.roots;return e===void 0||!Array.isArray(e)?null:{roots:e.map((i,n)=>{const s=i&&typeof i=="object"?i:{},a=s.zOrder,o=s.pausable;return{id:d(s.id)??`(world ${n})`,surface:(typeof s.adapter=="string"?d(s.adapter):void 0)??d(s.adapter&&typeof s.adapter=="object"?s.adapter.surface:void 0)??"(missing adapter surface)",adapter:L(s.adapter),scene:d(s.scene),entry:d(s.entry),zOrder:typeof a=="number"?a:void 0,pausable:typeof o=="boolean"?o:void 0,dev:s.dev===!0,world:J(s)}})}}function K(r){return V.has(r.surface)?!r.scene&&!r.entry?`World "${r.id}" declares neither \`scene\` nor \`entry\` — nothing to mount.`:null:`Unknown world surface "${r.surface}" — expected one of: three, canvas, react.`}function c(r,e){const t=r.roots;if(Array.isArray(t))return t.find(i=>!!i&&typeof i=="object"&&i.id===e)}function O(r,e){return c(r,e)}class U{raw;synthesizedValue;store;fileHistory;unsubscribeHistory;constructor(e,t,i){this.raw=e,this.synthesizedValue=t,this.store=i;const n=i.projectHistory;this.fileHistory=n?H(n,y(),"project-manifest"):null,this.unsubscribeHistory=this.fileHistory?this.fileHistory.subscribeAll(s=>{s==="vgai.project.json"&&y().readBytes(s).then(a=>JSON.parse(new TextDecoder().decode(a))).then(a=>{for(const o of Object.keys(this.raw))delete this.raw[o];Object.assign(this.raw,a),this.store.notifyIngestEdit()}).catch(()=>{})}):null}getGameName(){const e=this.raw.name;return typeof e=="string"?e:""}get synthesized(){return this.synthesizedValue}setGameName(e){this.raw.name=e,this.persist("Rename Game")}getRootContentSource(e){const t=c(this.raw,e);if(!t)return;const i=t.scene;if(typeof i=="string")return`Scene · ${i}`;const n=t.entry;return typeof n=="string"?`Entry · ${n}`:"Adapter-owned runtime content"}getRootZOrder(e){const t=c(this.raw,e)?.zOrder;return typeof t=="number"?t:0}setRootZOrder(e,t){const i=O(this.raw,e);i&&(i.zOrder=t,this.persist("Change World Order"))}getRootPausable(e){const t=c(this.raw,e)?.pausable;return typeof t=="boolean"?t:!0}setRootPausable(e,t){const i=O(this.raw,e);i&&(i.pausable=t,this.persist("Change World Pausing"))}async materialize(){const e=await this.write("Create Game Manifest");return e&&(this.synthesizedValue=!1),e}dispose(){this.unsubscribeHistory?.()}persist(e){this.synthesized||this.write(e)}async write(e){const t=JSON.stringify(this.raw,null,2);try{if(this.fileHistory)return await this.fileHistory.write("vgai.project.json",t,{label:e,kind:"manifest",contentType:"application/json"}),this.store.notifyIngestEdit(),!0;const i=async()=>{const n=await fetch("/__editor/manifest",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:"vgai.project.json",content:t,...C()})});N(n,"Write vgai.project.json failed"),n.ok||await F(n,{label:"Write vgai.project.json",attempted:{"vgai.project.json":t},reapply:i})};return await i(),this.store.notifyIngestEdit(),!0}catch(i){return this.fileHistory&&y().readBytes("vgai.project.json").then(n=>JSON.parse(new TextDecoder().decode(n))).then(n=>{for(const s of Object.keys(this.raw))delete this.raw[s];Object.assign(this.raw,n),this.store.notifyIngestEdit()}).catch(()=>{}),h.error(`Failed to write vgai.project.json: ${i}`,"project"),!1}}}let v=null;function Q(r,e,t){const i=S(e).map(o=>{const p=o.zOrder??0,m=z(o.surface);if(m)return{worldId:o.id,kind:o.surface,adapter:m(r,o.id),zOrder:p};const R=K(o),E={id:o.id,kind:o.surface,adapter:o.adapter,entryOrScenePath:o.scene??o.entry,zOrder:p,pausable:o.pausable??!0};return{worldId:o.id,kind:o.surface,adapter:new D(r,E,R??void 0),zOrder:p}}),n=t&&i.length>=1?new U(t.raw,t.synthesized,r):void 0;v=n??null;const s=k(_()?.config),a=new I(i,n,s);if(i.length>=1){if(B()&&!W())return h.warn("Edit-mode authoring not installed: a foreign session (ingest/play) owns the authoring override.","authoring"),a;P(a),A(a),r.notifyIngestEdit()}return a}function te(r){r&&$()===r&&A(null),v?.dispose(),v=null}async function re(r){const e=q(r);let t,i;try{const n=await M(),s=n!==null&&Z(n);if(s)t=s,i={raw:n,synthesized:!1};else throw new Error("manifest has no `roots` array (zero roots is fine; a missing field is not)")}catch(n){const s=n instanceof Error?n.message:String(n);h.error(`Failed to load vgai.project.json: ${s}`,"project"),t={roots:[{id:"manifest",surface:G,adapter:s}]}}try{return Q(r,t,i)}finally{e()}}export{D as B,G as I,Y as b,te as e,re as i,ee as q};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{bA as E,s as l,o as y,bB as b,a as L,j as T}from"./index-
|
|
1
|
+
import{bA as E,s as l,o as y,bB as b,a as L,j as T}from"./index-DuB3wHKD.js";import"./index-DaQZGF7d.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./three.module-BynznMJN.js";function x(e){return!e||e.trim()===""?"empty":e.includes("\0")?"nul":e.startsWith("/")||e.startsWith("\\")||/^[a-zA-Z]:[\\/]/.test(e)?"absolute":e.split(/[\\/]/).includes("..")?"traversal":null}function O(e){return x(e)===null}const d=".vgai/assets.json",k=y({key:l().min(1),license:l().min(1).optional(),sourceHash:l().regex(/^sha256-[a-f0-9]{64}$/,'sourceHash must be "sha256-<64 hex>"').optional(),materializedAt:l().datetime()}).strict(),z=E(l().min(1),k);function _(e){if(!/^[a-f0-9]{64}$/.test(e))throw new Error(`Not a sha256 digest, refusing to record it as a sourceHash: ${e}`);return`sha256-${e}`}function m(e){const t=e.replaceAll("\\","/").replace(/^\.\//,"").replace(/^\/+/,"");if(!t)throw new Error("An asset ledger path cannot be empty.");if(!O(t))throw new Error(`An asset ledger path cannot escape the project: ${e}`);return t}function D(e){return z.parse(e)}function I(e){if(e==null||e.trim()==="")return{};let t;try{t=JSON.parse(e)}catch(s){throw new Error(`${d} is not valid JSON: ${String(s)}`)}return D(t)}function M(e,t,s){const r=m(t),a=k.parse(s),n={...e,[r]:a},i={};for(const u of Object.keys(n).sort())i[u]=n[u];return i}function U(e){const t={};for(const s of Object.keys(e).sort())t[s]=e[s];return`${JSON.stringify(t,null,2)}
|
|
2
2
|
`}function H(e,t,s){const r=globalThis.navigator?.locks;return r?r.request(`vgai:${e}:${b(t)}`,s):s()}const j=1e4,N=15;function R(){return globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random()}`}async function B(e,t,s={}){const r=s.staleAfterMs??j,a=s.retryDelayMs??N,n=s.now??Date.now,i=s.sleep??(o=>new Promise(c=>setTimeout(c,o))),u=s.token??R;for(;;){const o=JSON.stringify({at:n(),owner:s.owner??"unknown",token:u()});if(await e.createIfAbsent(o))try{return await t()}finally{await e.removeIfHeldBy(o)}const c=await e.read();if(c!==null){if(n()-J(c)>r){await e.removeIfHeldBy(c);continue}await i(a)}}}function J(e){try{const t=JSON.parse(e);return typeof t.at=="number"?t.at:0}catch{return 0}}function F(){const e=new Map;return(t,s)=>{const a=(e.get(t)??Promise.resolve()).then(s,s),n=a.then(()=>{},()=>{});return e.set(t,n),n.then(()=>{e.get(t)===n&&e.delete(t)}),a}}async function S(e){return await e.exists(d)?I(await e.read(d)):{}}async function C(e,t){await e.write(d,U(t))}const f=`${d}.lock`,W=F(),A=new WeakMap;let $=0;function K(e){const t=A.get(e);if(t!==void 0)return t;$+=1;const s=`${e.id}#${$}`;return A.set(e,s),s}async function G(e,t){const s={key:t.key,...t.license?{license:t.license}:{},...t.sourceSha256?{sourceHash:_(t.sourceSha256)}:{},materializedAt:t.materializedAt??new Date().toISOString()};await W(K(e),()=>B({createIfAbsent:r=>e.writeIfAbsent(f,r),read:async()=>await e.exists(f)?e.read(f):null,removeIfHeldBy:r=>H(e.id,f,async()=>{await e.exists(f)&&await e.read(f)===r&&await e.remove(f)})},async()=>{const r=await S(e);await C(e,M(r,m(t.destPath),s))},{owner:e.id}))}const Y=y({key:l().regex(/^[^:]+:.+$/,'An asset key must be "source:id"'),dest:l().min(1),sha256:l().regex(/^[a-f0-9]{64}$/,"A pack entry must pin the sha256 of its bytes as 64 lowercase hex digits")}).strict(),q=y({packs:E(l().min(1),L(Y))}).strict();function V(e){return q.parse(e)}function Z(e){const t=[],s=new Map;for(const[r,a]of Object.entries(e.packs))for(const n of a){const i=s.get(n.dest);if(i!==void 0)throw new Error(`Two packs declare the same destination "${n.dest}": "${i}" and "${r}".`);s.set(n.dest,r),t.push({...n,pack:r})}return t}const w="asset-manifest.json",v="https://vgai-asset-library.aaron-0ed.workers.dev";function P(e){return(e.baseUrl??v).replace(/\/+$/,"")}function Q(e){return e.signal?{signal:e.signal}:{}}async function X(e,t={}){const s=P(t),r=await fetch(`${s}/v1/assets/${encodeURIComponent(e)}`,Q(t));if(!r.ok)return null;const a=await r.json();return!a||typeof a!="object"||!Array.isArray(a.files)?null:a}function ee(e,t,s,r){return`${P(e?{baseUrl:e}:{})}/v1/assets/${encodeURIComponent(t)}/files/${s}`}async function we(e,t={}){const s=await te(e),r={declared:s.length,materialized:[],alreadyPresent:[],failed:[]};if(s.length===0)return r;const a=await S(e);for(const n of s){if(t.signal?.aborted)break;if(a[m(n.dest)]&&await e.exists(n.dest)){r.alreadyPresent.push(n),t.onProgress?.(n,"already-present");continue}try{await se(e,n,t),r.materialized.push(n),t.onProgress?.(n,"materialized")}catch(i){r.failed.push({entry:n,reason:i instanceof Error?i.message:String(i)}),t.onProgress?.(n,"failed")}}return r}async function te(e){if(!await e.exists(w))return[];const t=await e.read(w);let s;try{s=JSON.parse(t)}catch(r){throw new Error(`${w} is not valid JSON: ${r instanceof Error?r.message:String(r)}`)}return Z(V(s))}async function se(e,t,s){const r=await re(t,s);await e.write(t.dest,r.bytes),await G(e,{destPath:t.dest,key:t.key,license:r.license,sourceSha256:t.sha256})}async function re(e,t={}){const s=e.key.indexOf(":");if(s<0)throw new Error(`Malformed asset key "${e.key}" (expected "source:id").`);const r=e.key.slice(0,s),a=e.key.slice(s+1);if(r!=="local")throw new Error(`Asset key "${e.key}": only the "local" (cloud-hosted) source can be materialized from the cloud worker.`);const n=t.baseUrl??v,i=t.signal?{baseUrl:n,signal:t.signal}:{baseUrl:n},u=await X(a,i);if(!u)throw new Error(`"${e.key}" is not hosted by the cloud asset library.`);const o=u.files[0];if(!o)throw new Error(`"${e.key}" has no files in the cloud library.`);if(o.dependencies.length>0)throw new Error(`"${e.key}" has ${o.dependencies.length} dependency file(s) — a pack entry names exactly one destination file.`);if(o.main.sha256!==e.sha256)throw new Error(`"${e.key}" → ${e.dest}: the cloud library reports sha256:${o.main.sha256} but ${w} pins sha256:${e.sha256}. Nothing was fetched or written; the pin is only re-cut by a reviewed change to the declaration.`);const c=ee(n,a,0),h=await fetch(c,t.signal?{signal:t.signal}:{});if(!h.ok)throw new Error(`${c} returned ${h.status} ${h.statusText}.`);const g=new Uint8Array(await h.arrayBuffer()),p=await T(g);if(p!==e.sha256)throw new Error(`"${e.key}" → ${e.dest}: ${c} delivered sha256:${p} but the declaration pins sha256:${e.sha256}. Nothing was written.`);return{bytes:g,license:u.license}}export{w as ASSET_MANIFEST_PATH,re as fetchVerifiedPackEntry,we as materializeDeclaredAssetPacks};
|