fromSb3: Fix loading component-based pen color blocks; document shadow blocks' fields more carefully#145
Merged
PullJosh merged 3 commits intoleopard-js:masterfrom Jun 17, 2024
Conversation
Also improves the clarity of some nearby comments.
Of note, only pen_menu_colorParam requires special behavior due to a mismatch between the shadow block's field name and the using blocks' input names.
Essentially just adds the pen extension to the blocks tested. The internal project.json is pretty-printed with JSON.stringify for slightly easier git committing (though the sb3 is still committed as a binary zip file).
Member
Author
|
Have requested a review from @adroitwhiz since this is probably at least of note to you, but all cool if you aren't around to look at this closely at the moment! |
adroitwhiz
approved these changes
Jun 5, 2024
Collaborator
adroitwhiz
left a comment
There was a problem hiding this comment.
LGTM! At some point, it may be worth revisiting shadow blocks but this should fix things for now.
PullJosh
approved these changes
Jun 17, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Development:
Hard-codes(!) a special-case fix for the
pen_menu_colorParamshadow block; we reviewed all shadow blocks that Leopard supports and would have included like fixes for any similar cases, but this is the only one.pen_menu_colorParamis different from normal SB3 shadow blocks because its field is namedcolorParamand does not match the name,COLOR_PARAM, of the input into which it is placed. All other names do match and we can just apply the shadow block's field as an sb-edit input with the same name, but this one needs to be manually transferred from sb3 fieldcolorParamto sb-edit inputCOLOR_PARAM.This fixes loading blocks which use this input (there are two in the Pen extension) and makes it so output formats see the
COLOR_PARAMinput that they're expecting. Our testing:toLeopardandtoSb3are working, and don't require any changes.fromSb3and writes withtoLeopard,toSb3, andtoScratchblocks)project.jsonis now pretty-printed w/JSON.stringifyfor more convenient git review. The SB3 is very old and saving it from the Scratch editor without making any changes will still produce a flat-out different file (in subtle ways), so the diff was manually reviewed to only commit the code changes. This should make for a clean diff in the snapshot file.