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/index.es.js
CHANGED
|
@@ -106,7 +106,7 @@ const config = {
|
|
|
106
106
|
preserveExpressionOnMotion: true,
|
|
107
107
|
cubism: CubismFrameworkConfig
|
|
108
108
|
};
|
|
109
|
-
const VERSION = "1.2.
|
|
109
|
+
const VERSION = "1.2.2";
|
|
110
110
|
const logger = {
|
|
111
111
|
log(tag, ...messages) {
|
|
112
112
|
if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
|
|
@@ -1477,6 +1477,118 @@ class MotionManager extends EventEmitter {
|
|
|
1477
1477
|
return definition;
|
|
1478
1478
|
}
|
|
1479
1479
|
}
|
|
1480
|
+
function setScale(matrix, scale) {
|
|
1481
|
+
matrix.a = scale;
|
|
1482
|
+
matrix.b = 0;
|
|
1483
|
+
matrix.c = 0;
|
|
1484
|
+
matrix.d = scale;
|
|
1485
|
+
}
|
|
1486
|
+
function getLayoutEntries(rawLayout) {
|
|
1487
|
+
const entries = [];
|
|
1488
|
+
for (const [key, value] of Object.entries(rawLayout)) {
|
|
1489
|
+
if (typeof value !== "number") {
|
|
1490
|
+
continue;
|
|
1491
|
+
}
|
|
1492
|
+
entries.push([key, value]);
|
|
1493
|
+
}
|
|
1494
|
+
return entries;
|
|
1495
|
+
}
|
|
1496
|
+
function setupLayoutMatrix(matrix, originalWidth, originalHeight, rawLayout) {
|
|
1497
|
+
var _a, _b;
|
|
1498
|
+
const layout = __spreadValues({
|
|
1499
|
+
width: LOGICAL_WIDTH,
|
|
1500
|
+
height: LOGICAL_HEIGHT
|
|
1501
|
+
}, rawLayout);
|
|
1502
|
+
const layoutWidth = (_a = layout.width) != null ? _a : LOGICAL_WIDTH;
|
|
1503
|
+
const layoutHeight = (_b = layout.height) != null ? _b : LOGICAL_HEIGHT;
|
|
1504
|
+
matrix.identity();
|
|
1505
|
+
matrix.scale(layoutWidth / LOGICAL_WIDTH, layoutHeight / LOGICAL_HEIGHT);
|
|
1506
|
+
const width = originalWidth * matrix.a;
|
|
1507
|
+
const height = originalHeight * matrix.d;
|
|
1508
|
+
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;
|
|
1509
|
+
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;
|
|
1510
|
+
matrix.translate(width * offsetX, -height * offsetY);
|
|
1511
|
+
return {
|
|
1512
|
+
width,
|
|
1513
|
+
height
|
|
1514
|
+
};
|
|
1515
|
+
}
|
|
1516
|
+
function getCubismLayoutWidth(state, aspect) {
|
|
1517
|
+
return LOGICAL_HEIGHT * aspect * state.scale;
|
|
1518
|
+
}
|
|
1519
|
+
function getCubismLayoutHeight(state) {
|
|
1520
|
+
return LOGICAL_HEIGHT * state.scale;
|
|
1521
|
+
}
|
|
1522
|
+
function setCubismWidth(state, aspect, width) {
|
|
1523
|
+
state.scale = width / (LOGICAL_HEIGHT * aspect);
|
|
1524
|
+
}
|
|
1525
|
+
function setCubismHeight(state, height) {
|
|
1526
|
+
state.scale = height / LOGICAL_HEIGHT;
|
|
1527
|
+
}
|
|
1528
|
+
function setCubismX(state, x) {
|
|
1529
|
+
state.x = x;
|
|
1530
|
+
}
|
|
1531
|
+
function setCubismY(state, y) {
|
|
1532
|
+
state.y = y;
|
|
1533
|
+
}
|
|
1534
|
+
function centerCubismX(state, aspect, x) {
|
|
1535
|
+
setCubismX(state, x - getCubismLayoutWidth(state, aspect) / 2);
|
|
1536
|
+
}
|
|
1537
|
+
function centerCubismY(state, y) {
|
|
1538
|
+
setCubismY(state, y - getCubismLayoutHeight(state) / 2);
|
|
1539
|
+
}
|
|
1540
|
+
function rightCubism(state, aspect, x) {
|
|
1541
|
+
setCubismX(state, x - getCubismLayoutWidth(state, aspect));
|
|
1542
|
+
}
|
|
1543
|
+
function bottomCubism(state, y) {
|
|
1544
|
+
setCubismY(state, y - getCubismLayoutHeight(state));
|
|
1545
|
+
}
|
|
1546
|
+
function setupCubismLayoutMatrix(matrix, originalWidth, originalHeight, rawLayout) {
|
|
1547
|
+
if (originalWidth <= 0 || originalHeight <= 0) {
|
|
1548
|
+
matrix.identity();
|
|
1549
|
+
return { width: 0, height: 0 };
|
|
1550
|
+
}
|
|
1551
|
+
const entries = getLayoutEntries(rawLayout);
|
|
1552
|
+
const aspect = originalWidth / originalHeight;
|
|
1553
|
+
const state = { scale: 1, x: 0, y: 0 };
|
|
1554
|
+
for (const [key, value] of entries) {
|
|
1555
|
+
if (key === "width") {
|
|
1556
|
+
setCubismWidth(state, aspect, value);
|
|
1557
|
+
} else if (key === "height") {
|
|
1558
|
+
setCubismHeight(state, value);
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
for (const [key, value] of entries) {
|
|
1562
|
+
if (key === "x") {
|
|
1563
|
+
setCubismX(state, value);
|
|
1564
|
+
} else if (key === "y") {
|
|
1565
|
+
setCubismY(state, value);
|
|
1566
|
+
} else if (key === "centerX") {
|
|
1567
|
+
centerCubismX(state, aspect, value);
|
|
1568
|
+
} else if (key === "centerY") {
|
|
1569
|
+
centerCubismY(state, value);
|
|
1570
|
+
} else if (key === "top") {
|
|
1571
|
+
setCubismY(state, value);
|
|
1572
|
+
} else if (key === "bottom") {
|
|
1573
|
+
bottomCubism(state, value);
|
|
1574
|
+
} else if (key === "left") {
|
|
1575
|
+
setCubismX(state, value);
|
|
1576
|
+
} else if (key === "right") {
|
|
1577
|
+
rightCubism(state, aspect, value);
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
const pixelsPerLogicalUnit = originalHeight / LOGICAL_HEIGHT;
|
|
1581
|
+
const defaultLogicalHalfWidth = LOGICAL_HEIGHT * aspect / 2;
|
|
1582
|
+
const defaultLogicalHalfHeight = LOGICAL_HEIGHT / 2;
|
|
1583
|
+
matrix.identity();
|
|
1584
|
+
setScale(matrix, state.scale);
|
|
1585
|
+
matrix.tx = pixelsPerLogicalUnit * (state.x + defaultLogicalHalfWidth) - originalWidth * state.scale / 2;
|
|
1586
|
+
matrix.ty = pixelsPerLogicalUnit * (defaultLogicalHalfHeight - state.y) - originalHeight * state.scale / 2;
|
|
1587
|
+
return {
|
|
1588
|
+
width: originalWidth * state.scale,
|
|
1589
|
+
height: originalHeight * state.scale
|
|
1590
|
+
};
|
|
1591
|
+
}
|
|
1480
1592
|
function normalizeHitAreaDefs(raw, resolveIndex) {
|
|
1481
1593
|
if (!Array.isArray(raw)) {
|
|
1482
1594
|
return [];
|
|
@@ -1566,19 +1678,14 @@ class InternalModel extends EventEmitter {
|
|
|
1566
1678
|
const size = this.getSize();
|
|
1567
1679
|
self.originalWidth = size[0];
|
|
1568
1680
|
self.originalHeight = size[1];
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
},
|
|
1681
|
+
const bounds = setupLayoutMatrix(
|
|
1682
|
+
this.localTransform,
|
|
1683
|
+
this.originalWidth,
|
|
1684
|
+
this.originalHeight,
|
|
1574
1685
|
this.getLayout()
|
|
1575
1686
|
);
|
|
1576
|
-
|
|
1577
|
-
self.
|
|
1578
|
-
self.height = this.originalHeight * this.localTransform.d;
|
|
1579
|
-
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;
|
|
1580
|
-
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;
|
|
1581
|
-
this.localTransform.translate(this.width * offsetX, -this.height * offsetY);
|
|
1687
|
+
self.width = bounds.width;
|
|
1688
|
+
self.height = bounds.height;
|
|
1582
1689
|
}
|
|
1583
1690
|
/**
|
|
1584
1691
|
* Sets up the hit areas by their definitions in settings.
|
|
@@ -9585,6 +9692,7 @@ class CubismMotionManager extends MotionManager {
|
|
|
9585
9692
|
shouldCheckMotionConsistency
|
|
9586
9693
|
);
|
|
9587
9694
|
const json = new CubismMotionJson(data, data.byteLength);
|
|
9695
|
+
motion.setLoop(json.isMotionLoop());
|
|
9588
9696
|
const defaultFadingDuration = (group === this.groups.idle ? config.idleMotionFadingDuration : config.motionFadingDuration) / 1e3;
|
|
9589
9697
|
if (json.getMotionFadeInTime() === void 0) {
|
|
9590
9698
|
motion.setFadeInTime(
|
|
@@ -12154,6 +12262,30 @@ const HIGH_PRECISION_MASK_MAX_MASKS_PER_DRAWABLE_THRESHOLD = 3;
|
|
|
12154
12262
|
const HIGH_PRECISION_MASK_MASKED_VERTEX_THRESHOLD = 4096;
|
|
12155
12263
|
const HIGH_PRECISION_MASK_VERTEX_RATIO_THRESHOLD = 0.5;
|
|
12156
12264
|
const HIGH_PRECISION_MASK_VERTEX_RATIO_DRAWABLE_THRESHOLD = 24;
|
|
12265
|
+
const layoutKeyMap = {
|
|
12266
|
+
CenterX: "centerX",
|
|
12267
|
+
centerX: "centerX",
|
|
12268
|
+
center_x: "centerX",
|
|
12269
|
+
CenterY: "centerY",
|
|
12270
|
+
centerY: "centerY",
|
|
12271
|
+
center_y: "centerY",
|
|
12272
|
+
X: "x",
|
|
12273
|
+
x: "x",
|
|
12274
|
+
Y: "y",
|
|
12275
|
+
y: "y",
|
|
12276
|
+
Width: "width",
|
|
12277
|
+
width: "width",
|
|
12278
|
+
Height: "height",
|
|
12279
|
+
height: "height",
|
|
12280
|
+
Top: "top",
|
|
12281
|
+
top: "top",
|
|
12282
|
+
Bottom: "bottom",
|
|
12283
|
+
bottom: "bottom",
|
|
12284
|
+
Left: "left",
|
|
12285
|
+
left: "left",
|
|
12286
|
+
Right: "right",
|
|
12287
|
+
right: "right"
|
|
12288
|
+
};
|
|
12157
12289
|
function getRequiredMaskRenderTextureCount(model) {
|
|
12158
12290
|
var _a;
|
|
12159
12291
|
if (!model.isUsingMasking()) {
|
|
@@ -12275,17 +12407,13 @@ class CubismInternalModel extends InternalModel {
|
|
|
12275
12407
|
super.init();
|
|
12276
12408
|
const eyeBlinkParameters = this.settings.getEyeBlinkParameters();
|
|
12277
12409
|
if (eyeBlinkParameters.length) {
|
|
12278
|
-
|
|
12279
|
-
|
|
12280
|
-
|
|
12281
|
-
const parameterIds = new csmVector();
|
|
12282
|
-
for (const parameter of eyeBlinkParameters) {
|
|
12283
|
-
parameterIds.pushBack(this.idManager.getId(parameter));
|
|
12284
|
-
}
|
|
12285
|
-
const eyeBlink = CubismEyeBlink.create();
|
|
12286
|
-
(_a = eyeBlink.setParameterIds) == null ? void 0 : _a.call(eyeBlink, parameterIds);
|
|
12287
|
-
this.eyeBlink = eyeBlink;
|
|
12410
|
+
const parameterIds = new csmVector();
|
|
12411
|
+
for (const parameter of eyeBlinkParameters) {
|
|
12412
|
+
parameterIds.pushBack(this.idManager.getId(parameter));
|
|
12288
12413
|
}
|
|
12414
|
+
const eyeBlink = CubismEyeBlink.create();
|
|
12415
|
+
(_a = eyeBlink.setParameterIds) == null ? void 0 : _a.call(eyeBlink, parameterIds);
|
|
12416
|
+
this.eyeBlink = eyeBlink;
|
|
12289
12417
|
}
|
|
12290
12418
|
const breathParams = new csmVector();
|
|
12291
12419
|
breathParams.pushBack(
|
|
@@ -12340,16 +12468,29 @@ class CubismInternalModel extends InternalModel {
|
|
|
12340
12468
|
const settingsLayout = this.settings.layout;
|
|
12341
12469
|
if (settingsLayout) {
|
|
12342
12470
|
for (const [key, value] of Object.entries(settingsLayout)) {
|
|
12343
|
-
const commonKey = key
|
|
12344
|
-
|
|
12471
|
+
const commonKey = layoutKeyMap[key];
|
|
12472
|
+
if (commonKey && typeof value === "number") {
|
|
12473
|
+
layout[commonKey] = value;
|
|
12474
|
+
}
|
|
12345
12475
|
}
|
|
12346
12476
|
}
|
|
12347
12477
|
return layout;
|
|
12348
12478
|
}
|
|
12349
12479
|
setupLayout() {
|
|
12350
|
-
|
|
12351
|
-
|
|
12352
|
-
|
|
12480
|
+
const self = this;
|
|
12481
|
+
const size = this.getSize();
|
|
12482
|
+
self.originalWidth = size[0];
|
|
12483
|
+
self.originalHeight = size[1];
|
|
12484
|
+
self.pixelsPerUnit = this.coreModel.getModel().canvasinfo.PixelsPerUnit;
|
|
12485
|
+
const bounds = setupCubismLayoutMatrix(
|
|
12486
|
+
this.localTransform,
|
|
12487
|
+
this.originalWidth,
|
|
12488
|
+
this.originalHeight,
|
|
12489
|
+
this.getLayout()
|
|
12490
|
+
);
|
|
12491
|
+
self.width = bounds.width;
|
|
12492
|
+
self.height = bounds.height;
|
|
12493
|
+
this.modelTransform.identity().scale(this.pixelsPerUnit, this.pixelsPerUnit).translate(this.originalWidth / 2, this.originalHeight / 2);
|
|
12353
12494
|
}
|
|
12354
12495
|
updateWebGLContext(gl, glContextID) {
|
|
12355
12496
|
this.renderer.firstDraw = true;
|
|
@@ -12477,9 +12618,6 @@ class CubismInternalModel extends InternalModel {
|
|
|
12477
12618
|
this.renderer = void 0;
|
|
12478
12619
|
this.coreModel = void 0;
|
|
12479
12620
|
}
|
|
12480
|
-
isCubismModelSetting(settings) {
|
|
12481
|
-
return typeof settings.getEyeBlinkParameterCount === "function" && typeof settings.getEyeBlinkParameterId === "function";
|
|
12482
|
-
}
|
|
12483
12621
|
}
|
|
12484
12622
|
class ICubismModelSetting {
|
|
12485
12623
|
}
|
|
@@ -13194,6 +13332,10 @@ var Live2DCubismFramework$6;
|
|
|
13194
13332
|
Live2DCubismFramework2.CubismModelSettingJson = CubismModelSettingJson;
|
|
13195
13333
|
Live2DCubismFramework2.FrequestNode = FrequestNode;
|
|
13196
13334
|
})(Live2DCubismFramework$6 || (Live2DCubismFramework$6 = {}));
|
|
13335
|
+
const defaultEyeBlinkParameters = [
|
|
13336
|
+
CubismDefaultParameterId.ParamEyeLOpen,
|
|
13337
|
+
CubismDefaultParameterId.ParamEyeROpen
|
|
13338
|
+
];
|
|
13197
13339
|
class CubismModelSettings extends ModelSettings {
|
|
13198
13340
|
constructor(json) {
|
|
13199
13341
|
var _a, _b;
|
|
@@ -13293,7 +13435,7 @@ class CubismModelSettings extends ModelSettings {
|
|
|
13293
13435
|
}
|
|
13294
13436
|
}
|
|
13295
13437
|
}
|
|
13296
|
-
return parameters;
|
|
13438
|
+
return parameters.length ? parameters : [...defaultEyeBlinkParameters];
|
|
13297
13439
|
}
|
|
13298
13440
|
getLipSyncParameters() {
|
|
13299
13441
|
var _a, _b, _c;
|
package/dist/index.js
CHANGED
|
@@ -108,7 +108,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
108
108
|
preserveExpressionOnMotion: true,
|
|
109
109
|
cubism: CubismFrameworkConfig
|
|
110
110
|
};
|
|
111
|
-
const VERSION = "1.2.
|
|
111
|
+
const VERSION = "1.2.2";
|
|
112
112
|
const logger = {
|
|
113
113
|
log(tag, ...messages) {
|
|
114
114
|
if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
|
|
@@ -1479,6 +1479,118 @@ var __async = (__this, __arguments, generator) => {
|
|
|
1479
1479
|
return definition;
|
|
1480
1480
|
}
|
|
1481
1481
|
}
|
|
1482
|
+
function setScale(matrix, scale) {
|
|
1483
|
+
matrix.a = scale;
|
|
1484
|
+
matrix.b = 0;
|
|
1485
|
+
matrix.c = 0;
|
|
1486
|
+
matrix.d = scale;
|
|
1487
|
+
}
|
|
1488
|
+
function getLayoutEntries(rawLayout) {
|
|
1489
|
+
const entries = [];
|
|
1490
|
+
for (const [key, value] of Object.entries(rawLayout)) {
|
|
1491
|
+
if (typeof value !== "number") {
|
|
1492
|
+
continue;
|
|
1493
|
+
}
|
|
1494
|
+
entries.push([key, value]);
|
|
1495
|
+
}
|
|
1496
|
+
return entries;
|
|
1497
|
+
}
|
|
1498
|
+
function setupLayoutMatrix(matrix, originalWidth, originalHeight, rawLayout) {
|
|
1499
|
+
var _a, _b;
|
|
1500
|
+
const layout = __spreadValues({
|
|
1501
|
+
width: LOGICAL_WIDTH,
|
|
1502
|
+
height: LOGICAL_HEIGHT
|
|
1503
|
+
}, rawLayout);
|
|
1504
|
+
const layoutWidth = (_a = layout.width) != null ? _a : LOGICAL_WIDTH;
|
|
1505
|
+
const layoutHeight = (_b = layout.height) != null ? _b : LOGICAL_HEIGHT;
|
|
1506
|
+
matrix.identity();
|
|
1507
|
+
matrix.scale(layoutWidth / LOGICAL_WIDTH, layoutHeight / LOGICAL_HEIGHT);
|
|
1508
|
+
const width = originalWidth * matrix.a;
|
|
1509
|
+
const height = originalHeight * matrix.d;
|
|
1510
|
+
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;
|
|
1511
|
+
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;
|
|
1512
|
+
matrix.translate(width * offsetX, -height * offsetY);
|
|
1513
|
+
return {
|
|
1514
|
+
width,
|
|
1515
|
+
height
|
|
1516
|
+
};
|
|
1517
|
+
}
|
|
1518
|
+
function getCubismLayoutWidth(state, aspect) {
|
|
1519
|
+
return LOGICAL_HEIGHT * aspect * state.scale;
|
|
1520
|
+
}
|
|
1521
|
+
function getCubismLayoutHeight(state) {
|
|
1522
|
+
return LOGICAL_HEIGHT * state.scale;
|
|
1523
|
+
}
|
|
1524
|
+
function setCubismWidth(state, aspect, width) {
|
|
1525
|
+
state.scale = width / (LOGICAL_HEIGHT * aspect);
|
|
1526
|
+
}
|
|
1527
|
+
function setCubismHeight(state, height) {
|
|
1528
|
+
state.scale = height / LOGICAL_HEIGHT;
|
|
1529
|
+
}
|
|
1530
|
+
function setCubismX(state, x) {
|
|
1531
|
+
state.x = x;
|
|
1532
|
+
}
|
|
1533
|
+
function setCubismY(state, y) {
|
|
1534
|
+
state.y = y;
|
|
1535
|
+
}
|
|
1536
|
+
function centerCubismX(state, aspect, x) {
|
|
1537
|
+
setCubismX(state, x - getCubismLayoutWidth(state, aspect) / 2);
|
|
1538
|
+
}
|
|
1539
|
+
function centerCubismY(state, y) {
|
|
1540
|
+
setCubismY(state, y - getCubismLayoutHeight(state) / 2);
|
|
1541
|
+
}
|
|
1542
|
+
function rightCubism(state, aspect, x) {
|
|
1543
|
+
setCubismX(state, x - getCubismLayoutWidth(state, aspect));
|
|
1544
|
+
}
|
|
1545
|
+
function bottomCubism(state, y) {
|
|
1546
|
+
setCubismY(state, y - getCubismLayoutHeight(state));
|
|
1547
|
+
}
|
|
1548
|
+
function setupCubismLayoutMatrix(matrix, originalWidth, originalHeight, rawLayout) {
|
|
1549
|
+
if (originalWidth <= 0 || originalHeight <= 0) {
|
|
1550
|
+
matrix.identity();
|
|
1551
|
+
return { width: 0, height: 0 };
|
|
1552
|
+
}
|
|
1553
|
+
const entries = getLayoutEntries(rawLayout);
|
|
1554
|
+
const aspect = originalWidth / originalHeight;
|
|
1555
|
+
const state = { scale: 1, x: 0, y: 0 };
|
|
1556
|
+
for (const [key, value] of entries) {
|
|
1557
|
+
if (key === "width") {
|
|
1558
|
+
setCubismWidth(state, aspect, value);
|
|
1559
|
+
} else if (key === "height") {
|
|
1560
|
+
setCubismHeight(state, value);
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
for (const [key, value] of entries) {
|
|
1564
|
+
if (key === "x") {
|
|
1565
|
+
setCubismX(state, value);
|
|
1566
|
+
} else if (key === "y") {
|
|
1567
|
+
setCubismY(state, value);
|
|
1568
|
+
} else if (key === "centerX") {
|
|
1569
|
+
centerCubismX(state, aspect, value);
|
|
1570
|
+
} else if (key === "centerY") {
|
|
1571
|
+
centerCubismY(state, value);
|
|
1572
|
+
} else if (key === "top") {
|
|
1573
|
+
setCubismY(state, value);
|
|
1574
|
+
} else if (key === "bottom") {
|
|
1575
|
+
bottomCubism(state, value);
|
|
1576
|
+
} else if (key === "left") {
|
|
1577
|
+
setCubismX(state, value);
|
|
1578
|
+
} else if (key === "right") {
|
|
1579
|
+
rightCubism(state, aspect, value);
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
const pixelsPerLogicalUnit = originalHeight / LOGICAL_HEIGHT;
|
|
1583
|
+
const defaultLogicalHalfWidth = LOGICAL_HEIGHT * aspect / 2;
|
|
1584
|
+
const defaultLogicalHalfHeight = LOGICAL_HEIGHT / 2;
|
|
1585
|
+
matrix.identity();
|
|
1586
|
+
setScale(matrix, state.scale);
|
|
1587
|
+
matrix.tx = pixelsPerLogicalUnit * (state.x + defaultLogicalHalfWidth) - originalWidth * state.scale / 2;
|
|
1588
|
+
matrix.ty = pixelsPerLogicalUnit * (defaultLogicalHalfHeight - state.y) - originalHeight * state.scale / 2;
|
|
1589
|
+
return {
|
|
1590
|
+
width: originalWidth * state.scale,
|
|
1591
|
+
height: originalHeight * state.scale
|
|
1592
|
+
};
|
|
1593
|
+
}
|
|
1482
1594
|
function normalizeHitAreaDefs(raw, resolveIndex) {
|
|
1483
1595
|
if (!Array.isArray(raw)) {
|
|
1484
1596
|
return [];
|
|
@@ -1568,19 +1680,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
1568
1680
|
const size = this.getSize();
|
|
1569
1681
|
self2.originalWidth = size[0];
|
|
1570
1682
|
self2.originalHeight = size[1];
|
|
1571
|
-
const
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
},
|
|
1683
|
+
const bounds = setupLayoutMatrix(
|
|
1684
|
+
this.localTransform,
|
|
1685
|
+
this.originalWidth,
|
|
1686
|
+
this.originalHeight,
|
|
1576
1687
|
this.getLayout()
|
|
1577
1688
|
);
|
|
1578
|
-
|
|
1579
|
-
self2.
|
|
1580
|
-
self2.height = this.originalHeight * this.localTransform.d;
|
|
1581
|
-
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;
|
|
1582
|
-
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;
|
|
1583
|
-
this.localTransform.translate(this.width * offsetX, -this.height * offsetY);
|
|
1689
|
+
self2.width = bounds.width;
|
|
1690
|
+
self2.height = bounds.height;
|
|
1584
1691
|
}
|
|
1585
1692
|
/**
|
|
1586
1693
|
* Sets up the hit areas by their definitions in settings.
|
|
@@ -9587,6 +9694,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
9587
9694
|
shouldCheckMotionConsistency
|
|
9588
9695
|
);
|
|
9589
9696
|
const json = new CubismMotionJson(data, data.byteLength);
|
|
9697
|
+
motion.setLoop(json.isMotionLoop());
|
|
9590
9698
|
const defaultFadingDuration = (group === this.groups.idle ? config.idleMotionFadingDuration : config.motionFadingDuration) / 1e3;
|
|
9591
9699
|
if (json.getMotionFadeInTime() === void 0) {
|
|
9592
9700
|
motion.setFadeInTime(
|
|
@@ -12156,6 +12264,30 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12156
12264
|
const HIGH_PRECISION_MASK_MASKED_VERTEX_THRESHOLD = 4096;
|
|
12157
12265
|
const HIGH_PRECISION_MASK_VERTEX_RATIO_THRESHOLD = 0.5;
|
|
12158
12266
|
const HIGH_PRECISION_MASK_VERTEX_RATIO_DRAWABLE_THRESHOLD = 24;
|
|
12267
|
+
const layoutKeyMap = {
|
|
12268
|
+
CenterX: "centerX",
|
|
12269
|
+
centerX: "centerX",
|
|
12270
|
+
center_x: "centerX",
|
|
12271
|
+
CenterY: "centerY",
|
|
12272
|
+
centerY: "centerY",
|
|
12273
|
+
center_y: "centerY",
|
|
12274
|
+
X: "x",
|
|
12275
|
+
x: "x",
|
|
12276
|
+
Y: "y",
|
|
12277
|
+
y: "y",
|
|
12278
|
+
Width: "width",
|
|
12279
|
+
width: "width",
|
|
12280
|
+
Height: "height",
|
|
12281
|
+
height: "height",
|
|
12282
|
+
Top: "top",
|
|
12283
|
+
top: "top",
|
|
12284
|
+
Bottom: "bottom",
|
|
12285
|
+
bottom: "bottom",
|
|
12286
|
+
Left: "left",
|
|
12287
|
+
left: "left",
|
|
12288
|
+
Right: "right",
|
|
12289
|
+
right: "right"
|
|
12290
|
+
};
|
|
12159
12291
|
function getRequiredMaskRenderTextureCount(model) {
|
|
12160
12292
|
var _a;
|
|
12161
12293
|
if (!model.isUsingMasking()) {
|
|
@@ -12277,17 +12409,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12277
12409
|
super.init();
|
|
12278
12410
|
const eyeBlinkParameters = this.settings.getEyeBlinkParameters();
|
|
12279
12411
|
if (eyeBlinkParameters.length) {
|
|
12280
|
-
|
|
12281
|
-
|
|
12282
|
-
|
|
12283
|
-
const parameterIds = new csmVector();
|
|
12284
|
-
for (const parameter of eyeBlinkParameters) {
|
|
12285
|
-
parameterIds.pushBack(this.idManager.getId(parameter));
|
|
12286
|
-
}
|
|
12287
|
-
const eyeBlink = CubismEyeBlink.create();
|
|
12288
|
-
(_a = eyeBlink.setParameterIds) == null ? void 0 : _a.call(eyeBlink, parameterIds);
|
|
12289
|
-
this.eyeBlink = eyeBlink;
|
|
12412
|
+
const parameterIds = new csmVector();
|
|
12413
|
+
for (const parameter of eyeBlinkParameters) {
|
|
12414
|
+
parameterIds.pushBack(this.idManager.getId(parameter));
|
|
12290
12415
|
}
|
|
12416
|
+
const eyeBlink = CubismEyeBlink.create();
|
|
12417
|
+
(_a = eyeBlink.setParameterIds) == null ? void 0 : _a.call(eyeBlink, parameterIds);
|
|
12418
|
+
this.eyeBlink = eyeBlink;
|
|
12291
12419
|
}
|
|
12292
12420
|
const breathParams = new csmVector();
|
|
12293
12421
|
breathParams.pushBack(
|
|
@@ -12342,16 +12470,29 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12342
12470
|
const settingsLayout = this.settings.layout;
|
|
12343
12471
|
if (settingsLayout) {
|
|
12344
12472
|
for (const [key, value] of Object.entries(settingsLayout)) {
|
|
12345
|
-
const commonKey = key
|
|
12346
|
-
|
|
12473
|
+
const commonKey = layoutKeyMap[key];
|
|
12474
|
+
if (commonKey && typeof value === "number") {
|
|
12475
|
+
layout[commonKey] = value;
|
|
12476
|
+
}
|
|
12347
12477
|
}
|
|
12348
12478
|
}
|
|
12349
12479
|
return layout;
|
|
12350
12480
|
}
|
|
12351
12481
|
setupLayout() {
|
|
12352
|
-
|
|
12353
|
-
|
|
12354
|
-
|
|
12482
|
+
const self2 = this;
|
|
12483
|
+
const size = this.getSize();
|
|
12484
|
+
self2.originalWidth = size[0];
|
|
12485
|
+
self2.originalHeight = size[1];
|
|
12486
|
+
self2.pixelsPerUnit = this.coreModel.getModel().canvasinfo.PixelsPerUnit;
|
|
12487
|
+
const bounds = setupCubismLayoutMatrix(
|
|
12488
|
+
this.localTransform,
|
|
12489
|
+
this.originalWidth,
|
|
12490
|
+
this.originalHeight,
|
|
12491
|
+
this.getLayout()
|
|
12492
|
+
);
|
|
12493
|
+
self2.width = bounds.width;
|
|
12494
|
+
self2.height = bounds.height;
|
|
12495
|
+
this.modelTransform.identity().scale(this.pixelsPerUnit, this.pixelsPerUnit).translate(this.originalWidth / 2, this.originalHeight / 2);
|
|
12355
12496
|
}
|
|
12356
12497
|
updateWebGLContext(gl, glContextID) {
|
|
12357
12498
|
this.renderer.firstDraw = true;
|
|
@@ -12479,9 +12620,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
12479
12620
|
this.renderer = void 0;
|
|
12480
12621
|
this.coreModel = void 0;
|
|
12481
12622
|
}
|
|
12482
|
-
isCubismModelSetting(settings) {
|
|
12483
|
-
return typeof settings.getEyeBlinkParameterCount === "function" && typeof settings.getEyeBlinkParameterId === "function";
|
|
12484
|
-
}
|
|
12485
12623
|
}
|
|
12486
12624
|
class ICubismModelSetting {
|
|
12487
12625
|
}
|
|
@@ -13196,6 +13334,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
13196
13334
|
Live2DCubismFramework2.CubismModelSettingJson = CubismModelSettingJson;
|
|
13197
13335
|
Live2DCubismFramework2.FrequestNode = FrequestNode;
|
|
13198
13336
|
})(Live2DCubismFramework$6 || (Live2DCubismFramework$6 = {}));
|
|
13337
|
+
const defaultEyeBlinkParameters = [
|
|
13338
|
+
CubismDefaultParameterId.ParamEyeLOpen,
|
|
13339
|
+
CubismDefaultParameterId.ParamEyeROpen
|
|
13340
|
+
];
|
|
13199
13341
|
class CubismModelSettings extends ModelSettings {
|
|
13200
13342
|
constructor(json) {
|
|
13201
13343
|
var _a, _b;
|
|
@@ -13295,7 +13437,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
13295
13437
|
}
|
|
13296
13438
|
}
|
|
13297
13439
|
}
|
|
13298
|
-
return parameters;
|
|
13440
|
+
return parameters.length ? parameters : [...defaultEyeBlinkParameters];
|
|
13299
13441
|
}
|
|
13300
13442
|
getLipSyncParameters() {
|
|
13301
13443
|
var _a, _b, _c;
|