@babylonjs/lite-compat 1.31.1-preview → 1.32.0-preview

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.
@@ -1390,6 +1390,31 @@ var Observable = class {
1390
1390
  }
1391
1391
  for (const observer of this._observers.slice()) if ((observer.mask & mask) !== 0) observer.callback(eventData);
1392
1392
  }
1393
+ /** @internal Notify every matching observer and capture the first thrown value. */
1394
+ _notifyObserversSafely(eventData, mask = -1) {
1395
+ if (this.notifyIfTriggered) {
1396
+ this._hasNotified = true;
1397
+ this._lastNotifiedValue = eventData;
1398
+ this._lastNotifiedMask = mask;
1399
+ }
1400
+ let hasError = false;
1401
+ let firstError;
1402
+ for (const observer of this._observers.slice()) {
1403
+ if ((observer.mask & mask) === 0) continue;
1404
+ try {
1405
+ observer.callback(eventData);
1406
+ } catch (error) {
1407
+ if (!hasError) {
1408
+ hasError = true;
1409
+ firstError = error;
1410
+ }
1411
+ }
1412
+ }
1413
+ return {
1414
+ hasError,
1415
+ error: firstError
1416
+ };
1417
+ }
1393
1418
  hasObservers() {
1394
1419
  return this._observers.length > 0;
1395
1420
  }
@@ -1551,15 +1576,49 @@ var Node = class {
1551
1576
  _disposeSelf(_doNotRecurse) {}
1552
1577
  /** @internal Dispose this compat wrapper tree in post-order. */
1553
1578
  _disposeWrapperTree(doNotRecurse = false) {
1579
+ this._disposeWrapperTreeInternal(doNotRecurse, true);
1580
+ }
1581
+ /**
1582
+ * @internal Retire a loader-owned wrapper without disposing its Lite node.
1583
+ * Asset-container teardown removes the native nodes as one ownership unit.
1584
+ */
1585
+ _disposeWrapperOnly() {
1586
+ this._disposeWrapperTreeInternal(true, false);
1587
+ }
1588
+ /** @internal Shared wrapper lifecycle for ordinary and container-owned disposal. */
1589
+ _disposeWrapperTreeInternal(doNotRecurse, disposeSelf) {
1554
1590
  if (this._disposed) return;
1555
1591
  if (doNotRecurse) for (const child of [...this._children]) child.parent = null;
1556
- else for (const child of [...this._children]) child._disposeWrapperTree();
1557
- this._disposeSelf(doNotRecurse);
1592
+ else for (const child of [...this._children]) child._disposeWrapperTreeInternal(false, disposeSelf);
1593
+ if (disposeSelf) this._disposeSelf(doNotRecurse);
1558
1594
  this._disposed = true;
1559
- this.onDisposeObservable.notifyObservers(this);
1560
- this.onDisposeObservable.clear();
1561
- this._linkParent(null);
1562
- this._scene?._unregisterNode(this);
1595
+ let hasError = false;
1596
+ let firstError;
1597
+ try {
1598
+ this.onDisposeObservable.notifyObservers(this);
1599
+ } catch (error) {
1600
+ hasError = true;
1601
+ firstError = error;
1602
+ } finally {
1603
+ this.onDisposeObservable.clear();
1604
+ }
1605
+ try {
1606
+ this._linkParent(null);
1607
+ } catch (error) {
1608
+ if (!hasError) {
1609
+ hasError = true;
1610
+ firstError = error;
1611
+ }
1612
+ }
1613
+ try {
1614
+ this._scene?._unregisterNode(this);
1615
+ } catch (error) {
1616
+ if (!hasError) {
1617
+ hasError = true;
1618
+ firstError = error;
1619
+ }
1620
+ }
1621
+ if (hasError) throw firstError;
1563
1622
  }
1564
1623
  /** @internal Hook for subclasses to wire the parent link into the Lite scene graph. */
1565
1624
  _applyParent(_parent) {}
@@ -3639,4 +3698,4 @@ function CreateTiledPlane(name, options, scene) {
3639
3698
  //#endregion
3640
3699
  export { PBRSpecularGlossinessMaterial as A, transformCoordinates as B, Material as C, PBRMaterial as D, PBRIridescenceConfiguration as E, Observable as F, liteBackedColor3 as G, Quaternion as H, BoundingBox as I, Vector4 as J, Vector2 as K, BoundingInfo as L, StandardMaterial as M, attachMaterialToScene as N, PBRMetallicRoughnessMaterial as O, Node as P, BoundingSphere as R, registerMeshAtStart as S, PBRClearCoatConfiguration as T, Color3 as U, transformNormal as V, Color4 as W, LiteCompatError as X, liteBackedVector3 as Y, unsupported as Z, Mesh as _, CreateDisc as a, VertexBuffer as b, CreateLines as c, CreateTiledBox as d, CreateTiledPlane as f, LinesMesh as g, InstancedMesh as h, CreateDashedLines as i, PushMaterial as j, PBRSheenConfiguration as k, CreatePlane as l, GroundMesh as m, CreateBox as n, CreateGround as o, CreateTorus as p, Vector3 as q, CreateCylinder as r, CreateLineSystem as s, AbstractMesh as t, CreateSphere as u, MeshBuilder as v, PBRAnisotropicConfiguration as w, VertexData as x, TransformNode as y, Matrix as z };
3641
3700
 
3642
- //# sourceMappingURL=meshes-Fu955h5M.js.map
3701
+ //# sourceMappingURL=meshes-Ds66ewr9.js.map