@onerjs/core 8.31.7 → 8.31.9

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.
@@ -1747,6 +1747,11 @@ export class NodeMaterial extends NodeMaterialBase {
1747
1747
  if (!merge) {
1748
1748
  this.clear();
1749
1749
  }
1750
+ const id = this.id;
1751
+ const uniqueId = this.uniqueId;
1752
+ SerializationHelper.ParseProperties(source, this, this.getScene(), rootUrl);
1753
+ this.id = id;
1754
+ this.uniqueId = uniqueId;
1750
1755
  const map = {};
1751
1756
  // Create blocks
1752
1757
  for (const parsedBlock of source.blocks) {
@@ -1813,9 +1818,6 @@ export class NodeMaterial extends NodeMaterialBase {
1813
1818
  }
1814
1819
  this.editorData.map = blockMap;
1815
1820
  }
1816
- if (source.forceAlphaBlending) {
1817
- this.forceAlphaBlending = true;
1818
- }
1819
1821
  Material.ParseAlphaMode(source, this);
1820
1822
  if (!merge) {
1821
1823
  this._mode = source.mode ?? NodeMaterialModes.Material;
@@ -1829,7 +1831,6 @@ export class NodeMaterial extends NodeMaterialBase {
1829
1831
  * @deprecated Please use the parseSerializedObject method instead
1830
1832
  */
1831
1833
  loadFromSerialization(source, rootUrl = "", merge = false) {
1832
- SerializationHelper.ParseProperties(source, this, this.getScene(), rootUrl);
1833
1834
  this.parseSerializedObject(source, rootUrl, merge);
1834
1835
  }
1835
1836
  /**
@@ -1841,9 +1842,9 @@ export class NodeMaterial extends NodeMaterialBase {
1841
1842
  clone(name, shareEffect = false) {
1842
1843
  const serializationObject = this.serialize();
1843
1844
  const clone = SerializationHelper.Clone(() => new NodeMaterial(name, this.getScene(), this.options), this);
1845
+ clone.parseSerializedObject(serializationObject);
1844
1846
  clone.id = name;
1845
1847
  clone.name = name;
1846
- clone.parseSerializedObject(serializationObject);
1847
1848
  clone._buildId = this._buildId;
1848
1849
  clone.build(false, !shareEffect);
1849
1850
  return clone;
@@ -1901,9 +1902,11 @@ export class NodeMaterial extends NodeMaterialBase {
1901
1902
  */
1902
1903
  static async ParseFromFileAsync(name, url, scene, rootUrl = "", skipBuild = false, targetMaterial, urlRewriter, options) {
1903
1904
  const material = targetMaterial ?? new NodeMaterial(name, scene, options);
1905
+ const finalName = material.name;
1904
1906
  const data = await scene._loadFileAsync(url);
1905
1907
  const serializationObject = JSON.parse(data);
1906
1908
  material.parseSerializedObject(serializationObject, rootUrl, undefined, urlRewriter);
1909
+ material.name = finalName; // in case it was changed during parse
1907
1910
  if (!skipBuild) {
1908
1911
  material.build();
1909
1912
  }