mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
rename stage monitors along with stage
Rename Stage object and monitors together then use the set name to name the sprite.
This commit is contained in:
parent
b41423bdfa
commit
db7b356825
1 changed files with 10 additions and 1 deletions
|
@ -355,7 +355,16 @@ const parseScratchObject = function (object, runtime, extensions, topLevel, zip)
|
||||||
const sprite = new Sprite(blocks, runtime);
|
const sprite = new Sprite(blocks, runtime);
|
||||||
// Sprite/stage name from JSON.
|
// Sprite/stage name from JSON.
|
||||||
if (object.hasOwnProperty('objName')) {
|
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.
|
// Costumes from JSON.
|
||||||
const costumePromises = [];
|
const costumePromises = [];
|
||||||
|
|
Loading…
Reference in a new issue