mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Add support for older SB3 JSON
If the `dataFormat` field is absent, fall back on the older `assetType` field. That can at least help us tell if something is a vector or bitmap image, though it doesn't tell us which kind of bitmap.
This commit is contained in:
parent
1bf1808826
commit
884ba19aab
1 changed files with 5 additions and 1 deletions
|
@ -75,7 +75,11 @@ const parseScratchObject = function (object, runtime) {
|
||||||
rotationCenterX: costumeSource.rotationCenterX,
|
rotationCenterX: costumeSource.rotationCenterX,
|
||||||
rotationCenterY: costumeSource.rotationCenterY
|
rotationCenterY: costumeSource.rotationCenterY
|
||||||
};
|
};
|
||||||
const costumeMd5 = `${costumeSource.assetId}.${costumeSource.dataFormat}`;
|
const dataFormat =
|
||||||
|
costumeSource.dataFormat ||
|
||||||
|
(costumeSource.assetType && costumeSource.assetType.runtimeFormat) || // older format
|
||||||
|
'png'; // if all else fails, guess that it might be a PNG
|
||||||
|
const costumeMd5 = `${costumeSource.assetId}.${dataFormat}`;
|
||||||
return loadCostume(costumeMd5, costume, runtime);
|
return loadCostume(costumeMd5, costume, runtime);
|
||||||
});
|
});
|
||||||
// Sounds from JSON
|
// Sounds from JSON
|
||||||
|
|
Loading…
Reference in a new issue