@2112-lab/central-plant 0.3.39 → 0.3.41

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.
@@ -37772,6 +37772,21 @@ function applyModelRootTranslation(mesh, modelRoot, origLocalPos, modelOffset) {
37772
37772
  mesh.position.copy(newWorldPos);
37773
37773
  }
37774
37774
 
37775
+ /**
37776
+ * Apply a model-root-space translation from a cached rest world position (preview).
37777
+ *
37778
+ * @param {THREE.Object3D} mesh
37779
+ * @param {THREE.Object3D} modelRoot
37780
+ * @param {THREE.Vector3} baseWorldPos
37781
+ * @param {{ x?: number, y?: number, z?: number }} modelOffset
37782
+ */
37783
+ function applyModelRootTranslationFromWorldBase(mesh, modelRoot, baseWorldPos, modelOffset) {
37784
+ if (!mesh || !modelRoot || !baseWorldPos) return;
37785
+ var newWorldPos = baseWorldPos.clone().add(modelOffsetToWorldDelta(modelRoot, modelOffset));
37786
+ if (mesh.parent) mesh.parent.worldToLocal(newWorldPos);
37787
+ mesh.position.copy(newWorldPos);
37788
+ }
37789
+
37775
37790
  var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
37776
37791
  function IoBehaviorManager(sceneViewer) {
37777
37792
  var _this;
@@ -40651,7 +40666,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
40651
40666
  * Initialize the CentralPlant manager
40652
40667
  *
40653
40668
  * @constructor
40654
- * @version 0.3.39
40669
+ * @version 0.3.41
40655
40670
  * @updated 2025-10-22
40656
40671
  *
40657
40672
  * @description Creates a new CentralPlant instance and initializes internal managers and utilities.
@@ -49329,6 +49344,8 @@ exports.SceneTooltipsManager = SceneTooltipsManager;
49329
49344
  exports.SnapshotManager = SnapshotManager;
49330
49345
  exports.ThreeJSResourceManager = ThreeJSResourceManager;
49331
49346
  exports.applyCrossComponentBehaviors = applyCrossComponentBehaviors;
49347
+ exports.applyModelRootTranslation = applyModelRootTranslation;
49348
+ exports.applyModelRootTranslationFromWorldBase = applyModelRootTranslationFromWorldBase;
49332
49349
  exports.buildCrossBehavior = buildCrossBehavior;
49333
49350
  exports.buildIntraBehavior = buildIntraBehavior;
49334
49351
  exports.cacheJsonData = cacheJsonData;
@@ -49376,6 +49393,7 @@ exports.loadTextureSetAndCreateMaterial = loadTextureSetAndCreateMaterial;
49376
49393
  exports.markAsComputed = markAsComputed;
49377
49394
  exports.markAsDeclared = markAsDeclared;
49378
49395
  exports.measureS3Transfer = measureS3Transfer;
49396
+ exports.modelOffsetToWorldDelta = modelOffsetToWorldDelta;
49379
49397
  exports.modelPreloader = modelPreloader;
49380
49398
  exports.normalizeBehavior = normalizeBehavior;
49381
49399
  exports.parseCrossBehavior = parseCrossBehavior;
@@ -37,7 +37,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
37
37
  * Initialize the CentralPlant manager
38
38
  *
39
39
  * @constructor
40
- * @version 0.3.39
40
+ * @version 0.3.41
41
41
  * @updated 2025-10-22
42
42
  *
43
43
  * @description Creates a new CentralPlant instance and initializes internal managers and utilities.
@@ -18,6 +18,7 @@ var behaviorSchema = require('./utils/behaviorSchema.js');
18
18
  var behaviorRegistration = require('./utils/behaviorRegistration.js');
19
19
  var behaviorDispatch = require('./utils/behaviorDispatch.js');
20
20
  var behaviorSceneUtils = require('./utils/behaviorSceneUtils.js');
21
+ var animationTransformUtils = require('./utils/animationTransformUtils.js');
21
22
  var componentManager = require('./managers/components/componentManager.js');
22
23
  var animationManager = require('./managers/scene/animationManager.js');
23
24
  var pathfindingManager = require('./managers/pathfinding/pathfindingManager.js');
@@ -87,6 +88,9 @@ exports.loadCrossComponentBehaviors = behaviorSceneUtils.loadCrossComponentBehav
87
88
  exports.refreshSceneIntraBehaviors = behaviorSceneUtils.refreshSceneIntraBehaviors;
88
89
  exports.reregisterSceneBehaviors = behaviorSceneUtils.reregisterSceneBehaviors;
89
90
  exports.scanSceneIoEndpoints = behaviorSceneUtils.scanSceneIoEndpoints;
91
+ exports.applyModelRootTranslation = animationTransformUtils.applyModelRootTranslation;
92
+ exports.applyModelRootTranslationFromWorldBase = animationTransformUtils.applyModelRootTranslationFromWorldBase;
93
+ exports.modelOffsetToWorldDelta = animationTransformUtils.modelOffsetToWorldDelta;
90
94
  exports.ComponentManager = componentManager.ComponentManager;
91
95
  exports.AnimationManager = animationManager.AnimationManager;
92
96
  exports.PathfindingManager = pathfindingManager.PathfindingManager;
@@ -62,5 +62,21 @@ function applyModelRootTranslation(mesh, modelRoot, origLocalPos, modelOffset) {
62
62
  mesh.position.copy(newWorldPos);
63
63
  }
64
64
 
65
+ /**
66
+ * Apply a model-root-space translation from a cached rest world position (preview).
67
+ *
68
+ * @param {THREE.Object3D} mesh
69
+ * @param {THREE.Object3D} modelRoot
70
+ * @param {THREE.Vector3} baseWorldPos
71
+ * @param {{ x?: number, y?: number, z?: number }} modelOffset
72
+ */
73
+ function applyModelRootTranslationFromWorldBase(mesh, modelRoot, baseWorldPos, modelOffset) {
74
+ if (!mesh || !modelRoot || !baseWorldPos) return;
75
+ var newWorldPos = baseWorldPos.clone().add(modelOffsetToWorldDelta(modelRoot, modelOffset));
76
+ if (mesh.parent) mesh.parent.worldToLocal(newWorldPos);
77
+ mesh.position.copy(newWorldPos);
78
+ }
79
+
65
80
  exports.applyModelRootTranslation = applyModelRootTranslation;
81
+ exports.applyModelRootTranslationFromWorldBase = applyModelRootTranslationFromWorldBase;
66
82
  exports.modelOffsetToWorldDelta = modelOffsetToWorldDelta;
@@ -33,7 +33,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
33
33
  * Initialize the CentralPlant manager
34
34
  *
35
35
  * @constructor
36
- * @version 0.3.39
36
+ * @version 0.3.41
37
37
  * @updated 2025-10-22
38
38
  *
39
39
  * @description Creates a new CentralPlant instance and initializes internal managers and utilities.
@@ -14,6 +14,7 @@ export { buildCrossBehavior, buildIntraBehavior, normalizeBehavior, parseCrossBe
14
14
  export { registerBehaviorsForComponent, reloadBehaviorsForDeviceAsset } from './utils/behaviorRegistration.js';
15
15
  export { getIoBehaviorManager, getScopedAttachmentKey, resolveDataPoints } from './utils/behaviorDispatch.js';
16
16
  export { applyCrossComponentBehaviors, loadCrossComponentBehaviors, refreshSceneIntraBehaviors, reregisterSceneBehaviors, scanSceneIoEndpoints } from './utils/behaviorSceneUtils.js';
17
+ export { applyModelRootTranslation, applyModelRootTranslationFromWorldBase, modelOffsetToWorldDelta } from './utils/animationTransformUtils.js';
17
18
  export { ComponentManager } from './managers/components/componentManager.js';
18
19
  export { AnimationManager } from './managers/scene/animationManager.js';
19
20
  export { PathfindingManager } from './managers/pathfinding/pathfindingManager.js';
@@ -38,4 +38,19 @@ function applyModelRootTranslation(mesh, modelRoot, origLocalPos, modelOffset) {
38
38
  mesh.position.copy(newWorldPos);
39
39
  }
40
40
 
41
- export { applyModelRootTranslation, modelOffsetToWorldDelta };
41
+ /**
42
+ * Apply a model-root-space translation from a cached rest world position (preview).
43
+ *
44
+ * @param {THREE.Object3D} mesh
45
+ * @param {THREE.Object3D} modelRoot
46
+ * @param {THREE.Vector3} baseWorldPos
47
+ * @param {{ x?: number, y?: number, z?: number }} modelOffset
48
+ */
49
+ function applyModelRootTranslationFromWorldBase(mesh, modelRoot, baseWorldPos, modelOffset) {
50
+ if (!mesh || !modelRoot || !baseWorldPos) return;
51
+ var newWorldPos = baseWorldPos.clone().add(modelOffsetToWorldDelta(modelRoot, modelOffset));
52
+ if (mesh.parent) mesh.parent.worldToLocal(newWorldPos);
53
+ mesh.position.copy(newWorldPos);
54
+ }
55
+
56
+ export { applyModelRootTranslation, applyModelRootTranslationFromWorldBase, modelOffsetToWorldDelta };
package/dist/index.d.ts CHANGED
@@ -176,6 +176,23 @@ export declare function loadCrossComponentBehaviors(centralPlant: any): CrossCom
176
176
  export declare function refreshSceneIntraBehaviors(centralPlant: any, libraryId: string, behaviors: CrossComponentBehavior[]): void
177
177
  export declare function reregisterSceneBehaviors(centralPlant: any): void
178
178
 
179
+ export declare function modelOffsetToWorldDelta(
180
+ modelRoot: any,
181
+ offset: { x?: number; y?: number; z?: number } | { clone(): any }
182
+ ): any
183
+ export declare function applyModelRootTranslation(
184
+ mesh: any,
185
+ modelRoot: any,
186
+ origLocalPos: any,
187
+ modelOffset: { x?: number; y?: number; z?: number }
188
+ ): void
189
+ export declare function applyModelRootTranslationFromWorldBase(
190
+ mesh: any,
191
+ modelRoot: any,
192
+ baseWorldPos: any,
193
+ modelOffset: { x?: number; y?: number; z?: number }
194
+ ): void
195
+
179
196
  export declare class IoBehaviorManager {
180
197
  constructor(sceneViewer: any)
181
198
  loadBehaviors(attachmentId: string, behaviorConfig: BehaviorEntry[] | { behaviors: BehaviorEntry[] }, deviceModelRoot: any, parentUuid: string): void
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2112-lab/central-plant",
3
- "version": "0.3.39",
3
+ "version": "0.3.41",
4
4
  "description": "Utility modules for the Central Plant Application",
5
5
  "main": "dist/bundle/index.js",
6
6
  "module": "dist/esm/src/index.js",