@zephyr3d/editor 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +143 -0
  2. package/dist/assets/{index-BaUzUcND.js → index-IISR7uQv.js} +1 -1
  3. package/dist/assistant/zephyr-types-index.json +1 -1
  4. package/dist/index.html +2 -2
  5. package/dist/modules/zephyr3d_backend-webgpu.js.map +1 -1
  6. package/dist/modules/zephyr3d_imgui.js +3 -3
  7. package/dist/modules/zephyr3d_imgui.js.map +1 -1
  8. package/dist/modules/zephyr3d_scene.js +1439 -1439
  9. package/dist/modules/zephyr3d_scene.js.map +1 -1
  10. package/dist/vendor/zephyr3d/backend-webgpu/dist/bindgroup_webgpu.js.map +1 -1
  11. package/dist/vendor/zephyr3d/backend-webgpu/dist/buffer_webgpu.js.map +1 -1
  12. package/dist/vendor/zephyr3d/backend-webgpu/dist/commandqueue.js.map +1 -1
  13. package/dist/vendor/zephyr3d/backend-webgpu/dist/uploadringbuffer.js.map +1 -1
  14. package/dist/vendor/zephyr3d/imgui/dist/imgui_impl.js.map +1 -1
  15. package/dist/vendor/zephyr3d/imgui/dist/renderer.js +3 -3
  16. package/dist/vendor/zephyr3d/imgui/dist/renderer.js.map +1 -1
  17. package/dist/vendor/zephyr3d/scene/dist/animation/animationset.js +135 -135
  18. package/dist/vendor/zephyr3d/scene/dist/animation/animationset.js.map +1 -1
  19. package/dist/vendor/zephyr3d/scene/dist/animation/joint_dynamics/controller.js +146 -146
  20. package/dist/vendor/zephyr3d/scene/dist/animation/joint_dynamics/controller.js.map +1 -1
  21. package/dist/vendor/zephyr3d/scene/dist/animation/spring/spring_system.js +75 -75
  22. package/dist/vendor/zephyr3d/scene/dist/animation/spring/spring_system.js.map +1 -1
  23. package/dist/vendor/zephyr3d/scene/dist/camera/camera.js +184 -184
  24. package/dist/vendor/zephyr3d/scene/dist/camera/camera.js.map +1 -1
  25. package/dist/vendor/zephyr3d/scene/dist/material/material.js +288 -288
  26. package/dist/vendor/zephyr3d/scene/dist/material/material.js.map +1 -1
  27. package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/history_resource_manager.js +93 -93
  28. package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/history_resource_manager.js.map +1 -1
  29. package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/history_resources.js +3 -3
  30. package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/history_resources.js.map +1 -1
  31. package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/types.js +22 -22
  32. package/dist/vendor/zephyr3d/scene/dist/render/rendergraph/types.js.map +1 -1
  33. package/dist/vendor/zephyr3d/scene/dist/utility/blueprint/material/ir.js +489 -489
  34. package/dist/vendor/zephyr3d/scene/dist/utility/blueprint/material/ir.js.map +1 -1
  35. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/animation.js.map +1 -1
  36. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/camera.js.map +1 -1
  37. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/common.js.map +1 -1
  38. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/light.js.map +1 -1
  39. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/material.js.map +1 -1
  40. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/mesh.js.map +1 -1
  41. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/node.js.map +1 -1
  42. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/particle.js.map +1 -1
  43. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/primitive.js.map +1 -1
  44. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/scene.js.map +1 -1
  45. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/terrain.js.map +1 -1
  46. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/types.js +4 -4
  47. package/dist/vendor/zephyr3d/scene/dist/utility/serialization/types.js.map +1 -1
  48. package/package.json +1 -1
@@ -292,25 +292,25 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
292
292
  dstClip.addTrack(remap.dstNode, track);
293
293
  }
294
294
  }
295
- /**
296
- * Animation set
297
- *
298
- * Manages a collection of named animation clips for a model and orchestrates:
299
- * - Playback state (time, loops, speed, weights, fade-in/out).
300
- * - Blending across multiple tracks targeting the same property via weighted averages.
301
- * - Skeleton usage and application for clips that drive skeletal animation.
302
- * - Active track registration and cleanup as clips start/stop.
303
- *
304
- * Usage:
305
- * - Create or retrieve `AnimationClip`s by name.
306
- * - Start playback with `playAnimation(name, options)`.
307
- * - Advance animation with `update(deltaSeconds)`.
308
- * - Optionally adjust weight while playing with `setAnimationWeight(name, weight)`.
309
- *
310
- * Lifetime:
311
- * - Disposing the set releases references to the model, clips, and clears active state.
312
- *
313
- * @public
295
+ /**
296
+ * Animation set
297
+ *
298
+ * Manages a collection of named animation clips for a model and orchestrates:
299
+ * - Playback state (time, loops, speed, weights, fade-in/out).
300
+ * - Blending across multiple tracks targeting the same property via weighted averages.
301
+ * - Skeleton usage and application for clips that drive skeletal animation.
302
+ * - Active track registration and cleanup as clips start/stop.
303
+ *
304
+ * Usage:
305
+ * - Create or retrieve `AnimationClip`s by name.
306
+ * - Start playback with `playAnimation(name, options)`.
307
+ * - Advance animation with `update(deltaSeconds)`.
308
+ * - Optionally adjust weight while playing with `setAnimationWeight(name, weight)`.
309
+ *
310
+ * Lifetime:
311
+ * - Disposing the set releases references to the model, clips, and clears active state.
312
+ *
313
+ * @public
314
314
  */ class AnimationSet extends Disposable {
315
315
  /** @internal */ _model;
316
316
  /** @internal */ _animations;
@@ -318,10 +318,10 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
318
318
  /** @internal */ _activeTracks;
319
319
  /** @internal */ _activeSkeletons;
320
320
  /** @internal */ _activeAnimations;
321
- /**
322
- * Create an AnimationSet controlling the provided model.
323
- *
324
- * @param model - The SceneNode (model root) controlled by this animation set.
321
+ /**
322
+ * Create an AnimationSet controlling the provided model.
323
+ *
324
+ * @param model - The SceneNode (model root) controlled by this animation set.
325
325
  */ constructor(model){
326
326
  super();
327
327
  this._model = model;
@@ -331,35 +331,35 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
331
331
  this._activeAnimations = new Map();
332
332
  this._skeletons = [];
333
333
  }
334
- /**
335
- * The model (SceneNode) controlled by this animation set.
334
+ /**
335
+ * The model (SceneNode) controlled by this animation set.
336
336
  */ get model() {
337
337
  return this._model;
338
338
  }
339
- /**
340
- * Number of animation clips registered in this set.
339
+ /**
340
+ * Number of animation clips registered in this set.
341
341
  */ get numAnimations() {
342
342
  return Object.getOwnPropertyNames(this._animations).length;
343
343
  }
344
- /**
345
- * The skeletons used by animations in this set.
344
+ /**
345
+ * The skeletons used by animations in this set.
346
346
  */ get skeletons() {
347
347
  return this._skeletons;
348
348
  }
349
- /**
350
- * Retrieve an animation clip by name.
351
- *
352
- * @param name - Name of the animation.
353
- * @returns The clip if present; otherwise null.
349
+ /**
350
+ * Retrieve an animation clip by name.
351
+ *
352
+ * @param name - Name of the animation.
353
+ * @returns The clip if present; otherwise null.
354
354
  */ get(name) {
355
355
  return this._animations[name] ?? null;
356
356
  }
357
- /**
358
- * Create and register a new animation clip.
359
- *
360
- * @param name - Unique name for the animation clip.
361
- * @param embedded - Whether the clip is embedded/owned (implementation-specific). Default false.
362
- * @returns The created clip, or null if the name is empty or not unique.
357
+ /**
358
+ * Create and register a new animation clip.
359
+ *
360
+ * @param name - Unique name for the animation clip.
361
+ * @param embedded - Whether the clip is embedded/owned (implementation-specific). Default false.
362
+ * @returns The created clip, or null if the name is empty or not unique.
363
363
  */ createAnimation(name, embedded = false) {
364
364
  if (!name || this._animations[name]) {
365
365
  console.error('Animation must have unique name');
@@ -371,12 +371,12 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
371
371
  return animation;
372
372
  }
373
373
  }
374
- /**
375
- * Delete and dispose an animation clip by name.
376
- *
377
- * - If the animation is currently playing, it is first stopped (immediately).
378
- *
379
- * @param name - Name of the animation to remove.
374
+ /**
375
+ * Delete and dispose an animation clip by name.
376
+ *
377
+ * - If the animation is currently playing, it is first stopped (immediately).
378
+ *
379
+ * @param name - Name of the animation to remove.
380
380
  */ deleteAnimation(name) {
381
381
  const animation = this._animations[name];
382
382
  if (animation) {
@@ -385,24 +385,24 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
385
385
  animation.dispose();
386
386
  }
387
387
  }
388
- /**
389
- * Get the list of all registered animation names.
390
- *
391
- * @returns An array of clip names.
388
+ /**
389
+ * Get the list of all registered animation names.
390
+ *
391
+ * @returns An array of clip names.
392
392
  */ getAnimationNames() {
393
393
  return Object.keys(this._animations);
394
394
  }
395
- /**
396
- * Advance and apply active animations.
397
- *
398
- * Responsibilities per call:
399
- * - Update time cursor for each active clip (respecting speedRatio and looping).
400
- * - Enforce repeat limits and apply fade-out termination if configured.
401
- * - For each animated target, blend active tracks (weighted by clip weight × fade-in × fade-out)
402
- * and apply the resulting state to the target.
403
- * - Apply all active skeletons to update skinning transforms.
404
- *
405
- * @param deltaInSeconds - Time step in seconds since last update.
395
+ /**
396
+ * Advance and apply active animations.
397
+ *
398
+ * Responsibilities per call:
399
+ * - Update time cursor for each active clip (respecting speedRatio and looping).
400
+ * - Enforce repeat limits and apply fade-out termination if configured.
401
+ * - For each animated target, blend active tracks (weighted by clip weight × fade-in × fade-out)
402
+ * and apply the resulting state to the target.
403
+ * - Apply all active skeletons to update skinning transforms.
404
+ *
405
+ * @param deltaInSeconds - Time step in seconds since last update.
406
406
  */ update(deltaInSeconds) {
407
407
  this._activeAnimations.forEach((v, k)=>{
408
408
  if (v.fadeOut > 0 && v.fadeOutStart < 0) {
@@ -464,11 +464,11 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
464
464
  v.get()?.apply(deltaInSeconds);
465
465
  });
466
466
  }
467
- /**
468
- * Check whether an animation is currently playing.
469
- *
470
- * @param name - Optional animation name. If omitted, returns true if any animation is playing.
471
- * @returns True if playing; otherwise false.
467
+ /**
468
+ * Check whether an animation is currently playing.
469
+ *
470
+ * @param name - Optional animation name. If omitted, returns true if any animation is playing.
471
+ * @returns True if playing; otherwise false.
472
472
  */ isPlayingAnimation(name) {
473
473
  if (name) {
474
474
  const animation = this._animations[name];
@@ -476,23 +476,23 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
476
476
  }
477
477
  return this._activeAnimations.size > 0;
478
478
  }
479
- /**
480
- * Get an animation clip by name.
481
- *
482
- * Alias of `get(name)` returning a nullable type.
483
- *
484
- * @param name - Name of the animation.
485
- * @returns The clip if present; otherwise null.
479
+ /**
480
+ * Get an animation clip by name.
481
+ *
482
+ * Alias of `get(name)` returning a nullable type.
483
+ *
484
+ * @param name - Name of the animation.
485
+ * @returns The clip if present; otherwise null.
486
486
  */ getAnimationClip(name) {
487
487
  return this._animations[name] ?? null;
488
488
  }
489
- /**
490
- * Set the runtime blend weight for a currently playing animation.
491
- *
492
- * Has no effect if the clip is not active.
493
- *
494
- * @param name - Name of the playing animation.
495
- * @param weight - New weight value used during blending.
489
+ /**
490
+ * Set the runtime blend weight for a currently playing animation.
491
+ *
492
+ * Has no effect if the clip is not active.
493
+ *
494
+ * @param name - Name of the playing animation.
495
+ * @param weight - New weight value used during blending.
496
496
  */ setAnimationWeight(name, weight) {
497
497
  const ani = this._animations[name];
498
498
  if (!ani) {
@@ -504,16 +504,16 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
504
504
  info.weight = weight;
505
505
  }
506
506
  }
507
- /**
508
- * Start (or update) playback of an animation clip.
509
- *
510
- * Behavior:
511
- * - If the clip is already playing, updates its fade-in (resets fade-out).
512
- * - Otherwise initializes playback state (repeat counter, speed, weight, initial time).
513
- * - Registers clip tracks and skeletons into the active sets for blending and application.
514
- *
515
- * @param name - Name of the animation to play.
516
- * @param options - Playback options (repeat, speedRatio, fadeIn).
507
+ /**
508
+ * Start (or update) playback of an animation clip.
509
+ *
510
+ * Behavior:
511
+ * - If the clip is already playing, updates its fade-in (resets fade-out).
512
+ * - Otherwise initializes playback state (repeat counter, speed, weight, initial time).
513
+ * - Registers clip tracks and skeletons into the active sets for blending and application.
514
+ *
515
+ * @param name - Name of the animation to play.
516
+ * @param options - Playback options (repeat, speedRatio, fadeIn).
517
517
  */ playAnimation(name, options) {
518
518
  const ani = this._animations[name];
519
519
  if (!ani) {
@@ -571,18 +571,18 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
571
571
  });
572
572
  }
573
573
  }
574
- /**
575
- * Stop playback of an animation clip.
576
- *
577
- * Behavior:
578
- * - If `options.fadeOut > 0`, marks the clip for fade-out; actual removal occurs after fade completes.
579
- * - If `fadeOut` is 0 or omitted, immediately:
580
- * - Removes the clip from active animations.
581
- * - Unregisters its tracks from active track maps.
582
- * - Decrements skeleton reference counts; resets and removes skeletons when refcount reaches 0.
583
- *
584
- * @param name - Name of the animation to stop.
585
- * @param options - Optional fade-out configuration.
574
+ /**
575
+ * Stop playback of an animation clip.
576
+ *
577
+ * Behavior:
578
+ * - If `options.fadeOut > 0`, marks the clip for fade-out; actual removal occurs after fade completes.
579
+ * - If `fadeOut` is 0 or omitted, immediately:
580
+ * - Removes the clip from active animations.
581
+ * - Unregisters its tracks from active track maps.
582
+ * - Decrements skeleton reference counts; resets and removes skeletons when refcount reaches 0.
583
+ *
584
+ * @param name - Name of the animation to stop.
585
+ * @param options - Optional fade-out configuration.
586
586
  */ stopAnimation(name, options) {
587
587
  const ani = this._animations[name];
588
588
  if (!ani) {
@@ -617,18 +617,18 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
617
617
  }
618
618
  }
619
619
  }
620
- /**
621
- * Copy a humanoid animation clip from another AnimationSet into this one via humanoid rig mapping.
622
- *
623
- * Prerequisites:
624
- * - Both source and destination skeletons must have a non-null `humanoidJointMapping`.
625
- * - Joints are matched by shared `HumanoidBodyRig` / `HumanoidHandRig` keys instead of joint names.
626
- * - The source clip must exist in `sourceSet` and must be driven by exactly one skeleton.
627
- *
628
- * @param sourceSet - The AnimationSet to copy from.
629
- * @param animationName - Name of the clip to copy.
630
- * @param targetName - Name for the new clip in this set. Defaults to `animationName`.
631
- * @returns The newly created AnimationClip, or null on failure.
620
+ /**
621
+ * Copy a humanoid animation clip from another AnimationSet into this one via humanoid rig mapping.
622
+ *
623
+ * Prerequisites:
624
+ * - Both source and destination skeletons must have a non-null `humanoidJointMapping`.
625
+ * - Joints are matched by shared `HumanoidBodyRig` / `HumanoidHandRig` keys instead of joint names.
626
+ * - The source clip must exist in `sourceSet` and must be driven by exactly one skeleton.
627
+ *
628
+ * @param sourceSet - The AnimationSet to copy from.
629
+ * @param animationName - Name of the clip to copy.
630
+ * @param targetName - Name for the new clip in this set. Defaults to `animationName`.
631
+ * @returns The newly created AnimationClip, or null on failure.
632
632
  */ copyHumanoidAnimationFrom(sourceSet, animationName, targetName) {
633
633
  const destName = targetName ?? animationName;
634
634
  const sourceClip = sourceSet.get(animationName);
@@ -796,21 +796,21 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
796
796
  }
797
797
  return dstClip;
798
798
  }
799
- /**
800
- * Copy an animation clip from another AnimationSet into this one.
801
- *
802
- * Prerequisites:
803
- * - Both sets must reference skeletons with identical joint names and counts.
804
- * - The source clip must exist in `sourceSet`.
805
- *
806
- * @param sourceSet - The AnimationSet to copy from.
807
- * @param animationName - Name of the clip to copy.
808
- * @param targetName - Name for the new clip in this set. Defaults to `animationName`.
809
- * @param excludeJoint - Optional predicate; joints whose name returns true are excluded from
810
- * skeleton structure matching.
811
- * @returns The newly created AnimationClip, or null on failure.
812
- *
813
- * @deprecated Use the new {@link AnimationSet.copyHumanoidAnimationFrom} method instead.
799
+ /**
800
+ * Copy an animation clip from another AnimationSet into this one.
801
+ *
802
+ * Prerequisites:
803
+ * - Both sets must reference skeletons with identical joint names and counts.
804
+ * - The source clip must exist in `sourceSet`.
805
+ *
806
+ * @param sourceSet - The AnimationSet to copy from.
807
+ * @param animationName - Name of the clip to copy.
808
+ * @param targetName - Name for the new clip in this set. Defaults to `animationName`.
809
+ * @param excludeJoint - Optional predicate; joints whose name returns true are excluded from
810
+ * skeleton structure matching.
811
+ * @returns The newly created AnimationClip, or null on failure.
812
+ *
813
+ * @deprecated Use the new {@link AnimationSet.copyHumanoidAnimationFrom} method instead.
814
814
  */ copyAnimationFrom(sourceSet, animationName, targetName, excludeJoint) {
815
815
  const destName = targetName ?? animationName;
816
816
  const sourceClip = sourceSet.get(animationName);
@@ -960,12 +960,12 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
960
960
  return ordered;
961
961
  }
962
962
  }
963
- /**
964
- * Dispose the animation set and release owned resources.
965
- *
966
- * - Disposes the weak reference to the model.
967
- * - Disposes all registered animation clips.
968
- * - Clears active animations, tracks, and skeleton references.
963
+ /**
964
+ * Dispose the animation set and release owned resources.
965
+ *
966
+ * - Disposes the weak reference to the model.
967
+ * - Disposes all registered animation clips.
968
+ * - Clears active animations, tracks, and skeleton references.
969
969
  */ onDispose() {
970
970
  super.onDispose();
971
971
  for(const k in this._animations){