babylonjs-node-editor 5.35.0 → 5.36.0

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.
@@ -63387,6 +63387,7 @@ __webpack_require__.r(__webpack_exports__);
63387
63387
 
63388
63388
 
63389
63389
 
63390
+ let throttleTimerId = -1;
63390
63391
  class TextInputLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
63391
63392
  constructor(props) {
63392
63393
  super(props);
@@ -63482,7 +63483,17 @@ class TextInputLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Componen
63482
63483
  if (this.props.propertyName && !this.props.delayInput) {
63483
63484
  this.props.target[this.props.propertyName] = value;
63484
63485
  }
63485
- this.raiseOnPropertyChanged(value, store);
63486
+ if (this.props.throttlePropertyChangedNotification) {
63487
+ if (throttleTimerId >= 0) {
63488
+ window.clearTimeout(throttleTimerId);
63489
+ }
63490
+ throttleTimerId = window.setTimeout(() => {
63491
+ this.raiseOnPropertyChanged(value, store);
63492
+ }, this.props.throttlePropertyChangedNotificationDelay ?? 200);
63493
+ }
63494
+ else {
63495
+ this.raiseOnPropertyChanged(value, store);
63496
+ }
63486
63497
  }
63487
63498
  incrementValue(amount) {
63488
63499
  if (this.props.step) {
@@ -68961,13 +68972,13 @@ __webpack_require__.r(__webpack_exports__);
68961
68972
 
68962
68973
 
68963
68974
 
68975
+ const dontSerializeTextureContent = true;
68964
68976
  class PreviewManager {
68965
68977
  constructor(targetCanvas, globalState) {
68966
68978
  this._nodeMaterial = globalState.nodeMaterial;
68967
68979
  this._globalState = globalState;
68968
- this._onBuildObserver = this._nodeMaterial.onBuildObservable.add((nodeMaterial) => {
68969
- const serializationObject = nodeMaterial.serialize();
68970
- this._updatePreview(serializationObject);
68980
+ this._onBuildObserver = this._nodeMaterial.onBuildObservable.add(() => {
68981
+ this._updatePreview();
68971
68982
  });
68972
68983
  this._onPreviewCommandActivatedObserver = globalState.onPreviewCommandActivated.add((forceRefresh) => {
68973
68984
  if (forceRefresh) {
@@ -68980,8 +68991,7 @@ class PreviewManager {
68980
68991
  this._prepareLights();
68981
68992
  });
68982
68993
  this._onUpdateRequiredObserver = globalState.stateManager.onUpdateRequiredObservable.add(() => {
68983
- const serializationObject = this._nodeMaterial.serialize();
68984
- this._updatePreview(serializationObject);
68994
+ this._updatePreview();
68985
68995
  });
68986
68996
  this._onPreviewBackgroundChangedObserver = globalState.onPreviewBackgroundChanged.add(() => {
68987
68997
  this._scene.clearColor = this._globalState.backgroundColor;
@@ -69032,6 +69042,39 @@ class PreviewManager {
69032
69042
  lastOffsetX = evt.event.offsetX;
69033
69043
  });
69034
69044
  }
69045
+ _serializeMaterial() {
69046
+ const nodeMaterial = this._nodeMaterial;
69047
+ let fullSerialization = false;
69048
+ if (dontSerializeTextureContent) {
69049
+ const textureBlocks = nodeMaterial.getAllTextureBlocks();
69050
+ for (const block of textureBlocks) {
69051
+ const texture = block.texture;
69052
+ if (!texture || block.hasImageSource) {
69053
+ continue;
69054
+ }
69055
+ let found = false;
69056
+ for (const localTexture of this._engine.getLoadedTexturesCache()) {
69057
+ if (localTexture.uniqueId === texture._texture?.uniqueId) {
69058
+ found = true;
69059
+ break;
69060
+ }
69061
+ }
69062
+ if (!found) {
69063
+ fullSerialization = true;
69064
+ break;
69065
+ }
69066
+ }
69067
+ }
69068
+ const bufferSerializationState = core_Materials_Node_nodeMaterial__WEBPACK_IMPORTED_MODULE_0__.Texture.SerializeBuffers;
69069
+ if (dontSerializeTextureContent) {
69070
+ core_Materials_Node_nodeMaterial__WEBPACK_IMPORTED_MODULE_0__.Texture.SerializeBuffers = fullSerialization;
69071
+ core_Materials_Node_nodeMaterial__WEBPACK_IMPORTED_MODULE_0__.Texture._SerializeInternalTextureUniqueId = true;
69072
+ }
69073
+ const serializationObject = nodeMaterial.serialize();
69074
+ core_Materials_Node_nodeMaterial__WEBPACK_IMPORTED_MODULE_0__.Texture.SerializeBuffers = bufferSerializationState;
69075
+ core_Materials_Node_nodeMaterial__WEBPACK_IMPORTED_MODULE_0__.Texture._SerializeInternalTextureUniqueId = false;
69076
+ return serializationObject;
69077
+ }
69035
69078
  _handleAnimations() {
69036
69079
  this._scene.stopAllAnimations();
69037
69080
  if (this._globalState.rotatePreview) {
@@ -69111,8 +69154,7 @@ class PreviewManager {
69111
69154
  }
69112
69155
  }
69113
69156
  // Material
69114
- const serializationObject = this._nodeMaterial.serialize();
69115
- this._updatePreview(serializationObject);
69157
+ this._updatePreview();
69116
69158
  }
69117
69159
  _refreshPreviewMesh() {
69118
69160
  if (this._currentType !== this._globalState.previewType || this._currentType === _previewType__WEBPACK_IMPORTED_MODULE_1__.PreviewType.Custom) {
@@ -69279,16 +69321,16 @@ class PreviewManager {
69279
69321
  this._prepareScene();
69280
69322
  }
69281
69323
  else {
69282
- const serializationObject = this._nodeMaterial.serialize();
69283
- this._updatePreview(serializationObject);
69324
+ this._updatePreview();
69284
69325
  }
69285
69326
  });
69286
69327
  }
69287
69328
  _forceCompilationAsync(material, mesh) {
69288
69329
  return material.forceCompilationAsync(mesh);
69289
69330
  }
69290
- _updatePreview(serializationObject) {
69331
+ _updatePreview() {
69291
69332
  try {
69333
+ const serializationObject = this._serializeMaterial();
69292
69334
  const store = core_Materials_Node_nodeMaterial__WEBPACK_IMPORTED_MODULE_0__.NodeMaterial.IgnoreTexturesAtLoadTime;
69293
69335
  core_Materials_Node_nodeMaterial__WEBPACK_IMPORTED_MODULE_0__.NodeMaterial.IgnoreTexturesAtLoadTime = false;
69294
69336
  const tempMaterial = core_Materials_Node_nodeMaterial__WEBPACK_IMPORTED_MODULE_0__.NodeMaterial.Parse(serializationObject, this._scene);
@@ -69315,7 +69357,7 @@ class PreviewManager {
69315
69357
  });
69316
69358
  }
69317
69359
  if (this._material) {
69318
- this._material.dispose(false, true);
69360
+ this._material.dispose();
69319
69361
  }
69320
69362
  this._material = tempMaterial;
69321
69363
  break;
@@ -69324,7 +69366,7 @@ class PreviewManager {
69324
69366
  this._globalState.onIsLoadingChanged.notifyObservers(false);
69325
69367
  this._proceduralTexture = tempMaterial.createProceduralTexture(512, this._scene);
69326
69368
  if (this._material) {
69327
- this._material.dispose(false, true);
69369
+ this._material.dispose();
69328
69370
  }
69329
69371
  if (this._layer) {
69330
69372
  this._layer.texture = this._proceduralTexture;
@@ -69343,7 +69385,7 @@ class PreviewManager {
69343
69385
  tempMaterial.createEffectForParticles(this._particleSystem);
69344
69386
  this._particleSystem.blendMode = this._globalState.particleSystemBlendMode;
69345
69387
  if (this._material) {
69346
- this._material.dispose(false, true);
69388
+ this._material.dispose();
69347
69389
  }
69348
69390
  this._material = tempMaterial;
69349
69391
  break;
@@ -69357,7 +69399,7 @@ class PreviewManager {
69357
69399
  mesh.material = tempMaterial;
69358
69400
  }
69359
69401
  if (this._material) {
69360
- this._material.dispose(false, true);
69402
+ this._material.dispose();
69361
69403
  }
69362
69404
  this._material = tempMaterial;
69363
69405
  this._globalState.onIsLoadingChanged.notifyObservers(false);
@@ -72023,7 +72065,7 @@ class GeneralPropertyTabComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Com
72023
72065
  { label: "Fragment", value: core_Materials_Node_nodeMaterialDecorator__WEBPACK_IMPORTED_MODULE_4__.NodeMaterialBlockTargets.Fragment },
72024
72066
  ];
72025
72067
  const block = this.props.nodeData.data;
72026
- return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_2__.LineContainerComponent, { title: "GENERAL", children: [(!block.isInput || !block.isAttribute) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_textInputLineComponent__WEBPACK_IMPORTED_MODULE_5__.TextInputLineComponent, { label: "Name", propertyName: "name", target: block, lockObject: this.props.stateManager.lockObject, onChange: () => this.props.stateManager.onUpdateRequiredObservable.notifyObservers(block), validator: (newName) => {
72068
+ return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_2__.LineContainerComponent, { title: "GENERAL", children: [(!block.isInput || !block.isAttribute) && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_textInputLineComponent__WEBPACK_IMPORTED_MODULE_5__.TextInputLineComponent, { label: "Name", propertyName: "name", target: block, lockObject: this.props.stateManager.lockObject, onChange: () => this.props.stateManager.onUpdateRequiredObservable.notifyObservers(block), throttlePropertyChangedNotification: true, validator: (newName) => {
72027
72069
  if (!block.validateBlockName(newName)) {
72028
72070
  this.props.stateManager.onErrorMessageDialogRequiredObservable.notifyObservers(`"${newName}" is a reserved name, please choose another`);
72029
72071
  return false;
@@ -72033,7 +72075,7 @@ class GeneralPropertyTabComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Com
72033
72075
  this.forceUpdate();
72034
72076
  this.props.stateManager.onUpdateRequiredObservable.notifyObservers(block);
72035
72077
  this.props.stateManager.onRebuildRequiredObservable.notifyObservers(true);
72036
- } })), !block._originalTargetIsNeutral && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_textLineComponent__WEBPACK_IMPORTED_MODULE_8__.TextLineComponent, { label: "Target", value: core_Materials_Node_nodeMaterialDecorator__WEBPACK_IMPORTED_MODULE_4__.NodeMaterialBlockTargets[block.target] }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_textLineComponent__WEBPACK_IMPORTED_MODULE_8__.TextLineComponent, { label: "Type", value: block.getClassName() }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_textInputLineComponent__WEBPACK_IMPORTED_MODULE_5__.TextInputLineComponent, { label: "Comments", propertyName: "comments", lockObject: this.props.stateManager.lockObject, target: block, onChange: () => this.props.stateManager.onUpdateRequiredObservable.notifyObservers(block) })] }) }));
72078
+ } })), !block._originalTargetIsNeutral && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_textLineComponent__WEBPACK_IMPORTED_MODULE_8__.TextLineComponent, { label: "Target", value: core_Materials_Node_nodeMaterialDecorator__WEBPACK_IMPORTED_MODULE_4__.NodeMaterialBlockTargets[block.target] }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_textLineComponent__WEBPACK_IMPORTED_MODULE_8__.TextLineComponent, { label: "Type", value: block.getClassName() }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_textInputLineComponent__WEBPACK_IMPORTED_MODULE_5__.TextInputLineComponent, { label: "Comments", propertyName: "comments", lockObject: this.props.stateManager.lockObject, target: block, onChange: () => this.props.stateManager.onUpdateRequiredObservable.notifyObservers(block), throttlePropertyChangedNotification: true })] }) }));
72037
72079
  }
72038
72080
  }
72039
72081
  class GenericPropertyTabComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
@@ -72696,7 +72738,7 @@ class InputPropertyTabComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Compo
72696
72738
  this.forceUpdate();
72697
72739
  this.props.stateManager.onUpdateRequiredObservable.notifyObservers(inputBlock);
72698
72740
  this.props.stateManager.onRebuildRequiredObservable.notifyObservers(true);
72699
- } })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_optionsLineComponent__WEBPACK_IMPORTED_MODULE_14__.OptionsLineComponent, { label: "Mode", options: modeOptions, target: inputBlock, noDirectUpdate: true, extractValue: (block) => {
72741
+ }, throttlePropertyChangedNotification: true })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_optionsLineComponent__WEBPACK_IMPORTED_MODULE_14__.OptionsLineComponent, { label: "Mode", options: modeOptions, target: inputBlock, noDirectUpdate: true, extractValue: (block) => {
72700
72742
  if (block.isAttribute) {
72701
72743
  return 1;
72702
72744
  }