@galacean/engine-core 2.0.0-alpha.49 → 2.0.0-alpha.50

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 (90) hide show
  1. package/dist/main.js +89 -74
  2. package/dist/main.js.map +1 -1
  3. package/dist/module.js +89 -74
  4. package/dist/module.js.map +1 -1
  5. package/package.json +3 -3
  6. package/types/2d/assembler/ISpriteRenderer.d.ts +2 -2
  7. package/types/2d/sprite/Sprite.d.ts +3 -3
  8. package/types/2d/sprite/SpriteMask.d.ts +1 -1
  9. package/types/2d/sprite/SpriteRenderer.d.ts +1 -1
  10. package/types/2d/text/CharInfo.d.ts +1 -1
  11. package/types/2d/text/Font.d.ts +1 -1
  12. package/types/2d/text/SubFont.d.ts +2 -2
  13. package/types/2d/text/TextRenderer.d.ts +2 -2
  14. package/types/Background.d.ts +2 -2
  15. package/types/Camera.d.ts +3 -3
  16. package/types/Component.d.ts +2 -2
  17. package/types/Engine.d.ts +1 -1
  18. package/types/Entity.d.ts +19 -19
  19. package/types/RenderPipeline/Blitter.d.ts +1 -1
  20. package/types/RenderPipeline/DepthOnlyPass.d.ts +1 -1
  21. package/types/RenderPipeline/PipelineUtils.d.ts +1 -1
  22. package/types/RenderPipeline/PrimitiveChunkManager.d.ts +1 -1
  23. package/types/RenderPipeline/RenderContext.d.ts +5 -5
  24. package/types/RenderPipeline/VertexArea.d.ts +2 -2
  25. package/types/Renderer.d.ts +8 -8
  26. package/types/Scene.d.ts +7 -8
  27. package/types/SceneManager.d.ts +5 -6
  28. package/types/Utils.d.ts +1 -1
  29. package/types/animation/AnimationClipCurveBinding.d.ts +1 -1
  30. package/types/animation/AnimationEvent.d.ts +2 -2
  31. package/types/animation/Animator.d.ts +1 -1
  32. package/types/animation/AnimatorController.d.ts +2 -2
  33. package/types/animation/AnimatorControllerParameter.d.ts +1 -1
  34. package/types/animation/AnimatorState.d.ts +3 -3
  35. package/types/animation/AnimatorStateInstance.d.ts +1 -1
  36. package/types/animation/AnimatorStateTransition.d.ts +1 -1
  37. package/types/animation/Keyframe.d.ts +1 -1
  38. package/types/animation/animationCurve/AnimationCurve.d.ts +2 -2
  39. package/types/animation/animationCurve/AnimationRefCurve.d.ts +4 -4
  40. package/types/animation/internal/AnimatorLayerData.d.ts +1 -1
  41. package/types/animation/internal/animationCurveOwner/AnimationCurveOwner.d.ts +4 -4
  42. package/types/asset/AssetPromise.d.ts +4 -4
  43. package/types/asset/JSONAsset.d.ts +1 -1
  44. package/types/asset/Loader.d.ts +2 -2
  45. package/types/asset/ResourceManager.d.ts +1 -1
  46. package/types/audio/AudioClip.d.ts +1 -1
  47. package/types/audio/AudioSource.d.ts +2 -2
  48. package/types/env-probe/Probe.d.ts +1 -1
  49. package/types/graphic/Buffer.d.ts +2 -2
  50. package/types/graphic/Mesh.d.ts +2 -2
  51. package/types/graphic/Primitive.d.ts +5 -5
  52. package/types/input/keyboard/KeyboardManager.d.ts +1 -1
  53. package/types/input/pointer/emitter/IHitResult.d.ts +1 -1
  54. package/types/input/pointer/emitter/PhysicsPointerEventEmitter.d.ts +3 -3
  55. package/types/lighting/KHR_lights.d.ts +13 -1
  56. package/types/mesh/BlendShape.d.ts +1 -1
  57. package/types/mesh/BlendShapeFrame.d.ts +4 -4
  58. package/types/mesh/BlendShapeManager.d.ts +1 -1
  59. package/types/mesh/BufferMesh.d.ts +2 -2
  60. package/types/mesh/ModelMesh.d.ts +4 -4
  61. package/types/mesh/PrimitiveMesh.d.ts +1 -1
  62. package/types/mesh/SkinnedMeshRenderer.d.ts +1 -1
  63. package/types/particle/ParticleGenerator.d.ts +1 -1
  64. package/types/particle/modules/ParticleCompositeCurve.d.ts +2 -2
  65. package/types/particle/modules/ParticleCompositeGradient.d.ts +1 -1
  66. package/types/particle/modules/ParticleGeneratorModule.d.ts +1 -1
  67. package/types/particle/modules/ParticleGradient.d.ts +4 -4
  68. package/types/particle/modules/SubEmitter.d.ts +2 -2
  69. package/types/particle/modules/shape/MeshShape.d.ts +2 -2
  70. package/types/particle/modules/shape/ShapeUtils.d.ts +1 -1
  71. package/types/physics/HitResult.d.ts +2 -2
  72. package/types/physics/joint/Joint.d.ts +3 -3
  73. package/types/physics/shape/ColliderShape.d.ts +3 -3
  74. package/types/physics/shape/MeshColliderShape.d.ts +2 -2
  75. package/types/postProcess/PostProcess.d.ts +6 -6
  76. package/types/postProcess/PostProcessEffectParameter.d.ts +2 -2
  77. package/types/postProcess/PostProcessManager.d.ts +1 -1
  78. package/types/postProcess/PostProcessPass.d.ts +2 -2
  79. package/types/shader/Shader.d.ts +8 -8
  80. package/types/shader/ShaderData.d.ts +3 -3
  81. package/types/shader/ShaderMacro.d.ts +2 -2
  82. package/types/shader/state/BlendState.d.ts +1 -1
  83. package/types/shader/state/DepthState.d.ts +1 -1
  84. package/types/shader/state/RasterState.d.ts +1 -1
  85. package/types/shader/state/RenderState.d.ts +1 -1
  86. package/types/shader/state/StencilState.d.ts +1 -1
  87. package/types/sky/Sky.d.ts +4 -4
  88. package/types/texture/RenderTarget.d.ts +3 -3
  89. package/types/utils/DisorderedArray.d.ts +1 -1
  90. package/types/xr/XRManager.d.ts +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-core",
3
- "version": "2.0.0-alpha.49",
3
+ "version": "2.0.0-alpha.50",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -18,10 +18,10 @@
18
18
  "types/**/*"
19
19
  ],
20
20
  "dependencies": {
21
- "@galacean/engine-math": "2.0.0-alpha.49"
21
+ "@galacean/engine-math": "2.0.0-alpha.50"
22
22
  },
23
23
  "devDependencies": {
24
- "@galacean/engine-design": "2.0.0-alpha.49"
24
+ "@galacean/engine-design": "2.0.0-alpha.50"
25
25
  },
26
26
  "scripts": {
27
27
  "b:types": "tsc"
@@ -8,10 +8,10 @@ import { Sprite } from "../sprite";
8
8
  * Interface for sprite renderer.
9
9
  */
10
10
  export interface ISpriteRenderer {
11
- sprite: Sprite;
11
+ sprite: Sprite | null;
12
12
  color?: Color;
13
13
  tileMode?: SpriteTileMode;
14
14
  tiledAdaptiveThreshold?: number;
15
- _subChunk: SubPrimitiveChunk;
15
+ _subChunk: SubPrimitiveChunk | null;
16
16
  _getChunkManager(): PrimitiveChunkManager;
17
17
  }
@@ -9,7 +9,7 @@ import { SpriteAtlas } from "../atlas/SpriteAtlas";
9
9
  */
10
10
  export declare class Sprite extends ReferResource {
11
11
  /** The name of sprite. */
12
- name: string;
12
+ name: string | null;
13
13
  private _automaticWidth;
14
14
  private _automaticHeight;
15
15
  private _customWidth;
@@ -32,7 +32,7 @@ export declare class Sprite extends ReferResource {
32
32
  /**
33
33
  * The reference to the used texture.
34
34
  */
35
- get texture(): Texture2D;
35
+ get texture(): Texture2D | null;
36
36
  set texture(value: Texture2D);
37
37
  /**
38
38
  * The width of the sprite (in world coordinates).
@@ -96,7 +96,7 @@ export declare class Sprite extends ReferResource {
96
96
  * @param border - Boundaries when using Slice DrawMode, specified in normalized
97
97
  * @param name - The name of Sprite
98
98
  */
99
- constructor(engine: Engine, texture?: Texture2D, region?: Rect, pivot?: Vector2, border?: Vector4, name?: string);
99
+ constructor(engine: Engine, texture?: Texture2D | null, region?: Rect | null, pivot?: Vector2 | null, border?: Vector4 | null, name?: string | null);
100
100
  /**
101
101
  * Clone.
102
102
  * @returns Cloned sprite
@@ -64,7 +64,7 @@ export declare class SpriteMask extends Renderer implements ISpriteRenderer {
64
64
  /**
65
65
  * The Sprite to render.
66
66
  */
67
- get sprite(): Sprite;
67
+ get sprite(): Sprite | null;
68
68
  set sprite(value: Sprite | null);
69
69
  /**
70
70
  * The minimum alpha value used by the mask to select the area of influence defined over the mask's sprite. Value between 0 and 1.
@@ -50,7 +50,7 @@ export declare class SpriteRenderer extends Renderer implements ISpriteRenderer
50
50
  /**
51
51
  * The Sprite to render.
52
52
  */
53
- get sprite(): Sprite;
53
+ get sprite(): Sprite | null;
54
54
  set sprite(value: Sprite | null);
55
55
  /**
56
56
  * Rendering color for the Sprite graphic.
@@ -14,7 +14,7 @@ export interface CharInfo {
14
14
  ascent: number;
15
15
  descent: number;
16
16
  index: number;
17
- data?: Uint8Array;
17
+ data?: Uint8Array | null;
18
18
  uvs: Vector2[];
19
19
  bufferOffset?: Vector2;
20
20
  }
@@ -12,7 +12,7 @@ export declare class Font extends ReferResource {
12
12
  * @param name - The name of font want to create
13
13
  * @returns The font object has been create
14
14
  */
15
- static createFromOS(engine: Engine, name: string): Font;
15
+ static createFromOS(engine: Engine, name: string): Font | null;
16
16
  private _name;
17
17
  private _subFontMap;
18
18
  /**
@@ -22,11 +22,11 @@ export declare class SubFont {
22
22
  /**
23
23
  * @internal
24
24
  */
25
- _getCharInfo(char: string): CharInfo;
25
+ _getCharInfo(char: string): CharInfo | null;
26
26
  /**
27
27
  * @internal
28
28
  */
29
- _getTextureByIndex(index: number): Texture2D;
29
+ _getTextureByIndex(index: number): Texture2D | null;
30
30
  /**
31
31
  * @internal
32
32
  */
@@ -24,7 +24,7 @@ export declare class TextRenderer extends Renderer implements ITextRenderer {
24
24
  private static _charRenderInfos;
25
25
  private _textChunks;
26
26
  /** @internal */
27
- _subFont: SubFont;
27
+ _subFont: SubFont | null;
28
28
  /** @internal */
29
29
  _dirtyFlag: DirtyFlag;
30
30
  private _color;
@@ -64,7 +64,7 @@ export declare class TextRenderer extends Renderer implements ITextRenderer {
64
64
  /**
65
65
  * The font of the Text.
66
66
  */
67
- get font(): Font;
67
+ get font(): Font | null;
68
68
  set font(value: Font);
69
69
  /**
70
70
  * The font size of the Text.
@@ -42,8 +42,8 @@ export declare class Background {
42
42
  * Background texture.
43
43
  * @remarks When `mode` is `BackgroundMode.Texture`, the property will take effects.
44
44
  */
45
- get texture(): Texture2D;
46
- set texture(value: Texture2D);
45
+ get texture(): Texture2D | null;
46
+ set texture(value: Texture2D | null);
47
47
  /**
48
48
  * Background texture fill mode.
49
49
  * @remarks When `mode` is `BackgroundMode.Texture`, the property will take effects.
package/types/Camera.d.ts CHANGED
@@ -95,11 +95,11 @@ export declare class Camera extends Component {
95
95
  /** @internal */
96
96
  _virtualCamera: VirtualCamera;
97
97
  /** @internal */
98
- _replacementShader: Shader;
98
+ _replacementShader: Shader | null;
99
99
  /** @internal */
100
- _replacementSubShaderTag: ShaderTagKey;
100
+ _replacementSubShaderTag: ShaderTagKey | null | undefined;
101
101
  /** @internal */
102
- _replacementFailureStrategy: ReplacementFailureStrategy;
102
+ _replacementFailureStrategy: ReplacementFailureStrategy | null;
103
103
  /** @internal */
104
104
  _cameraIndex: number;
105
105
  private _priority;
@@ -24,9 +24,9 @@ export declare class Component extends EngineObject {
24
24
  */
25
25
  get entity(): Entity;
26
26
  /**
27
- * The scene which the component's entity belongs to.
27
+ * The owning entity's scene, or null/undefined if it is not in a scene.
28
28
  */
29
- get scene(): Scene;
29
+ get scene(): Scene | null | undefined;
30
30
  constructor(entity: Entity);
31
31
  /**
32
32
  * @internal
package/types/Engine.d.ts CHANGED
@@ -79,7 +79,7 @@ export declare class Engine extends EventDispatcher {
79
79
  /** @internal */
80
80
  _basicResources: BasicResources;
81
81
  /** @internal */
82
- _textDefaultFont: Font;
82
+ _textDefaultFont: Font | null;
83
83
  /** @internal */
84
84
  _renderContext: RenderContext;
85
85
  /** @internal */
package/types/Entity.d.ts CHANGED
@@ -23,11 +23,11 @@ export declare class Entity extends EngineObject {
23
23
  /**
24
24
  * @internal
25
25
  */
26
- static _findChildByName(entity: Entity, childIndex: number, paths: string[], pathIndex: number): Entity;
26
+ static _findChildByName(entity: Entity, childIndex: number, paths: string[], pathIndex: number): Entity | null;
27
27
  /**
28
28
  * @internal
29
29
  */
30
- static _traverseSetOwnerScene(entity: Entity, scene: Scene): void;
30
+ static _traverseSetOwnerScene(entity: Entity, scene: Scene | null | undefined): void;
31
31
  /**
32
32
  * @internal
33
33
  */
@@ -53,7 +53,7 @@ export declare class Entity extends EngineObject {
53
53
  /** @internal */
54
54
  _children: Entity[];
55
55
  /** @internal */
56
- _scene: Scene;
56
+ _scene: Scene | null | undefined;
57
57
  /** @internal */
58
58
  _isRoot: boolean;
59
59
  /** @internal */
@@ -83,10 +83,10 @@ export declare class Entity extends EngineObject {
83
83
  */
84
84
  get isActiveInHierarchy(): boolean;
85
85
  /**
86
- * The parent entity.
86
+ * The parent entity, or null if this entity has no parent.
87
87
  */
88
- get parent(): Entity;
89
- set parent(value: Entity);
88
+ get parent(): Entity | null;
89
+ set parent(value: Entity | null);
90
90
  /**
91
91
  * The children entities
92
92
  */
@@ -97,9 +97,9 @@ export declare class Entity extends EngineObject {
97
97
  */
98
98
  get childCount(): number;
99
99
  /**
100
- * The scene the entity belongs to.
100
+ * The owning scene, or null/undefined if this entity is not in a scene.
101
101
  */
102
- get scene(): Scene;
102
+ get scene(): Scene | null | undefined;
103
103
  /**
104
104
  * The sibling index.
105
105
  */
@@ -157,24 +157,24 @@ export declare class Entity extends EngineObject {
157
157
  */
158
158
  removeChild(child: Entity): void;
159
159
  /**
160
+ * Get a child entity by index.
161
+ * @param index - The zero-based child index
162
+ * @returns The child at the index, or undefined if none exists
160
163
  * @deprecated Please use `children` property instead.
161
- * Find child entity by index.
162
- * @param index - The index of the child entity
163
- * @returns The entity that was found
164
164
  */
165
- getChild(index: number): Entity;
165
+ getChild(index: number): Entity | undefined;
166
166
  /**
167
- * Find entity by name.
167
+ * Find the first entity with the given name in this entity and its descendants.
168
168
  * @param name - The name of the entity to find
169
- * @returns The entity that was found
169
+ * @returns The first matching entity, or null if none is found
170
170
  */
171
- findByName(name: string): Entity;
171
+ findByName(name: string): Entity | null;
172
172
  /**
173
- * Find the entity by path.
174
- * @param path - The path of the entity eg: /entity
175
- * @returns The entity that was found
173
+ * Find a descendant by its path relative to this entity.
174
+ * @param path - The entity path, with names separated by "/"
175
+ * @returns The matching entity, this entity for an empty path, or null if none is found
176
176
  */
177
- findByPath(path: string): Entity;
177
+ findByPath(path: string): Entity | null;
178
178
  /**
179
179
  * Create child entity.
180
180
  * @param name - The child entity's name
@@ -24,5 +24,5 @@ export declare class Blitter {
24
24
  * @param passIndex - Pass index to use of the provided material
25
25
  * @param sourceScaleOffset - Source scale and offset
26
26
  */
27
- static blitTexture(engine: Engine, source: Texture2D, destination: RenderTarget | null, mipLevel?: number, viewport?: Vector4, material?: Material, passIndex?: number, sourceScaleOffset?: Vector4): void;
27
+ static blitTexture(engine: Engine, source: Texture2D, destination: RenderTarget | null, mipLevel?: number, viewport?: Vector4, material?: Material | null, passIndex?: number, sourceScaleOffset?: Vector4): void;
28
28
  }
@@ -10,7 +10,7 @@ import { RenderContext } from "./RenderContext";
10
10
  */
11
11
  export declare class DepthOnlyPass extends PipelinePass {
12
12
  readonly supportDepthTexture: boolean;
13
- renderTarget: RenderTarget;
13
+ renderTarget: RenderTarget | null;
14
14
  constructor(engine: Engine);
15
15
  onConfig(camera: Camera): void;
16
16
  onRender(context: RenderContext, cullingResults: CullingResults): void;
@@ -7,5 +7,5 @@ import { RenderTarget, Texture2D, TextureFilterMode, TextureFormat, TextureWrapM
7
7
  export declare class PipelineUtils {
8
8
  static readonly defaultViewport: Vector4;
9
9
  static recreateTextureIfNeeded(engine: Engine, currentTexture: Texture2D | null, width: number, height: number, format: TextureFormat, mipmap: boolean, isSRGBColorSpace: boolean, textureWrapMode: TextureWrapMode, textureFilterMode: TextureFilterMode): Texture2D;
10
- static recreateRenderTargetIfNeeded(engine: Engine, currentRenderTarget: RenderTarget | null, width: number, height: number, colorFormat: TextureFormat | null, depthFormat: TextureFormat | null, needDepthTexture: boolean, mipmap: boolean, isSRGBColorSpace: boolean, antiAliasing: number, textureWrapMode: TextureWrapMode, textureFilterMode: TextureFilterMode): RenderTarget;
10
+ static recreateRenderTargetIfNeeded(engine: Engine, currentRenderTarget: RenderTarget | null | undefined, width: number, height: number, colorFormat: TextureFormat | null, depthFormat: TextureFormat | null, needDepthTexture: boolean, mipmap: boolean, isSRGBColorSpace: boolean, antiAliasing: number, textureWrapMode: TextureWrapMode, textureFilterMode: TextureFilterMode): RenderTarget;
11
11
  }
@@ -9,7 +9,7 @@ export declare class PrimitiveChunkManager {
9
9
  maxVertexCount: number;
10
10
  primitiveChunks: PrimitiveChunk[];
11
11
  constructor(engine: Engine, maxVertexCount?: number);
12
- allocateSubChunk(vertexCount: number): SubPrimitiveChunk;
12
+ allocateSubChunk(vertexCount: number): SubPrimitiveChunk | null;
13
13
  freeSubChunk(subChunk: SubPrimitiveChunk): void;
14
14
  uploadBuffer(): void;
15
15
  destroy(): void;
@@ -21,14 +21,14 @@ export declare class RenderContext {
21
21
  private _projectionParams;
22
22
  camera: Camera;
23
23
  virtualCamera: VirtualCamera;
24
- replacementShader: Shader;
25
- replacementTag: ShaderTagKey;
26
- replacementFailureStrategy: ReplacementFailureStrategy;
27
- flipProjection: boolean;
24
+ replacementShader: Shader | null;
25
+ replacementTag: ShaderTagKey | null | undefined;
26
+ replacementFailureStrategy: ReplacementFailureStrategy | null;
27
+ flipProjection: boolean | null;
28
28
  viewMatrix: Matrix;
29
29
  projectionMatrix: Matrix;
30
30
  viewProjectionMatrix: Matrix;
31
- applyVirtualCamera(virtualCamera: VirtualCamera, flipProjection: boolean): void;
31
+ applyVirtualCamera(virtualCamera: VirtualCamera, flipProjection: boolean | null): void;
32
32
  setRenderTarget(destination: RenderTarget | null, viewport: Vector4, mipLevel?: number, faceIndex?: TextureCubeFace): void;
33
33
  garbageCollection(): void;
34
34
  }
@@ -3,8 +3,8 @@ import { IPoolElement } from "../utils/ObjectPool";
3
3
  * @internal
4
4
  */
5
5
  export declare class VertexArea implements IPoolElement {
6
- start?: number;
7
- size?: number;
6
+ start: number;
7
+ size: number;
8
8
  constructor(start?: number, size?: number);
9
9
  dispose?(): void;
10
10
  }
@@ -40,11 +40,11 @@ export declare class Renderer extends Component implements ICloneHook<Renderer>
40
40
  /** @internal */
41
41
  _maskLayer: SpriteMaskLayer;
42
42
  protected _overrideUpdate: boolean;
43
- protected _materials: Material[];
43
+ protected _materials: (Material | null)[];
44
44
  protected _dirtyUpdateFlag: number;
45
45
  protected _rendererLayer: Vector4;
46
46
  protected _bounds: BoundingBox;
47
- protected _transformEntity: Entity;
47
+ protected _transformEntity: Entity | null;
48
48
  private _shaderData;
49
49
  private _mvMatrix;
50
50
  private _mvpMatrix;
@@ -112,29 +112,29 @@ export declare class Renderer extends Component implements ICloneHook<Renderer>
112
112
  * Set the first material.
113
113
  * @param material - The first material
114
114
  */
115
- setMaterial(material: Material): void;
115
+ setMaterial(material: Material | null): void;
116
116
  /**
117
117
  * Set material by index.
118
118
  * @param index - Material index
119
119
  * @param material - The material
120
120
  */
121
- setMaterial(index: number, material: Material): void;
121
+ setMaterial(index: number, material: Material | null): void;
122
122
  /**
123
123
  * Get all instance materials.
124
124
  * @remarks Calling this function for the first time after the material is set will create an instance material to ensure that it is unique to the renderer.
125
125
  * @returns All instance materials
126
126
  */
127
- getInstanceMaterials(): Readonly<Material[]>;
127
+ getInstanceMaterials(): Readonly<(Material | null)[]>;
128
128
  /**
129
129
  * Get all materials.
130
130
  * @returns All materials
131
131
  */
132
- getMaterials(): Readonly<Material[]>;
132
+ getMaterials(): Readonly<(Material | null)[]>;
133
133
  /**
134
134
  * Set all materials.
135
135
  * @param materials - All materials
136
136
  */
137
- setMaterials(materials: Material[]): void;
137
+ setMaterials(materials: (Material | null)[]): void;
138
138
  update(deltaTime: number): void;
139
139
  /**
140
140
  * @internal
@@ -185,7 +185,7 @@ export declare class Renderer extends Component implements ICloneHook<Renderer>
185
185
  /**
186
186
  * @internal
187
187
  */
188
- protected _setTransformEntity(entity: Entity): void;
188
+ protected _setTransformEntity(entity: Entity | null): void;
189
189
  protected _updateBounds(worldBounds: BoundingBox): void;
190
190
  protected _render(context: RenderContext): void;
191
191
  private _createInstanceMaterial;
package/types/Scene.d.ts CHANGED
@@ -59,7 +59,7 @@ export declare class Scene extends EngineObject {
59
59
  /** @internal */
60
60
  _isActiveInEngine: boolean;
61
61
  /** @internal */
62
- _sceneManager: SceneManager;
62
+ _sceneManager: SceneManager | null;
63
63
  /** @internal */
64
64
  _rootEntities: Entity[];
65
65
  private _background;
@@ -137,10 +137,9 @@ export declare class Scene extends EngineObject {
137
137
  */
138
138
  get rootEntities(): Readonly<Entity[]>;
139
139
  /**
140
- * Sun light source.
141
- * @remarks If set this to null, scene will use the brightest directional light.
140
+ * The explicit sun light; null or undefined enables automatic selection.
142
141
  */
143
- get sun(): DirectLight | null;
142
+ get sun(): DirectLight | null | undefined;
144
143
  set sun(light: DirectLight | null);
145
144
  /**
146
145
  * Whether to enable transparent shadow.
@@ -176,11 +175,11 @@ export declare class Scene extends EngineObject {
176
175
  */
177
176
  removeRootEntity(entity: Entity): void;
178
177
  /**
179
- * Get root entity from index.
180
- * @param index - Index
181
- * @returns Entity
178
+ * Get a root entity by index.
179
+ * @param index - The zero-based root entity index
180
+ * @returns The root entity at the index, or undefined if none exists
182
181
  */
183
- getRootEntity(index?: number): Entity | null;
182
+ getRootEntity(index?: number): Entity | undefined;
184
183
  /**
185
184
  * Find entity globally by name.
186
185
  * @param name - Entity name
@@ -54,11 +54,10 @@ export declare class SceneManager {
54
54
  */
55
55
  _destroyAllScene(): void;
56
56
  /**
57
- * @deprecated
58
- * Please use `scenes` instead.
59
- *
60
- * Get the first scene.
57
+ * Get the first scene, or undefined if no scene is registered.
58
+ * @remarks Assigning null or undefined removes the first scene.
59
+ * @deprecated Please use `scenes` instead.
61
60
  */
62
- get activeScene(): Scene;
63
- set activeScene(scene: Scene);
61
+ get activeScene(): Scene | undefined;
62
+ set activeScene(scene: Scene | null | undefined);
64
63
  }
package/types/Utils.d.ts CHANGED
@@ -44,7 +44,7 @@ export declare class Utils {
44
44
  * @param path - The path of the property to get.
45
45
  * @returns Returns the resolved value.
46
46
  */
47
- static _reflectGet(target: object, path: string): object;
47
+ static _reflectGet(target: object, path: string): object | undefined;
48
48
  /**
49
49
  * @internal
50
50
  * @remarks
@@ -28,7 +28,7 @@ export declare class AnimationClipCurveBinding {
28
28
  */
29
29
  getProperty?: string;
30
30
  /** The animation curve. */
31
- curve: AnimationCurve<KeyframeValueType>;
31
+ curve: AnimationCurve<KeyframeValueType> | undefined;
32
32
  private _tempCurveOwner;
33
33
  /**
34
34
  * @internal
@@ -3,9 +3,9 @@
3
3
  */
4
4
  export declare class AnimationEvent {
5
5
  /** The time when the event be triggered. */
6
- time: number;
6
+ time: number | undefined;
7
7
  /** The name of the method called in the script. */
8
8
  functionName: string;
9
9
  /** The parameter that is stored in the event and will be sent to the function. */
10
- parameter: Object;
10
+ parameter: object | undefined;
11
11
  }
@@ -107,7 +107,7 @@ export declare class Animator extends Component implements ICloneHook<Animator>
107
107
  * @param name - The name of the parameter
108
108
  * @param value - The value of the parameter
109
109
  */
110
- getParameterValue(name: string): AnimatorControllerParameterValue;
110
+ getParameterValue(name: string): AnimatorControllerParameterValue | undefined;
111
111
  /**
112
112
  * Set the value of the given parameter.
113
113
  * @param name - The name of the parameter
@@ -39,12 +39,12 @@ export declare class AnimatorController extends ReferResource {
39
39
  * @param name - The name of the parameter
40
40
  * @param defaultValue - The default value of the parameter
41
41
  */
42
- addParameter(name: string, defaultValue?: AnimatorControllerParameterValue): AnimatorControllerParameter;
42
+ addParameter(name: string, defaultValue?: AnimatorControllerParameterValue): AnimatorControllerParameter | null;
43
43
  /**
44
44
  * Add a trigger parameter to the controller.
45
45
  * @param name - The name of the parameter
46
46
  */
47
- addTriggerParameter(name: string): AnimatorControllerParameter;
47
+ addTriggerParameter(name: string): AnimatorControllerParameter | null;
48
48
  /**
49
49
  * Remove a parameter from the controller by name, including trigger parameters.
50
50
  * @param name - The name of the parameter
@@ -6,7 +6,7 @@ export declare class AnimatorControllerParameter {
6
6
  /** The default value of the parameter. */
7
7
  defaultValue: AnimatorControllerParameterValue;
8
8
  /** @internal */
9
- _onNameChanged: (oldName: string, newName: string) => void;
9
+ _onNameChanged: ((oldName: string, newName: string) => void) | null;
10
10
  /** @internal */
11
11
  _isTrigger: boolean;
12
12
  private _name;
@@ -33,8 +33,8 @@ export declare class AnimatorState {
33
33
  /**
34
34
  * The clip that is being played by this animator state.
35
35
  */
36
- get clip(): AnimationClip;
37
- set clip(clip: AnimationClip);
36
+ get clip(): AnimationClip | null | undefined;
37
+ set clip(clip: AnimationClip | null | undefined);
38
38
  /**
39
39
  * The normalized start time of the clip, the range is 0 to 1, default is 0.
40
40
  */
@@ -93,7 +93,7 @@ export declare class AnimatorState {
93
93
  /**
94
94
  * @internal
95
95
  */
96
- _getDuration(): number;
96
+ _getDuration(): number | null;
97
97
  /**
98
98
  * @internal
99
99
  */
@@ -22,7 +22,7 @@ export declare class AnimatorStateInstance {
22
22
  /**
23
23
  * The animation clip of the underlying state.
24
24
  */
25
- get clip(): AnimationClip;
25
+ get clip(): AnimationClip | null | undefined;
26
26
  /**
27
27
  * The normalized clip start time of the underlying state.
28
28
  */
@@ -20,7 +20,7 @@ export declare class AnimatorStateTransition {
20
20
  /** Determines whether the duration of the transition is reported in a fixed duration in seconds or as a normalized time. */
21
21
  isFixedDuration: boolean;
22
22
  /** @internal */
23
- _collection: AnimatorStateTransitionCollection;
23
+ _collection: AnimatorStateTransitionCollection | null;
24
24
  /** @internal */
25
25
  _isExit: boolean;
26
26
  private _conditions;
@@ -17,4 +17,4 @@ export declare class Keyframe<V extends KeyframeValueType, T = V extends number
17
17
  /**
18
18
  * Type of Keyframe value.
19
19
  */
20
- export type KeyframeValueType = number | Vector2 | Vector3 | Vector4 | number[] | Float32Array | Quaternion | Color | Rect | string | boolean | ReferResource;
20
+ export type KeyframeValueType = number | Vector2 | Vector3 | Vector4 | number[] | Float32Array | Quaternion | Color | Rect | string | boolean | ReferResource | null;
@@ -30,7 +30,7 @@ export declare abstract class AnimationCurve<V extends KeyframeValueType> {
30
30
  * Evaluate the curve at time.
31
31
  * @param time - The time within the curve you want to evaluate
32
32
  */
33
- evaluate(time: number): V;
33
+ evaluate(time: number): V | undefined;
34
34
  /**
35
35
  * Removes a key.
36
36
  * @param index - The index of the key to remove
@@ -39,7 +39,7 @@ export declare abstract class AnimationCurve<V extends KeyframeValueType> {
39
39
  /**
40
40
  * @internal
41
41
  */
42
- _evaluate(time: number, evaluateData: IEvaluateData<V>): V;
42
+ _evaluate(time: number, evaluateData: IEvaluateData<V>): V | undefined;
43
43
  /**
44
44
  * @internal
45
45
  */
@@ -3,9 +3,9 @@ import { AnimationCurveLayerOwner } from "../internal/AnimationCurveLayerOwner";
3
3
  import { AnimationCurveOwner } from "../internal/animationCurveOwner/AnimationCurveOwner";
4
4
  import { AnimationCurve } from "./AnimationCurve";
5
5
  /**
6
- * Store a collection of Keyframes that can be evaluated over time.
6
+ * Animates resource references. A `null` keyframe clears the reference.
7
7
  */
8
- export declare class AnimationRefCurve extends AnimationCurve<ReferResource> {
8
+ export declare class AnimationRefCurve extends AnimationCurve<ReferResource | null> {
9
9
  /** @internal */
10
10
  static _isCopyMode: boolean;
11
11
  /** @internal */
@@ -13,7 +13,7 @@ export declare class AnimationRefCurve extends AnimationCurve<ReferResource> {
13
13
  /**
14
14
  * @internal
15
15
  */
16
- static _initializeOwner(owner: AnimationCurveOwner<ReferResource>): void;
16
+ static _initializeOwner(owner: AnimationCurveOwner<ReferResource | null>): void;
17
17
  /**
18
18
  * @internal
19
19
  */
@@ -21,6 +21,6 @@ export declare class AnimationRefCurve extends AnimationCurve<ReferResource> {
21
21
  /**
22
22
  * @internal
23
23
  */
24
- static _setValue(value: ReferResource): ReferResource;
24
+ static _setValue(value: ReferResource | null): ReferResource | null;
25
25
  constructor();
26
26
  }
@@ -21,7 +21,7 @@ export declare class AnimatorLayerData {
21
21
  layerState: LayerState;
22
22
  crossCurveMark: number;
23
23
  manuallyTransition: AnimatorStateTransition;
24
- crossFadeTransition: AnimatorStateTransition;
24
+ crossFadeTransition: AnimatorStateTransition | null;
25
25
  crossLayerOwnerCollection: AnimationCurveLayerOwner[];
26
26
  getOrCreateInstance(state: AnimatorState): AnimatorStateInstance;
27
27
  resetCurrentCheckIndex(): void;