Update to Cubism 4 SDK for Web R5 beta5

This commit is contained in:
wada
2022-08-04 11:17:45 +09:00
parent 4e14ef622d
commit e115df6e1e
7 changed files with 288 additions and 236 deletions

View File

@ -24,7 +24,10 @@ export class CubismMoc {
if (moc) {
cubismMoc = new CubismMoc(moc);
cubismMoc._mocVersion = Live2DCubismCore.Version.csmGetMocVersion(moc);
cubismMoc._mocVersion = Live2DCubismCore.Version.csmGetMocVersion(
moc,
mocBytes
);
}
return cubismMoc;

View File

@ -129,14 +129,20 @@ export class CubismUserModel {
*/
public loadModel(buffer: ArrayBuffer) {
this._moc = CubismMoc.create(buffer);
this._model = this._moc.createModel();
this._model.saveParameters();
if (this._moc == null || this._model == null) {
if (this._moc == null) {
CubismLogError('Failed to CubismMoc.create().');
return;
}
this._model = this._moc.createModel();
if (this._model == null) {
CubismLogError('Failed to CreateModel().');
return;
}
this._model.saveParameters();
this._modelMatrix = new CubismModelMatrix(
this._model.getCanvasWidth(),
this._model.getCanvasHeight()