@luminocity/lemonate-engine 26.5.1 → 26.5.3

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.
@@ -1,5 +1,5 @@
1
1
  import { Engine } from "./Engine";
2
- export type ShortcutListenerFunction = (event: KeyboardEvent) => void;
2
+ export type ShortcutListenerFunction = (event: KeyboardEvent) => void | Promise<void>;
3
3
  export type ShortcutListener = {
4
4
  func: ShortcutListenerFunction;
5
5
  targetObject: any;
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { parseVectorFormulaSet } from './subsystems/Ribbons';
7
7
  export * from './tools/DebugTools';
8
8
  export { Item, LodMode, ItemState } from './items/Item';
9
9
  export { Engine, WaitMode } from './Engine';
10
- export { Shortcuts } from './Shortcuts';
10
+ export { Shortcuts, ShortcutListener, ShortcutListenerFunction } from './Shortcuts';
11
11
  export { Player } from './Player';
12
12
  export { Renderer, MaxLayerCount, FrameBufferResult } from './Renderer';
13
13
  export { LoadingManager } from "./LoadingManager";
@@ -11390,7 +11390,7 @@ class Item extends EventEmitter {
11390
11390
  }
11391
11391
  }
11392
11392
 
11393
- var engine$1 = "26.5.1";
11393
+ var engine$1 = "26.5.3";
11394
11394
  var bullet = "3.26";
11395
11395
  var lua = "5.4.3";
11396
11396
  var packageVersionInfo = {
@@ -71206,7 +71206,9 @@ class SgItem extends SgResourceOwner {
71206
71206
  autoRecreate = true;
71207
71207
  // item nodes are nodes below an sgitem that are typically owned by the item and not editable.
71208
71208
  // they can be for example further on the fly sgitems, or internal mesh nodes.
71209
+ // The updated timestamp helps to determine if the subnodes need to be refreshed for example in the UI
71209
71210
  itemSubNodes = [];
71211
+ itemSubNodesUpdatedTs = 0;
71210
71212
  recreationMutex = new Mutex();
71211
71213
  container = new Group();
71212
71214
  boxHelper;
@@ -71297,6 +71299,12 @@ class SgItem extends SgResourceOwner {
71297
71299
  getItemSubNodes() {
71298
71300
  return this.itemSubNodes;
71299
71301
  }
71302
+ getItemSubNodesUpdatedTs() {
71303
+ return this.itemSubNodesUpdatedTs;
71304
+ }
71305
+ hasSubNodes() {
71306
+ return this.itemSubNodes.length > 0;
71307
+ }
71300
71308
  findSubNodeById(id, subNodes) {
71301
71309
  subNodes = subNodes ?? this.itemSubNodes;
71302
71310
  for (const subNode of subNodes) {
@@ -71322,9 +71330,12 @@ class SgItem extends SgResourceOwner {
71322
71330
  subNode.dispose();
71323
71331
  });
71324
71332
  this.itemSubNodes = [];
71333
+ this.itemSubNodesUpdatedTs = performance.now();
71325
71334
  }
71326
71335
  createItemSubNodesFromObject3D(obj) {
71327
71336
  this.itemSubNodes = [this._createItemSubNodesFromObject3D(obj, this.block.id, 0)];
71337
+ this.itemSubNodesUpdatedTs = performance.now();
71338
+ //console.log("Item subnodes refreshed.", this, this.itemSubNodes);
71328
71339
  this.updateChildSubnodeParenting();
71329
71340
  this.engine.eventBus.$emit('sgitem:itemNodesUpdated', this);
71330
71341
  }
@@ -99703,10 +99714,19 @@ class RtItem extends RtBase {
99703
99714
  return typeof (value) === 'object' && typeof (value.r) === 'number' && typeof (value.g) === 'number' && typeof (value.b) === 'number' && typeof (value.a) === 'number';
99704
99715
  }
99705
99716
  function isValidEnum(value, options) {
99706
- return typeof (value) === 'string' && options.includes(value);
99717
+ return typeof (value) === 'string' && options.find((option) => {
99718
+ if (typeof (option) === 'object')
99719
+ return option.value === value;
99720
+ return option === value;
99721
+ });
99707
99722
  }
99708
99723
  function isValidMultiEnum(value, options) {
99709
- return Array.isArray(value) && value.filter((x) => options.includes(x)).length === value.length;
99724
+ return Array.isArray(value) && value.filter((x) => isValidEnum(x, options)).length === value.length;
99725
+ }
99726
+ function getEnumOptionsString(options) {
99727
+ return options.reduce((previousValue, currentValue, currentIndex) => {
99728
+ return previousValue + (currentIndex === 0 ? '' : ', ') + (typeof (currentValue) === 'object' ? currentValue.value : currentValue);
99729
+ });
99710
99730
  }
99711
99731
  if (!field) {
99712
99732
  console.error(`Field ${name} not found!`);
@@ -99768,7 +99788,7 @@ class RtItem extends RtBase {
99768
99788
  }
99769
99789
  case "Enum": {
99770
99790
  if (!isValidEnum(value, field.options)) {
99771
- console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value is invalid.`);
99791
+ console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value '${value}' is invalid. Possible values: ${getEnumOptionsString(field.options)}`);
99772
99792
  return;
99773
99793
  }
99774
99794
  field.value = value;
@@ -99776,7 +99796,7 @@ class RtItem extends RtBase {
99776
99796
  }
99777
99797
  case "MultiEnum": {
99778
99798
  if (!isValidMultiEnum(value, field.options)) {
99779
- console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value is invalid.`);
99799
+ console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value '${value}' is invalid. Possible values: ${getEnumOptionsString(field.options)}`);
99780
99800
  return;
99781
99801
  }
99782
99802
  field.value = value;
@@ -100622,10 +100642,19 @@ class RtSceneObject extends RtBase {
100622
100642
  return typeof (value) === 'object' && typeof (value.r) === 'number' && typeof (value.g) === 'number' && typeof (value.b) === 'number' && typeof (value.a) === 'number';
100623
100643
  }
100624
100644
  function isValidEnum(value, options) {
100625
- return typeof (value) === 'string' && options.includes(value);
100645
+ return typeof (value) === 'string' && options.find((option) => {
100646
+ if (typeof (option) === 'object')
100647
+ return option.value === value;
100648
+ return option === value;
100649
+ });
100626
100650
  }
100627
100651
  function isValidMultiEnum(value, options) {
100628
- return Array.isArray(value) && value.filter((x) => options.includes(x)).length === value.length;
100652
+ return Array.isArray(value) && value.filter((x) => isValidEnum(x, options)).length === value.length;
100653
+ }
100654
+ function getEnumOptionsString(options) {
100655
+ return options.reduce((previousValue, currentValue, currentIndex) => {
100656
+ return previousValue + (currentIndex === 0 ? '' : ', ') + (typeof (currentValue) === 'object' ? currentValue.value : currentValue);
100657
+ });
100629
100658
  }
100630
100659
  if (!field) {
100631
100660
  console.error(`Field ${name} not found!`);
@@ -100686,7 +100715,7 @@ class RtSceneObject extends RtBase {
100686
100715
  }
100687
100716
  case "Enum": {
100688
100717
  if (!isValidEnum(value, field.options)) {
100689
- console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value is invalid.`);
100718
+ console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value '${value}' is invalid. Possible values: ${getEnumOptionsString(field.options)}`);
100690
100719
  return;
100691
100720
  }
100692
100721
  field.value = value;
@@ -100694,7 +100723,7 @@ class RtSceneObject extends RtBase {
100694
100723
  }
100695
100724
  case "MultiEnum": {
100696
100725
  if (!isValidMultiEnum(value, field.options)) {
100697
- console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value is invalid.`);
100726
+ console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value '${value}' is invalid. Possible values: ${getEnumOptionsString(field.options)}`);
100698
100727
  return;
100699
100728
  }
100700
100729
  field.value = value;
package/dist/lemonate.js CHANGED
@@ -88153,7 +88153,7 @@ void main() {
88153
88153
  }
88154
88154
  }
88155
88155
 
88156
- var engine$1 = "26.5.1";
88156
+ var engine$1 = "26.5.3";
88157
88157
  var bullet = "3.26";
88158
88158
  var lua = "5.4.3";
88159
88159
  var packageVersionInfo = {
@@ -208372,7 +208372,9 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
208372
208372
  autoRecreate = true;
208373
208373
  // item nodes are nodes below an sgitem that are typically owned by the item and not editable.
208374
208374
  // they can be for example further on the fly sgitems, or internal mesh nodes.
208375
+ // The updated timestamp helps to determine if the subnodes need to be refreshed for example in the UI
208375
208376
  itemSubNodes = [];
208377
+ itemSubNodesUpdatedTs = 0;
208376
208378
  recreationMutex = new Mutex();
208377
208379
  container = new Group();
208378
208380
  boxHelper;
@@ -208463,6 +208465,12 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
208463
208465
  getItemSubNodes() {
208464
208466
  return this.itemSubNodes;
208465
208467
  }
208468
+ getItemSubNodesUpdatedTs() {
208469
+ return this.itemSubNodesUpdatedTs;
208470
+ }
208471
+ hasSubNodes() {
208472
+ return this.itemSubNodes.length > 0;
208473
+ }
208466
208474
  findSubNodeById(id, subNodes) {
208467
208475
  subNodes = subNodes ?? this.itemSubNodes;
208468
208476
  for (const subNode of subNodes) {
@@ -208488,9 +208496,12 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
208488
208496
  subNode.dispose();
208489
208497
  });
208490
208498
  this.itemSubNodes = [];
208499
+ this.itemSubNodesUpdatedTs = performance.now();
208491
208500
  }
208492
208501
  createItemSubNodesFromObject3D(obj) {
208493
208502
  this.itemSubNodes = [this._createItemSubNodesFromObject3D(obj, this.block.id, 0)];
208503
+ this.itemSubNodesUpdatedTs = performance.now();
208504
+ //console.log("Item subnodes refreshed.", this, this.itemSubNodes);
208494
208505
  this.updateChildSubnodeParenting();
208495
208506
  this.engine.eventBus.$emit('sgitem:itemNodesUpdated', this);
208496
208507
  }
@@ -236869,10 +236880,19 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
236869
236880
  return typeof (value) === 'object' && typeof (value.r) === 'number' && typeof (value.g) === 'number' && typeof (value.b) === 'number' && typeof (value.a) === 'number';
236870
236881
  }
236871
236882
  function isValidEnum(value, options) {
236872
- return typeof (value) === 'string' && options.includes(value);
236883
+ return typeof (value) === 'string' && options.find((option) => {
236884
+ if (typeof (option) === 'object')
236885
+ return option.value === value;
236886
+ return option === value;
236887
+ });
236873
236888
  }
236874
236889
  function isValidMultiEnum(value, options) {
236875
- return Array.isArray(value) && value.filter((x) => options.includes(x)).length === value.length;
236890
+ return Array.isArray(value) && value.filter((x) => isValidEnum(x, options)).length === value.length;
236891
+ }
236892
+ function getEnumOptionsString(options) {
236893
+ return options.reduce((previousValue, currentValue, currentIndex) => {
236894
+ return previousValue + (currentIndex === 0 ? '' : ', ') + (typeof (currentValue) === 'object' ? currentValue.value : currentValue);
236895
+ });
236876
236896
  }
236877
236897
  if (!field) {
236878
236898
  console.error(`Field ${name} not found!`);
@@ -236934,7 +236954,7 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
236934
236954
  }
236935
236955
  case "Enum": {
236936
236956
  if (!isValidEnum(value, field.options)) {
236937
- console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value is invalid.`);
236957
+ console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value '${value}' is invalid. Possible values: ${getEnumOptionsString(field.options)}`);
236938
236958
  return;
236939
236959
  }
236940
236960
  field.value = value;
@@ -236942,7 +236962,7 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
236942
236962
  }
236943
236963
  case "MultiEnum": {
236944
236964
  if (!isValidMultiEnum(value, field.options)) {
236945
- console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value is invalid.`);
236965
+ console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value '${value}' is invalid. Possible values: ${getEnumOptionsString(field.options)}`);
236946
236966
  return;
236947
236967
  }
236948
236968
  field.value = value;
@@ -237788,10 +237808,19 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
237788
237808
  return typeof (value) === 'object' && typeof (value.r) === 'number' && typeof (value.g) === 'number' && typeof (value.b) === 'number' && typeof (value.a) === 'number';
237789
237809
  }
237790
237810
  function isValidEnum(value, options) {
237791
- return typeof (value) === 'string' && options.includes(value);
237811
+ return typeof (value) === 'string' && options.find((option) => {
237812
+ if (typeof (option) === 'object')
237813
+ return option.value === value;
237814
+ return option === value;
237815
+ });
237792
237816
  }
237793
237817
  function isValidMultiEnum(value, options) {
237794
- return Array.isArray(value) && value.filter((x) => options.includes(x)).length === value.length;
237818
+ return Array.isArray(value) && value.filter((x) => isValidEnum(x, options)).length === value.length;
237819
+ }
237820
+ function getEnumOptionsString(options) {
237821
+ return options.reduce((previousValue, currentValue, currentIndex) => {
237822
+ return previousValue + (currentIndex === 0 ? '' : ', ') + (typeof (currentValue) === 'object' ? currentValue.value : currentValue);
237823
+ });
237795
237824
  }
237796
237825
  if (!field) {
237797
237826
  console.error(`Field ${name} not found!`);
@@ -237852,7 +237881,7 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
237852
237881
  }
237853
237882
  case "Enum": {
237854
237883
  if (!isValidEnum(value, field.options)) {
237855
- console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value is invalid.`);
237884
+ console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value '${value}' is invalid. Possible values: ${getEnumOptionsString(field.options)}`);
237856
237885
  return;
237857
237886
  }
237858
237887
  field.value = value;
@@ -237860,7 +237889,7 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
237860
237889
  }
237861
237890
  case "MultiEnum": {
237862
237891
  if (!isValidMultiEnum(value, field.options)) {
237863
- console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value is invalid.`);
237892
+ console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value '${value}' is invalid. Possible values: ${getEnumOptionsString(field.options)}`);
237864
237893
  return;
237865
237894
  }
237866
237895
  field.value = value;