From 884ba19aab57611da74bceeee09c04f98349f7df Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford Date: Tue, 13 Jun 2017 14:56:06 -0700 Subject: [PATCH] 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. --- src/serialization/sb3.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/serialization/sb3.js b/src/serialization/sb3.js index 816b1af19..3ffac8ead 100644 --- a/src/serialization/sb3.js +++ b/src/serialization/sb3.js @@ -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