@wonderlandengine/editor-api 1.4.7 → 1.5.0-rc.2

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
@@ -1,4 +1,4 @@
1
- export declare let data: EditorData;
1
+ export declare let data: ProjectData;
2
2
  /** Object reference */
3
3
  export type ObjectReference = string | null;
4
4
  /** Mesh reference */
@@ -23,6 +23,8 @@ export type ImageReference = string | null;
23
23
  export type AnimationReference = string | null;
24
24
  /** Particle effect reference */
25
25
  export type ParticleEffectReference = string | null;
26
+ /** Plugin reference */
27
+ export type PluginReference = string | null;
26
28
  /** Project type */
27
29
  export declare enum ProjectType {
28
30
  Website = "website",
@@ -37,7 +39,17 @@ export declare enum RecordType {
37
39
  /** A dictionary (key-value pairs) of records */
38
40
  Dict = 2,
39
41
  /** A dictionary (key-value pairs) of records with stable indices */
40
- IdDict = 3
42
+ IdDict = 3,
43
+ Value = 4,
44
+ Bool = 5,
45
+ Int = 6,
46
+ Uint = 7,
47
+ Float = 8,
48
+ Double = 9,
49
+ String = 10,
50
+ Id = 11,
51
+ Enum = 12,
52
+ EnumInt = 13
41
53
  }
42
54
  export declare class Access {
43
55
  recordType?: () => RecordType;
@@ -129,6 +141,7 @@ export declare class RenderingSettings extends Access {
129
141
  usePreZ: boolean;
130
142
  useMultiDraw: boolean;
131
143
  useTextureStreaming: boolean;
144
+ deferSkinningCompilation: boolean;
132
145
  sky: SkySettings;
133
146
  bloom: BloomSettings;
134
147
  hdr: HdrSettings;
@@ -155,9 +168,6 @@ export declare class EditorSettings extends Access {
155
168
  };
156
169
  importPhysicalAsPhongMaterials: boolean;
157
170
  }
158
- /** Plugins settings */
159
- export declare class PluginsSettings extends Access {
160
- }
161
171
  /** PWA settings */
162
172
  export declare class PWASettings extends Access {
163
173
  enable: boolean;
@@ -279,7 +289,6 @@ export interface Settings extends Access {
279
289
  editor: EditorSettings;
280
290
  runtime: RuntimeSettings;
281
291
  scripting: ScriptingSettings;
282
- plugins: PluginsSettings;
283
292
  xr: XRSettings;
284
293
  physx: PhysXSettings;
285
294
  localization: LocalizationSettings;
@@ -298,6 +307,8 @@ export declare class Resource extends Access {
298
307
  name: string;
299
308
  link: Link | null;
300
309
  packageAlways: boolean;
310
+ resourceKey: string;
311
+ resourceId: number;
301
312
  }
302
313
  /** Image resource */
303
314
  export declare class ImageResource extends Resource {
@@ -809,15 +820,23 @@ export declare class LanguageResource extends Resource {
809
820
  export declare class ParticleEffectResource extends Resource {
810
821
  name: string;
811
822
  }
823
+ /** Plugin resource */
824
+ export declare class PluginResource extends Resource {
825
+ name: string;
826
+ /** Whether this plugin is enabled */
827
+ enabled: boolean;
828
+ }
812
829
  /** File resource */
813
830
  export declare class FileResource extends Resource {
814
831
  fileName: string;
815
832
  importerName: string;
816
833
  importPhysicalAsPhongMaterials: boolean;
817
834
  }
818
- export declare class ResourceSection<T> {
835
+ export type ResourceSection<T> = {
836
+ add(): T;
837
+ } & {
819
838
  [key: string]: T;
820
- }
839
+ };
821
840
  /**
822
841
  * Access to Wonderland Editor's data.
823
842
  *
@@ -835,7 +854,7 @@ export declare class ResourceSection<T> {
835
854
  * WL.data.objects[123].components[0].text.text
836
855
  * ```
837
856
  */
838
- export interface EditorData {
857
+ export interface ProjectData {
839
858
  /** Project settings */
840
859
  settings: Settings;
841
860
  /** List of scene file paths */
@@ -864,4 +883,6 @@ export interface EditorData {
864
883
  languages: ResourceSection<LanguageResource>;
865
884
  /** Particle effect resources */
866
885
  particleEffects: ResourceSection<ParticleEffectResource>;
886
+ /** Particle effect resources */
887
+ plugins: ResourceSection<PluginResource>;
867
888
  }
package/dist/data.js CHANGED
@@ -23,8 +23,17 @@ export var RecordType;
23
23
  RecordType[RecordType["Dict"] = 2] = "Dict";
24
24
  /** A dictionary (key-value pairs) of records with stable indices */
25
25
  RecordType[RecordType["IdDict"] = 3] = "IdDict";
26
+ RecordType[RecordType["Value"] = 4] = "Value";
27
+ RecordType[RecordType["Bool"] = 5] = "Bool";
28
+ RecordType[RecordType["Int"] = 6] = "Int";
29
+ RecordType[RecordType["Uint"] = 7] = "Uint";
30
+ RecordType[RecordType["Float"] = 8] = "Float";
31
+ RecordType[RecordType["Double"] = 9] = "Double";
32
+ RecordType[RecordType["String"] = 10] = "String";
33
+ RecordType[RecordType["Id"] = 11] = "Id";
34
+ RecordType[RecordType["Enum"] = 12] = "Enum";
35
+ RecordType[RecordType["EnumInt"] = 13] = "EnumInt";
26
36
  })(RecordType || (RecordType = {}));
27
- ;
28
37
  export class Access {
29
38
  recordType;
30
39
  exists;
@@ -55,13 +64,13 @@ export class Access {
55
64
  }
56
65
  }
57
66
  if (ApiObject) {
58
- Object.assign(ApiObject, {
59
- keys: Access.prototype.keys,
60
- values: Access.prototype.values,
61
- entries: Access.prototype.entries,
62
- toValue: Access.prototype.toValue,
63
- toJSON: Access.prototype.toJSON,
64
- [Symbol.iterator]: Access.prototype[Symbol.iterator],
67
+ Object.defineProperties(ApiObject, {
68
+ keys: { value: Access.prototype.keys, enumerable: false },
69
+ values: { value: Access.prototype.values, enumerable: false },
70
+ entries: { value: Access.prototype.entries, enumerable: false },
71
+ toValue: { value: Access.prototype.toValue, enumerable: false },
72
+ toJSON: { value: Access.prototype.toJSON, enumerable: false },
73
+ [Symbol.iterator]: { value: Access.prototype[Symbol.iterator], enumerable: false },
65
74
  });
66
75
  }
67
76
  /** Project settings */
@@ -141,6 +150,7 @@ export class RenderingSettings extends Access {
141
150
  usePreZ = false;
142
151
  useMultiDraw = false;
143
152
  useTextureStreaming = true;
153
+ deferSkinningCompilation = false;
144
154
  sky = new SkySettings();
145
155
  bloom = new BloomSettings();
146
156
  hdr = new HdrSettings();
@@ -167,9 +177,6 @@ export class EditorSettings extends Access {
167
177
  };
168
178
  importPhysicalAsPhongMaterials = true;
169
179
  }
170
- /** Plugins settings */
171
- export class PluginsSettings extends Access {
172
- }
173
180
  /** PWA settings */
174
181
  export class PWASettings extends Access {
175
182
  enable = false;
@@ -309,6 +316,8 @@ export class Resource extends Access {
309
316
  name = '';
310
317
  link = null;
311
318
  packageAlways = false;
319
+ resourceKey = "0";
320
+ resourceId = 0;
312
321
  }
313
322
  /** Image resource */
314
323
  export class ImageResource extends Resource {
@@ -829,11 +838,15 @@ export class LanguageResource extends Resource {
829
838
  export class ParticleEffectResource extends Resource {
830
839
  name = 'particleEffect';
831
840
  }
841
+ /** Plugin resource */
842
+ export class PluginResource extends Resource {
843
+ name = 'plugin';
844
+ /** Whether this plugin is enabled */
845
+ enabled = true;
846
+ }
832
847
  /** File resource */
833
848
  export class FileResource extends Resource {
834
849
  fileName = '';
835
850
  importerName = '';
836
851
  importPhysicalAsPhongMaterials = true;
837
852
  }
838
- export class ResourceSection {
839
- }
@@ -0,0 +1,15 @@
1
+ export interface Camera {
2
+ lookAt(target: [number, number, number]): void;
3
+ }
4
+ export interface SceneViewState {
5
+ camera: Camera;
6
+ }
7
+ export interface EditorState {
8
+ /** `true` if baking is in progress. */
9
+ baking: boolean;
10
+ sceneView: SceneViewState;
11
+ }
12
+ declare global {
13
+ function _wl_internalBinding(moduleName: 'editorState'): EditorState;
14
+ }
15
+ export declare const editorState: EditorState;
@@ -0,0 +1 @@
1
+ export const editorState = _wl_internalBinding('editorState');
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from './data.js';
2
+ export * from './editor-state.js';
2
3
  export * as ui from './ui.js';
3
4
  export * as tools from './tools.js';
4
- export * from './project.js';
5
5
  export * from './workspace.js';
6
6
  /** Editor plugin */
7
7
  export declare class EditorPlugin {
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export * from './data.js';
2
+ export * from './editor-state.js';
2
3
  import * as ui_1 from './ui.js';
3
4
  export { ui_1 as ui };
4
5
  import * as tools_1 from './tools.js';
5
6
  export { tools_1 as tools };
6
- export * from './project.js';
7
7
  export * from './workspace.js';
8
8
  /** Editor plugin */
9
9
  export class EditorPlugin {
package/dist/native.d.ts CHANGED
@@ -1,12 +1,15 @@
1
- import { EditorData } from './data.js';
1
+ import { ProjectData } from './data.js';
2
2
  import { Workspace } from './workspace.js';
3
3
  interface NativeToolsAPI {
4
+ newSubProject(name: string, filename?: string, projectKind?: string): boolean;
5
+ switchProject(id: number): void;
4
6
  packageProject(destDir?: string): number;
5
7
  loadFile(filename: string): number;
6
8
  loadScene(filename: string, parent?: string): number;
7
9
  awaitJob(jobId: number, cb: (success: boolean) => void): void;
8
10
  openBrowser(url: string): void;
9
11
  computeMeshBounds(meshId: string, out: Float32Array): void;
12
+ saveProject(): void;
10
13
  }
11
14
  interface NativeUiAPI {
12
15
  freeImage(id: number): void;
@@ -30,51 +33,11 @@ interface NativeUiAPI {
30
33
  inputInt(label: string, value: number): number | null;
31
34
  inputInt3(label: string, value: Int32Array): boolean;
32
35
  }
33
- /** Project paths */
34
- export interface Project {
35
- /**
36
- * Root directory of the project
37
- *
38
- * Directory in which the project file resides in.
39
- */
40
- readonly root: string;
41
- /**
42
- * Project filename
43
- *
44
- * File only without the root directory.
45
- */
46
- readonly filename: string;
47
- /**
48
- * Project deploy path
49
- * @returns `<root>/deploy`
50
- */
51
- readonly deployPath: string;
52
- /**
53
- * Project cache path
54
- * @returns `<root>/cache`
55
- */
56
- readonly cachePath: string;
57
- /**
58
- * Project package.json path
59
- * @returns `<root>/package.json`
60
- */
61
- readonly packageJsonPath: string;
62
- /**
63
- * Project node_modules path
64
- * @returns `<root>/node_modules`
65
- */
66
- readonly nodeModulesPath: string;
67
- /**
68
- * Project shaders path
69
- * @returns `<root>/shaders`
70
- */
71
- readonly shadersPath: string;
72
- }
73
36
  declare global {
74
37
  function _wl_internalBinding(moduleName: 'tools'): NativeToolsAPI;
75
38
  function _wl_internalBinding(moduleName: 'ui'): NativeUiAPI;
76
- function _wl_internalBinding(moduleName: 'data'): EditorData;
77
- function _wl_internalBinding(moduleName: 'project'): Project;
39
+ /** @todo Remove/deprecate */
40
+ function _wl_internalBinding(moduleName: 'data'): ProjectData;
78
41
  function _wl_internalBinding(moduleName: 'workspace'): Workspace;
79
42
  }
80
43
  export {};
package/dist/tools.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  /** @hidden */
2
2
  export declare function awaitJob(jobId: number): Promise<void>;
3
+ export declare const newSubProject: (name: string, filename?: string, projectKind?: string) => boolean;
4
+ export declare const switchProject: (id: number) => void;
3
5
  /**
4
6
  * Package the current project
5
7
  * @param destDir Destination directory into which to package, default `'<project-root>/deploy'`.
@@ -31,3 +33,4 @@ export declare function loadScene(path: string, options: {
31
33
  */
32
34
  export declare const openBrowser: (url: string) => void;
33
35
  export declare const computeMeshBounds: (meshId: string, out: Float32Array) => void;
36
+ export declare const saveProject: () => void;
package/dist/tools.js CHANGED
@@ -10,6 +10,8 @@ export function awaitJob(jobId) {
10
10
  });
11
11
  });
12
12
  }
13
+ export const newSubProject = tools.newSubProject.bind(tools);
14
+ export const switchProject = tools.switchProject.bind(tools);
13
15
  /**
14
16
  * Package the current project
15
17
  * @param destDir Destination directory into which to package, default `'<project-root>/deploy'`.
@@ -48,3 +50,4 @@ export function loadScene(path, options) {
48
50
  */
49
51
  export const openBrowser = tools.openBrowser.bind(tools);
50
52
  export const computeMeshBounds = tools.computeMeshBounds.bind(tools);
53
+ export const saveProject = tools.saveProject.bind(tools);
@@ -1,10 +1,65 @@
1
- /** @todo: Give access to each projects using: getProject(filename). */
1
+ import { ProjectData } from './data.js';
2
2
  /**
3
3
  * Workspace access.
4
4
  *
5
5
  * Allows to read the current workspace setup.
6
6
  */
7
7
  export interface Workspace {
8
- mainFilename: string;
8
+ /**
9
+ * Workspace projects
10
+ *
11
+ * The main project is always at index/id 0
12
+ */
13
+ readonly projects: Array<ProjectData>;
14
+ projectId(filename: String): number;
15
+ /**
16
+ * Root directory of the project
17
+ *
18
+ * Directory in which the project file resides in.
19
+ */
20
+ readonly root: string;
21
+ /**
22
+ * Main project filename
23
+ *
24
+ * Filename relative to the workspace root directory.
25
+ *
26
+ * @deprecated Use the per-project accessors instead
27
+ */
28
+ readonly filename: string;
29
+ /**
30
+ * Main project filename
31
+ *
32
+ * Filename relative to the workspace root directory.
33
+ */
34
+ readonly mainFilename: string;
35
+ /**
36
+ * Project deploy path
37
+ * @returns `<root>/deploy`
38
+ */
39
+ readonly deployPath: string;
40
+ /**
41
+ * Project cache path
42
+ * @returns `<root>/cache`
43
+ */
44
+ readonly cachePath: string;
45
+ /**
46
+ * Project package.json path
47
+ * @returns `<root>/package.json`
48
+ */
49
+ readonly packageJsonPath: string;
50
+ /**
51
+ * Project node_modules path
52
+ * @returns `<root>/node_modules`
53
+ */
54
+ readonly nodeModulesPath: string;
55
+ /**
56
+ * Project shaders path
57
+ * @returns `<root>/shaders`
58
+ */
59
+ readonly shadersPath: string;
9
60
  }
10
61
  export declare const workspace: Workspace;
62
+ /**
63
+ * @deprecated Use the {@link workspace} export instead
64
+ */
65
+ export declare const project: Workspace;
package/dist/workspace.js CHANGED
@@ -1,2 +1,5 @@
1
- /** @todo: Give access to each projects using: getProject(filename). */
2
1
  export const workspace = _wl_internalBinding('workspace');
2
+ /**
3
+ * @deprecated Use the {@link workspace} export instead
4
+ */
5
+ export const project = workspace;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderlandengine/editor-api",
3
- "version": "1.4.7",
3
+ "version": "1.5.0-rc.2",
4
4
  "description": "Wonderland Engine's Editor API for plugins - very experimental.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
package/dist/project.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const project: import("./native.js").Project;
package/dist/project.js DELETED
@@ -1 +0,0 @@
1
- export const project = _wl_internalBinding('project');