@wonderlandengine/editor-api 1.2.3-dev.2 → 1.2.4

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/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Wonderland Editor JavaScript Plugin API
1
+ # Wonderland Editor JavaScript/TypeScript Plugin API
2
2
 
3
- (Experimental!) API to extend the Wonderland Editor with JavaScript or TypeScript.
3
+ API to extend the Wonderland Editor with JavaScript or TypeScript.
4
4
 
5
- **Note:** This package requires the upcoming 1.2.0 version of Wonderland Engine.
5
+ **Note:** This package requires version 1.2.4 of Wonderland Engine.
6
6
 
7
7
  Learn more about Wonderland Engine in the [documentation](https://wonderlandengine.com/editor/plugins/).
8
8
 
package/dist/data.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export declare let data: EditorData;
1
2
  /** Object reference */
2
3
  export type ObjectReference = string | null;
3
4
  /** Mesh reference */
@@ -25,8 +26,18 @@ export declare enum ProjectType {
25
26
  Website = "website",
26
27
  Game = "game"
27
28
  }
29
+ export declare function toValue(value: any): any;
30
+ export declare class Access {
31
+ exists?: (key: string) => boolean;
32
+ keys(): string[];
33
+ values(): any[];
34
+ entries(): [string, any][];
35
+ toValue(): Object;
36
+ toJSON(): Object;
37
+ [Symbol.iterator](): IterableIterator<[string, any]>;
38
+ }
28
39
  /** Project settings */
29
- export declare class ProjectSettings {
40
+ export declare class ProjectSettings extends Access {
30
41
  name: string;
31
42
  description: string;
32
43
  type: ProjectType;
@@ -36,12 +47,12 @@ export declare class ProjectSettings {
36
47
  version: number[];
37
48
  }
38
49
  /** Sky settings */
39
- export declare class SkySettings {
50
+ export declare class SkySettings extends Access {
40
51
  enabled: boolean;
41
52
  material: MaterialReference;
42
53
  }
43
54
  /** Bloom settings */
44
- export declare class BloomSettings {
55
+ export declare class BloomSettings extends Access {
45
56
  enabled: boolean;
46
57
  passes: number;
47
58
  threshold: number;
@@ -64,12 +75,12 @@ export declare enum TonemappingMode {
64
75
  Exponential = "exponential"
65
76
  }
66
77
  /** HDR settings */
67
- export declare class HdrSettings {
78
+ export declare class HdrSettings extends Access {
68
79
  exposure: number;
69
80
  tonemapping: TonemappingMode;
70
81
  }
71
82
  /** Texture streaming settings */
72
- export declare class TextureStreamingSettings {
83
+ export declare class TextureStreamingSettings extends Access {
73
84
  maxCacheSize: number;
74
85
  maxUploadPerFrame: number;
75
86
  }
@@ -80,7 +91,7 @@ export declare enum EnvironmentMode {
80
91
  SphericalHarmonic2 = "spherical-harmonic-2"
81
92
  }
82
93
  /** Environment settings */
83
- export declare class EnvironmentSettings {
94
+ export declare class EnvironmentSettings extends Access {
84
95
  enabled: boolean;
85
96
  image: ImageReference;
86
97
  mode: EnvironmentMode;
@@ -90,7 +101,7 @@ export declare class EnvironmentSettings {
90
101
  maxSpecularEnvironmentSize: number;
91
102
  }
92
103
  /** Rendering settings */
93
- export declare class RenderingSettings {
104
+ export declare class RenderingSettings extends Access {
94
105
  api: 'webgl2' | 'webgpu-or-webgl2';
95
106
  textureAtlasSize: number[];
96
107
  compressedTextureAtlasSize: number[];
@@ -107,12 +118,12 @@ export declare class RenderingSettings {
107
118
  maxTextures: number;
108
119
  }
109
120
  /** Camera settings */
110
- export declare class CameraSettings {
121
+ export declare class CameraSettings extends Access {
111
122
  near: number;
112
123
  far: number;
113
124
  }
114
125
  /** Editor settings */
115
- export declare class EditorSettings {
126
+ export declare class EditorSettings extends Access {
116
127
  serverPort: number;
117
128
  serverCOEP: string;
118
129
  camera: CameraSettings;
@@ -123,30 +134,29 @@ export declare class EditorSettings {
123
134
  };
124
135
  }
125
136
  /** Plugins settings */
126
- export declare class PluginsSettings {
137
+ export declare class PluginsSettings extends Access {
127
138
  }
128
139
  /** WebXR feature flags */
129
140
  export interface WebXRFeatureFlags {
130
- local: boolean;
141
+ 'local': boolean;
131
142
  'local-floor': boolean;
132
143
  'bounded-floor': boolean;
133
- unbounded: boolean;
144
+ 'unbounded': boolean;
134
145
  'hand-tracking': boolean;
135
146
  'hit-test': boolean;
136
147
  'plane-detection': boolean;
137
148
  'light-estimation': boolean;
138
- anchors: boolean;
139
- occlusion: boolean;
149
+ 'anchors': boolean;
150
+ 'occlusion': boolean;
140
151
  'marker-tracking': boolean;
141
- extraFeatures: string;
142
152
  }
143
153
  /** WebXR settings */
144
- export declare class WebXRSettings {
154
+ export declare class WebXRSettings extends Access {
145
155
  optionalFeatures: WebXRFeatureFlags;
146
156
  requiredFeatures: WebXRFeatureFlags;
147
157
  }
148
158
  /** PWA settings */
149
- export declare class PWASettings {
159
+ export declare class PWASettings extends Access {
150
160
  enable: boolean;
151
161
  customServiceWorker: boolean;
152
162
  customManifest: boolean;
@@ -155,7 +165,7 @@ export declare class PWASettings {
155
165
  appIcon: ImageReference;
156
166
  }
157
167
  /** Runtime settings */
158
- export declare class RuntimeSettings {
168
+ export declare class RuntimeSettings extends Access {
159
169
  visualizeColliders: boolean;
160
170
  visualizePhysX: boolean;
161
171
  visualizeOverdraw: boolean;
@@ -174,7 +184,7 @@ export declare enum BundlingType {
174
184
  Npm = "npm"
175
185
  }
176
186
  /** Scripting settings */
177
- export declare class ScriptingSettings {
187
+ export declare class ScriptingSettings extends Access {
178
188
  sourcePaths: never[];
179
189
  libraryPaths: never[];
180
190
  bundlingType: BundlingType;
@@ -184,14 +194,14 @@ export declare class ScriptingSettings {
184
194
  entryPoint: string;
185
195
  }
186
196
  /** VR settings */
187
- export declare class VRSettings {
197
+ export declare class VRSettings extends Access {
188
198
  enable: boolean;
189
199
  rightEyeObject: ObjectReference;
190
200
  leftEyeObject: ObjectReference;
191
201
  framebufferScaleFactor: number;
192
202
  }
193
203
  /** Physics settings */
194
- export declare class PhysXSettings {
204
+ export declare class PhysXSettings extends Access {
195
205
  enable: boolean;
196
206
  maxTimestep: number;
197
207
  contactOffset: number;
@@ -211,18 +221,18 @@ export declare class PhysXSettings {
211
221
  speedToleranceScale: number;
212
222
  }
213
223
  /** AR settings */
214
- export declare class ARSettings {
224
+ export declare class ARSettings extends Access {
215
225
  enable: boolean;
216
226
  }
217
227
  /** Localization settings */
218
- export declare class LocalizationSettings {
228
+ export declare class LocalizationSettings extends Access {
219
229
  enableZipCompression: boolean;
220
230
  format: 'i18next';
221
231
  languagesFolder: string;
222
232
  defaultLanguage: string;
223
233
  }
224
234
  /** Settings for the currently open project */
225
- export declare class Settings {
235
+ export declare class Settings extends Access {
226
236
  project: ProjectSettings;
227
237
  rendering: RenderingSettings;
228
238
  editor: EditorSettings;
@@ -240,8 +250,16 @@ export declare enum ImageCompressionType {
240
250
  ETC1s = "etc1s",
241
251
  UASTC = "uastc"
242
252
  }
253
+ export declare class Link extends Access {
254
+ name: string;
255
+ file: string;
256
+ }
257
+ export declare class Resource extends Access {
258
+ name: string;
259
+ link: Link | null;
260
+ }
243
261
  /** Image resource */
244
- export declare class ImageResource {
262
+ export declare class ImageResource extends Resource {
245
263
  name: string;
246
264
  maxSize: number[];
247
265
  compression: ImageCompressionType;
@@ -251,7 +269,7 @@ export declare class ImageResource {
251
269
  hdr: boolean;
252
270
  }
253
271
  /** Texture resource */
254
- export declare class TextureResource {
272
+ export declare class TextureResource extends Resource {
255
273
  name: string;
256
274
  image: ImageReference;
257
275
  type: number;
@@ -271,14 +289,14 @@ export declare enum ShaderType {
271
289
  Fullscreen = "fullscreen"
272
290
  }
273
291
  /** Shader resource */
274
- export declare class ShaderResource {
292
+ export declare class ShaderResource extends Resource {
275
293
  name: string;
276
294
  stage: ShaderStage;
277
295
  type: ShaderType;
278
296
  packageUnused: boolean;
279
297
  }
280
298
  /** Mesh resource */
281
- export declare class MeshResource {
299
+ export declare class MeshResource extends Resource {
282
300
  name: string;
283
301
  simplify: boolean;
284
302
  simplifyTarget: number;
@@ -287,7 +305,7 @@ export declare class MeshResource {
287
305
  hasMorphTargets: boolean;
288
306
  }
289
307
  /** Material properties for the default Phong pipeline */
290
- export declare class PhongMaterial {
308
+ export declare class PhongMaterial extends Access {
291
309
  ambientColor: number[];
292
310
  diffuseTexture: TextureReference;
293
311
  diffuseColor: number[];
@@ -303,7 +321,7 @@ export declare class PhongMaterial {
303
321
  alphaMaskTexture: TextureReference;
304
322
  }
305
323
  /** Material properties for the default Phong pipeline */
306
- export declare class PhysicalMaterial {
324
+ export declare class PhysicalMaterial extends Access {
307
325
  albedoColor: number[];
308
326
  emissiveTexture: TextureReference;
309
327
  emissiveColor: number[];
@@ -320,19 +338,19 @@ export declare class PhysicalMaterial {
320
338
  alphaMaskTexture: TextureReference;
321
339
  }
322
340
  /** Material properties for the default MeshVisualizer pipeline */
323
- export declare class MeshVisualizerMaterial {
341
+ export declare class MeshVisualizerMaterial extends Access {
324
342
  color: number[];
325
343
  wireframeColor: number[];
326
344
  }
327
345
  /** Material properties for the default Flat pipeline */
328
- export declare class FlatMaterial {
346
+ export declare class FlatMaterial extends Access {
329
347
  color: number[];
330
348
  flatTexture: TextureReference;
331
349
  alphaMaskThreshold: number;
332
350
  alphaMaskTexture: TextureReference;
333
351
  }
334
352
  /** Material properties for the default Particle pipeline */
335
- export declare class ParticleMaterial {
353
+ export declare class ParticleMaterial extends Access {
336
354
  color: number[];
337
355
  mainTexture: TextureReference;
338
356
  noiseTexture: TextureReference;
@@ -340,7 +358,7 @@ export declare class ParticleMaterial {
340
358
  offsetY: number;
341
359
  }
342
360
  /** Material properties for the default DistanceFieldVector pipeline */
343
- export declare class DistanceFieldVectorMaterial {
361
+ export declare class DistanceFieldVectorMaterial extends Access {
344
362
  color: number[];
345
363
  outlineColor: number[];
346
364
  outlineRange: number[];
@@ -348,13 +366,13 @@ export declare class DistanceFieldVectorMaterial {
348
366
  smoothness: number;
349
367
  }
350
368
  /** Material properties for the default Text pipeline */
351
- export declare class TextMaterial {
369
+ export declare class TextMaterial extends Access {
352
370
  color: number[];
353
371
  effectColor: number[];
354
372
  font: FontReference;
355
373
  }
356
374
  /** Material properties for the default Sky pipeline */
357
- export declare class SkyMaterial {
375
+ export declare class SkyMaterial extends Access {
358
376
  colorStop0: number[];
359
377
  colorStop1: number[];
360
378
  colorStop2: number[];
@@ -362,7 +380,7 @@ export declare class SkyMaterial {
362
380
  texture: TextureReference;
363
381
  }
364
382
  /** Material properties for the default Background pipeline */
365
- export declare class BackgroundMaterial {
383
+ export declare class BackgroundMaterial extends Access {
366
384
  colorStop0: number[];
367
385
  colorStop1: number[];
368
386
  colorStop2: number[];
@@ -370,7 +388,7 @@ export declare class BackgroundMaterial {
370
388
  texture: TextureReference;
371
389
  }
372
390
  /** Material properties for the default Particle pipeline */
373
- export declare class MaterialResource {
391
+ export declare class MaterialResource extends Resource {
374
392
  pipeline: PipelineReference;
375
393
  name: string;
376
394
  Phong?: PhongMaterial;
@@ -394,8 +412,8 @@ export declare enum RootMotionMode {
394
412
  ApplyToOwner = "applyToOwner",
395
413
  ScriptEvent = "scriptEvent"
396
414
  }
397
- /** 'animation' component configuration */
398
- export declare class AnimationComponent {
415
+ /** 'animation' component */
416
+ export declare class AnimationComponent extends Access {
399
417
  preview: boolean;
400
418
  retarget: boolean;
401
419
  autoplay: boolean;
@@ -420,8 +438,8 @@ export declare enum LightType {
420
438
  /** Sun light type */
421
439
  Sun = "sun"
422
440
  }
423
- /** 'light' component configuration */
424
- export declare class LightComponent {
441
+ /** 'light' component */
442
+ export declare class LightComponent extends Access {
425
443
  type: LightType;
426
444
  color: number[];
427
445
  intensity: number;
@@ -441,34 +459,34 @@ export declare enum ProjectionType {
441
459
  /** Orthographic projection */
442
460
  Orthographic = "orthographic"
443
461
  }
444
- /** 'view' component configuration */
445
- export declare class ViewComponent {
462
+ /** 'view' component */
463
+ export declare class ViewComponent extends Access {
446
464
  projectionType: ProjectionType;
447
465
  fov: number;
448
466
  extent: number;
449
467
  near: number;
450
468
  far: number;
451
469
  }
452
- /** Settings for a sphere physics shape */
453
- export declare class PhysXSphereConfig {
470
+ /** Sphere physics shape */
471
+ export declare class PhysXSphere extends Access {
454
472
  radius: number;
455
473
  }
456
- /** Settings for a box physics shape */
457
- export declare class PhysXBoxConfig {
474
+ /** Box physics shape */
475
+ export declare class PhysXBox extends Access {
458
476
  extents: number[];
459
477
  }
460
- /** Settings for a capsule physics shape */
461
- export declare class PhysXCapsuleConfig {
478
+ /** Capsule physics shape */
479
+ export declare class PhysXCapsule extends Access {
462
480
  radius: number;
463
481
  halfHeight: number;
464
482
  }
465
- /** Settings for a triangle mesh physics shape */
466
- export declare class PhysXTriangleMeshConfig {
483
+ /** Triangle mesh physics shape */
484
+ export declare class PhysXTriangleMesh extends Access {
467
485
  mesh: MeshReference;
468
486
  scaling: number[];
469
487
  }
470
- /** Settings for a convex mesh physics shape */
471
- export declare class PhysXConvexMeshConfig {
488
+ /** Convex mesh physics shape */
489
+ export declare class PhysXConvexMesh extends Access {
472
490
  mesh: MeshReference;
473
491
  scaling: number[];
474
492
  }
@@ -480,8 +498,8 @@ export declare enum PhysXShapeType {
480
498
  TriangleMesh = "triangleMesh",
481
499
  ConvexMesh = "convexMesh"
482
500
  }
483
- /** 'physx' component configuration */
484
- export declare class PhysXComponent {
501
+ /** 'physx' component */
502
+ export declare class PhysXComponent extends Access {
485
503
  static: boolean;
486
504
  kinematic: boolean;
487
505
  simulate: boolean;
@@ -489,11 +507,11 @@ export declare class PhysXComponent {
489
507
  allowSimulation: boolean;
490
508
  mass: number;
491
509
  shape: PhysXShapeType;
492
- sphere?: PhysXSphereConfig;
493
- box?: PhysXBoxConfig;
494
- capsule?: PhysXCapsuleConfig;
495
- triangleMesh?: PhysXTriangleMeshConfig;
496
- convexMesh?: PhysXConvexMeshConfig;
510
+ sphere?: PhysXSphere;
511
+ box?: PhysXBox;
512
+ capsule?: PhysXCapsule;
513
+ triangleMesh?: PhysXTriangleMesh;
514
+ convexMesh?: PhysXConvexMesh;
497
515
  linearDamping: number;
498
516
  angularDamping: number;
499
517
  staticFriction: number;
@@ -510,8 +528,8 @@ export declare class PhysXComponent {
510
528
  solverPositionIterations: number;
511
529
  solverVelocityIterations: number;
512
530
  }
513
- /** 'mesh' component configuration */
514
- export declare class MeshComponent {
531
+ /** 'mesh' component */
532
+ export declare class MeshComponent extends Access {
515
533
  material: MaterialReference;
516
534
  mesh: MeshReference;
517
535
  skin: SkinReference;
@@ -530,8 +548,8 @@ export declare enum TextWrapMode {
530
548
  Hard = "hard",
531
549
  Clip = "clip"
532
550
  }
533
- /** 'text' component configuration */
534
- export declare class TextComponent {
551
+ /** 'text' component */
552
+ export declare class TextComponent extends Access {
535
553
  alignment: string;
536
554
  verticalAlignment: string;
537
555
  characterSpacing: number;
@@ -542,24 +560,24 @@ export declare class TextComponent {
542
560
  wrapMode: TextWrapMode;
543
561
  wrapWidth: number;
544
562
  }
545
- /** Settings for a sphere collider */
546
- export declare class SphereConfig {
563
+ /** Sphere collider */
564
+ export declare class Sphere extends Access {
547
565
  radius: number;
548
566
  }
549
- /** Settings for a AxisAlignedBoundingBox collider */
550
- export declare class AABBConfig {
567
+ /** AxisAlignedBoundingBox collider */
568
+ export declare class AABB extends Access {
551
569
  extents: number[];
552
570
  }
553
- /** Settings for a box collider */
554
- export declare class BoxConfig {
571
+ /** Box collider */
572
+ export declare class Box extends Access {
555
573
  extents: number[];
556
574
  }
557
- /** 'collision' component configuration */
558
- export declare class CollisionComponent {
575
+ /** 'collision' component */
576
+ export declare class CollisionComponent extends Access {
559
577
  collider: 'sphere' | 'aabb' | 'box';
560
- sphere?: SphereConfig;
561
- aabb?: AABBConfig;
562
- box?: BoxConfig;
578
+ sphere?: Sphere;
579
+ aabb?: AABB;
580
+ box?: Box;
563
581
  groups: number;
564
582
  }
565
583
  /** Input type enum */
@@ -572,21 +590,21 @@ export declare enum InputType {
572
590
  RayLeft = "ray left",
573
591
  RayRight = "ray right"
574
592
  }
575
- /** 'input' component configuration */
576
- export declare class InputComponent {
593
+ /** 'input' component */
594
+ export declare class InputComponent extends Access {
577
595
  type: InputType;
578
596
  }
579
- export declare class AnimationEvent {
597
+ export declare class AnimationEvent extends Access {
580
598
  time: number;
581
599
  name: string;
582
600
  }
583
- export declare class RootMotion {
601
+ export declare class RootMotion extends Access {
584
602
  target: ObjectReference;
585
603
  translationAxis: number;
586
604
  rotationAxis: number;
587
605
  }
588
606
  /** Animation resource */
589
- export declare class AnimationResource {
607
+ export declare class AnimationResource extends Resource {
590
608
  /** Name of the animation */
591
609
  name: string;
592
610
  /** Whether to compress the animation */
@@ -597,31 +615,31 @@ export declare class AnimationResource {
597
615
  events: AnimationEvent[];
598
616
  rootMotion?: RootMotion;
599
617
  }
600
- /** Component configuration */
601
- export declare class ComponentConfig {
618
+ /** Component */
619
+ export declare class ObjectComponent extends Access {
602
620
  /** Component type */
603
621
  type: string | null;
604
622
  /** Whether the component is active */
605
623
  active: boolean;
606
- /** Configuration for animation components */
624
+ /** Animation component */
607
625
  animation?: AnimationComponent;
608
- /** Configuration for collision components */
626
+ /** Collision component */
609
627
  collision?: CollisionComponent;
610
- /** Configuration for input components */
628
+ /** Input component */
611
629
  input?: InputComponent;
612
- /** Configuration for light components */
630
+ /** Light component */
613
631
  light?: LightComponent;
614
- /** Configuration for mesh components */
632
+ /** Mesh component */
615
633
  mesh?: MeshComponent;
616
- /** Configuration for physx components */
634
+ /** Physx component */
617
635
  physx?: PhysXComponent;
618
- /** Configuration for text components */
636
+ /** Text component */
619
637
  text?: TextComponent;
620
- /** Configuration for view components */
638
+ /** View component */
621
639
  view?: ViewComponent;
622
640
  }
623
641
  /** Object resource */
624
- export declare class ObjectResource {
642
+ export declare class ObjectResource extends Resource {
625
643
  /** Name of the object */
626
644
  name: string;
627
645
  /** Translation vector */
@@ -635,10 +653,10 @@ export declare class ObjectResource {
635
653
  /** Skin this object is part of, or `null`, if not a joint. */
636
654
  skin: SkinReference;
637
655
  /** List of components on this object */
638
- components: ComponentConfig[];
656
+ components: ObjectComponent[];
639
657
  }
640
658
  /** Skin resource */
641
- export declare class SkinResource {
659
+ export declare class SkinResource extends Resource {
642
660
  /** Name of the skin */
643
661
  name: string;
644
662
  /** List of objects that make up the joints of this skin */
@@ -685,7 +703,7 @@ export declare enum MeshSorting {
685
703
  MeshIndex = "mesh-index"
686
704
  }
687
705
  /** Pipeline resource */
688
- export declare class PipelineResource {
706
+ export declare class PipelineResource extends Resource {
689
707
  name: string;
690
708
  doubleSided: boolean;
691
709
  castShadows: boolean;
@@ -708,7 +726,7 @@ export declare class PipelineResource {
708
726
  depthFunction: DepthFunction;
709
727
  }
710
728
  /** Font resource */
711
- export declare class FontResource {
729
+ export declare class FontResource extends Resource {
712
730
  /** Name of the font */
713
731
  name: string;
714
732
  /** Which characters need to be renderable with this font */
@@ -719,18 +737,21 @@ export declare class FontResource {
719
737
  outlineSize: number;
720
738
  }
721
739
  /** Language resource */
722
- export declare class LanguageResource {
740
+ export declare class LanguageResource extends Resource {
723
741
  /** Name of the language */
724
742
  name: string;
725
743
  /** Whether this is the default language */
726
744
  isDefault: boolean;
727
745
  }
728
746
  /** File resource */
729
- export declare class FileResource {
747
+ export declare class FileResource extends Resource {
730
748
  fileName: string;
731
749
  importerName: string;
732
750
  importPhysicalAsPhongMaterials: boolean;
733
751
  }
752
+ export declare class ResourceSection<T> {
753
+ [key: string]: T;
754
+ }
734
755
  /**
735
756
  * Access to Wonderland Editor's data.
736
757
  *
@@ -748,32 +769,31 @@ export declare class FileResource {
748
769
  * WL.data.objects[123].components[0].text.text
749
770
  * ```
750
771
  */
751
- export declare class EditorData {
772
+ export interface EditorData {
752
773
  /** Project settings */
753
774
  settings: Settings;
754
775
  /** List of scene file paths */
755
- files: FileResource[];
776
+ files: ResourceSection<FileResource>;
756
777
  /** Animation resources */
757
- animations: AnimationResource[];
778
+ animations: ResourceSection<AnimationResource>;
758
779
  /** Object resources */
759
- objects: ObjectResource[];
780
+ objects: ResourceSection<ObjectResource>;
760
781
  /** Skin resources */
761
- skins: SkinResource[];
782
+ skins: ResourceSection<SkinResource>;
762
783
  /** Image resources */
763
- images: ImageResource[];
784
+ images: ResourceSection<ImageResource>;
764
785
  /** Shader resources */
765
- shaders: ShaderResource[];
786
+ shaders: ResourceSection<ShaderResource>;
766
787
  /** Mesh resources */
767
- meshes: MeshResource[];
788
+ meshes: ResourceSection<MeshResource>;
768
789
  /** Texture resources */
769
- textures: TextureResource[];
790
+ textures: ResourceSection<TextureResource>;
770
791
  /** Material resources */
771
- materials: MaterialResource[];
792
+ materials: ResourceSection<MaterialResource>;
772
793
  /** Font resources */
773
- fonts: FontResource[];
794
+ fonts: ResourceSection<FontResource>;
774
795
  /** Pipeline resources */
775
- pipelines: PipelineResource[];
796
+ pipelines: ResourceSection<PipelineResource>;
776
797
  /** Language resources */
777
- languages: LanguageResource[];
798
+ languages: ResourceSection<LanguageResource>;
778
799
  }
779
- export declare let data: EditorData;
package/dist/data.js CHANGED
@@ -1,11 +1,55 @@
1
+ export let data = (global._wl_internalBinding ?? (() => { }))('data');
2
+ /* Copy over the access functions to the base prototype */
3
+ let ApiObject = data ? Object.getPrototypeOf(Object.getPrototypeOf(data)) : null;
1
4
  /** Project type */
2
5
  export var ProjectType;
3
6
  (function (ProjectType) {
4
7
  ProjectType["Website"] = "website";
5
8
  ProjectType["Game"] = "game";
6
9
  })(ProjectType || (ProjectType = {}));
10
+ export function toValue(value) {
11
+ if (ApiObject.isPrototypeOf(value))
12
+ return value.toValue();
13
+ else
14
+ return value;
15
+ }
16
+ export class Access {
17
+ exists;
18
+ keys() {
19
+ return Object.keys(this).filter((k) => this.exists(k));
20
+ }
21
+ values() {
22
+ return Object.keys(this)
23
+ .filter((k) => this.exists(k))
24
+ .map((k) => toValue(this[k]));
25
+ }
26
+ entries() {
27
+ return Object.entries(this)
28
+ .filter(([k, v]) => this.exists(k))
29
+ .map(([k, v]) => [k, toValue(v)]);
30
+ }
31
+ toValue() {
32
+ return Object.fromEntries(this.entries());
33
+ }
34
+ toJSON() {
35
+ return this.toValue();
36
+ }
37
+ [Symbol.iterator]() {
38
+ return Object.entries(this)[Symbol.iterator]();
39
+ }
40
+ }
41
+ if (ApiObject) {
42
+ Object.assign(ApiObject, {
43
+ keys: Access.prototype.keys,
44
+ values: Access.prototype.values,
45
+ entries: Access.prototype.entries,
46
+ toValue: Access.prototype.toValue,
47
+ toJSON: Access.prototype.toJSON,
48
+ [Symbol.iterator]: Access.prototype[Symbol.iterator],
49
+ });
50
+ }
7
51
  /** Project settings */
8
- export class ProjectSettings {
52
+ export class ProjectSettings extends Access {
9
53
  name = '';
10
54
  description = '';
11
55
  type = ProjectType.Website;
@@ -15,12 +59,12 @@ export class ProjectSettings {
15
59
  version = [1, 2, 0];
16
60
  }
17
61
  /** Sky settings */
18
- export class SkySettings {
62
+ export class SkySettings extends Access {
19
63
  enabled = false;
20
64
  material = null;
21
65
  }
22
66
  /** Bloom settings */
23
- export class BloomSettings {
67
+ export class BloomSettings extends Access {
24
68
  enabled = false;
25
69
  passes = 3;
26
70
  threshold = 1.25;
@@ -44,12 +88,12 @@ export var TonemappingMode;
44
88
  TonemappingMode["Exponential"] = "exponential";
45
89
  })(TonemappingMode || (TonemappingMode = {}));
46
90
  /** HDR settings */
47
- export class HdrSettings {
91
+ export class HdrSettings extends Access {
48
92
  exposure = 1.0;
49
93
  tonemapping = TonemappingMode.Reinhard;
50
94
  }
51
95
  /** Texture streaming settings */
52
- export class TextureStreamingSettings {
96
+ export class TextureStreamingSettings extends Access {
53
97
  maxCacheSize = 1024;
54
98
  maxUploadPerFrame = 10;
55
99
  }
@@ -61,7 +105,7 @@ export var EnvironmentMode;
61
105
  EnvironmentMode["SphericalHarmonic2"] = "spherical-harmonic-2";
62
106
  })(EnvironmentMode || (EnvironmentMode = {}));
63
107
  /** Environment settings */
64
- export class EnvironmentSettings {
108
+ export class EnvironmentSettings extends Access {
65
109
  enabled = false;
66
110
  image = null;
67
111
  mode = EnvironmentMode.Disabled;
@@ -71,7 +115,7 @@ export class EnvironmentSettings {
71
115
  maxSpecularEnvironmentSize = 512;
72
116
  }
73
117
  /** Rendering settings */
74
- export class RenderingSettings {
118
+ export class RenderingSettings extends Access {
75
119
  api = 'webgl2';
76
120
  textureAtlasSize = [8192, 4096];
77
121
  compressedTextureAtlasSize = [16384, 8192];
@@ -88,12 +132,12 @@ export class RenderingSettings {
88
132
  maxTextures = 1024;
89
133
  }
90
134
  /** Camera settings */
91
- export class CameraSettings {
135
+ export class CameraSettings extends Access {
92
136
  near = 0.02;
93
137
  far = 100.0;
94
138
  }
95
139
  /** Editor settings */
96
- export class EditorSettings {
140
+ export class EditorSettings extends Access {
97
141
  serverPort = 8080;
98
142
  serverCOEP = 'require-corp';
99
143
  camera = new CameraSettings();
@@ -104,10 +148,10 @@ export class EditorSettings {
104
148
  };
105
149
  }
106
150
  /** Plugins settings */
107
- export class PluginsSettings {
151
+ export class PluginsSettings extends Access {
108
152
  }
109
153
  /** WebXR settings */
110
- export class WebXRSettings {
154
+ export class WebXRSettings extends Access {
111
155
  optionalFeatures = {
112
156
  'local': true,
113
157
  'local-floor': false,
@@ -120,7 +164,6 @@ export class WebXRSettings {
120
164
  'anchors': false,
121
165
  'occlusion': false,
122
166
  'marker-tracking': false,
123
- 'extraFeatures': '',
124
167
  };
125
168
  requiredFeatures = {
126
169
  'local': true,
@@ -134,11 +177,10 @@ export class WebXRSettings {
134
177
  'anchors': false,
135
178
  'occlusion': false,
136
179
  'marker-tracking': false,
137
- 'extraFeatures': '',
138
180
  };
139
181
  }
140
182
  /** PWA settings */
141
- export class PWASettings {
183
+ export class PWASettings extends Access {
142
184
  enable = false;
143
185
  customServiceWorker = false;
144
186
  customManifest = false;
@@ -147,7 +189,7 @@ export class PWASettings {
147
189
  appIcon = null;
148
190
  }
149
191
  /** Runtime settings */
150
- export class RuntimeSettings {
192
+ export class RuntimeSettings extends Access {
151
193
  visualizeColliders = false;
152
194
  visualizePhysX = false;
153
195
  visualizeOverdraw = false;
@@ -167,7 +209,7 @@ export var BundlingType;
167
209
  BundlingType["Npm"] = "npm";
168
210
  })(BundlingType || (BundlingType = {}));
169
211
  /** Scripting settings */
170
- export class ScriptingSettings {
212
+ export class ScriptingSettings extends Access {
171
213
  sourcePaths = [];
172
214
  libraryPaths = [];
173
215
  bundlingType = BundlingType.Esbuild;
@@ -177,14 +219,14 @@ export class ScriptingSettings {
177
219
  entryPoint = 'js/index.js';
178
220
  }
179
221
  /** VR settings */
180
- export class VRSettings {
222
+ export class VRSettings extends Access {
181
223
  enable = true;
182
224
  rightEyeObject = null;
183
225
  leftEyeObject = null;
184
226
  framebufferScaleFactor = 1.0;
185
227
  }
186
228
  /** Physics settings */
187
- export class PhysXSettings {
229
+ export class PhysXSettings extends Access {
188
230
  enable = false;
189
231
  maxTimestep = 0.05;
190
232
  contactOffset = 0.02;
@@ -204,18 +246,18 @@ export class PhysXSettings {
204
246
  speedToleranceScale = 10.0;
205
247
  }
206
248
  /** AR settings */
207
- export class ARSettings {
249
+ export class ARSettings extends Access {
208
250
  enable = false;
209
251
  }
210
252
  /** Localization settings */
211
- export class LocalizationSettings {
253
+ export class LocalizationSettings extends Access {
212
254
  enableZipCompression = false;
213
255
  format = 'i18next';
214
256
  languagesFolder = 'languages';
215
257
  defaultLanguage = 'en';
216
258
  }
217
259
  /** Settings for the currently open project */
218
- export class Settings {
260
+ export class Settings extends Access {
219
261
  project = new ProjectSettings();
220
262
  rendering = new RenderingSettings();
221
263
  editor = new EditorSettings();
@@ -234,8 +276,16 @@ export var ImageCompressionType;
234
276
  ImageCompressionType["ETC1s"] = "etc1s";
235
277
  ImageCompressionType["UASTC"] = "uastc";
236
278
  })(ImageCompressionType || (ImageCompressionType = {}));
279
+ export class Link extends Access {
280
+ name = '';
281
+ file = '';
282
+ }
283
+ export class Resource extends Access {
284
+ name = '';
285
+ link = null;
286
+ }
237
287
  /** Image resource */
238
- export class ImageResource {
288
+ export class ImageResource extends Resource {
239
289
  name = 'image';
240
290
  maxSize = [8192, 8192];
241
291
  compression = ImageCompressionType.ETC1s;
@@ -245,7 +295,7 @@ export class ImageResource {
245
295
  hdr = false;
246
296
  }
247
297
  /** Texture resource */
248
- export class TextureResource {
298
+ export class TextureResource extends Resource {
249
299
  name = 'texture';
250
300
  image = null;
251
301
  type = 1;
@@ -267,14 +317,14 @@ export var ShaderType;
267
317
  ShaderType["Fullscreen"] = "fullscreen";
268
318
  })(ShaderType || (ShaderType = {}));
269
319
  /** Shader resource */
270
- export class ShaderResource {
320
+ export class ShaderResource extends Resource {
271
321
  name = 'shader';
272
322
  stage = ShaderStage.Fragment;
273
323
  type = ShaderType.Forward;
274
324
  packageUnused = false;
275
325
  }
276
326
  /** Mesh resource */
277
- export class MeshResource {
327
+ export class MeshResource extends Resource {
278
328
  name = 'mesh';
279
329
  simplify = false;
280
330
  simplifyTarget = 0.5;
@@ -283,7 +333,7 @@ export class MeshResource {
283
333
  hasMorphTargets = false;
284
334
  }
285
335
  /** Material properties for the default Phong pipeline */
286
- export class PhongMaterial {
336
+ export class PhongMaterial extends Access {
287
337
  ambientColor = [0.05, 0.05, 0.05, 1.0];
288
338
  diffuseTexture = null;
289
339
  diffuseColor = [1, 1, 1, 1.0];
@@ -299,7 +349,7 @@ export class PhongMaterial {
299
349
  alphaMaskTexture = null;
300
350
  }
301
351
  /** Material properties for the default Phong pipeline */
302
- export class PhysicalMaterial {
352
+ export class PhysicalMaterial extends Access {
303
353
  albedoColor = [1.0, 1.0, 1.0, 1.0];
304
354
  emissiveTexture = null;
305
355
  emissiveColor = [0.0, 0.0, 0.0, 1.0];
@@ -316,19 +366,19 @@ export class PhysicalMaterial {
316
366
  alphaMaskTexture = null;
317
367
  }
318
368
  /** Material properties for the default MeshVisualizer pipeline */
319
- export class MeshVisualizerMaterial {
369
+ export class MeshVisualizerMaterial extends Access {
320
370
  color = [0.5, 0.5, 0.5, 1];
321
371
  wireframeColor = [1, 1, 1, 1];
322
372
  }
323
373
  /** Material properties for the default Flat pipeline */
324
- export class FlatMaterial {
374
+ export class FlatMaterial extends Access {
325
375
  color = [1, 1, 1, 1];
326
376
  flatTexture = null;
327
377
  alphaMaskThreshold = 0.5;
328
378
  alphaMaskTexture = null;
329
379
  }
330
380
  /** Material properties for the default Particle pipeline */
331
- export class ParticleMaterial {
381
+ export class ParticleMaterial extends Access {
332
382
  color = [1, 1, 1, 1];
333
383
  mainTexture = null;
334
384
  noiseTexture = null;
@@ -336,7 +386,7 @@ export class ParticleMaterial {
336
386
  offsetY = 0.0;
337
387
  }
338
388
  /** Material properties for the default DistanceFieldVector pipeline */
339
- export class DistanceFieldVectorMaterial {
389
+ export class DistanceFieldVectorMaterial extends Access {
340
390
  color = [1, 1, 1, 1];
341
391
  outlineColor = [0, 0, 0, 1];
342
392
  outlineRange = [0.4, 0.3];
@@ -344,13 +394,13 @@ export class DistanceFieldVectorMaterial {
344
394
  smoothness = 0.02;
345
395
  }
346
396
  /** Material properties for the default Text pipeline */
347
- export class TextMaterial {
397
+ export class TextMaterial extends Access {
348
398
  color = [1, 1, 1, 1];
349
399
  effectColor = [0, 0, 0, 1];
350
400
  font = null;
351
401
  }
352
402
  /** Material properties for the default Sky pipeline */
353
- export class SkyMaterial {
403
+ export class SkyMaterial extends Access {
354
404
  colorStop0 = [1, 1, 1, 1];
355
405
  colorStop1 = [0.55, 0.95, 1, 1];
356
406
  colorStop2 = [0.55, 0.95, 1, 1];
@@ -358,7 +408,7 @@ export class SkyMaterial {
358
408
  texture = null;
359
409
  }
360
410
  /** Material properties for the default Background pipeline */
361
- export class BackgroundMaterial {
411
+ export class BackgroundMaterial extends Access {
362
412
  colorStop0 = [1, 1, 1, 1];
363
413
  colorStop1 = [0.55, 0.95, 1, 1];
364
414
  colorStop2 = [0.55, 0.95, 1, 1];
@@ -366,7 +416,7 @@ export class BackgroundMaterial {
366
416
  texture = null;
367
417
  }
368
418
  /** Material properties for the default Particle pipeline */
369
- export class MaterialResource {
419
+ export class MaterialResource extends Resource {
370
420
  pipeline = null;
371
421
  name = 'material';
372
422
  Phong;
@@ -392,8 +442,8 @@ export var RootMotionMode;
392
442
  RootMotionMode["ApplyToOwner"] = "applyToOwner";
393
443
  RootMotionMode["ScriptEvent"] = "scriptEvent";
394
444
  })(RootMotionMode || (RootMotionMode = {}));
395
- /** 'animation' component configuration */
396
- export class AnimationComponent {
445
+ /** 'animation' component */
446
+ export class AnimationComponent extends Access {
397
447
  preview = false;
398
448
  retarget = false;
399
449
  autoplay = false;
@@ -416,8 +466,8 @@ export var LightType;
416
466
  /** Sun light type */
417
467
  LightType["Sun"] = "sun";
418
468
  })(LightType || (LightType = {}));
419
- /** 'light' component configuration */
420
- export class LightComponent {
469
+ /** 'light' component */
470
+ export class LightComponent extends Access {
421
471
  type = LightType.Point;
422
472
  color = [1.0, 1.0, 1.0];
423
473
  intensity = 1;
@@ -438,34 +488,34 @@ export var ProjectionType;
438
488
  /** Orthographic projection */
439
489
  ProjectionType["Orthographic"] = "orthographic";
440
490
  })(ProjectionType || (ProjectionType = {}));
441
- /** 'view' component configuration */
442
- export class ViewComponent {
491
+ /** 'view' component */
492
+ export class ViewComponent extends Access {
443
493
  projectionType = ProjectionType.Perspective;
444
494
  fov = 90;
445
495
  extent = 10;
446
496
  near = 0.01;
447
497
  far = 100;
448
498
  }
449
- /** Settings for a sphere physics shape */
450
- export class PhysXSphereConfig {
499
+ /** Sphere physics shape */
500
+ export class PhysXSphere extends Access {
451
501
  radius = 0.25;
452
502
  }
453
- /** Settings for a box physics shape */
454
- export class PhysXBoxConfig {
503
+ /** Box physics shape */
504
+ export class PhysXBox extends Access {
455
505
  extents = [0.25, 0.25, 0.25];
456
506
  }
457
- /** Settings for a capsule physics shape */
458
- export class PhysXCapsuleConfig {
507
+ /** Capsule physics shape */
508
+ export class PhysXCapsule extends Access {
459
509
  radius = 0.15;
460
510
  halfHeight = 0.25;
461
511
  }
462
- /** Settings for a triangle mesh physics shape */
463
- export class PhysXTriangleMeshConfig {
512
+ /** Triangle mesh physics shape */
513
+ export class PhysXTriangleMesh extends Access {
464
514
  mesh = null;
465
515
  scaling = [1, 1, 1];
466
516
  }
467
- /** Settings for a convex mesh physics shape */
468
- export class PhysXConvexMeshConfig {
517
+ /** Convex mesh physics shape */
518
+ export class PhysXConvexMesh extends Access {
469
519
  mesh = null;
470
520
  scaling = [1, 1, 1];
471
521
  }
@@ -478,8 +528,8 @@ export var PhysXShapeType;
478
528
  PhysXShapeType["TriangleMesh"] = "triangleMesh";
479
529
  PhysXShapeType["ConvexMesh"] = "convexMesh";
480
530
  })(PhysXShapeType || (PhysXShapeType = {}));
481
- /** 'physx' component configuration */
482
- export class PhysXComponent {
531
+ /** 'physx' component */
532
+ export class PhysXComponent extends Access {
483
533
  static = false;
484
534
  kinematic = false;
485
535
  simulate = true;
@@ -508,8 +558,8 @@ export class PhysXComponent {
508
558
  solverPositionIterations = 4;
509
559
  solverVelocityIterations = 1;
510
560
  }
511
- /** 'mesh' component configuration */
512
- export class MeshComponent {
561
+ /** 'mesh' component */
562
+ export class MeshComponent extends Access {
513
563
  material = null;
514
564
  mesh = null;
515
565
  skin = null;
@@ -530,8 +580,8 @@ export var TextWrapMode;
530
580
  TextWrapMode["Hard"] = "hard";
531
581
  TextWrapMode["Clip"] = "clip";
532
582
  })(TextWrapMode || (TextWrapMode = {}));
533
- /** 'text' component configuration */
534
- export class TextComponent {
583
+ /** 'text' component */
584
+ export class TextComponent extends Access {
535
585
  alignment = 'center';
536
586
  verticalAlignment = 'middle';
537
587
  characterSpacing = 0.0;
@@ -542,20 +592,20 @@ export class TextComponent {
542
592
  wrapMode = TextWrapMode.None;
543
593
  wrapWidth = 0.0;
544
594
  }
545
- /** Settings for a sphere collider */
546
- export class SphereConfig {
595
+ /** Sphere collider */
596
+ export class Sphere extends Access {
547
597
  radius = 1.0;
548
598
  }
549
- /** Settings for a AxisAlignedBoundingBox collider */
550
- export class AABBConfig {
599
+ /** AxisAlignedBoundingBox collider */
600
+ export class AABB extends Access {
551
601
  extents = [1.0, 1.0, 1.0];
552
602
  }
553
- /** Settings for a box collider */
554
- export class BoxConfig {
603
+ /** Box collider */
604
+ export class Box extends Access {
555
605
  extents = [1.0, 1.0, 1.0];
556
606
  }
557
- /** 'collision' component configuration */
558
- export class CollisionComponent {
607
+ /** 'collision' component */
608
+ export class CollisionComponent extends Access {
559
609
  collider = 'sphere';
560
610
  sphere;
561
611
  aabb;
@@ -573,21 +623,21 @@ export var InputType;
573
623
  InputType["RayLeft"] = "ray left";
574
624
  InputType["RayRight"] = "ray right";
575
625
  })(InputType || (InputType = {}));
576
- /** 'input' component configuration */
577
- export class InputComponent {
626
+ /** 'input' component */
627
+ export class InputComponent extends Access {
578
628
  type = InputType.Head;
579
629
  }
580
- export class AnimationEvent {
630
+ export class AnimationEvent extends Access {
581
631
  time = 0.0;
582
632
  name = '';
583
633
  }
584
- export class RootMotion {
634
+ export class RootMotion extends Access {
585
635
  target = null;
586
636
  translationAxis = 0;
587
637
  rotationAxis = 0;
588
638
  }
589
639
  /** Animation resource */
590
- export class AnimationResource {
640
+ export class AnimationResource extends Resource {
591
641
  /** Name of the animation */
592
642
  name = 'animation';
593
643
  /** Whether to compress the animation */
@@ -598,31 +648,31 @@ export class AnimationResource {
598
648
  events = [];
599
649
  rootMotion;
600
650
  }
601
- /** Component configuration */
602
- export class ComponentConfig {
651
+ /** Component */
652
+ export class ObjectComponent extends Access {
603
653
  /** Component type */
604
654
  type = null;
605
655
  /** Whether the component is active */
606
656
  active = true;
607
- /** Configuration for animation components */
657
+ /** Animation component */
608
658
  animation;
609
- /** Configuration for collision components */
659
+ /** Collision component */
610
660
  collision;
611
- /** Configuration for input components */
661
+ /** Input component */
612
662
  input;
613
- /** Configuration for light components */
663
+ /** Light component */
614
664
  light;
615
- /** Configuration for mesh components */
665
+ /** Mesh component */
616
666
  mesh;
617
- /** Configuration for physx components */
667
+ /** Physx component */
618
668
  physx;
619
- /** Configuration for text components */
669
+ /** Text component */
620
670
  text;
621
- /** Configuration for view components */
671
+ /** View component */
622
672
  view;
623
673
  }
624
674
  /** Object resource */
625
- export class ObjectResource {
675
+ export class ObjectResource extends Resource {
626
676
  /** Name of the object */
627
677
  name = 'object';
628
678
  /** Translation vector */
@@ -639,7 +689,7 @@ export class ObjectResource {
639
689
  components = [];
640
690
  }
641
691
  /** Skin resource */
642
- export class SkinResource {
692
+ export class SkinResource extends Resource {
643
693
  /** Name of the skin */
644
694
  name = 'skin';
645
695
  /** List of objects that make up the joints of this skin */
@@ -690,7 +740,7 @@ export var MeshSorting;
690
740
  MeshSorting["MeshIndex"] = "mesh-index";
691
741
  })(MeshSorting || (MeshSorting = {}));
692
742
  /** Pipeline resource */
693
- export class PipelineResource {
743
+ export class PipelineResource extends Resource {
694
744
  name = 'pipeline';
695
745
  doubleSided = false;
696
746
  castShadows = false;
@@ -711,7 +761,7 @@ export class PipelineResource {
711
761
  depthFunction = DepthFunction.Less;
712
762
  }
713
763
  /** Font resource */
714
- export class FontResource {
764
+ export class FontResource extends Resource {
715
765
  /** Name of the font */
716
766
  name = 'font';
717
767
  /** Which characters need to be renderable with this font */
@@ -722,61 +772,17 @@ export class FontResource {
722
772
  outlineSize = 0.1;
723
773
  }
724
774
  /** Language resource */
725
- export class LanguageResource {
775
+ export class LanguageResource extends Resource {
726
776
  /** Name of the language */
727
777
  name = 'language';
728
778
  /** Whether this is the default language */
729
779
  isDefault = false;
730
780
  }
731
781
  /** File resource */
732
- export class FileResource {
782
+ export class FileResource extends Resource {
733
783
  fileName = '';
734
784
  importerName = '';
735
785
  importPhysicalAsPhongMaterials = true;
736
786
  }
737
- /**
738
- * Access to Wonderland Editor's data.
739
- *
740
- * Hold control and hover any field in Wonderland Editor to see its JSON path.
741
- * The path is equivalent to how you find the matching chain of properties.
742
- * @example
743
- *
744
- * ```
745
- * /objects/123/components/0/text/text
746
- * ```
747
- *
748
- * Will match the following code:
749
- *
750
- * ```ts
751
- * WL.data.objects[123].components[0].text.text
752
- * ```
753
- */
754
- export class EditorData {
755
- /** Project settings */
756
- settings = new Settings();
757
- /** List of scene file paths */
758
- files = [];
759
- /** Animation resources */
760
- animations = [];
761
- /** Object resources */
762
- objects = [];
763
- /** Skin resources */
764
- skins = [];
765
- /** Image resources */
766
- images = [];
767
- /** Shader resources */
768
- shaders = [];
769
- /** Mesh resources */
770
- meshes = [];
771
- /** Texture resources */
772
- textures = [];
773
- /** Material resources */
774
- materials = [];
775
- /** Font resources */
776
- fonts = [];
777
- /** Pipeline resources */
778
- pipelines = [];
779
- /** Language resources */
780
- languages = [];
787
+ export class ResourceSection {
781
788
  }
782
- export let data = (global._wl_internalBinding ?? (() => { }))('data');
package/dist/index.d.ts CHANGED
@@ -4,10 +4,34 @@ export * as tools from './tools.js';
4
4
  export * from './project.js';
5
5
  /** Editor plugin */
6
6
  export declare class EditorPlugin {
7
+ /** Name of the plugin */
7
8
  name: string;
8
- draw?: () => void;
9
- preProjectSave?: () => boolean;
10
- postProjectLoad?: () => boolean;
11
- prePackage?: () => boolean;
12
- postPackage?: () => boolean;
9
+ /**
10
+ * Called to let the plugin draw it's ui. See {@link ui}.
11
+ */
12
+ draw?(): void;
13
+ /**
14
+ * Called before a project is saved
15
+ *
16
+ * @returns `false` to indicate failure to save.
17
+ */
18
+ preProjectSave?(): boolean;
19
+ /**
20
+ * Called after a project is loaded
21
+ *
22
+ * @returns `false` to indicate failure to load.
23
+ */
24
+ postProjectLoad?: boolean;
25
+ /**
26
+ * Called before a project is packaged
27
+ *
28
+ * @returns `false` to abort packaging.
29
+ */
30
+ prePackage?(): boolean;
31
+ /**
32
+ * Called after a project is packaged
33
+ *
34
+ * @returns `false` to abort packaging.
35
+ */
36
+ postPackage?(): boolean;
13
37
  }
package/dist/index.js CHANGED
@@ -6,10 +6,12 @@ export { tools_1 as tools };
6
6
  export * from './project.js';
7
7
  /** Editor plugin */
8
8
  export class EditorPlugin {
9
+ /** Name of the plugin */
9
10
  name = 'Editor Plugin';
10
- draw;
11
- preProjectSave;
11
+ /**
12
+ * Called after a project is loaded
13
+ *
14
+ * @returns `false` to indicate failure to load.
15
+ */
12
16
  postProjectLoad;
13
- prePackage;
14
- postPackage;
15
17
  }
package/dist/native.d.ts CHANGED
@@ -17,12 +17,13 @@ interface NativeUiAPI {
17
17
  checkbox(label: string, value: boolean): boolean | null;
18
18
  colorEdit4(label: string, value: Float32Array): boolean;
19
19
  dummy(width: number, height: number): void;
20
- sameLine(offset: number): void;
20
+ sameLine(offset?: number): void;
21
21
  separator(): void;
22
22
  spinner(): void;
23
23
  beginGroup(): void;
24
24
  endGroup(): void;
25
25
  }
26
+ /** Project paths */
26
27
  export interface Project {
27
28
  /**
28
29
  * Root directory of the project
package/dist/ui.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
- /** Image to be used in the {@ref Ui}. */
2
+ /** Image to be used in {@link ui}. */
3
3
  export declare class UiImage {
4
4
  _id: number;
5
5
  constructor(id: number);
@@ -91,7 +91,7 @@ export declare const dummy: (width: number, height: number) => void;
91
91
  *
92
92
  * @param offset Offset on the x axis.
93
93
  */
94
- export declare const sameLine: (offset: number) => void;
94
+ export declare const sameLine: (offset?: number) => void;
95
95
  /** Separator line. */
96
96
  export declare const separator: () => void;
97
97
  /** Begin a widget group. */
package/dist/ui.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { awaitJob } from './tools.js';
2
2
  const ui = _wl_internalBinding('ui');
3
- /** Image to be used in the {@ref Ui}. */
3
+ /** Image to be used in {@link ui}. */
4
4
  export class UiImage {
5
5
  _id = -1;
6
6
  constructor(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderlandengine/editor-api",
3
- "version": "1.2.3-dev.2",
3
+ "version": "1.2.4",
4
4
  "description": "Wonderland Engine's Editor API for plugins - very experimental.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "git+https://github.com/WonderlandEngine/api.git"
14
+ "url": "git+https://github.com/WonderlandEngine/editor-api.git"
15
15
  },
16
16
  "keywords": [
17
17
  "webxr",