From 0dc1883e9f40f69db804c0a7eaceb2f79f8cb5f1 Mon Sep 17 00:00:00 2001 From: morant Date: Tue, 7 Feb 2017 18:15:11 -0500 Subject: [PATCH] Write costumes and sounds to JSON on save --- src/serialization/sb3.js | 2 +- src/sprites/rendered-target.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/serialization/sb3.js b/src/serialization/sb3.js index 727afe00f..7189a3b7c 100644 --- a/src/serialization/sb3.js +++ b/src/serialization/sb3.js @@ -67,7 +67,7 @@ var parseScratchObject = function (object, runtime, topLevel) { // Costumes from JSON. if (object.hasOwnProperty('costumes') || object.hasOwnProperty('costume')) { for (var i = 0; i < object.costumeCount; i++) { - var costume = object.costume; // [i]? + var costume = object.costumes[i]; // @todo: Make sure all the relevant metadata is being pulled out. sprite.costumes.push({ skin: costume.skin, diff --git a/src/sprites/rendered-target.js b/src/sprites/rendered-target.js index effc48897..9d9efaf7c 100644 --- a/src/sprites/rendered-target.js +++ b/src/sprites/rendered-target.js @@ -723,7 +723,9 @@ RenderedTarget.prototype.toJSON = function () { rotationStyle: this.rotationStyle, blocks: this.blocks._blocks, variables: this.variables, - lists: this.lists + lists: this.lists, + costumes: this.getCostumes(), + sounds: this.sprite.sounds }; };