untitled-pixi-live2d-engine 1.2.0 → 1.2.2
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/cubism-legacy.es.js +27 -12
- package/dist/cubism-legacy.js +27 -12
- package/dist/cubism-legacy.min.js +1 -1
- package/dist/cubism.es.js +173 -31
- package/dist/cubism.js +173 -31
- package/dist/cubism.min.js +1 -1
- package/dist/index.es.js +173 -31
- package/dist/index.js +173 -31
- package/dist/index.min.js +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +12 -16
package/dist/cubism.es.js
CHANGED
|
@@ -2760,7 +2760,7 @@ const config = {
|
|
|
2760
2760
|
preserveExpressionOnMotion: true,
|
|
2761
2761
|
cubism: CubismFrameworkConfig
|
|
2762
2762
|
};
|
|
2763
|
-
const VERSION = "1.2.
|
|
2763
|
+
const VERSION = "1.2.2";
|
|
2764
2764
|
const logger = {
|
|
2765
2765
|
log(tag, ...messages) {
|
|
2766
2766
|
if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
|
|
@@ -4131,6 +4131,118 @@ class MotionManager extends EventEmitter {
|
|
|
4131
4131
|
return definition;
|
|
4132
4132
|
}
|
|
4133
4133
|
}
|
|
4134
|
+
function setScale(matrix, scale) {
|
|
4135
|
+
matrix.a = scale;
|
|
4136
|
+
matrix.b = 0;
|
|
4137
|
+
matrix.c = 0;
|
|
4138
|
+
matrix.d = scale;
|
|
4139
|
+
}
|
|
4140
|
+
function getLayoutEntries(rawLayout) {
|
|
4141
|
+
const entries = [];
|
|
4142
|
+
for (const [key, value] of Object.entries(rawLayout)) {
|
|
4143
|
+
if (typeof value !== "number") {
|
|
4144
|
+
continue;
|
|
4145
|
+
}
|
|
4146
|
+
entries.push([key, value]);
|
|
4147
|
+
}
|
|
4148
|
+
return entries;
|
|
4149
|
+
}
|
|
4150
|
+
function setupLayoutMatrix(matrix, originalWidth, originalHeight, rawLayout) {
|
|
4151
|
+
var _a, _b;
|
|
4152
|
+
const layout = __spreadValues({
|
|
4153
|
+
width: LOGICAL_WIDTH,
|
|
4154
|
+
height: LOGICAL_HEIGHT
|
|
4155
|
+
}, rawLayout);
|
|
4156
|
+
const layoutWidth = (_a = layout.width) != null ? _a : LOGICAL_WIDTH;
|
|
4157
|
+
const layoutHeight = (_b = layout.height) != null ? _b : LOGICAL_HEIGHT;
|
|
4158
|
+
matrix.identity();
|
|
4159
|
+
matrix.scale(layoutWidth / LOGICAL_WIDTH, layoutHeight / LOGICAL_HEIGHT);
|
|
4160
|
+
const width = originalWidth * matrix.a;
|
|
4161
|
+
const height = originalHeight * matrix.d;
|
|
4162
|
+
const offsetX = layout.x !== void 0 && layout.x - layoutWidth / 2 || layout.centerX !== void 0 && layout.centerX || layout.left !== void 0 && layout.left - layoutWidth / 2 || layout.right !== void 0 && layout.right + layoutWidth / 2 || 0;
|
|
4163
|
+
const offsetY = layout.y !== void 0 && layout.y - layoutHeight / 2 || layout.centerY !== void 0 && layout.centerY || layout.top !== void 0 && layout.top - layoutHeight / 2 || layout.bottom !== void 0 && layout.bottom + layoutHeight / 2 || 0;
|
|
4164
|
+
matrix.translate(width * offsetX, -height * offsetY);
|
|
4165
|
+
return {
|
|
4166
|
+
width,
|
|
4167
|
+
height
|
|
4168
|
+
};
|
|
4169
|
+
}
|
|
4170
|
+
function getCubismLayoutWidth(state, aspect) {
|
|
4171
|
+
return LOGICAL_HEIGHT * aspect * state.scale;
|
|
4172
|
+
}
|
|
4173
|
+
function getCubismLayoutHeight(state) {
|
|
4174
|
+
return LOGICAL_HEIGHT * state.scale;
|
|
4175
|
+
}
|
|
4176
|
+
function setCubismWidth(state, aspect, width) {
|
|
4177
|
+
state.scale = width / (LOGICAL_HEIGHT * aspect);
|
|
4178
|
+
}
|
|
4179
|
+
function setCubismHeight(state, height) {
|
|
4180
|
+
state.scale = height / LOGICAL_HEIGHT;
|
|
4181
|
+
}
|
|
4182
|
+
function setCubismX(state, x) {
|
|
4183
|
+
state.x = x;
|
|
4184
|
+
}
|
|
4185
|
+
function setCubismY(state, y) {
|
|
4186
|
+
state.y = y;
|
|
4187
|
+
}
|
|
4188
|
+
function centerCubismX(state, aspect, x) {
|
|
4189
|
+
setCubismX(state, x - getCubismLayoutWidth(state, aspect) / 2);
|
|
4190
|
+
}
|
|
4191
|
+
function centerCubismY(state, y) {
|
|
4192
|
+
setCubismY(state, y - getCubismLayoutHeight(state) / 2);
|
|
4193
|
+
}
|
|
4194
|
+
function rightCubism(state, aspect, x) {
|
|
4195
|
+
setCubismX(state, x - getCubismLayoutWidth(state, aspect));
|
|
4196
|
+
}
|
|
4197
|
+
function bottomCubism(state, y) {
|
|
4198
|
+
setCubismY(state, y - getCubismLayoutHeight(state));
|
|
4199
|
+
}
|
|
4200
|
+
function setupCubismLayoutMatrix(matrix, originalWidth, originalHeight, rawLayout) {
|
|
4201
|
+
if (originalWidth <= 0 || originalHeight <= 0) {
|
|
4202
|
+
matrix.identity();
|
|
4203
|
+
return { width: 0, height: 0 };
|
|
4204
|
+
}
|
|
4205
|
+
const entries = getLayoutEntries(rawLayout);
|
|
4206
|
+
const aspect = originalWidth / originalHeight;
|
|
4207
|
+
const state = { scale: 1, x: 0, y: 0 };
|
|
4208
|
+
for (const [key, value] of entries) {
|
|
4209
|
+
if (key === "width") {
|
|
4210
|
+
setCubismWidth(state, aspect, value);
|
|
4211
|
+
} else if (key === "height") {
|
|
4212
|
+
setCubismHeight(state, value);
|
|
4213
|
+
}
|
|
4214
|
+
}
|
|
4215
|
+
for (const [key, value] of entries) {
|
|
4216
|
+
if (key === "x") {
|
|
4217
|
+
setCubismX(state, value);
|
|
4218
|
+
} else if (key === "y") {
|
|
4219
|
+
setCubismY(state, value);
|
|
4220
|
+
} else if (key === "centerX") {
|
|
4221
|
+
centerCubismX(state, aspect, value);
|
|
4222
|
+
} else if (key === "centerY") {
|
|
4223
|
+
centerCubismY(state, value);
|
|
4224
|
+
} else if (key === "top") {
|
|
4225
|
+
setCubismY(state, value);
|
|
4226
|
+
} else if (key === "bottom") {
|
|
4227
|
+
bottomCubism(state, value);
|
|
4228
|
+
} else if (key === "left") {
|
|
4229
|
+
setCubismX(state, value);
|
|
4230
|
+
} else if (key === "right") {
|
|
4231
|
+
rightCubism(state, aspect, value);
|
|
4232
|
+
}
|
|
4233
|
+
}
|
|
4234
|
+
const pixelsPerLogicalUnit = originalHeight / LOGICAL_HEIGHT;
|
|
4235
|
+
const defaultLogicalHalfWidth = LOGICAL_HEIGHT * aspect / 2;
|
|
4236
|
+
const defaultLogicalHalfHeight = LOGICAL_HEIGHT / 2;
|
|
4237
|
+
matrix.identity();
|
|
4238
|
+
setScale(matrix, state.scale);
|
|
4239
|
+
matrix.tx = pixelsPerLogicalUnit * (state.x + defaultLogicalHalfWidth) - originalWidth * state.scale / 2;
|
|
4240
|
+
matrix.ty = pixelsPerLogicalUnit * (defaultLogicalHalfHeight - state.y) - originalHeight * state.scale / 2;
|
|
4241
|
+
return {
|
|
4242
|
+
width: originalWidth * state.scale,
|
|
4243
|
+
height: originalHeight * state.scale
|
|
4244
|
+
};
|
|
4245
|
+
}
|
|
4134
4246
|
function normalizeHitAreaDefs(raw, resolveIndex) {
|
|
4135
4247
|
if (!Array.isArray(raw)) {
|
|
4136
4248
|
return [];
|
|
@@ -4220,19 +4332,14 @@ class InternalModel extends EventEmitter {
|
|
|
4220
4332
|
const size = this.getSize();
|
|
4221
4333
|
self.originalWidth = size[0];
|
|
4222
4334
|
self.originalHeight = size[1];
|
|
4223
|
-
const
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
},
|
|
4335
|
+
const bounds = setupLayoutMatrix(
|
|
4336
|
+
this.localTransform,
|
|
4337
|
+
this.originalWidth,
|
|
4338
|
+
this.originalHeight,
|
|
4228
4339
|
this.getLayout()
|
|
4229
4340
|
);
|
|
4230
|
-
|
|
4231
|
-
self.
|
|
4232
|
-
self.height = this.originalHeight * this.localTransform.d;
|
|
4233
|
-
const offsetX = layout.x !== void 0 && layout.x - layout.width / 2 || layout.centerX !== void 0 && layout.centerX || layout.left !== void 0 && layout.left - layout.width / 2 || layout.right !== void 0 && layout.right + layout.width / 2 || 0;
|
|
4234
|
-
const offsetY = layout.y !== void 0 && layout.y - layout.height / 2 || layout.centerY !== void 0 && layout.centerY || layout.top !== void 0 && layout.top - layout.height / 2 || layout.bottom !== void 0 && layout.bottom + layout.height / 2 || 0;
|
|
4235
|
-
this.localTransform.translate(this.width * offsetX, -this.height * offsetY);
|
|
4341
|
+
self.width = bounds.width;
|
|
4342
|
+
self.height = bounds.height;
|
|
4236
4343
|
}
|
|
4237
4344
|
/**
|
|
4238
4345
|
* Sets up the hit areas by their definitions in settings.
|
|
@@ -8669,6 +8776,7 @@ class CubismMotionManager extends MotionManager {
|
|
|
8669
8776
|
shouldCheckMotionConsistency
|
|
8670
8777
|
);
|
|
8671
8778
|
const json = new CubismMotionJson(data, data.byteLength);
|
|
8779
|
+
motion.setLoop(json.isMotionLoop());
|
|
8672
8780
|
const defaultFadingDuration = (group === this.groups.idle ? config.idleMotionFadingDuration : config.motionFadingDuration) / 1e3;
|
|
8673
8781
|
if (json.getMotionFadeInTime() === void 0) {
|
|
8674
8782
|
motion.setFadeInTime(
|
|
@@ -11357,6 +11465,30 @@ const HIGH_PRECISION_MASK_MAX_MASKS_PER_DRAWABLE_THRESHOLD = 3;
|
|
|
11357
11465
|
const HIGH_PRECISION_MASK_MASKED_VERTEX_THRESHOLD = 4096;
|
|
11358
11466
|
const HIGH_PRECISION_MASK_VERTEX_RATIO_THRESHOLD = 0.5;
|
|
11359
11467
|
const HIGH_PRECISION_MASK_VERTEX_RATIO_DRAWABLE_THRESHOLD = 24;
|
|
11468
|
+
const layoutKeyMap = {
|
|
11469
|
+
CenterX: "centerX",
|
|
11470
|
+
centerX: "centerX",
|
|
11471
|
+
center_x: "centerX",
|
|
11472
|
+
CenterY: "centerY",
|
|
11473
|
+
centerY: "centerY",
|
|
11474
|
+
center_y: "centerY",
|
|
11475
|
+
X: "x",
|
|
11476
|
+
x: "x",
|
|
11477
|
+
Y: "y",
|
|
11478
|
+
y: "y",
|
|
11479
|
+
Width: "width",
|
|
11480
|
+
width: "width",
|
|
11481
|
+
Height: "height",
|
|
11482
|
+
height: "height",
|
|
11483
|
+
Top: "top",
|
|
11484
|
+
top: "top",
|
|
11485
|
+
Bottom: "bottom",
|
|
11486
|
+
bottom: "bottom",
|
|
11487
|
+
Left: "left",
|
|
11488
|
+
left: "left",
|
|
11489
|
+
Right: "right",
|
|
11490
|
+
right: "right"
|
|
11491
|
+
};
|
|
11360
11492
|
function getRequiredMaskRenderTextureCount(model) {
|
|
11361
11493
|
var _a;
|
|
11362
11494
|
if (!model.isUsingMasking()) {
|
|
@@ -11478,17 +11610,13 @@ class CubismInternalModel extends InternalModel {
|
|
|
11478
11610
|
super.init();
|
|
11479
11611
|
const eyeBlinkParameters = this.settings.getEyeBlinkParameters();
|
|
11480
11612
|
if (eyeBlinkParameters.length) {
|
|
11481
|
-
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
const parameterIds = new csmVector();
|
|
11485
|
-
for (const parameter of eyeBlinkParameters) {
|
|
11486
|
-
parameterIds.pushBack(this.idManager.getId(parameter));
|
|
11487
|
-
}
|
|
11488
|
-
const eyeBlink = CubismEyeBlink.create();
|
|
11489
|
-
(_a = eyeBlink.setParameterIds) == null ? void 0 : _a.call(eyeBlink, parameterIds);
|
|
11490
|
-
this.eyeBlink = eyeBlink;
|
|
11613
|
+
const parameterIds = new csmVector();
|
|
11614
|
+
for (const parameter of eyeBlinkParameters) {
|
|
11615
|
+
parameterIds.pushBack(this.idManager.getId(parameter));
|
|
11491
11616
|
}
|
|
11617
|
+
const eyeBlink = CubismEyeBlink.create();
|
|
11618
|
+
(_a = eyeBlink.setParameterIds) == null ? void 0 : _a.call(eyeBlink, parameterIds);
|
|
11619
|
+
this.eyeBlink = eyeBlink;
|
|
11492
11620
|
}
|
|
11493
11621
|
const breathParams = new csmVector();
|
|
11494
11622
|
breathParams.pushBack(
|
|
@@ -11543,16 +11671,29 @@ class CubismInternalModel extends InternalModel {
|
|
|
11543
11671
|
const settingsLayout = this.settings.layout;
|
|
11544
11672
|
if (settingsLayout) {
|
|
11545
11673
|
for (const [key, value] of Object.entries(settingsLayout)) {
|
|
11546
|
-
const commonKey = key
|
|
11547
|
-
|
|
11674
|
+
const commonKey = layoutKeyMap[key];
|
|
11675
|
+
if (commonKey && typeof value === "number") {
|
|
11676
|
+
layout[commonKey] = value;
|
|
11677
|
+
}
|
|
11548
11678
|
}
|
|
11549
11679
|
}
|
|
11550
11680
|
return layout;
|
|
11551
11681
|
}
|
|
11552
11682
|
setupLayout() {
|
|
11553
|
-
|
|
11554
|
-
|
|
11555
|
-
|
|
11683
|
+
const self = this;
|
|
11684
|
+
const size = this.getSize();
|
|
11685
|
+
self.originalWidth = size[0];
|
|
11686
|
+
self.originalHeight = size[1];
|
|
11687
|
+
self.pixelsPerUnit = this.coreModel.getModel().canvasinfo.PixelsPerUnit;
|
|
11688
|
+
const bounds = setupCubismLayoutMatrix(
|
|
11689
|
+
this.localTransform,
|
|
11690
|
+
this.originalWidth,
|
|
11691
|
+
this.originalHeight,
|
|
11692
|
+
this.getLayout()
|
|
11693
|
+
);
|
|
11694
|
+
self.width = bounds.width;
|
|
11695
|
+
self.height = bounds.height;
|
|
11696
|
+
this.modelTransform.identity().scale(this.pixelsPerUnit, this.pixelsPerUnit).translate(this.originalWidth / 2, this.originalHeight / 2);
|
|
11556
11697
|
}
|
|
11557
11698
|
updateWebGLContext(gl, glContextID) {
|
|
11558
11699
|
this.renderer.firstDraw = true;
|
|
@@ -11680,9 +11821,6 @@ class CubismInternalModel extends InternalModel {
|
|
|
11680
11821
|
this.renderer = void 0;
|
|
11681
11822
|
this.coreModel = void 0;
|
|
11682
11823
|
}
|
|
11683
|
-
isCubismModelSetting(settings) {
|
|
11684
|
-
return typeof settings.getEyeBlinkParameterCount === "function" && typeof settings.getEyeBlinkParameterId === "function";
|
|
11685
|
-
}
|
|
11686
11824
|
}
|
|
11687
11825
|
class ICubismModelSetting {
|
|
11688
11826
|
}
|
|
@@ -12397,6 +12535,10 @@ var Live2DCubismFramework$6;
|
|
|
12397
12535
|
Live2DCubismFramework2.CubismModelSettingJson = CubismModelSettingJson;
|
|
12398
12536
|
Live2DCubismFramework2.FrequestNode = FrequestNode;
|
|
12399
12537
|
})(Live2DCubismFramework$6 || (Live2DCubismFramework$6 = {}));
|
|
12538
|
+
const defaultEyeBlinkParameters = [
|
|
12539
|
+
CubismDefaultParameterId.ParamEyeLOpen,
|
|
12540
|
+
CubismDefaultParameterId.ParamEyeROpen
|
|
12541
|
+
];
|
|
12400
12542
|
class CubismModelSettings extends ModelSettings {
|
|
12401
12543
|
constructor(json) {
|
|
12402
12544
|
var _a, _b;
|
|
@@ -12496,7 +12638,7 @@ class CubismModelSettings extends ModelSettings {
|
|
|
12496
12638
|
}
|
|
12497
12639
|
}
|
|
12498
12640
|
}
|
|
12499
|
-
return parameters;
|
|
12641
|
+
return parameters.length ? parameters : [...defaultEyeBlinkParameters];
|
|
12500
12642
|
}
|
|
12501
12643
|
getLipSyncParameters() {
|
|
12502
12644
|
var _a, _b, _c;
|
package/dist/cubism.js
CHANGED
|
@@ -2762,7 +2762,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
2762
2762
|
preserveExpressionOnMotion: true,
|
|
2763
2763
|
cubism: CubismFrameworkConfig
|
|
2764
2764
|
};
|
|
2765
|
-
const VERSION = "1.2.
|
|
2765
|
+
const VERSION = "1.2.2";
|
|
2766
2766
|
const logger = {
|
|
2767
2767
|
log(tag, ...messages) {
|
|
2768
2768
|
if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
|
|
@@ -4133,6 +4133,118 @@ var __async = (__this, __arguments, generator) => {
|
|
|
4133
4133
|
return definition;
|
|
4134
4134
|
}
|
|
4135
4135
|
}
|
|
4136
|
+
function setScale(matrix, scale) {
|
|
4137
|
+
matrix.a = scale;
|
|
4138
|
+
matrix.b = 0;
|
|
4139
|
+
matrix.c = 0;
|
|
4140
|
+
matrix.d = scale;
|
|
4141
|
+
}
|
|
4142
|
+
function getLayoutEntries(rawLayout) {
|
|
4143
|
+
const entries = [];
|
|
4144
|
+
for (const [key, value] of Object.entries(rawLayout)) {
|
|
4145
|
+
if (typeof value !== "number") {
|
|
4146
|
+
continue;
|
|
4147
|
+
}
|
|
4148
|
+
entries.push([key, value]);
|
|
4149
|
+
}
|
|
4150
|
+
return entries;
|
|
4151
|
+
}
|
|
4152
|
+
function setupLayoutMatrix(matrix, originalWidth, originalHeight, rawLayout) {
|
|
4153
|
+
var _a, _b;
|
|
4154
|
+
const layout = __spreadValues({
|
|
4155
|
+
width: LOGICAL_WIDTH,
|
|
4156
|
+
height: LOGICAL_HEIGHT
|
|
4157
|
+
}, rawLayout);
|
|
4158
|
+
const layoutWidth = (_a = layout.width) != null ? _a : LOGICAL_WIDTH;
|
|
4159
|
+
const layoutHeight = (_b = layout.height) != null ? _b : LOGICAL_HEIGHT;
|
|
4160
|
+
matrix.identity();
|
|
4161
|
+
matrix.scale(layoutWidth / LOGICAL_WIDTH, layoutHeight / LOGICAL_HEIGHT);
|
|
4162
|
+
const width = originalWidth * matrix.a;
|
|
4163
|
+
const height = originalHeight * matrix.d;
|
|
4164
|
+
const offsetX = layout.x !== void 0 && layout.x - layoutWidth / 2 || layout.centerX !== void 0 && layout.centerX || layout.left !== void 0 && layout.left - layoutWidth / 2 || layout.right !== void 0 && layout.right + layoutWidth / 2 || 0;
|
|
4165
|
+
const offsetY = layout.y !== void 0 && layout.y - layoutHeight / 2 || layout.centerY !== void 0 && layout.centerY || layout.top !== void 0 && layout.top - layoutHeight / 2 || layout.bottom !== void 0 && layout.bottom + layoutHeight / 2 || 0;
|
|
4166
|
+
matrix.translate(width * offsetX, -height * offsetY);
|
|
4167
|
+
return {
|
|
4168
|
+
width,
|
|
4169
|
+
height
|
|
4170
|
+
};
|
|
4171
|
+
}
|
|
4172
|
+
function getCubismLayoutWidth(state, aspect) {
|
|
4173
|
+
return LOGICAL_HEIGHT * aspect * state.scale;
|
|
4174
|
+
}
|
|
4175
|
+
function getCubismLayoutHeight(state) {
|
|
4176
|
+
return LOGICAL_HEIGHT * state.scale;
|
|
4177
|
+
}
|
|
4178
|
+
function setCubismWidth(state, aspect, width) {
|
|
4179
|
+
state.scale = width / (LOGICAL_HEIGHT * aspect);
|
|
4180
|
+
}
|
|
4181
|
+
function setCubismHeight(state, height) {
|
|
4182
|
+
state.scale = height / LOGICAL_HEIGHT;
|
|
4183
|
+
}
|
|
4184
|
+
function setCubismX(state, x) {
|
|
4185
|
+
state.x = x;
|
|
4186
|
+
}
|
|
4187
|
+
function setCubismY(state, y) {
|
|
4188
|
+
state.y = y;
|
|
4189
|
+
}
|
|
4190
|
+
function centerCubismX(state, aspect, x) {
|
|
4191
|
+
setCubismX(state, x - getCubismLayoutWidth(state, aspect) / 2);
|
|
4192
|
+
}
|
|
4193
|
+
function centerCubismY(state, y) {
|
|
4194
|
+
setCubismY(state, y - getCubismLayoutHeight(state) / 2);
|
|
4195
|
+
}
|
|
4196
|
+
function rightCubism(state, aspect, x) {
|
|
4197
|
+
setCubismX(state, x - getCubismLayoutWidth(state, aspect));
|
|
4198
|
+
}
|
|
4199
|
+
function bottomCubism(state, y) {
|
|
4200
|
+
setCubismY(state, y - getCubismLayoutHeight(state));
|
|
4201
|
+
}
|
|
4202
|
+
function setupCubismLayoutMatrix(matrix, originalWidth, originalHeight, rawLayout) {
|
|
4203
|
+
if (originalWidth <= 0 || originalHeight <= 0) {
|
|
4204
|
+
matrix.identity();
|
|
4205
|
+
return { width: 0, height: 0 };
|
|
4206
|
+
}
|
|
4207
|
+
const entries = getLayoutEntries(rawLayout);
|
|
4208
|
+
const aspect = originalWidth / originalHeight;
|
|
4209
|
+
const state = { scale: 1, x: 0, y: 0 };
|
|
4210
|
+
for (const [key, value] of entries) {
|
|
4211
|
+
if (key === "width") {
|
|
4212
|
+
setCubismWidth(state, aspect, value);
|
|
4213
|
+
} else if (key === "height") {
|
|
4214
|
+
setCubismHeight(state, value);
|
|
4215
|
+
}
|
|
4216
|
+
}
|
|
4217
|
+
for (const [key, value] of entries) {
|
|
4218
|
+
if (key === "x") {
|
|
4219
|
+
setCubismX(state, value);
|
|
4220
|
+
} else if (key === "y") {
|
|
4221
|
+
setCubismY(state, value);
|
|
4222
|
+
} else if (key === "centerX") {
|
|
4223
|
+
centerCubismX(state, aspect, value);
|
|
4224
|
+
} else if (key === "centerY") {
|
|
4225
|
+
centerCubismY(state, value);
|
|
4226
|
+
} else if (key === "top") {
|
|
4227
|
+
setCubismY(state, value);
|
|
4228
|
+
} else if (key === "bottom") {
|
|
4229
|
+
bottomCubism(state, value);
|
|
4230
|
+
} else if (key === "left") {
|
|
4231
|
+
setCubismX(state, value);
|
|
4232
|
+
} else if (key === "right") {
|
|
4233
|
+
rightCubism(state, aspect, value);
|
|
4234
|
+
}
|
|
4235
|
+
}
|
|
4236
|
+
const pixelsPerLogicalUnit = originalHeight / LOGICAL_HEIGHT;
|
|
4237
|
+
const defaultLogicalHalfWidth = LOGICAL_HEIGHT * aspect / 2;
|
|
4238
|
+
const defaultLogicalHalfHeight = LOGICAL_HEIGHT / 2;
|
|
4239
|
+
matrix.identity();
|
|
4240
|
+
setScale(matrix, state.scale);
|
|
4241
|
+
matrix.tx = pixelsPerLogicalUnit * (state.x + defaultLogicalHalfWidth) - originalWidth * state.scale / 2;
|
|
4242
|
+
matrix.ty = pixelsPerLogicalUnit * (defaultLogicalHalfHeight - state.y) - originalHeight * state.scale / 2;
|
|
4243
|
+
return {
|
|
4244
|
+
width: originalWidth * state.scale,
|
|
4245
|
+
height: originalHeight * state.scale
|
|
4246
|
+
};
|
|
4247
|
+
}
|
|
4136
4248
|
function normalizeHitAreaDefs(raw, resolveIndex) {
|
|
4137
4249
|
if (!Array.isArray(raw)) {
|
|
4138
4250
|
return [];
|
|
@@ -4222,19 +4334,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
4222
4334
|
const size = this.getSize();
|
|
4223
4335
|
self2.originalWidth = size[0];
|
|
4224
4336
|
self2.originalHeight = size[1];
|
|
4225
|
-
const
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
},
|
|
4337
|
+
const bounds = setupLayoutMatrix(
|
|
4338
|
+
this.localTransform,
|
|
4339
|
+
this.originalWidth,
|
|
4340
|
+
this.originalHeight,
|
|
4230
4341
|
this.getLayout()
|
|
4231
4342
|
);
|
|
4232
|
-
|
|
4233
|
-
self2.
|
|
4234
|
-
self2.height = this.originalHeight * this.localTransform.d;
|
|
4235
|
-
const offsetX = layout.x !== void 0 && layout.x - layout.width / 2 || layout.centerX !== void 0 && layout.centerX || layout.left !== void 0 && layout.left - layout.width / 2 || layout.right !== void 0 && layout.right + layout.width / 2 || 0;
|
|
4236
|
-
const offsetY = layout.y !== void 0 && layout.y - layout.height / 2 || layout.centerY !== void 0 && layout.centerY || layout.top !== void 0 && layout.top - layout.height / 2 || layout.bottom !== void 0 && layout.bottom + layout.height / 2 || 0;
|
|
4237
|
-
this.localTransform.translate(this.width * offsetX, -this.height * offsetY);
|
|
4343
|
+
self2.width = bounds.width;
|
|
4344
|
+
self2.height = bounds.height;
|
|
4238
4345
|
}
|
|
4239
4346
|
/**
|
|
4240
4347
|
* Sets up the hit areas by their definitions in settings.
|
|
@@ -8671,6 +8778,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
8671
8778
|
shouldCheckMotionConsistency
|
|
8672
8779
|
);
|
|
8673
8780
|
const json = new CubismMotionJson(data, data.byteLength);
|
|
8781
|
+
motion.setLoop(json.isMotionLoop());
|
|
8674
8782
|
const defaultFadingDuration = (group === this.groups.idle ? config.idleMotionFadingDuration : config.motionFadingDuration) / 1e3;
|
|
8675
8783
|
if (json.getMotionFadeInTime() === void 0) {
|
|
8676
8784
|
motion.setFadeInTime(
|
|
@@ -11359,6 +11467,30 @@ var __async = (__this, __arguments, generator) => {
|
|
|
11359
11467
|
const HIGH_PRECISION_MASK_MASKED_VERTEX_THRESHOLD = 4096;
|
|
11360
11468
|
const HIGH_PRECISION_MASK_VERTEX_RATIO_THRESHOLD = 0.5;
|
|
11361
11469
|
const HIGH_PRECISION_MASK_VERTEX_RATIO_DRAWABLE_THRESHOLD = 24;
|
|
11470
|
+
const layoutKeyMap = {
|
|
11471
|
+
CenterX: "centerX",
|
|
11472
|
+
centerX: "centerX",
|
|
11473
|
+
center_x: "centerX",
|
|
11474
|
+
CenterY: "centerY",
|
|
11475
|
+
centerY: "centerY",
|
|
11476
|
+
center_y: "centerY",
|
|
11477
|
+
X: "x",
|
|
11478
|
+
x: "x",
|
|
11479
|
+
Y: "y",
|
|
11480
|
+
y: "y",
|
|
11481
|
+
Width: "width",
|
|
11482
|
+
width: "width",
|
|
11483
|
+
Height: "height",
|
|
11484
|
+
height: "height",
|
|
11485
|
+
Top: "top",
|
|
11486
|
+
top: "top",
|
|
11487
|
+
Bottom: "bottom",
|
|
11488
|
+
bottom: "bottom",
|
|
11489
|
+
Left: "left",
|
|
11490
|
+
left: "left",
|
|
11491
|
+
Right: "right",
|
|
11492
|
+
right: "right"
|
|
11493
|
+
};
|
|
11362
11494
|
function getRequiredMaskRenderTextureCount(model) {
|
|
11363
11495
|
var _a;
|
|
11364
11496
|
if (!model.isUsingMasking()) {
|
|
@@ -11480,17 +11612,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
11480
11612
|
super.init();
|
|
11481
11613
|
const eyeBlinkParameters = this.settings.getEyeBlinkParameters();
|
|
11482
11614
|
if (eyeBlinkParameters.length) {
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
const parameterIds = new csmVector();
|
|
11487
|
-
for (const parameter of eyeBlinkParameters) {
|
|
11488
|
-
parameterIds.pushBack(this.idManager.getId(parameter));
|
|
11489
|
-
}
|
|
11490
|
-
const eyeBlink = CubismEyeBlink.create();
|
|
11491
|
-
(_a = eyeBlink.setParameterIds) == null ? void 0 : _a.call(eyeBlink, parameterIds);
|
|
11492
|
-
this.eyeBlink = eyeBlink;
|
|
11615
|
+
const parameterIds = new csmVector();
|
|
11616
|
+
for (const parameter of eyeBlinkParameters) {
|
|
11617
|
+
parameterIds.pushBack(this.idManager.getId(parameter));
|
|
11493
11618
|
}
|
|
11619
|
+
const eyeBlink = CubismEyeBlink.create();
|
|
11620
|
+
(_a = eyeBlink.setParameterIds) == null ? void 0 : _a.call(eyeBlink, parameterIds);
|
|
11621
|
+
this.eyeBlink = eyeBlink;
|
|
11494
11622
|
}
|
|
11495
11623
|
const breathParams = new csmVector();
|
|
11496
11624
|
breathParams.pushBack(
|
|
@@ -11545,16 +11673,29 @@ var __async = (__this, __arguments, generator) => {
|
|
|
11545
11673
|
const settingsLayout = this.settings.layout;
|
|
11546
11674
|
if (settingsLayout) {
|
|
11547
11675
|
for (const [key, value] of Object.entries(settingsLayout)) {
|
|
11548
|
-
const commonKey = key
|
|
11549
|
-
|
|
11676
|
+
const commonKey = layoutKeyMap[key];
|
|
11677
|
+
if (commonKey && typeof value === "number") {
|
|
11678
|
+
layout[commonKey] = value;
|
|
11679
|
+
}
|
|
11550
11680
|
}
|
|
11551
11681
|
}
|
|
11552
11682
|
return layout;
|
|
11553
11683
|
}
|
|
11554
11684
|
setupLayout() {
|
|
11555
|
-
|
|
11556
|
-
|
|
11557
|
-
|
|
11685
|
+
const self2 = this;
|
|
11686
|
+
const size = this.getSize();
|
|
11687
|
+
self2.originalWidth = size[0];
|
|
11688
|
+
self2.originalHeight = size[1];
|
|
11689
|
+
self2.pixelsPerUnit = this.coreModel.getModel().canvasinfo.PixelsPerUnit;
|
|
11690
|
+
const bounds = setupCubismLayoutMatrix(
|
|
11691
|
+
this.localTransform,
|
|
11692
|
+
this.originalWidth,
|
|
11693
|
+
this.originalHeight,
|
|
11694
|
+
this.getLayout()
|
|
11695
|
+
);
|
|
11696
|
+
self2.width = bounds.width;
|
|
11697
|
+
self2.height = bounds.height;
|
|
11698
|
+
this.modelTransform.identity().scale(this.pixelsPerUnit, this.pixelsPerUnit).translate(this.originalWidth / 2, this.originalHeight / 2);
|
|
11558
11699
|
}
|
|
11559
11700
|
updateWebGLContext(gl, glContextID) {
|
|
11560
11701
|
this.renderer.firstDraw = true;
|
|
@@ -11682,9 +11823,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
11682
11823
|
this.renderer = void 0;
|
|
11683
11824
|
this.coreModel = void 0;
|
|
11684
11825
|
}
|
|
11685
|
-
isCubismModelSetting(settings) {
|
|
11686
|
-
return typeof settings.getEyeBlinkParameterCount === "function" && typeof settings.getEyeBlinkParameterId === "function";
|
|
11687
|
-
}
|
|
11688
11826
|
}
|
|
11689
11827
|
class ICubismModelSetting {
|
|
11690
11828
|
}
|
|
@@ -12399,6 +12537,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12399
12537
|
Live2DCubismFramework2.CubismModelSettingJson = CubismModelSettingJson;
|
|
12400
12538
|
Live2DCubismFramework2.FrequestNode = FrequestNode;
|
|
12401
12539
|
})(Live2DCubismFramework$6 || (Live2DCubismFramework$6 = {}));
|
|
12540
|
+
const defaultEyeBlinkParameters = [
|
|
12541
|
+
CubismDefaultParameterId.ParamEyeLOpen,
|
|
12542
|
+
CubismDefaultParameterId.ParamEyeROpen
|
|
12543
|
+
];
|
|
12402
12544
|
class CubismModelSettings extends ModelSettings {
|
|
12403
12545
|
constructor(json) {
|
|
12404
12546
|
var _a, _b;
|
|
@@ -12498,7 +12640,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12498
12640
|
}
|
|
12499
12641
|
}
|
|
12500
12642
|
}
|
|
12501
|
-
return parameters;
|
|
12643
|
+
return parameters.length ? parameters : [...defaultEyeBlinkParameters];
|
|
12502
12644
|
}
|
|
12503
12645
|
getLipSyncParameters() {
|
|
12504
12646
|
var _a, _b, _c;
|