@siduri-x/body 1.0.1 → 1.0.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/dist/index.d.ts +6 -0
- package/dist/index.js +10 -0
- package/dist/index.test.js +10 -1
- package/organ-manifest.json +9 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export type BodyState = 'idle' | 'speaking' | 'acting';
|
|
|
3
3
|
export interface BodySnapshot {
|
|
4
4
|
state: BodyState;
|
|
5
5
|
currentExpression: string;
|
|
6
|
+
modelPath?: string;
|
|
7
|
+
modelUrl?: string;
|
|
6
8
|
lastSpeechId: string | null;
|
|
7
9
|
lastAction: string | null;
|
|
8
10
|
lastText?: string;
|
|
@@ -11,12 +13,16 @@ export interface BodySnapshot {
|
|
|
11
13
|
}
|
|
12
14
|
export interface NeutralBodyOrganConfig {
|
|
13
15
|
initialExpression?: string;
|
|
16
|
+
modelPath?: string;
|
|
17
|
+
modelUrl?: string;
|
|
14
18
|
[key: string]: unknown;
|
|
15
19
|
}
|
|
16
20
|
export type Live2DAdapterConfig = NeutralBodyOrganConfig;
|
|
17
21
|
export declare class NeutralBodyOrgan implements BodyOrgan, ExperienceAdapter {
|
|
18
22
|
readonly kind: "avatar";
|
|
19
23
|
currentExpression: string;
|
|
24
|
+
modelPath?: string;
|
|
25
|
+
modelUrl?: string;
|
|
20
26
|
lastSpeechId: string | null;
|
|
21
27
|
lastAction: string | null;
|
|
22
28
|
lastText?: string;
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,8 @@ const core_1 = require("@siduri-x/core");
|
|
|
5
5
|
class NeutralBodyOrgan {
|
|
6
6
|
kind = 'avatar';
|
|
7
7
|
currentExpression = 'neutral';
|
|
8
|
+
modelPath;
|
|
9
|
+
modelUrl;
|
|
8
10
|
lastSpeechId = null;
|
|
9
11
|
lastAction = null;
|
|
10
12
|
lastText;
|
|
@@ -16,6 +18,12 @@ class NeutralBodyOrgan {
|
|
|
16
18
|
if (config.initialExpression) {
|
|
17
19
|
this.currentExpression = config.initialExpression;
|
|
18
20
|
}
|
|
21
|
+
if (config.modelPath) {
|
|
22
|
+
this.modelPath = config.modelPath;
|
|
23
|
+
}
|
|
24
|
+
if (config.modelUrl) {
|
|
25
|
+
this.modelUrl = config.modelUrl;
|
|
26
|
+
}
|
|
19
27
|
}
|
|
20
28
|
setExpression(expression) {
|
|
21
29
|
this.currentExpression = expression;
|
|
@@ -41,6 +49,8 @@ class NeutralBodyOrgan {
|
|
|
41
49
|
return {
|
|
42
50
|
state: this.state,
|
|
43
51
|
currentExpression: this.currentExpression,
|
|
52
|
+
modelPath: this.modelPath,
|
|
53
|
+
modelUrl: this.modelUrl,
|
|
44
54
|
lastSpeechId: this.lastSpeechId,
|
|
45
55
|
lastAction: this.lastAction,
|
|
46
56
|
lastText: this.lastText,
|
package/dist/index.test.js
CHANGED
|
@@ -14,8 +14,17 @@ describe('NeutralBodyOrgan', () => {
|
|
|
14
14
|
expect(organ.state).toBe('idle');
|
|
15
15
|
expect(organ.lastSpeechId).toBeNull();
|
|
16
16
|
expect(organ.lastAction).toBeNull();
|
|
17
|
-
const customOrgan = new index_1.NeutralBodyOrgan({
|
|
17
|
+
const customOrgan = new index_1.NeutralBodyOrgan({
|
|
18
|
+
initialExpression: 'happy',
|
|
19
|
+
modelPath: './assets/body/model/custom/model.model3.json',
|
|
20
|
+
modelUrl: '/live2d/custom/model.model3.json',
|
|
21
|
+
});
|
|
18
22
|
expect(customOrgan.currentExpression).toBe('happy');
|
|
23
|
+
expect(customOrgan.modelPath).toBe('./assets/body/model/custom/model.model3.json');
|
|
24
|
+
expect(customOrgan.modelUrl).toBe('/live2d/custom/model.model3.json');
|
|
25
|
+
const snapshot = customOrgan.getSnapshot();
|
|
26
|
+
expect(snapshot.modelPath).toBe('./assets/body/model/custom/model.model3.json');
|
|
27
|
+
expect(snapshot.modelUrl).toBe('/live2d/custom/model.model3.json');
|
|
19
28
|
customOrgan.cleanup();
|
|
20
29
|
});
|
|
21
30
|
test('Live2DAdapter is exported as a compatible alias', () => {
|
package/organ-manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siduri-x/body",
|
|
3
3
|
"organType": "body",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.3",
|
|
5
5
|
"displayName": "Body (Live2D & Avatar State)",
|
|
6
6
|
"description": "Renderer-agnostic avatar expression and embodiment event adapter",
|
|
7
7
|
"entrypoint": "./dist/index.js",
|
|
@@ -23,6 +23,14 @@
|
|
|
23
23
|
"initialExpression": {
|
|
24
24
|
"type": "string",
|
|
25
25
|
"default": "neutral"
|
|
26
|
+
},
|
|
27
|
+
"modelPath": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "Path to local Live2D Cubism model (.model3.json)"
|
|
30
|
+
},
|
|
31
|
+
"modelUrl": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "Relative web or remote HTTP URL to Live2D Cubism model"
|
|
26
34
|
}
|
|
27
35
|
}
|
|
28
36
|
},
|