mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-11 10:39:56 -05:00
Don't include asset data in exported JSON
This commit is contained in:
parent
2a4af8a9ca
commit
b2ea201707
1 changed files with 16 additions and 4 deletions
|
@ -763,11 +763,23 @@ class RenderedTarget extends Target {
|
|||
this.dragging = false;
|
||||
}
|
||||
|
||||
assetListToJSON (assetList) {
|
||||
const exclude = ['data', 'url'];
|
||||
return assetList.map(asset =>
|
||||
Object.keys(asset).reduce((rAsset, prop) => {
|
||||
if (exclude.indexOf(prop) === -1) rAsset[prop] = asset[prop];
|
||||
return rAsset;
|
||||
}, {})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize sprite info, used when emitting events about the sprite
|
||||
* @returns {object} Sprite data as a simple object
|
||||
*/
|
||||
toJSON () {
|
||||
const costumes = this.assetListToJSON(this.getCostumes());
|
||||
const sounds = this.assetListToJSON(this.getSounds());
|
||||
return {
|
||||
id: this.id,
|
||||
name: this.getName(),
|
||||
|
@ -777,15 +789,15 @@ class RenderedTarget extends Target {
|
|||
size: this.size,
|
||||
direction: this.direction,
|
||||
draggable: this.draggable,
|
||||
costume: this.getCurrentCostume(),
|
||||
costumeCount: this.getCostumes().length,
|
||||
costume: costumes[this.currentCostume],
|
||||
costumeCount: costumes.length,
|
||||
visible: this.visible,
|
||||
rotationStyle: this.rotationStyle,
|
||||
blocks: this.blocks._blocks,
|
||||
variables: this.variables,
|
||||
lists: this.lists,
|
||||
costumes: this.getCostumes(),
|
||||
sounds: this.getSounds()
|
||||
costumes: costumes,
|
||||
sounds: sounds
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue