sb-edit
sb-edit copied to clipboard
.sb loading support
The original Scratch 1.x file format (.sb
) would be good to implement.
The following sources might be useful for figuring out how it works:
- The Scratch Project File Format documentation from John Maloney, Scratch 1.x developer. This is out-of-date with regards to newer Scratch features (e.g. lists + comments) but could be a good starting point.
-
kurt
, a Python library which supports reading the Scratch 1.x file format. -
scratch-sb1-converter
, the JS library that Scratch itself currently uses to convert .sb files into .sb2. -
ObjReader.as
, the ActionScript code used by Scratch 2.0 to read .sb files.
Scratch 1.x uses mostly the same block opcodes as 2.0, so the same opcode mappings could potentially be used for both formats. As such, this is kinda blocked on ~~a .sb2 implementation.~~ the library rework in #100.
Couldn't you just use https://github.com/LLK/scratch-sb1-converter and load the sb2, once sb2 loading is done?
scratch-sb1-converter-bundle.zip
We can use the JS file I have above. Then you can use ScratchSB1Converter
. If you don't know how to use it, here is an example:
fetch("https://projects.scratch.mit.edu/1000").then(res => res.arrayBuffer()).then(data => new ScratchSB1Converter.SB1File(data)).then(data => {
console.log(data.json); // This logs a Scratch 1 project as a Scratch 2 JSON object in the console.
console.log(data.zip); // This logs all bytes of the Scratch 1 project's assets in the console (but not the JSON).
});
Yeah, we know about that. Currently it is blocked by sb2 loading support.
On Wed, Jul 8, 2020, 5:35 AM Boomer001 [email protected] wrote:
scratch-sb1-converter-bundle.zip https://github.com/PullJosh/sb-edit/files/4889780/scratch-sb1-converter-bundle.zip We can use the JS file I have above. Then you can use ScratchSB1Converter. If you don't know how to use it, here is an example:
fetch("https://projects.scratch.mit.edu/1000").then(res => res.arrayBuffer()).then(data => new ScratchSB1Converter.SB1File(data)).then(data => { console.log(data.json); // This logs a Scratch 1 project as a Scratch 2 JSON object in the console. console.log(data.zip); // This logs all bytes of the Scratch 1 project's assets in the console (but not the JSON).});
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PullJosh/sb-edit/issues/37#issuecomment-655407980, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFQENB4IPABSLOTJMRKBRK3R2Q4WNANCNFSM4K66PROA .
@adroitwhiz, is this something you're interested in exploring in the near future or would you like to clear the assignment and let anyone (maybe yourself) come back to it later?
I'm interested on working this after the library is recoded to fix #100. I was blocked in the past on a resolution to #53, but I think we should be good once #100 is fixed.
Sounds good, that makes sense!