@babylonjs/inspector 5.12.0 → 5.13.1

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.
@@ -63005,7 +63005,8 @@ class ParticleSystemPropertyGridComponent extends react__WEBPACK_IMPORTED_MODULE
63005
63005
  this.props.globalState.onSelectionChangedObservable.notifyObservers(null);
63006
63006
  system.dispose();
63007
63007
  } })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(shared_ui_components_lines_lineContainerComponent__WEBPACK_IMPORTED_MODULE_2__.LineContainerComponent, Object.assign({ title: "FILE", selection: this.props.globalState }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_fileButtonLineComponent__WEBPACK_IMPORTED_MODULE_21__.FileButtonLineComponent, { label: "Load", onClick: (file) => this.loadFromFile(file), accept: ".json" }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_buttonLineComponent__WEBPACK_IMPORTED_MODULE_6__.ButtonLineComponent, { label: "Save", onClick: () => this.saveToFile() })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(shared_ui_components_lines_lineContainerComponent__WEBPACK_IMPORTED_MODULE_2__.LineContainerComponent, Object.assign({ title: "SNIPPET", selection: this.props.globalState }, { children: [system.snippetId && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_textLineComponent__WEBPACK_IMPORTED_MODULE_3__.TextLineComponent, { label: "Snippet ID", value: system.snippetId }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_buttonLineComponent__WEBPACK_IMPORTED_MODULE_6__.ButtonLineComponent, { label: "Load from snippet server", onClick: () => this.loadFromSnippet() }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_buttonLineComponent__WEBPACK_IMPORTED_MODULE_6__.ButtonLineComponent, { label: "Save to snippet server", onClick: () => this.saveToSnippet() })] })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(shared_ui_components_lines_lineContainerComponent__WEBPACK_IMPORTED_MODULE_2__.LineContainerComponent, Object.assign({ title: "EMITTER", closed: true, selection: this.props.globalState }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_optionsLineComponent__WEBPACK_IMPORTED_MODULE_8__.OptionsLineComponent, { label: "Emitter", options: emitterOptions, target: system, propertyName: "emitter", noDirectUpdate: true, onSelect: (value) => {
63008
- switch (value) {
63008
+ const valueAsNumber = value;
63009
+ switch (valueAsNumber) {
63009
63010
  case -1:
63010
63011
  this.raiseOnPropertyChanged("emitter", null, system.emitter);
63011
63012
  system.emitter = null;
@@ -63015,8 +63016,8 @@ class ParticleSystemPropertyGridComponent extends react__WEBPACK_IMPORTED_MODULE
63015
63016
  system.emitter = core_Particles_particleSystem__WEBPACK_IMPORTED_MODULE_9__.Vector3.Zero();
63016
63017
  break;
63017
63018
  default:
63018
- this.raiseOnPropertyChanged("emitter", meshEmitters[value - 1], system.emitter);
63019
- system.emitter = meshEmitters[value - 1];
63019
+ this.raiseOnPropertyChanged("emitter", meshEmitters[valueAsNumber - 1], system.emitter);
63020
+ system.emitter = meshEmitters[valueAsNumber - 1];
63020
63021
  }
63021
63022
  this.forceUpdate();
63022
63023
  }, extractValue: () => {
@@ -63032,8 +63033,9 @@ class ParticleSystemPropertyGridComponent extends react__WEBPACK_IMPORTED_MODULE
63032
63033
  }
63033
63034
  return -1;
63034
63035
  } }), system.emitter && system.emitter.x === undefined && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_textLineComponent__WEBPACK_IMPORTED_MODULE_3__.TextLineComponent, { label: "Link to emitter", value: system.emitter.name, onLink: () => this.props.globalState.onSelectionChangedObservable.notifyObservers(system.emitter) })), system.emitter && system.emitter.x !== undefined && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_vector3LineComponent__WEBPACK_IMPORTED_MODULE_10__.Vector3LineComponent, { label: "Position", target: system, propertyName: "emitter", onPropertyChangedObservable: this.props.onPropertyChangedObservable })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_optionsLineComponent__WEBPACK_IMPORTED_MODULE_8__.OptionsLineComponent, { label: "Type", options: particleEmitterTypeOptions, target: system, propertyName: "particleEmitterType", noDirectUpdate: true, onSelect: (value) => {
63036
+ const valueAsNumber = value;
63035
63037
  const currentType = system.particleEmitterType;
63036
- switch (value) {
63038
+ switch (valueAsNumber) {
63037
63039
  case 0:
63038
63040
  system.particleEmitterType = new core_Particles_particleSystem__WEBPACK_IMPORTED_MODULE_9__.BoxParticleEmitter();
63039
63041
  break;
@@ -64196,11 +64198,12 @@ class VariantsPropertyGridComponent extends react__WEBPACK_IMPORTED_MODULE_1__.C
64196
64198
  });
64197
64199
  options.splice(0, 0, { label: "Original", value: 0 });
64198
64200
  return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_lineContainerComponent__WEBPACK_IMPORTED_MODULE_2__.LineContainerComponent, Object.assign({ title: "VARIANTS", selection: this.props.globalState }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_optionsLineComponent__WEBPACK_IMPORTED_MODULE_3__.OptionsLineComponent, { label: "Active variant", options: options, noDirectUpdate: true, target: this.props.host, propertyName: "", onSelect: (value) => {
64199
- if (value === 0) {
64201
+ const valueAsNumber = value;
64202
+ if (valueAsNumber === 0) {
64200
64203
  extension.reset(this.props.host);
64201
64204
  }
64202
64205
  else {
64203
- extension.selectVariant(this.props.host, variants[value - 1]);
64206
+ extension.selectVariant(this.props.host, variants[valueAsNumber - 1]);
64204
64207
  }
64205
64208
  this.forceUpdate();
64206
64209
  }, extractValue: () => {
@@ -69758,7 +69761,7 @@ class ButtonLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
69758
69761
  super(props);
69759
69762
  }
69760
69763
  render() {
69761
- return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", Object.assign({ className: "buttonLine" }, { children: [this.props.icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, className: "icon" }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("button", Object.assign({ onClick: () => this.props.onClick() }, { children: this.props.label }))] })));
69764
+ return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", Object.assign({ className: "buttonLine" + (this.props.isDisabled ? " disabled" : "") }, { children: [this.props.icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, className: "icon" }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("button", Object.assign({ onClick: () => this.props.onClick() }, { children: this.props.label }))] })));
69762
69765
  }
69763
69766
  }
69764
69767
 
@@ -70909,7 +70912,7 @@ class OptionsLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
70909
70912
  constructor(props) {
70910
70913
  super(props);
70911
70914
  this._localChange = false;
70912
- this.state = { value: this._remapValueIn(this.props.extractValue ? this.props.extractValue() : props.target[props.propertyName]) };
70915
+ this.state = { value: this._remapValueIn(this._getValue(props)) };
70913
70916
  }
70914
70917
  _remapValueIn(value) {
70915
70918
  return this.props.allowNullValue && value === null ? Null_Value : value;
@@ -70917,12 +70920,18 @@ class OptionsLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
70917
70920
  _remapValueOut(value) {
70918
70921
  return this.props.allowNullValue && value === Null_Value ? null : value;
70919
70922
  }
70923
+ _getValue(props) {
70924
+ if (props.extractValue) {
70925
+ return props.extractValue(props.target);
70926
+ }
70927
+ return props.target && props.propertyName ? props.target[props.propertyName] : props.options[props.defaultIfNull || 0];
70928
+ }
70920
70929
  shouldComponentUpdate(nextProps, nextState) {
70921
70930
  if (this._localChange) {
70922
70931
  this._localChange = false;
70923
70932
  return true;
70924
70933
  }
70925
- const newValue = this._remapValueIn(nextProps.extractValue ? nextProps.extractValue() : nextProps.target[nextProps.propertyName]);
70934
+ const newValue = this._remapValueIn(nextProps.extractValue ? nextProps.extractValue(this.props.target) : nextProps.target[nextProps.propertyName]);
70926
70935
  if (newValue != null && newValue !== nextState.value) {
70927
70936
  nextState.value = newValue;
70928
70937
  return true;
@@ -70941,10 +70950,13 @@ class OptionsLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
70941
70950
  allowNullValue: this.props.allowNullValue,
70942
70951
  });
70943
70952
  }
70953
+ setValue(value) {
70954
+ this.setState({ value: value });
70955
+ }
70944
70956
  updateValue(valueString) {
70945
- const value = parseInt(valueString);
70957
+ const value = this.props.valuesAreStrings ? valueString : parseInt(valueString);
70946
70958
  this._localChange = true;
70947
- const store = this.props.extractValue ? this.props.extractValue() : this.props.target[this.props.propertyName];
70959
+ const store = this.props.extractValue ? this.props.extractValue(this.props.target) : this.props.target[this.props.propertyName];
70948
70960
  if (!this.props.noDirectUpdate) {
70949
70961
  this.props.target[this.props.propertyName] = this._remapValueOut(value);
70950
70962
  }
@@ -70952,12 +70964,12 @@ class OptionsLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
70952
70964
  if (this.props.onSelect) {
70953
70965
  this.props.onSelect(value);
70954
70966
  }
70955
- const newValue = this.props.extractValue ? this.props.extractValue() : this.props.target[this.props.propertyName];
70967
+ const newValue = this.props.extractValue ? this.props.extractValue(this.props.target) : this.props.target[this.props.propertyName];
70956
70968
  this.raiseOnPropertyChanged(newValue, store);
70957
70969
  }
70958
70970
  render() {
70959
70971
  var _a;
70960
- return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", Object.assign({ className: "listLine" }, { children: [this.props.icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, color: "black", className: "icon" }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", Object.assign({ className: "label", title: this.props.label }, { children: this.props.label })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", Object.assign({ className: "options" }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("select", Object.assign({ onChange: (evt) => this.updateValue(evt.target.value), value: (_a = this.state.value) !== null && _a !== void 0 ? _a : "" }, { children: this.props.options.map((option, i) => {
70972
+ return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", Object.assign({ className: "listLine" + (this.props.className ? " " + this.props.className : "") }, { children: [this.props.icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, color: "black", className: "icon" }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", Object.assign({ className: "label", title: this.props.label }, { children: this.props.label })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", Object.assign({ className: "options" }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("select", Object.assign({ onChange: (evt) => this.updateValue(evt.target.value), value: (_a = this.state.value) !== null && _a !== void 0 ? _a : "" }, { children: this.props.options.map((option, i) => {
70961
70973
  return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("option", Object.assign({ selected: option.selected, value: option.value, title: option.label }, { children: option.label }), option.label + i));
70962
70974
  }) })) }))] })));
70963
70975
  }
@@ -71281,6 +71293,11 @@ class TextInputLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Componen
71281
71293
  }
71282
71294
  this._localChange = true;
71283
71295
  const store = this.props.value !== undefined ? this.props.value : this.props.target[this.props.propertyName];
71296
+ if (this.props.validator) {
71297
+ if (this.props.validator(value) == false) {
71298
+ value = store;
71299
+ }
71300
+ }
71284
71301
  this.setState({ value: value });
71285
71302
  if (this.props.propertyName && !this.props.delayInput) {
71286
71303
  this.props.target[this.props.propertyName] = value;
@@ -71314,7 +71331,21 @@ class TextInputLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Componen
71314
71331
  const value = this.state.value === _targetsProxy__WEBPACK_IMPORTED_MODULE_2__.conflictingValuesPlaceholder ? "" : this.state.value;
71315
71332
  const placeholder = this.state.value === _targetsProxy__WEBPACK_IMPORTED_MODULE_2__.conflictingValuesPlaceholder ? _targetsProxy__WEBPACK_IMPORTED_MODULE_2__.conflictingValuesPlaceholder : this.props.placeholder || "";
71316
71333
  const step = this.props.step || (this.props.roundValues ? 1 : 0.01);
71317
- return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", Object.assign({ className: this.props.unit !== undefined ? "textInputLine withUnits" : "textInputLine" }, { children: [this.props.icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, color: "black", className: "icon" }), this.props.label !== undefined && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", Object.assign({ className: "label", title: this.props.label }, { children: this.props.label }))), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", Object.assign({ className: `value${this.props.noUnderline === true ? " noUnderline" : ""}${this.props.arrows ? " hasArrows" : ""}${this.state.dragging ? " dragging" : ""}` }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input", { value: value, onBlur: () => {
71334
+ return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", Object.assign({ className: this.props.multilines ? "textInputArea" : this.props.unit !== undefined ? "textInputLine withUnits" : "textInputLine" }, { children: [this.props.icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, color: "black", className: "icon" }), this.props.label !== undefined && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", Object.assign({ className: "label", title: this.props.label }, { children: this.props.label }))), this.props.multilines && ((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__.jsx)("textarea", { value: this.state.value, onFocus: () => {
71335
+ if (this.props.lockObject) {
71336
+ this.props.lockObject.lock = true;
71337
+ }
71338
+ }, onChange: (evt) => this.updateValue(evt.target.value), onKeyDown: (evt) => {
71339
+ if (evt.keyCode !== 13) {
71340
+ return;
71341
+ }
71342
+ this.updateValue(this.state.value);
71343
+ }, onBlur: (evt) => {
71344
+ this.updateValue(evt.target.value);
71345
+ if (this.props.lockObject) {
71346
+ this.props.lockObject.lock = false;
71347
+ }
71348
+ } }) })), !this.props.multilines && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", Object.assign({ className: `value${this.props.noUnderline === true ? " noUnderline" : ""}${this.props.arrows ? " hasArrows" : ""}${this.state.dragging ? " dragging" : ""}` }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input", { value: value, onBlur: () => {
71318
71349
  if (this.props.lockObject) {
71319
71350
  this.props.lockObject.lock = false;
71320
71351
  }
@@ -71323,7 +71354,7 @@ class TextInputLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Componen
71323
71354
  if (this.props.lockObject) {
71324
71355
  this.props.lockObject.lock = true;
71325
71356
  }
71326
- }, onChange: (evt) => this.updateValue(evt.target.value), onKeyDown: (evt) => this.onKeyDown(evt), placeholder: placeholder, type: this.props.numeric ? "number" : "text", step: step }), this.props.arrows && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_inputArrowsComponent__WEBPACK_IMPORTED_MODULE_3__.InputArrowsComponent, { incrementValue: (amount) => this.incrementValue(amount), setDragging: (dragging) => this.setState({ dragging }) })] })), this.props.unit] })));
71357
+ }, onChange: (evt) => this.updateValue(evt.target.value), onKeyDown: (evt) => this.onKeyDown(evt), placeholder: placeholder, type: this.props.numeric ? "number" : "text", step: step }), this.props.arrows && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_inputArrowsComponent__WEBPACK_IMPORTED_MODULE_3__.InputArrowsComponent, { incrementValue: (amount) => this.incrementValue(amount), setDragging: (dragging) => this.setState({ dragging }) }))] }))), this.props.unit] })));
71327
71358
  }
71328
71359
  }
71329
71360
 
@@ -71614,7 +71645,7 @@ class Vector4LineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
71614
71645
  this.state = { isExpanded: false, value: this.getCurrentValue().clone() };
71615
71646
  }
71616
71647
  getCurrentValue() {
71617
- return this.props.target[this.props.propertyName];
71648
+ return this.props.value || this.props.target[this.props.propertyName];
71618
71649
  }
71619
71650
  shouldComponentUpdate(nextProps, nextState) {
71620
71651
  const nextPropsValue = this.getCurrentValue();
@@ -71638,14 +71669,19 @@ class Vector4LineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
71638
71669
  }
71639
71670
  this.props.onPropertyChangedObservable.notifyObservers({
71640
71671
  object: this.props.target,
71641
- property: this.props.propertyName,
71672
+ property: this.props.propertyName || "",
71642
71673
  value: this.state.value,
71643
71674
  initialValue: previousValue,
71644
71675
  });
71645
71676
  }
71646
71677
  updateVector4() {
71647
- const store = this.props.target[this.props.propertyName].clone();
71648
- this.props.target[this.props.propertyName] = this.state.value;
71678
+ const store = this.getCurrentValue().clone();
71679
+ if (this.props.value) {
71680
+ this.props.value.copyFrom(this.state.value);
71681
+ }
71682
+ else {
71683
+ this.props.target[this.props.propertyName] = this.state.value;
71684
+ }
71649
71685
  this.setState({ value: store });
71650
71686
  this.raiseOnPropertyChanged(store);
71651
71687
  }