babylonjs-editor 4.2.0 → 4.3.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.
Files changed (2) hide show
  1. package/index.d.ts +297 -11
  2. package/package.json +11 -11
package/index.d.ts CHANGED
@@ -689,6 +689,10 @@ declare module 'babylonjs-editor/renderer/editor/tools/tools' {
689
689
  * @param timeMs the time in milliseconds to wait.
690
690
  */
691
691
  static Wait(timeMs: number): Promise<void>;
692
+ /**
693
+ * Waits for the next animation frame.
694
+ */
695
+ static WaitNextAnimationFrame(): Promise<void>;
692
696
  /**
693
697
  * Returns the given array by keeping only distinct values.
694
698
  * @param array the array to filter.
@@ -1275,11 +1279,6 @@ declare module 'babylonjs-editor/renderer/editor/components/assets-browser/files
1275
1279
  * Defines the reference to the assets worker.
1276
1280
  */
1277
1281
  static AssetWorker: IWorkerConfiguration;
1278
- /**
1279
- * Defines the reference to the drag'n'dropped item.
1280
- * @hidden
1281
- */
1282
- static _DragAndDroppedItem: Nullable<AssetsBrowserItemHandler>;
1283
1282
  /**
1284
1283
  * Initialzes the item handler.
1285
1284
  */
@@ -1532,11 +1531,11 @@ declare module 'babylonjs-editor/renderer/editor/assets/textures' {
1532
1531
  }
1533
1532
 
1534
1533
  declare module 'babylonjs-editor/renderer/editor/components/inspector' {
1534
+ import { Undefinable } from "babylonjs-editor/shared/types";
1535
1535
  import * as React from "react";
1536
1536
  import { Editor } from "babylonjs-editor/renderer/editor/editor";
1537
1537
  import { AbstractInspector } from "babylonjs-editor/renderer/editor/components/inspectors/abstract-inspector";
1538
1538
  import { AbstractInspectorLegacy } from "babylonjs-editor/renderer/editor/components/inspectors/abstract-inspector-legacy";
1539
- import { Undefinable } from "babylonjs-editor/shared/types";
1540
1539
  export interface IObjectInspector {
1541
1540
  ctor: (new (props: IObjectInspectorProps) => AbstractInspectorLegacy<any> | AbstractInspector<any, any>);
1542
1541
  ctorNames: string[];
@@ -1797,6 +1796,10 @@ declare module 'babylonjs-editor/renderer/editor/components/inspectors/abstract-
1797
1796
  * Defines the reference to the edited root object (node, sound, etc.).
1798
1797
  */
1799
1798
  protected selectedObject: T;
1799
+ /**
1800
+ * @hidden
1801
+ */
1802
+ protected readonly _inspectorName: string;
1800
1803
  /**
1801
1804
  * Constructor.
1802
1805
  * @param props the component's props.
@@ -2420,7 +2423,10 @@ declare module 'babylonjs-editor/renderer/editor/gui/inspector/fields/vector3' {
2420
2423
  }
2421
2424
 
2422
2425
  declare module 'babylonjs-editor/renderer/editor/gui/inspector/notifier' {
2426
+ import { Nullable } from "babylonjs-editor/shared/types";
2423
2427
  import * as React from "react";
2428
+ import { _IDragAndDroppedItem } from "babylonjs-editor/renderer/editor/components/graph";
2429
+ import { AssetsBrowserItemHandler } from "babylonjs-editor/renderer/editor/components/assets-browser/files/item-handler";
2424
2430
  export interface IInspectorNotifierChangeOptions {
2425
2431
  /**
2426
2432
  * Defines the caller that notifies the change. This is typically used to don't listen themselves.
@@ -2450,6 +2456,8 @@ declare module 'babylonjs-editor/renderer/editor/gui/inspector/notifier' {
2450
2456
  * @param caller defines the reference to the original caller.
2451
2457
  */
2452
2458
  static Unregister(caller: any): void;
2459
+ static _DragAndDroppedGraphItem: Nullable<_IDragAndDroppedItem>;
2460
+ static _DragAndDroppedAssetItem: Nullable<AssetsBrowserItemHandler>;
2453
2461
  /**
2454
2462
  * Called on the user drops the asset in a supported inspector field.
2455
2463
  * @param ev defiens the reference to the event object.
@@ -2463,6 +2471,24 @@ declare module 'babylonjs-editor/renderer/editor/gui/inspector/notifier' {
2463
2471
  declare module 'babylonjs-editor/renderer/editor/gui/inspector/fields/color-picker' {
2464
2472
  import * as React from "react";
2465
2473
  import { Color3, Color4 } from "babylonjs";
2474
+ export interface IColor4Like {
2475
+ /**
2476
+ * Defines the red component (between 0 and 1, default is 0)
2477
+ */
2478
+ r: number;
2479
+ /**
2480
+ * Defines the green component (between 0 and 1, default is 0)
2481
+ */
2482
+ g: number;
2483
+ /**
2484
+ * Defines the blue component (between 0 and 1, default is 0)
2485
+ */
2486
+ b: number;
2487
+ /**
2488
+ * Defines the alpha component (between 0 and 1, default is 1)
2489
+ */
2490
+ a: number;
2491
+ }
2466
2492
  export interface IInspectorColorPickerProps {
2467
2493
  /**
2468
2494
  * Defines the reference to the object to modify.
@@ -2566,7 +2592,7 @@ declare module 'babylonjs-editor/renderer/editor/gui/inspector/fields/list' {
2566
2592
  /**
2567
2593
  * Defines the label of the field.
2568
2594
  */
2569
- label: string;
2595
+ label: string | JSX.Element;
2570
2596
  /**
2571
2597
  * Defines the list of items drawn in the suggest.
2572
2598
  */
@@ -2579,6 +2605,10 @@ declare module 'babylonjs-editor/renderer/editor/gui/inspector/fields/list' {
2579
2605
  * Defines the optional list of all available drag'n'droppable types.
2580
2606
  */
2581
2607
  dndHandledTypes?: string[];
2608
+ /**
2609
+ * Defines the optional color to apply on the border left.
2610
+ */
2611
+ borderLeftColor?: string;
2582
2612
  /**
2583
2613
  * Defines the optional callback called on the value changes.
2584
2614
  * @param value defines the new value of the object's property.
@@ -2979,6 +3009,11 @@ declare module 'babylonjs-editor/renderer/editor/project/typings' {
2979
3009
  * store in the workspace JSON file.
2980
3010
  */
2981
3011
  export type PhysicsEngineType = "cannon" | "oimo" | "ammo";
3012
+ /**
3013
+ * Defines the values of available package managers than can be used by
3014
+ * the editor for each workspace. The default value is "npm".
3015
+ */
3016
+ export type PackageManagerType = "npm" | "yarn";
2982
3017
  export interface IWorkSpace {
2983
3018
  /**
2984
3019
  * Defines the version of the Editor that handled the project.
@@ -3016,6 +3051,17 @@ declare module 'babylonjs-editor/renderer/editor/project/typings' {
3016
3051
  * Defines the dictionary that contains the preferences of external plugins in the editor.
3017
3052
  */
3018
3053
  pluginsPreferences?: Undefinable<IStringDictionary<any>>;
3054
+ /**
3055
+ * Defines the package manager used by the project.
3056
+ * Can be npm or yarn.
3057
+ */
3058
+ packageManager: PackageManagerType;
3059
+ /**
3060
+ * Defines the custom directory where to generate the output scenes. By default,
3061
+ * the value is the working directory of the workspace.
3062
+ * @default "./"
3063
+ */
3064
+ outputSceneDirectory: string;
3019
3065
  /**
3020
3066
  * Defines wether or not the project should be played in an isolated iFrame in the preview
3021
3067
  * panel when the user clicks the "play button". This is typically useful to avoid conflicts between
@@ -3111,6 +3157,10 @@ declare module 'babylonjs-editor/renderer/editor/project/typings' {
3111
3157
  * Defines the list of the files associated to the project.
3112
3158
  */
3113
3159
  filesList?: string[];
3160
+ /**
3161
+ * Defines the list of scene's animation groups.
3162
+ */
3163
+ animationGroups: string[];
3114
3164
  /**
3115
3165
  * Defines the list of scene's cameras.
3116
3166
  */
@@ -3207,6 +3257,10 @@ declare module 'babylonjs-editor/renderer/editor/project/typings' {
3207
3257
  */
3208
3258
  graphs: Undefinable<string[]>;
3209
3259
  };
3260
+ /**
3261
+ * Defines the list of all project's cinematics.
3262
+ */
3263
+ cinematics: string[];
3210
3264
  /**
3211
3265
  * Defines some useful datas
3212
3266
  */
@@ -3343,6 +3397,7 @@ declare module 'babylonjs-editor/renderer/editor/project/project-exporter' {
3343
3397
 
3344
3398
  declare module 'babylonjs-editor/renderer/editor/project/project' {
3345
3399
  import { Nullable } from "babylonjs-editor/shared/types";
3400
+ import { Cinematic } from "babylonjs-editor/renderer/editor/cinematic/cinematic";
3346
3401
  import { IProject } from "babylonjs-editor/renderer/editor/project/typings";
3347
3402
  export class Project {
3348
3403
  /**
@@ -3357,6 +3412,10 @@ declare module 'babylonjs-editor/renderer/editor/project/project' {
3357
3412
  * Defines the current project datas.
3358
3413
  */
3359
3414
  static Project: Nullable<IProject>;
3415
+ /**
3416
+ * Defines the list of all available cinematics for the project.
3417
+ */
3418
+ static Cinematics: Cinematic[];
3360
3419
  /**
3361
3420
  * Returns the project path set when opened the editor from the OS file system.
3362
3421
  */
@@ -3423,6 +3482,10 @@ declare module 'babylonjs-editor/renderer/editor/project/workspace' {
3423
3482
  * @param projectPath the absolute path of the saved project.
3424
3483
  */
3425
3484
  static WriteWorkspaceFile(projectPath: string): Promise<void>;
3485
+ /**
3486
+ * Returns the relative path to the directory where the output scene should be written.
3487
+ */
3488
+ static get OutputSceneDirectory(): string;
3426
3489
  /**
3427
3490
  * Refreshes the list of available projects in the workspace.
3428
3491
  */
@@ -3504,6 +3567,18 @@ declare module 'babylonjs-editor/renderer/editor/project/workspace' {
3504
3567
  * @param editor defines the editor reference.
3505
3568
  */
3506
3569
  static RestartTypeScriptWatcher(editor: Editor): Nullable<IEditorProcess>;
3570
+ /**
3571
+ * Returns wether or not the major Babylon.JS version of the project matches with the one of the editor.
3572
+ * Checked at initialization time of the Editor.
3573
+ * @param version defines the version of Babylon.JS being used by the editor.
3574
+ */
3575
+ static MatchesEditorBabylonJSMajorVersion(version: string): Promise<boolean>;
3576
+ /**
3577
+ * Configures the package.json file of the project to match the Babylon.JS version used in the editor.
3578
+ * Checked at initialization time of the Editor.
3579
+ * @param version defines the version of Babylon.JS being used by the editor.
3580
+ */
3581
+ static MatchBabylonJSEditorVersion(version: string): Promise<void>;
3507
3582
  /**
3508
3583
  * Kills all the existing programs.
3509
3584
  */
@@ -3526,6 +3601,10 @@ declare module 'babylonjs-editor/renderer/editor/project/scene-exporter' {
3526
3601
  * Defines wether or not files are forced to be re-generated.
3527
3602
  */
3528
3603
  forceRegenerateFiles?: boolean;
3604
+ /**
3605
+ * Defines wether or not all compressed textures should be regenerated.
3606
+ */
3607
+ forceRegenerateCompressedTextures?: boolean;
3529
3608
  /**
3530
3609
  * Defines wether or not all compressed texture formats should be generated.
3531
3610
  * Typically used when exporting final scene version.
@@ -3767,11 +3846,11 @@ declare module 'babylonjs-editor/renderer/editor/gui/confirm' {
3767
3846
  /**
3768
3847
  * The title of the dialog.
3769
3848
  */
3770
- title: string;
3849
+ title: React.ReactNode;
3771
3850
  /**
3772
3851
  * The message of the dialog.
3773
3852
  */
3774
- message: string;
3853
+ message: React.ReactNode;
3775
3854
  /**
3776
3855
  * The icon to show on top-left of the dialog.
3777
3856
  */
@@ -3792,7 +3871,7 @@ declare module 'babylonjs-editor/renderer/editor/gui/confirm' {
3792
3871
  * @param message the message of the dialog.
3793
3872
  * @param icon the icon of the dialog to show on top-left.
3794
3873
  */
3795
- static Show(title: string, message: string, icon?: Undefinable<IconName | JSX.Element>): Promise<boolean>;
3874
+ static Show(title: React.ReactNode, message: React.ReactNode, icon?: Undefinable<IconName | JSX.Element>): Promise<boolean>;
3796
3875
  /**
3797
3876
  * Renders the component.
3798
3877
  */
@@ -4474,6 +4553,10 @@ declare module 'babylonjs-editor/renderer/editor/components/graph' {
4474
4553
  */
4475
4554
  showLights: boolean;
4476
4555
  }
4556
+ export interface _IDragAndDroppedItem {
4557
+ nodeId: string;
4558
+ onDropInInspector: (ev: React.DragEvent<HTMLElement>, object: any, property: string) => Promise<void>;
4559
+ }
4477
4560
  export class Graph extends React.Component<IGraphProps, IGraphState> {
4478
4561
  /**
4479
4562
  * Defines the last selected node in the graph.
@@ -5069,7 +5152,7 @@ declare module 'babylonjs-editor/renderer/editor/workers/workers' {
5069
5152
  * @param parameters defines the parameters to send to the function called in the worker.
5070
5153
  * @returns the result of the function computed in the worker's context.
5071
5154
  */
5072
- static ExecuteFunction<TClass, TFunction extends FunctionPropertyNames<TClass>>(config: IWorkerConfiguration, fnName: TFunction, ...parameters: Parameters<TClass[TFunction]>): Promise<Awaitable<ReturnType<TClass[TFunction]>>>;
5155
+ static ExecuteFunction<TClass extends Record<any, any>, TFunction extends FunctionPropertyNames<TClass>>(config: IWorkerConfiguration, fnName: TFunction, ...parameters: Parameters<TClass[TFunction]>): Promise<Awaitable<ReturnType<TClass[TFunction]>>>;
5073
5156
  }
5074
5157
  }
5075
5158
 
@@ -5457,6 +5540,59 @@ declare module 'babylonjs-editor/renderer/editor/tools/ktx' {
5457
5540
  }
5458
5541
  }
5459
5542
 
5543
+ declare module 'babylonjs-editor/renderer/editor/cinematic/cinematic' {
5544
+ import { Nullable } from "babylonjs-editor/shared/types";
5545
+ import { AnimationGroup, Scene } from "babylonjs";
5546
+ import { ICinematic, ICinematicCamera, ICinematicTrack } from "babylonjs-editor/renderer/editor/cinematic/base";
5547
+ export class Cinematic implements ICinematic {
5548
+ /**
5549
+ * @hidden
5550
+ */
5551
+ _animationGroup: Nullable<AnimationGroup>;
5552
+ /**
5553
+ * Plays the cinematic.
5554
+ */
5555
+ play(scene: Scene, from?: number): void;
5556
+ /**
5557
+ * Stops the cinematic.
5558
+ */
5559
+ stop(): void;
5560
+ /**
5561
+ * Generates the animation group and returns its reference.
5562
+ */
5563
+ generateAnimationGroup(scene: Scene): AnimationGroup;
5564
+ /**
5565
+ * Serializes the cinematic.
5566
+ */
5567
+ serialize(): ICinematic;
5568
+ /**
5569
+ * Parses the cinematic according the given parsed data.
5570
+ * @param parsedData defines the reference to object as JSON representation of cinematic.
5571
+ */
5572
+ static Parse(parsedData: ICinematic): Cinematic;
5573
+ /**
5574
+ * Defines the name of the cinematic.
5575
+ */
5576
+ name: string;
5577
+ /**
5578
+ * Defines the number of frames computed per second.
5579
+ */
5580
+ framesPerSecond: number;
5581
+ /**
5582
+ * Defines wether or not the cinematic is embedded in the file scene file output.
5583
+ */
5584
+ embedInSceneFile: boolean;
5585
+ /**
5586
+ * Defines the reference to the camera's configuration for the cinematic.
5587
+ */
5588
+ camera: ICinematicCamera;
5589
+ /**
5590
+ * Defines the list of all cinematic tracks.
5591
+ */
5592
+ tracks: ICinematicTrack[];
5593
+ }
5594
+ }
5595
+
5460
5596
  declare module 'babylonjs-editor/renderer/editor/tools/process' {
5461
5597
  import { IPty } from "node-pty";
5462
5598
  import { Terminal, IDisposable } from "xterm";
@@ -5732,6 +5868,84 @@ declare module 'babylonjs-editor/renderer/editor/components/console/log' {
5732
5868
  }
5733
5869
  }
5734
5870
 
5871
+ declare module 'babylonjs-editor/renderer/editor/cinematic/base' {
5872
+ import { CinematicTrackType, ICinematicAnimationGroupTrack, ICinematicPropertyGroupTrack, ICinematicPropertyTrack, ICinematicTrackGroup } from "babylonjs-editor/renderer/editor/cinematic/track";
5873
+ export interface ICinematicCamera {
5874
+ /**
5875
+ * Defines the id of the camera used for the cinematic.
5876
+ */
5877
+ cameraId: string;
5878
+ /**
5879
+ * Defines the list of animation keys for camera's fov.
5880
+ */
5881
+ fov: ICinematicTrack;
5882
+ /**
5883
+ * Defines the list of animation keys for camera's position.
5884
+ */
5885
+ position: ICinematicTrack;
5886
+ /**
5887
+ * Defines the list of animation keys for camera's target.
5888
+ */
5889
+ target: ICinematicTrack;
5890
+ /**
5891
+ * Defines the list of animation keys for camera's DOF focus distance.
5892
+ */
5893
+ focusDistance: ICinematicTrack;
5894
+ /**
5895
+ * Defines the list of animation keys for camera's DOF F-Stop.
5896
+ */
5897
+ fStop: ICinematicTrack;
5898
+ /**
5899
+ * Defines the list of animation keys for camera's DOF focal length.
5900
+ */
5901
+ focalLength: ICinematicTrack;
5902
+ }
5903
+ export interface ICinematicTrack {
5904
+ /**
5905
+ * Defines the type of the cinematic track.
5906
+ */
5907
+ type: CinematicTrackType;
5908
+ /**
5909
+ * In case of group, defines the configuration of the group.
5910
+ */
5911
+ group?: ICinematicTrackGroup;
5912
+ /**
5913
+ * In case of property track, defines the configuration of the animated property.
5914
+ */
5915
+ property?: ICinematicPropertyTrack;
5916
+ /**
5917
+ * In case of property group track, defines the configuration of the animated property for multiple nodes.
5918
+ */
5919
+ propertyGroup?: ICinematicPropertyGroupTrack;
5920
+ /**
5921
+ * In case of animation group track, defines the configuration of the animation group.
5922
+ */
5923
+ animationGroup?: ICinematicAnimationGroupTrack;
5924
+ }
5925
+ export interface ICinematic {
5926
+ /**
5927
+ * Defines the name of the cinematic.
5928
+ */
5929
+ name: string;
5930
+ /**
5931
+ * Defines the number of frames computed per second for the cinematic.
5932
+ */
5933
+ framesPerSecond: number;
5934
+ /**
5935
+ * Defines wether or not the cinematic is embedded in the file scene file output.
5936
+ */
5937
+ embedInSceneFile?: boolean;
5938
+ /**
5939
+ * Defines the reference to the camera's configuration for the cinematic.
5940
+ */
5941
+ camera: ICinematicCamera;
5942
+ /**
5943
+ * Defines the list of all cinematic tracks.
5944
+ */
5945
+ tracks: ICinematicTrack[];
5946
+ }
5947
+ }
5948
+
5735
5949
  declare module 'babylonjs-editor/renderer/editor/scene/icons' {
5736
5950
  import { UtilityLayerRenderer, Observable } from "babylonjs";
5737
5951
  import { Editor } from "babylonjs-editor/renderer/editor/editor";
@@ -5773,3 +5987,75 @@ declare module 'babylonjs-editor/renderer/editor' {
5773
5987
  export default Editor;
5774
5988
  }
5775
5989
 
5990
+ declare module 'babylonjs-editor/renderer/editor/cinematic/track' {
5991
+ import { IAnimationKey } from "babylonjs";
5992
+ import { ICinematicTrack } from "babylonjs-editor/renderer/editor/cinematic/base";
5993
+ export enum CinematicTrackType {
5994
+ Group = "group",
5995
+ Property = "property",
5996
+ PropertyGroup = "propertyGroup",
5997
+ AnimationGroup = "animationGroup"
5998
+ }
5999
+ export interface ICinematicTrackGroup {
6000
+ /**
6001
+ * Defines the name of the group.
6002
+ */
6003
+ name: string;
6004
+ /**
6005
+ * Defines the array of tracks.
6006
+ */
6007
+ tracks: ICinematicTrack[];
6008
+ }
6009
+ export interface ICinematicAnimationGroupSlot {
6010
+ /**
6011
+ * Defines the position of the slot in the timeline expressed in pixels.
6012
+ */
6013
+ position: number;
6014
+ /**
6015
+ * Defines the end frame of the track in the animation group.
6016
+ */
6017
+ end: number;
6018
+ /**
6019
+ * Defines the start frame of the track in the animation group.
6020
+ */
6021
+ start: number;
6022
+ }
6023
+ export interface ICinematicAnimationGroupTrack {
6024
+ /**
6025
+ * Defines the name of the animation group to play.
6026
+ */
6027
+ name: string;
6028
+ /**
6029
+ * Defines the list of all animation group slots.
6030
+ */
6031
+ slots: ICinematicAnimationGroupSlot[];
6032
+ }
6033
+ export interface ICinematicPropertyTrackBase {
6034
+ /**
6035
+ * Define the path of the animated property.
6036
+ */
6037
+ propertyPath: string;
6038
+ /**
6039
+ * Defines the list of all animation keys.
6040
+ */
6041
+ keys: IAnimationKey[];
6042
+ /**
6043
+ * Defines the type of the property being animated (float, vector3, etc.).
6044
+ * @see BABYLON.Animation.XType
6045
+ */
6046
+ animationType: number;
6047
+ }
6048
+ export interface ICinematicPropertyTrack extends ICinematicPropertyTrackBase {
6049
+ /**
6050
+ * Defines the id of the node being animated.
6051
+ */
6052
+ nodeId: string;
6053
+ }
6054
+ export interface ICinematicPropertyGroupTrack extends ICinematicPropertyTrackBase {
6055
+ /**
6056
+ * Defines the list of all nodes being animated.
6057
+ */
6058
+ nodeIds: string[];
6059
+ }
6060
+ }
6061
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylonjs-editor",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "Babylon.js Editor is a Web Application helping artists to work with Babylon.js",
5
5
  "productName": "Babylon.js Editor",
6
6
  "typings": "index.d.ts",
@@ -21,16 +21,16 @@
21
21
  "@types/node": "13.9.0",
22
22
  "@types/react": "16.9.19",
23
23
  "@types/react-dom": "16.9.5",
24
- "typescript": "4.0.5",
25
- "babylonjs": "4.2.1",
26
- "babylonjs-gui": "4.2.1",
27
- "babylonjs-inspector": "4.2.1",
28
- "babylonjs-loaders": "4.2.1",
29
- "babylonjs-materials": "4.2.1",
30
- "babylonjs-node-editor": "4.2.1",
31
- "babylonjs-post-process": "4.2.1",
32
- "babylonjs-procedural-textures": "4.2.1",
33
- "babylonjs-serializers": "4.2.1",
24
+ "typescript": "4.6.3",
25
+ "babylonjs": "5.9.0",
26
+ "babylonjs-gui": "5.9.0",
27
+ "babylonjs-inspector": "5.9.0",
28
+ "babylonjs-loaders": "5.9.0",
29
+ "babylonjs-materials": "5.9.0",
30
+ "babylonjs-node-editor": "5.9.0",
31
+ "babylonjs-post-process": "5.9.0",
32
+ "babylonjs-procedural-textures": "5.9.0",
33
+ "babylonjs-serializers": "5.9.0",
34
34
  "@blueprintjs/core": "3.28.1",
35
35
  "@blueprintjs/select": "3.13.2",
36
36
  "react": "16.12.0",