@wonderlandengine/editor-api 1.3.4 → 1.4.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.
package/dist/data.d.ts CHANGED
@@ -21,13 +21,26 @@ export type SkinReference = string | null;
21
21
  export type ImageReference = string | null;
22
22
  /** Animation reference */
23
23
  export type AnimationReference = string | null;
24
+ /** Particle effect reference */
25
+ export type ParticleEffectReference = string | null;
24
26
  /** Project type */
25
27
  export declare enum ProjectType {
26
28
  Website = "website",
27
29
  Game = "game"
28
30
  }
29
31
  export declare function toValue(value: any): any;
32
+ export declare enum RecordType {
33
+ /** An object record */
34
+ Object = 0,
35
+ /** An array of records */
36
+ Array = 1,
37
+ /** A dictionary (key-value pairs) of records */
38
+ Dict = 2,
39
+ /** A dictionary (key-value pairs) of records with stable indices */
40
+ IdDict = 3
41
+ }
30
42
  export declare class Access {
43
+ recordType?: () => RecordType;
31
44
  exists?: (key: string) => boolean;
32
45
  keys(): string[];
33
46
  values(): any[];
@@ -632,6 +645,10 @@ export declare enum InputType {
632
645
  export declare class InputComponent extends Access {
633
646
  type: InputType;
634
647
  }
648
+ /** 'particle-effect' component */
649
+ export declare class ParticleEffectComponent extends Access {
650
+ particleEffect: ParticleEffectReference;
651
+ }
635
652
  export declare class AnimationEvent extends Access {
636
653
  time: number;
637
654
  name: string;
@@ -675,6 +692,8 @@ export declare class ObjectComponent extends Access {
675
692
  text?: TextComponent;
676
693
  /** View component */
677
694
  view?: ViewComponent;
695
+ /** Particle effect component */
696
+ particleEffect?: ParticleEffectComponent;
678
697
  }
679
698
  /** Object resource */
680
699
  export declare class ObjectResource extends Resource {
@@ -781,6 +800,10 @@ export declare class LanguageResource extends Resource {
781
800
  /** Whether this is the default language */
782
801
  isDefault: boolean;
783
802
  }
803
+ /** Particle effect resource */
804
+ export declare class ParticleEffectResource extends Resource {
805
+ name: string;
806
+ }
784
807
  /** File resource */
785
808
  export declare class FileResource extends Resource {
786
809
  fileName: string;
@@ -834,4 +857,6 @@ export interface EditorData {
834
857
  pipelines: ResourceSection<PipelineResource>;
835
858
  /** Language resources */
836
859
  languages: ResourceSection<LanguageResource>;
860
+ /** Particle effect resources */
861
+ particleEffects: ResourceSection<ParticleEffectResource>;
837
862
  }
package/dist/data.js CHANGED
@@ -13,7 +13,20 @@ export function toValue(value) {
13
13
  else
14
14
  return value;
15
15
  }
16
+ export var RecordType;
17
+ (function (RecordType) {
18
+ /** An object record */
19
+ RecordType[RecordType["Object"] = 0] = "Object";
20
+ /** An array of records */
21
+ RecordType[RecordType["Array"] = 1] = "Array";
22
+ /** A dictionary (key-value pairs) of records */
23
+ RecordType[RecordType["Dict"] = 2] = "Dict";
24
+ /** A dictionary (key-value pairs) of records with stable indices */
25
+ RecordType[RecordType["IdDict"] = 3] = "IdDict";
26
+ })(RecordType || (RecordType = {}));
27
+ ;
16
28
  export class Access {
29
+ recordType;
17
30
  exists;
18
31
  keys() {
19
32
  return Object.keys(this).filter((k) => this.exists(k));
@@ -29,7 +42,10 @@ export class Access {
29
42
  .map(([k, v]) => [k, toValue(v)]);
30
43
  }
31
44
  toValue() {
32
- return Object.fromEntries(this.entries());
45
+ if (this.recordType() == RecordType.Array)
46
+ return this.values();
47
+ else
48
+ return Object.fromEntries(this.entries());
33
49
  }
34
50
  toJSON() {
35
51
  return this.toValue();
@@ -647,6 +663,10 @@ export var InputType;
647
663
  export class InputComponent extends Access {
648
664
  type = InputType.Head;
649
665
  }
666
+ /** 'particle-effect' component */
667
+ export class ParticleEffectComponent extends Access {
668
+ particleEffect = null;
669
+ }
650
670
  export class AnimationEvent extends Access {
651
671
  time = 0.0;
652
672
  name = '';
@@ -690,6 +710,8 @@ export class ObjectComponent extends Access {
690
710
  text;
691
711
  /** View component */
692
712
  view;
713
+ /** Particle effect component */
714
+ particleEffect;
693
715
  }
694
716
  /** Object resource */
695
717
  export class ObjectResource extends Resource {
@@ -798,6 +820,10 @@ export class LanguageResource extends Resource {
798
820
  /** Whether this is the default language */
799
821
  isDefault = false;
800
822
  }
823
+ /** Particle effect resource */
824
+ export class ParticleEffectResource extends Resource {
825
+ name = 'particleEffect';
826
+ }
801
827
  /** File resource */
802
828
  export class FileResource extends Resource {
803
829
  fileName = '';
package/dist/index.d.ts CHANGED
@@ -11,6 +11,13 @@ export declare class EditorPlugin {
11
11
  * Called to let the plugin draw it's ui. See {@link ui}.
12
12
  */
13
13
  draw?(): void;
14
+ /**
15
+ * Called when the plugin is deactivated or reloaded.
16
+ *
17
+ * Plugins get deactivated when the editor is closed
18
+ * or projects are switched.
19
+ */
20
+ unload?(): void;
14
21
  /**
15
22
  * Called before a project is saved
16
23
  *
package/dist/native.d.ts CHANGED
@@ -6,6 +6,7 @@ interface NativeToolsAPI {
6
6
  loadScene(filename: string, parent?: string): number;
7
7
  awaitJob(jobId: number, cb: (success: boolean) => void): void;
8
8
  openBrowser(url: string): void;
9
+ computeMeshBounds(meshId: string, out: Float32Array): void;
9
10
  }
10
11
  interface NativeUiAPI {
11
12
  freeImage(id: number): void;
@@ -15,6 +16,7 @@ interface NativeUiAPI {
15
16
  button(label: string): boolean;
16
17
  image(id: number, width: number, height: number): boolean;
17
18
  inputText(label: string, value: string): string | null;
19
+ inputTextMultiline(widgetId: string, value: string): string | null;
18
20
  checkbox(label: string, value: boolean): boolean | null;
19
21
  colorEdit4(label: string, value: Float32Array): boolean;
20
22
  dummy(width: number, height: number): void;
package/dist/tools.d.ts CHANGED
@@ -30,3 +30,4 @@ export declare function loadScene(path: string, options: {
30
30
  * @param url URL to open
31
31
  */
32
32
  export declare const openBrowser: (url: string) => void;
33
+ export declare const computeMeshBounds: (meshId: string, out: Float32Array) => void;
package/dist/tools.js CHANGED
@@ -47,3 +47,4 @@ export function loadScene(path, options) {
47
47
  * @param url URL to open
48
48
  */
49
49
  export const openBrowser = tools.openBrowser.bind(tools);
50
+ export const computeMeshBounds = tools.computeMeshBounds.bind(tools);
package/dist/ui.d.ts CHANGED
@@ -53,6 +53,17 @@ export declare function image(image: UiImage, width: number, height: number): bo
53
53
  * s = ui.inputText("change this:", s) || s;
54
54
  */
55
55
  export declare const inputText: (label: string, value: string) => string | null;
56
+ /**
57
+ * Text input field multi line.
58
+ *
59
+ * @param widgetId Unique id for the widget.
60
+ * @param value Current value to set the field to.
61
+ * @returns The new string value when changed by the user this frame, otherwise `null`.
62
+ *
63
+ * @example
64
+ * s = ui.inputTextMultiline("change this:", s) || s;
65
+ */
66
+ export declare const inputTextMultiline: (widgetId: string, value: string) => string | null;
56
67
  /**
57
68
  * Checkbox.
58
69
  *
package/dist/ui.js CHANGED
@@ -77,6 +77,17 @@ export function image(image, width, height) {
77
77
  * s = ui.inputText("change this:", s) || s;
78
78
  */
79
79
  export const inputText = ui.inputText.bind(ui);
80
+ /**
81
+ * Text input field multi line.
82
+ *
83
+ * @param widgetId Unique id for the widget.
84
+ * @param value Current value to set the field to.
85
+ * @returns The new string value when changed by the user this frame, otherwise `null`.
86
+ *
87
+ * @example
88
+ * s = ui.inputTextMultiline("change this:", s) || s;
89
+ */
90
+ export const inputTextMultiline = ui.inputTextMultiline.bind(ui);
80
91
  /**
81
92
  * Checkbox.
82
93
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderlandengine/editor-api",
3
- "version": "1.3.4",
3
+ "version": "1.4.0",
4
4
  "description": "Wonderland Engine's Editor API for plugins - very experimental.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",