@galacean/engine-loader 1.1.0-beta.43 → 1.1.0-beta.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js.map +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
- package/types/resource-deserialize/resources/parser/HierarchyParser.d.ts +36 -0
- package/types/resource-deserialize/resources/parser/ParserContext.d.ts +29 -0
- package/types/resource-deserialize/resources/prefab/PrefabParser.d.ts +13 -4
- package/types/resource-deserialize/resources/prefab/PrefabParserContext.d.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-loader",
|
|
3
|
-
"version": "1.1.0-beta.
|
|
3
|
+
"version": "1.1.0-beta.45",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"types/**/*"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@galacean/engine-
|
|
19
|
-
"@galacean/engine-math": "1.1.0-beta.
|
|
20
|
-
"@galacean/engine-
|
|
21
|
-
"@galacean/engine-
|
|
18
|
+
"@galacean/engine-core": "1.1.0-beta.45",
|
|
19
|
+
"@galacean/engine-math": "1.1.0-beta.45",
|
|
20
|
+
"@galacean/engine-rhi-webgl": "1.1.0-beta.45",
|
|
21
|
+
"@galacean/engine-draco": "1.1.0-beta.45"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"b:types": "tsc"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Entity, Engine, Scene } from "@galacean/engine-core";
|
|
2
|
+
import type { IPrefabFile } from "../schema";
|
|
3
|
+
import { ReflectionParser } from "./ReflectionParser";
|
|
4
|
+
import { ParserContext } from "./ParserContext";
|
|
5
|
+
/** @Internal */
|
|
6
|
+
export default abstract class HierarchyParser<T extends Scene | Entity, V extends ParserContext<IPrefabFile, T>> {
|
|
7
|
+
readonly context: V;
|
|
8
|
+
/**
|
|
9
|
+
* The promise of parsed object.
|
|
10
|
+
*/
|
|
11
|
+
readonly promise: Promise<T>;
|
|
12
|
+
protected _resolve: (item: T) => void;
|
|
13
|
+
protected _reject: (reason: any) => void;
|
|
14
|
+
protected _engine: Engine;
|
|
15
|
+
protected _reflectionParser: ReflectionParser;
|
|
16
|
+
private prefabContextMap;
|
|
17
|
+
private prefabPromiseMap;
|
|
18
|
+
constructor(context: V);
|
|
19
|
+
/** start parse the scene or prefab or others */
|
|
20
|
+
start(): void;
|
|
21
|
+
protected abstract handleRootEntity(id: string): void;
|
|
22
|
+
private _parseEntities;
|
|
23
|
+
private _parseComponents;
|
|
24
|
+
private _parsePrefabModification;
|
|
25
|
+
private _parsePrefabRemovedEntities;
|
|
26
|
+
private _parsePrefabRemovedComponents;
|
|
27
|
+
private _clearAndResolve;
|
|
28
|
+
private _organizeEntities;
|
|
29
|
+
private _getEntityByConfig;
|
|
30
|
+
private _parseEntity;
|
|
31
|
+
private _parseGLTF;
|
|
32
|
+
private _parseStrippedEntity;
|
|
33
|
+
private _parseChildren;
|
|
34
|
+
private _applyEntityData;
|
|
35
|
+
private _traverseAddEntityToMap;
|
|
36
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Component, EngineObject, Entity, ResourceManager } from "@galacean/engine-core";
|
|
2
|
+
import type { IEntity } from "../schema";
|
|
3
|
+
/**
|
|
4
|
+
* Parser context
|
|
5
|
+
* @export
|
|
6
|
+
* @abstract
|
|
7
|
+
* @class ParserContext
|
|
8
|
+
* @template T
|
|
9
|
+
* @template I
|
|
10
|
+
*/
|
|
11
|
+
export declare class ParserContext<T extends Object, I extends EngineObject> {
|
|
12
|
+
readonly originalData: T;
|
|
13
|
+
readonly engine: any;
|
|
14
|
+
target?: I;
|
|
15
|
+
entityMap: Map<string, Entity>;
|
|
16
|
+
components: Map<string, Component>;
|
|
17
|
+
assets: Map<string, any>;
|
|
18
|
+
entityConfigMap: Map<string, IEntity>;
|
|
19
|
+
rootIds: string[];
|
|
20
|
+
strippedIds: string[];
|
|
21
|
+
readonly resourceManager: ResourceManager;
|
|
22
|
+
constructor(originalData: T, engine: any, target?: I);
|
|
23
|
+
/**
|
|
24
|
+
* Destroy the context.
|
|
25
|
+
* @abstract
|
|
26
|
+
* @memberof ParserContext
|
|
27
|
+
*/
|
|
28
|
+
destroy(): void;
|
|
29
|
+
}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import { Entity } from "@galacean/engine-core";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Entity, Engine } from "@galacean/engine-core";
|
|
2
|
+
import type { IPrefabFile } from "../schema";
|
|
3
|
+
import { PrefabParserContext } from "./PrefabParserContext";
|
|
4
|
+
import HierarchyParser from "../parser/HierarchyParser";
|
|
5
|
+
export declare class PrefabParser extends HierarchyParser<Entity, PrefabParserContext> {
|
|
6
|
+
/**
|
|
7
|
+
* Parse prefab data.
|
|
8
|
+
* @param engine - the engine of the parser context
|
|
9
|
+
* @param prefabData - prefab data which is exported by editor
|
|
10
|
+
* @returns a promise of prefab
|
|
11
|
+
*/
|
|
12
|
+
static parse(engine: Engine, prefabData: IPrefabFile): PrefabParser;
|
|
13
|
+
protected handleRootEntity(id: string): void;
|
|
5
14
|
}
|