@xeokit/xeokit-sdk 2.6.20 → 2.6.22

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.
@@ -99457,7 +99457,11 @@ class PropertySet {
99457
99457
  const properties = params.properties;
99458
99458
  for (let i = 0, len = properties.length; i < len; i++) {
99459
99459
  const property = properties[i];
99460
- this.properties.push(new Property(property.name, property.value, property.type, property.valueType, property.description));
99460
+ if (Number.isInteger(property)) { // Will decompress in MetaModel.finalize();
99461
+ this.properties.push(property);
99462
+ } else {
99463
+ this.properties.push(new Property(property.name, property.value, property.type, property.valueType, property.description));
99464
+ }
99461
99465
  }
99462
99466
  }
99463
99467
  }
@@ -99821,6 +99825,8 @@ class MetaModel {
99821
99825
 
99822
99826
  this.metaScene.metaModels[this.id] = this;
99823
99827
 
99828
+ this._propertyLookup = [];
99829
+
99824
99830
  /**
99825
99831
  * True when this MetaModel has been finalized.
99826
99832
  * @type {boolean}
@@ -99835,7 +99841,7 @@ class MetaModel {
99835
99841
  * @type {MetaObject|null}
99836
99842
  */
99837
99843
  get rootMetaObject() {
99838
- if (this.rootMetaObjects.length == 1) {
99844
+ if (this.rootMetaObjects.length === 1) {
99839
99845
  return this.rootMetaObjects[0];
99840
99846
  }
99841
99847
  return null;
@@ -99856,6 +99862,12 @@ class MetaModel {
99856
99862
  const metaScene = this.metaScene;
99857
99863
  const propertyLookup = metaModelData.properties;
99858
99864
 
99865
+ if (propertyLookup) {
99866
+ for (let i = 0, len = propertyLookup.length; i < len; i++) {
99867
+ this._propertyLookup.push(propertyLookup[i]);
99868
+ }
99869
+ }
99870
+
99859
99871
  // Create global Property Sets
99860
99872
 
99861
99873
  if (metaModelData.propertySets) {
@@ -99866,9 +99878,6 @@ class MetaModel {
99866
99878
  }
99867
99879
  let propertySet = metaScene.propertySets[propertySetData.id];
99868
99880
  if (!propertySet) {
99869
- if (propertyLookup) {
99870
- this._decompressProperties(propertyLookup, propertySetData.properties);
99871
- }
99872
99881
  propertySet = new PropertySet({
99873
99882
  id: propertySetData.id,
99874
99883
  originalSystemId: propertySetData.originalSystemId || propertySetData.id,
@@ -99915,15 +99924,21 @@ class MetaModel {
99915
99924
  }
99916
99925
 
99917
99926
  _decompressProperties(propertyLookup, properties) {
99927
+ const propsNotFound = [];
99918
99928
  for (let i = 0, len = properties.length; i < len; i++) {
99919
99929
  const property = properties[i];
99920
99930
  if (Number.isInteger(property)) {
99921
99931
  const lookupProperty = propertyLookup[property];
99922
99932
  if (lookupProperty) {
99923
99933
  properties[i] = lookupProperty;
99934
+ } else {
99935
+ propsNotFound.push(property);
99924
99936
  }
99925
99937
  }
99926
99938
  }
99939
+ if (propsNotFound.length > 0) {
99940
+ console.error(`[MetaModel._decompressProperties] Properties not found: ${propsNotFound}`);
99941
+ }
99927
99942
  }
99928
99943
 
99929
99944
  finalize() {
@@ -99991,6 +100006,18 @@ class MetaModel {
99991
100006
  (metaScene.metaObjectsByType[type] || (metaScene.metaObjectsByType[type] = {}))[objectId] = metaObject;
99992
100007
  }
99993
100008
 
100009
+ // Decompress properties
100010
+
100011
+ if (this.propertySets) {
100012
+ for (let i = 0, len = this.propertySets.length; i < len; i++) {
100013
+ const propertySet = this.propertySets[i];
100014
+ this._decompressProperties(this._propertyLookup, propertySet.properties);
100015
+ }
100016
+ }
100017
+
100018
+
100019
+ this._propertyLookup = [];
100020
+
99994
100021
  this.finalized = true;
99995
100022
 
99996
100023
  this.metaScene.fire("metaModelCreated", this.id);
@@ -99453,7 +99453,11 @@ class PropertySet {
99453
99453
  const properties = params.properties;
99454
99454
  for (let i = 0, len = properties.length; i < len; i++) {
99455
99455
  const property = properties[i];
99456
- this.properties.push(new Property(property.name, property.value, property.type, property.valueType, property.description));
99456
+ if (Number.isInteger(property)) { // Will decompress in MetaModel.finalize();
99457
+ this.properties.push(property);
99458
+ } else {
99459
+ this.properties.push(new Property(property.name, property.value, property.type, property.valueType, property.description));
99460
+ }
99457
99461
  }
99458
99462
  }
99459
99463
  }
@@ -99817,6 +99821,8 @@ class MetaModel {
99817
99821
 
99818
99822
  this.metaScene.metaModels[this.id] = this;
99819
99823
 
99824
+ this._propertyLookup = [];
99825
+
99820
99826
  /**
99821
99827
  * True when this MetaModel has been finalized.
99822
99828
  * @type {boolean}
@@ -99831,7 +99837,7 @@ class MetaModel {
99831
99837
  * @type {MetaObject|null}
99832
99838
  */
99833
99839
  get rootMetaObject() {
99834
- if (this.rootMetaObjects.length == 1) {
99840
+ if (this.rootMetaObjects.length === 1) {
99835
99841
  return this.rootMetaObjects[0];
99836
99842
  }
99837
99843
  return null;
@@ -99852,6 +99858,12 @@ class MetaModel {
99852
99858
  const metaScene = this.metaScene;
99853
99859
  const propertyLookup = metaModelData.properties;
99854
99860
 
99861
+ if (propertyLookup) {
99862
+ for (let i = 0, len = propertyLookup.length; i < len; i++) {
99863
+ this._propertyLookup.push(propertyLookup[i]);
99864
+ }
99865
+ }
99866
+
99855
99867
  // Create global Property Sets
99856
99868
 
99857
99869
  if (metaModelData.propertySets) {
@@ -99862,9 +99874,6 @@ class MetaModel {
99862
99874
  }
99863
99875
  let propertySet = metaScene.propertySets[propertySetData.id];
99864
99876
  if (!propertySet) {
99865
- if (propertyLookup) {
99866
- this._decompressProperties(propertyLookup, propertySetData.properties);
99867
- }
99868
99877
  propertySet = new PropertySet({
99869
99878
  id: propertySetData.id,
99870
99879
  originalSystemId: propertySetData.originalSystemId || propertySetData.id,
@@ -99911,15 +99920,21 @@ class MetaModel {
99911
99920
  }
99912
99921
 
99913
99922
  _decompressProperties(propertyLookup, properties) {
99923
+ const propsNotFound = [];
99914
99924
  for (let i = 0, len = properties.length; i < len; i++) {
99915
99925
  const property = properties[i];
99916
99926
  if (Number.isInteger(property)) {
99917
99927
  const lookupProperty = propertyLookup[property];
99918
99928
  if (lookupProperty) {
99919
99929
  properties[i] = lookupProperty;
99930
+ } else {
99931
+ propsNotFound.push(property);
99920
99932
  }
99921
99933
  }
99922
99934
  }
99935
+ if (propsNotFound.length > 0) {
99936
+ console.error(`[MetaModel._decompressProperties] Properties not found: ${propsNotFound}`);
99937
+ }
99923
99938
  }
99924
99939
 
99925
99940
  finalize() {
@@ -99987,6 +100002,18 @@ class MetaModel {
99987
100002
  (metaScene.metaObjectsByType[type] || (metaScene.metaObjectsByType[type] = {}))[objectId] = metaObject;
99988
100003
  }
99989
100004
 
100005
+ // Decompress properties
100006
+
100007
+ if (this.propertySets) {
100008
+ for (let i = 0, len = this.propertySets.length; i < len; i++) {
100009
+ const propertySet = this.propertySets[i];
100010
+ this._decompressProperties(this._propertyLookup, propertySet.properties);
100011
+ }
100012
+ }
100013
+
100014
+
100015
+ this._propertyLookup = [];
100016
+
99990
100017
  this.finalized = true;
99991
100018
 
99992
100019
  this.metaScene.fire("metaModelCreated", this.id);