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:
Christopher Willis-Ford 2017-06-13 14:56:06 -07:00
parent 1bf1808826
commit 884ba19aab

View file

@ -75,7 +75,11 @@ const parseScratchObject = function (object, runtime) {
rotationCenterX: costumeSource.rotationCenterX,
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);
});
// Sounds from JSON