Specify dataFormat when loading asset for import

When importing a project we know the file extension for each asset to be
loaded. This change provides that information to the storage system so
that we can load assets which don't use the default. For example, this
allows loading JPG-format backdrops.

In support of this change, there's a new function on `StringUtil` called
`splitFirst`, which splits a string on the first instance of a separator
character. This change includes unit tests for this new function.
This commit is contained in:
Christopher Willis-Ford 2017-05-24 15:30:29 -07:00
parent b39de6722f
commit eb931fd99b
7 changed files with 44 additions and 9 deletions
src/serialization

View file

@ -75,7 +75,7 @@ const parseScratchObject = function (object, runtime) {
rotationCenterX: costumeSource.rotationCenterX,
rotationCenterY: costumeSource.rotationCenterY
};
const costumeMd5 = `${costumeSource.assetId}.${costumeSource.assetType.runtimeFormat}`;
const costumeMd5 = `${costumeSource.assetId}.${costumeSource.dataFormat}`;
return loadCostume(costumeMd5, costume, runtime);
});
// Sounds from JSON