@galacean/engine-spine 4.2.0-beta.2 → 4.2.0-beta.3

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.2.0-beta.2",
2
+ "version": "4.2.0-beta.3",
3
3
  "description": "galacean spine runtime",
4
4
  "name": "@galacean/engine-spine",
5
5
  "main": "dist/main.js",
@@ -20,7 +20,7 @@
20
20
  "@babel/plugin-transform-object-assign": "^7.12.1",
21
21
  "@babel/preset-env": "^7.24.8",
22
22
  "@babel/preset-typescript": "^7.24.7",
23
- "@galacean/engine": "^1.3.20",
23
+ "@galacean/engine": "^1.3.0-alpha.3",
24
24
  "@galacean/engine-toolkit": "beta",
25
25
  "@rollup/plugin-babel": "^5.2.1",
26
26
  "@rollup/plugin-commonjs": "^16.0.0",
@@ -107,11 +107,12 @@
107
107
  "e2e": "cypress run --browser chrome --headless",
108
108
  "e2e:debug": "cypress open",
109
109
  "dev": "rollup -cw",
110
- "build": "npm run b:types && cross-env BUILD_TYPE=ALL rollup -c",
110
+ "build": "cross-env BUILD_TYPE=ALL rollup -c",
111
111
  "build:watch": "npm run b:types && cross-env BUILD_TYPE=ALL rollup -c --watch",
112
112
  "ci": "npm run lint && npm run test-cov",
113
113
  "lint": "eslint src --fix --ext .ts,.tsx",
114
- "b:types": "tsc --emitDeclarationOnly"
114
+ "b:types": "tsc --emitDeclarationOnly",
115
+ "b:all": "npm run b:types && npm run build"
115
116
  },
116
117
  "types": "types/index.d.ts",
117
118
  "repository": "https://github.com/johanzhu/engine-spine.git"
@@ -0,0 +1,11 @@
1
+ import { Entity, MeshRenderer, Camera } from '@galacean/engine';
2
+ export default class BoundingBoxLine extends MeshRenderer {
3
+ private attachedEntity;
4
+ private renderers;
5
+ private boundingBox;
6
+ constructor(entity: Entity);
7
+ updateBoundingBox(): void;
8
+ attachToEntity(entity: Entity): void;
9
+ private updateVertices;
10
+ _render(camera: Camera): void;
11
+ }
@@ -0,0 +1,13 @@
1
+ import { Texture, TextureFilter, TextureWrap } from "@esotericsoftware/spine-core";
2
+ import { Texture2D } from "@galacean/engine";
3
+ /**
4
+ * @internal
5
+ */
6
+ export declare class AdaptiveTexture extends Texture {
7
+ constructor(image: Texture2D);
8
+ getImage(): Texture2D;
9
+ setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
10
+ setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
11
+ dispose(): void;
12
+ private _convertWrapMode;
13
+ }
@@ -0,0 +1,7 @@
1
+ import { TextureAtlas } from "@esotericsoftware/spine-core";
2
+ import { AssetPromise, Loader, LoadItem, ResourceManager } from "@galacean/engine";
3
+ export declare class SpineAtlasLoader extends Loader<TextureAtlas> {
4
+ private static _groupAssetsByExtension;
5
+ private static _assignSpineAtlas;
6
+ load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<TextureAtlas>;
7
+ }
@@ -3,15 +3,15 @@ import { Engine, Entity, ReferResource } from "@galacean/engine";
3
3
  /**
4
4
  * Represents a resource that manages Spine animation data, textures, and entity templates for the Galacean engine.
5
5
  *
6
- */
6
+ */
7
7
  export declare class SpineResource extends ReferResource {
8
- /** Name of skeletonData. */
9
- readonly name: string;
8
+ /** The url of spine resource. */
9
+ readonly url: string;
10
10
  private _texturesInSpineAtlas;
11
11
  private _skeletonData;
12
12
  private _stateData;
13
13
  private _template;
14
- constructor(engine: Engine, skeletonData: SkeletonData, name?: string);
14
+ constructor(engine: Engine, skeletonData: SkeletonData, url?: string);
15
15
  /**
16
16
  * The skeleton data associated with this Spine resource.
17
17
  */
@@ -29,4 +29,5 @@ export declare class SpineResource extends ReferResource {
29
29
  private _createTemplate;
30
30
  private _associationTextureInSkeletonData;
31
31
  private _disassociationSuperResource;
32
+ private _extractFileName;
32
33
  }
@@ -0,0 +1,13 @@
1
+ import { Texture, TextureFilter, TextureWrap } from "@esotericsoftware/spine-core";
2
+ import { Texture2D } from "@galacean/engine";
3
+ /**
4
+ * @internal
5
+ */
6
+ export declare class SpineTexture extends Texture {
7
+ constructor(image: Texture2D);
8
+ getImage(): Texture2D;
9
+ setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
10
+ setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
11
+ dispose(): void;
12
+ private _convertWrapMode;
13
+ }
@@ -0,0 +1,4 @@
1
+ import "./SpineLoader";
2
+ import "./SpineAtlasLoader";
3
+ export { SpineResource } from "./SpineResource";
4
+ export { LoaderUtils } from "./LoaderUtils";
@@ -0,0 +1,177 @@
1
+ import { AnimationState, Skeleton } from "@esotericsoftware/spine-core";
2
+ import { BoundingBox, Buffer, Engine, Entity, Material, Primitive, Renderer, SubPrimitive } from "@galacean/engine";
3
+ import { SpineResource } from "../loader/SpineResource";
4
+ /**
5
+ * Spine animation renderer, capable of rendering spine animations and providing functions for animation and skeleton manipulation.
6
+ */
7
+ export declare class SpineAnimationRenderer extends Renderer {
8
+ private static _defaultMaterial;
9
+ private static _spineGenerator;
10
+ private static _positionVertexElement;
11
+ private static _colorVertexElement;
12
+ private static _uvVertexElement;
13
+ /** @internal */
14
+ static _materialCache: Map<string, Material>;
15
+ /** @internal */
16
+ static _getDefaultMaterial(engine: Engine): Material;
17
+ /**
18
+ * The spacing between z layers.
19
+ */
20
+ zSpacing: number;
21
+ /**
22
+ * Whether to use premultiplied alpha mode for rendering.
23
+ * When enabled, vertex color values are multiplied by the alpha channel.
24
+ * @remarks
25
+ If this option is enabled, the Spine editor must export textures with "Premultiply Alpha" checked.
26
+ */
27
+ premultipliedAlpha: boolean;
28
+ /**
29
+ * Default state for spine animation.
30
+ * Contains the default animation name to be played, whether this animation should loop, the default skin name.
31
+ */
32
+ readonly defaultConfig: SpineAnimationDefaultConfig;
33
+ /** @internal */
34
+ _primitive: Primitive;
35
+ /** @internal */
36
+ _subPrimitives: SubPrimitive[];
37
+ /** @internal */
38
+ _indexBuffer: Buffer;
39
+ /** @internal */
40
+ _vertexBuffer: Buffer;
41
+ /** @internal */
42
+ _vertices: Float32Array<ArrayBuffer>;
43
+ /** @internal */
44
+ _indices: Uint16Array<ArrayBuffer>;
45
+ /** @internal */
46
+ _needResizeBuffer: boolean;
47
+ /** @internal */
48
+ _vertexCount: number;
49
+ /** @internal */
50
+ _resource: SpineResource;
51
+ /** @internal */
52
+ _localBounds: BoundingBox;
53
+ private _skeleton;
54
+ private _state;
55
+ /**
56
+ * The Spine.AnimationState object of this SpineAnimationRenderer.
57
+ * Manage, blend, and transition between multiple simultaneous animations effectively.
58
+ */
59
+ get state(): AnimationState;
60
+ /**
61
+ * The Spine.Skeleton object of this SpineAnimationRenderer.
62
+ * Manipulate bone positions, rotations, scaling
63
+ * and change spine attachment to customize character appearances dynamically during runtime.
64
+ */
65
+ get skeleton(): Skeleton;
66
+ /**
67
+ * @internal
68
+ */
69
+ constructor(entity: Entity);
70
+ /**
71
+ * @internal
72
+ */
73
+ _onEnable(): void;
74
+ /**
75
+ * @internal
76
+ */
77
+ update(delta: number): void;
78
+ /**
79
+ * @internal
80
+ */
81
+ _render(context: any): void;
82
+ /**
83
+ * @internal
84
+ */
85
+ _updateBounds(worldBounds: BoundingBox): void;
86
+ /**
87
+ * @internal
88
+ */
89
+ _setSkeleton(skeleton: Skeleton): void;
90
+ /**
91
+ * @internal
92
+ */
93
+ _setState(state: AnimationState): void;
94
+ /**
95
+ * @internal
96
+ */
97
+ _cloneTo(target: SpineAnimationRenderer): void;
98
+ /**
99
+ * @internal
100
+ */
101
+ _onDestroy(): void;
102
+ /**
103
+ * @internal
104
+ */
105
+ _createAndBindBuffer(vertexCount: number): void;
106
+ /**
107
+ * @internal
108
+ */
109
+ _addSubPrimitive(subPrimitive: SubPrimitive): void;
110
+ /**
111
+ * @internal
112
+ */
113
+ _clearSubPrimitives(): void;
114
+ private _clearMaterialCache;
115
+ private _applyDefaultConfig;
116
+ /**
117
+ * * @deprecated This property is deprecated and will be removed in future releases.
118
+ * Spine resource of current spine animation.
119
+ */
120
+ get resource(): SpineResource;
121
+ /**
122
+ * * @deprecated This property is deprecated and will be removed in future releases.
123
+ * Sets the Spine resource for the current animation. This property allows switching to a different `SpineResource`.
124
+ *
125
+ * @param value - The new `SpineResource` to be used for the current animation
126
+ */
127
+ set resource(value: SpineResource);
128
+ }
129
+ /**
130
+ * @internal
131
+ */
132
+ export declare enum SpineAnimationUpdateFlags {
133
+ /** On Animation change */
134
+ Animation = 2
135
+ }
136
+ /**
137
+ * @internal
138
+ */
139
+ export declare enum RendererUpdateFlags {
140
+ /** Include world position and world bounds. */
141
+ WorldVolume = 1
142
+ }
143
+ /**
144
+ * Default state for spine animation.
145
+ * Contains the default animation name to be played, whether this animation should loop,
146
+ * the default skin name, and the default scale of the skeleton.
147
+ */
148
+ export declare class SpineAnimationDefaultConfig {
149
+ /**
150
+ * Whether the default animation should loop @defaultValue `true. The default animation should loop`
151
+ */
152
+ loop: boolean;
153
+ /**
154
+ * The name of the default animation @defaultValue `null. Do not play any animation by default`
155
+ */
156
+ animationName: string | null;
157
+ /**
158
+ * The name of the default skin @defaultValue `default`
159
+ */
160
+ skinName: string;
161
+ /**
162
+ * Creates an instance of default config
163
+ */
164
+ constructor(
165
+ /**
166
+ * Whether the default animation should loop @defaultValue `true. The default animation should loop`
167
+ */
168
+ loop?: boolean,
169
+ /**
170
+ * The name of the default animation @defaultValue `null. Do not play any animation by default`
171
+ */
172
+ animationName?: string | null,
173
+ /**
174
+ * The name of the default skin @defaultValue `default`
175
+ */
176
+ skinName?: string);
177
+ }
@@ -0,0 +1,35 @@
1
+ import { BlendMode, Color, Skeleton } from "@esotericsoftware/spine-core";
2
+ import { SubPrimitive, Texture2D } from "@galacean/engine";
3
+ import { SpineAnimationRenderer } from "./SpineAnimationRenderer";
4
+ import { ClearablePool } from "../util/ClearablePool";
5
+ import { ReturnablePool } from "../util/ReturnablePool";
6
+ declare class SubRenderItem {
7
+ subPrimitive: SubPrimitive;
8
+ blendMode: BlendMode;
9
+ texture: any;
10
+ slotName?: string;
11
+ }
12
+ /**
13
+ * @internal
14
+ */
15
+ export declare class SpineGenerator {
16
+ static VERTEX_SIZE: number;
17
+ static VERTEX_STRIDE: number;
18
+ static tempDark: Color;
19
+ static tempColor: Color;
20
+ static tempVerts: any[];
21
+ static QUAD_TRIANGLES: number[];
22
+ static subPrimitivePool: ReturnablePool<SubPrimitive>;
23
+ static subRenderItemPool: ClearablePool<SubRenderItem>;
24
+ private _separateSlots;
25
+ private _subRenderItems;
26
+ private _clipper;
27
+ private _separateSlotTextureMap;
28
+ buildPrimitive(skeleton: Skeleton, renderer: SpineAnimationRenderer): void;
29
+ addSeparateSlot(slotName: string): void;
30
+ addSeparateSlotTexture(slotName: string, texture: Texture2D): void;
31
+ private _createMaterialForTexture;
32
+ private _createRenderItem;
33
+ private _expandBounds;
34
+ }
35
+ export {};
@@ -0,0 +1,6 @@
1
+ import { Engine, Material } from "@galacean/engine";
2
+ export declare class SpineMaterial extends Material {
3
+ private static _spineVS;
4
+ private static _spineFS;
5
+ constructor(engine: Engine);
6
+ }
@@ -0,0 +1,2 @@
1
+ export { SpineAnimationRenderer } from "./SpineAnimationRenderer";
2
+ export { SpineMaterial } from "./SpineMaterial";
@@ -0,0 +1,197 @@
1
+ import { AnimationState, Skeleton } from "@esotericsoftware/spine-core";
2
+ import { BoundingBox, Buffer, Engine, Entity, Material, Primitive, Renderer, SubPrimitive } from "@galacean/engine";
3
+ import { SpineResource } from "./loader/SpineResource";
4
+ /**
5
+ * Spine animation renderer, capable of rendering spine animations and providing functions for animation and skeleton manipulation.
6
+ */
7
+ export declare class SpineAnimationRenderer extends Renderer {
8
+ private static _defaultMaterial;
9
+ private static _spineGenerator;
10
+ private static _positionVertexElement;
11
+ private static _colorVertexElement;
12
+ private static _uvVertexElement;
13
+ /** @internal */
14
+ static _materialCache: Map<string, Material>;
15
+ /** @internal */
16
+ static _getDefaultMaterial(engine: Engine): Material;
17
+ /**
18
+ * The spacing between z layers.
19
+ */
20
+ zSpacing: number;
21
+ /**
22
+ * Whether to use premultiplied alpha mode for rendering.
23
+ * When enabled, vertex color values are multiplied by the alpha channel.
24
+ * @remarks
25
+ If this option is enabled, the Spine editor must export textures with "Premultiply Alpha" checked.
26
+ */
27
+ premultipliedAlpha: boolean;
28
+ /**
29
+ * Updates the bounding box every frame when enabled.
30
+ * Otherwise, it is calculated only during animation initialization.
31
+ */
32
+ updateBoundsPerFrame: boolean;
33
+ /**
34
+ * Default state for spine animation.
35
+ * Contains the default animation name to be played, whether this animation should loop, the default skin name.
36
+ */
37
+ readonly defaultConfig: SpineAnimationDefaultConfig;
38
+ /** @internal */
39
+ _primitive: Primitive;
40
+ /** @internal */
41
+ _subPrimitives: SubPrimitive[];
42
+ /** @internal */
43
+ _indexBuffer: Buffer;
44
+ /** @internal */
45
+ _vertexBuffer: Buffer;
46
+ /** @internal */
47
+ _vertices: Float32Array<ArrayBuffer>;
48
+ /** @internal */
49
+ _indices: Uint16Array<ArrayBuffer>;
50
+ /** @internal */
51
+ _needResizeBuffer: boolean;
52
+ /** @internal */
53
+ _vertexCount: number;
54
+ /** @internal */
55
+ _resource: SpineResource;
56
+ /** @internal */
57
+ _spineBounds: BoundingBox;
58
+ /** @internal */
59
+ _needsInitialize: boolean;
60
+ private _skeleton;
61
+ private _state;
62
+ /**
63
+ * The Spine.AnimationState object of this SpineAnimationRenderer.
64
+ * Manage, blend, and transition between multiple simultaneous animations effectively.
65
+ */
66
+ get state(): AnimationState;
67
+ /**
68
+ * The Spine.Skeleton object of this SpineAnimationRenderer.
69
+ * Manipulate bone positions, rotations, scaling
70
+ * and change spine attachment to customize character appearances dynamically during runtime.
71
+ */
72
+ get skeleton(): Skeleton;
73
+ /**
74
+ * @internal
75
+ */
76
+ constructor(entity: Entity);
77
+ /**
78
+ * @internal
79
+ */
80
+ _onEnable(): void;
81
+ /**
82
+ * @internal
83
+ */
84
+ update(delta: number): void;
85
+ /**
86
+ * @internal
87
+ */
88
+ _render(context: any): void;
89
+ /**
90
+ * @internal
91
+ */
92
+ _updateBounds(worldBounds: BoundingBox): void;
93
+ /**
94
+ * @internal
95
+ */
96
+ _setSkeleton(skeleton: Skeleton): void;
97
+ /**
98
+ * @internal
99
+ */
100
+ _setState(state: AnimationState): void;
101
+ /**
102
+ * @internal
103
+ */
104
+ _cloneTo(target: SpineAnimationRenderer): void;
105
+ /**
106
+ * @internal
107
+ */
108
+ _onDestroy(): void;
109
+ /**
110
+ * @internal
111
+ */
112
+ _createAndBindBuffer(vertexCount: number): void;
113
+ /**
114
+ * @internal
115
+ */
116
+ _addSubPrimitive(subPrimitive: SubPrimitive): void;
117
+ /**
118
+ * @internal
119
+ */
120
+ _clearSubPrimitives(): void;
121
+ /**
122
+ * @internal
123
+ */
124
+ _isContainDirtyFlag(type: number): boolean;
125
+ /**
126
+ * @internal
127
+ */
128
+ _setDirtyFlagFalse(type: number): void;
129
+ private _initialize;
130
+ private _onAnimationStart;
131
+ private _onAnimationEnd;
132
+ private _clearMaterialCache;
133
+ private _applyDefaultConfig;
134
+ /**
135
+ * * @deprecated This property is deprecated and will be removed in future releases.
136
+ * Spine resource of current spine animation.
137
+ */
138
+ get resource(): SpineResource;
139
+ /**
140
+ * * @deprecated This property is deprecated and will be removed in future releases.
141
+ * Sets the Spine resource for the current animation. This property allows switching to a different `SpineResource`.
142
+ *
143
+ * @param value - The new `SpineResource` to be used for the current animation
144
+ */
145
+ set resource(value: SpineResource);
146
+ }
147
+ /**
148
+ * @internal
149
+ */
150
+ export declare enum SpineAnimationUpdateFlags {
151
+ /** On Animation start play */
152
+ AnimationVolume = 2,
153
+ /** On skeleton data asset changed */
154
+ InitialVolume = 4
155
+ }
156
+ /**
157
+ * @internal
158
+ */
159
+ export declare enum RendererUpdateFlags {
160
+ /** Include world position and world bounds. */
161
+ WorldVolume = 1
162
+ }
163
+ /**
164
+ * Default state for spine animation.
165
+ * Contains the default animation name to be played, whether this animation should loop,
166
+ * the default skin name, and the default scale of the skeleton.
167
+ */
168
+ export declare class SpineAnimationDefaultConfig {
169
+ /**
170
+ * Whether the default animation should loop @defaultValue `true. The default animation should loop`
171
+ */
172
+ loop: boolean;
173
+ /**
174
+ * The name of the default animation @defaultValue `null. Do not play any animation by default`
175
+ */
176
+ animationName: string | null;
177
+ /**
178
+ * The name of the default skin @defaultValue `default`
179
+ */
180
+ skinName: string;
181
+ /**
182
+ * Creates an instance of default config
183
+ */
184
+ constructor(
185
+ /**
186
+ * Whether the default animation should loop @defaultValue `true. The default animation should loop`
187
+ */
188
+ loop?: boolean,
189
+ /**
190
+ * The name of the default animation @defaultValue `null. Do not play any animation by default`
191
+ */
192
+ animationName?: string | null,
193
+ /**
194
+ * The name of the default skin @defaultValue `default`
195
+ */
196
+ skinName?: string);
197
+ }
@@ -0,0 +1,34 @@
1
+ import { BlendMode, Color, Skeleton } from "@esotericsoftware/spine-core";
2
+ import { SubPrimitive, Texture2D } from "@galacean/engine";
3
+ import { SpineAnimationRenderer } from "./SpineAnimationRenderer";
4
+ import { AdaptiveTexture } from "./loader/LoaderUtils";
5
+ import { ClearablePool } from "./util/ClearablePool";
6
+ import { ReturnablePool } from "./util/ReturnablePool";
7
+ declare class SubRenderItem {
8
+ subPrimitive: SubPrimitive;
9
+ blendMode: BlendMode;
10
+ texture: any;
11
+ slotName?: string;
12
+ }
13
+ export declare class SpineGenerator {
14
+ static QUAD_TRIANGLES: number[];
15
+ static VERTEX_SIZE: number;
16
+ static VERTEX_STRIDE: number;
17
+ static tempDark: Color;
18
+ static tempColor: Color;
19
+ static tempVerts: any[];
20
+ static tempBlendMode: BlendMode | null;
21
+ static tempTexture: AdaptiveTexture | null;
22
+ static subPrimitivePool: ReturnablePool<SubPrimitive>;
23
+ static subRenderItemPool: ClearablePool<SubRenderItem>;
24
+ private _clipper;
25
+ private _subRenderItems;
26
+ private _separateSlots;
27
+ private _separateSlotTextureMap;
28
+ buildPrimitive(skeleton: Skeleton, renderer: SpineAnimationRenderer, shouldUpdateBounds: boolean): void;
29
+ addSeparateSlot(slotName: string): void;
30
+ addSeparateSlotTexture(slotName: string, texture: Texture2D): void;
31
+ private _createMaterialForTexture;
32
+ private _expandByPoint;
33
+ }
34
+ export {};
@@ -0,0 +1,9 @@
1
+ import "./loader/SpineLoader";
2
+ import "./loader/EditorSpineAtlasLoader";
3
+ import BoundingBoxLine from "../example/outline";
4
+ export { SpineAnimationRenderer } from "./SpineAnimationRenderer";
5
+ export { SpineResource } from "./loader/SpineResource";
6
+ export { createTextureAtlas } from "./loader/LoaderUtils";
7
+ export { BoundingBoxLine };
8
+ export * from "@esotericsoftware/spine-core";
9
+ export declare const version = "__buildVersion";
@@ -0,0 +1,29 @@
1
+ import { AssetPromise, Loader, LoadItem, ResourceManager } from "@galacean/engine";
2
+ import { SpineResource } from "./SpineResource";
3
+ export type SpineAssetBundle = {
4
+ skeletonPath: string;
5
+ skeletonExtension: string;
6
+ skeletonTextData?: string | ArrayBuffer;
7
+ atlasPath: string;
8
+ imagePaths: string[];
9
+ imageExtensions: string[];
10
+ };
11
+ type SpineLoaderParams = {
12
+ fileExtensions?: string | string[];
13
+ };
14
+ type SpineLoadItem = LoadItem & {
15
+ params?: SpineLoaderParams;
16
+ };
17
+ export declare class SpineLoader extends Loader<SpineResource> {
18
+ static imageExtensions: string[];
19
+ static skeletonExtensions: string[];
20
+ static parseAndAssignSpineAsset(url: string, fileExtension: string | null, bundle: SpineAssetBundle): void;
21
+ static deriveAndAssignSpineAsset(url: string, fileExtension: string | null, bundle: SpineAssetBundle): void;
22
+ static verifyFileExtensions(fileExtensions: string | string[], expectArray: boolean): string | string[] | null;
23
+ static getUrlExtension(url: string, fileExtension: string): string | null;
24
+ load(item: SpineLoadItem, resourceManager: ResourceManager): AssetPromise<SpineResource>;
25
+ private _handleEditorAsset;
26
+ private _handleOriginAsset;
27
+ private _determineSkeletonDataType;
28
+ }
29
+ export {};
@@ -0,0 +1,33 @@
1
+ import { AnimationStateData, SkeletonData } from "@esotericsoftware/spine-core";
2
+ import { Engine, Entity, ReferResource } from "@galacean/engine";
3
+ /**
4
+ * Represents a resource that manages Spine animation data, textures, and entity templates for the Galacean engine.
5
+ *
6
+ */
7
+ export declare class SpineResource extends ReferResource {
8
+ /** The url of skeletonData. */
9
+ readonly url: string;
10
+ private _texturesInSpineAtlas;
11
+ private _skeletonData;
12
+ private _stateData;
13
+ private _template;
14
+ constructor(engine: Engine, skeletonData: SkeletonData, url?: string);
15
+ /**
16
+ * The skeleton data associated with this Spine resource.
17
+ */
18
+ get skeletonData(): SkeletonData;
19
+ /**
20
+ * The animation state data associated with this Spine resource.
21
+ */
22
+ get stateData(): AnimationStateData;
23
+ /**
24
+ * Creates and returns a new instance of the spine entity template.
25
+ * @returns A instance of the spine entity template
26
+ */
27
+ instantiate(): Entity;
28
+ protected _onDestroy(): void;
29
+ private _createTemplate;
30
+ private _associationTextureInSkeletonData;
31
+ private _disassociationSuperResource;
32
+ private _extractFileName;
33
+ }
@@ -1,3 +1,24 @@
1
- import { MeshAttachment, RegionAttachment, TextureAtlasRegion } from "@esotericsoftware/spine-core";
2
- export declare function createAttachmentFromRegion(region: TextureAtlasRegion, attachmentName: string, scale?: number, rotation?: number): RegionAttachment;
3
- export declare function cloneAttachmentWithRegion(attachment: RegionAttachment | MeshAttachment, atlasRegion: TextureAtlasRegion, cloneMeshAsLinked?: boolean, useOriginalRegionSize?: boolean, scale?: number): import("@esotericsoftware/spine-core").Attachment;
1
+ import { Attachment, MeshAttachment, RegionAttachment, TextureAtlasRegion } from "@esotericsoftware/spine-core";
2
+ export declare class AttachmentTools {
3
+ /**
4
+ * Creates a new `RegionAttachment` from a specified texture atlas region.
5
+ *
6
+ * @param region - The texture atlas region used to create the attachment.
7
+ * @param attachmentName - The name of the new attachment.
8
+ * @param scale - A scaling factor applied to the attachment's dimensions (default is 1).
9
+ * @param rotation - The rotation angle of the attachment in degrees (default is 0).
10
+ * @returns The created `RegionAttachment` with the passed in region.
11
+ */
12
+ static createAttachmentFromRegion(region: TextureAtlasRegion, attachmentName: string, scale?: number, rotation?: number): RegionAttachment;
13
+ /**
14
+ * Clones an attachment (`RegionAttachment` or `MeshAttachment`) and applies a new texture atlas region.
15
+ *
16
+ * @param attachment - The attachment to clone (either `RegionAttachment` or `MeshAttachment`).
17
+ * @param atlasRegion - The new texture atlas region to associate with the cloned attachment.
18
+ * @param useOriginalRegionSize - Whether to retain the original region's size for the cloned attachment (default is `false`).
19
+ * @param scale - A scaling factor applied to the dimensions of the cloned attachment (default is 1).
20
+ * @param cloneMeshAsLinked - If `true`, clones a `MeshAttachment` as a linked mesh (default is `true`).
21
+ * @returns The cloned attachment with the specified properties and the new texture region.
22
+ */
23
+ static cloneAttachmentWithRegion(attachment: RegionAttachment | MeshAttachment, atlasRegion: TextureAtlasRegion, useOriginalRegionSize?: boolean, scale?: number, cloneMeshAsLinked?: boolean): Attachment;
24
+ }
@@ -0,0 +1 @@
1
+ export { AttachmentTools } from "./AttachmentTools";