From db7b356825d63ffb2eaddc0f5d7710b83022ea0a Mon Sep 17 00:00:00 2001 From: "Michael \"Z\" Goddard" Date: Fri, 7 Sep 2018 14:36:44 -0400 Subject: [PATCH] rename stage monitors along with stage Rename Stage object and monitors together then use the set name to name the sprite. --- src/serialization/sb2.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/serialization/sb2.js b/src/serialization/sb2.js index 6fd63c72c..02d09a205 100644 --- a/src/serialization/sb2.js +++ b/src/serialization/sb2.js @@ -355,7 +355,16 @@ const parseScratchObject = function (object, runtime, extensions, topLevel, zip) const sprite = new Sprite(blocks, runtime); // Sprite/stage name from JSON. if (object.hasOwnProperty('objName')) { - sprite.name = topLevel ? 'Stage' : object.objName; + if (topLevel && object.objName !== 'Stage') { + for (const child of object.children) { + if (!child.hasOwnProperty('objName') && child.target === object.objName) { + child.target = 'Stage'; + } + } + object.objName = 'Stage'; + } + + sprite.name = object.objName; } // Costumes from JSON. const costumePromises = [];