leopard-js / sb-edit

Javascript library for manipulating Scratch project files
MIT License
54 stars 15 forks source link

fromSb3: Fix loading component-based pen color blocks; document shadow blocks' fields more carefully #145

Closed towerofnix closed 5 months ago

towerofnix commented 5 months ago

Development:

Hard-codes(!) a special-case fix for the pen_menu_colorParam shadow 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_colorParam is different from normal SB3 shadow blocks because its field is named colorParam and 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 field colorParam to sb-edit input COLOR_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_PARAM input that they're expecting. Our testing:

towerofnix commented 5 months ago

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!