From 63be5bc48780cc0fe94a6b7544742a446ab0c3bc Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Thu, 4 Jan 2018 10:24:13 -0500 Subject: [PATCH] Transform sb2 looks reporters to new menu blocks --- src/serialization/sb2.js | 27 ++++++++++++++++++++++++--- src/serialization/sb2_specmap.js | 6 +++--- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/serialization/sb2.js b/src/serialization/sb2.js index 85f55910a..1102c005e 100644 --- a/src/serialization/sb2.js +++ b/src/serialization/sb2.js @@ -602,17 +602,38 @@ const parseBlock = function (sb2block, addBroadcastMsg, getVariableId, extension } } - // Updated layering blocks - if (oldOpcode === 'comeToFront') { + // Updates for blocks that have new menus (e.g. in Looks) + switch (oldOpcode) { + case 'comeToFront': activeBlock.fields.FRONT_BACK = { name: 'FRONT_BACK', value: 'front' }; - } else if (oldOpcode === 'goBackByLayers:') { + break; + case 'goBackByLayers:': activeBlock.fields.FORWARD_BACKWARD = { name: 'FORWARD_BACKWARD', value: 'backward' }; + break; + case 'backgroundIndex': + activeBlock.fields.NUMBER_NAME = { + name: 'NUMBER_NAME', + value: 'number' + }; + break; + case 'sceneName': + activeBlock.fields.NUMBER_NAME = { + name: 'NUMBER_NAME', + value: 'name' + }; + break; + case 'costumeIndex': + activeBlock.fields.NUMBER_NAME = { + name: 'NUMBER_NAME', + value: 'number' + }; + break; } // Special cases to generate mutations. diff --git a/src/serialization/sb2_specmap.js b/src/serialization/sb2_specmap.js index a8ca43540..bf386a15e 100644 --- a/src/serialization/sb2_specmap.js +++ b/src/serialization/sb2_specmap.js @@ -360,12 +360,12 @@ const specMap = { ] }, 'costumeIndex': { - opcode: 'looks_costumeorder', + opcode: 'looks_costumenumbername', argMap: [ ] }, 'sceneName': { - opcode: 'looks_backdropname', + opcode: 'looks_backdropnumbername', argMap: [ ] }, @@ -390,7 +390,7 @@ const specMap = { ] }, 'backgroundIndex': { - opcode: 'looks_backdroporder', + opcode: 'looks_backdropnumbername', argMap: [ ] },