Commit graph

1589 commits

Author SHA1 Message Date
Karishma Chadha
3a4f620318 Check if loadProject input is any typed array using ArrayBuffer.isView. This allows us to pass a project's asset.data (from storage) directly instead of calling toString on it first. 2018-03-22 14:04:58 -04:00
Karishma Chadha
2c3e3472ed Add warning to 'fromJSON' function since it is now just a wrapper around loadProject. Change vm sb3_serialization test to use 'loadProject' function instead of 'fromJSON'. 2018-03-21 17:55:02 -04:00
Karishma Chadha
ce6ef92eb5 Clear runtime after validation success instead of before. 2018-03-21 17:46:39 -04:00
Karishma Chadha
ab863096cd Remove cruft and fix for..in loops. 2018-03-21 17:42:01 -04:00
Karishma Chadha
9d3a3fd12f When serializing md5+ext, the name should reflect that. Deserializing translates this name back to what vm and other components currently expect. 2018-03-21 16:51:40 -04:00
Karishma Chadha
24e248d4fb Removing cruft... 2018-03-21 14:46:21 -04:00
Karishma Chadha
b4f6f24926 Fix up tests. 2018-03-16 11:43:27 -04:00
Karishma Chadha
003ed01015 Update VM to use scratch-parser callback interface 2018-03-15 22:40:40 -04:00
kchadha
a3ed4cad99 Remove todo 2018-03-14 22:52:00 -04:00
kchadha
0d55e4c74f Modifying apis to accomodate existing tests. 2018-03-14 22:52:00 -04:00
kchadha
22be2b15f3 Major refactor of project loading. Removed loadProjectLocal, in favor of going back to single API (loadProject). loadProject uses scratch-parser to unpack and validate project. Scratch-parser is getting updated to return validated project, with appended project metadata, and unpacked zip (JSZip object) if provided a buffer. 2018-03-14 22:52:00 -04:00
kchadha
2c551d1739 Some more cleanup. 2018-03-14 22:51:59 -04:00
kchadha
09c8110923 Always serialize parent and next on a block even if they're null. 2018-03-14 22:51:59 -04:00
kchadha
4f6ece9fa8 Be specific about what we're serializing. Flatten targets first by turning them into JSON strings and re-parsing them, and then only serialize the properties necessary for saving and loading. 2018-03-14 22:51:59 -04:00
Andrew Sliwinski
2ae788ca28
Merge pull request #968 from gnarf/instanceof-fix
ensure this.workerClass exists before instanceof check
2018-03-12 12:45:09 -04:00
Andrew Sliwinski
6039f1b7e7
Merge pull request #969 from gnarf/fix-music-no-audio
Ensure music extension _decodeSound is promise
2018-03-12 12:44:16 -04:00
kchadha
adfbeddcab
Merge pull request #964 from kchadha/save-load
Preliminary Save and Load Work
2018-03-09 09:34:44 -05:00
Corey Frang
1d414dd5a0 Ensure music extension _decodeSound is promise
Currently if there is no audio engine detected this returns undefined,
which in turn causes the line above to fail trying to call `.then` on
it.
2018-03-08 12:32:01 -05:00
kchadha
d59a4ffd55 VM receives input buffer representing project to load and unpacks it as zip. This functionality will eventually move to storage. 2018-03-08 10:25:58 -05:00
Corey Frang
9b8a8647f0 ensure this.workerClass exists before instanceof check
This avoids an error I was running into in a node environment:

```
TypeError: Right-hand side of 'instanceof' is not an object
```
2018-03-07 18:13:15 -05:00
kchadha
cc2bf1dfc7
Merge pull request #957 from kchadha/mouse-up-drag-end
Use flag to selectively activate 'when this sprite clicked' hat on mouse up
2018-03-07 13:26:28 -05:00
Chris Willis-Ford
219f083a29
Merge pull request #934 from picklesrus/extensions-dynamic-menu
Extensions dynamic menu
2018-03-06 16:33:26 -05:00
Karishma Chadha
d6e248aab8 VM should do the heavy lifting of saving project to a zip file, and return a promise of the zip to gui. 2018-03-05 17:20:36 -05:00
Karishma Chadha
c0afcd2ab3 Ensure that md5 and assetId stay in sync. 2018-03-05 15:16:06 -05:00
Karishma Chadha
9d8602db93 Removing specific save-load branch dependency now that scratch-parser has been updated. 2018-03-05 15:16:06 -05:00
Karishma Chadha
605ce4b16d Configuring scratch-vm to use changes made to scratch-parser. 2018-03-05 15:16:06 -05:00
Karishma Chadha
e0b23cde31 Can load saved sb3 files (including sounds and costumes that were modified in the 3.0 editors and saved in the sb3 zip when the project was saved). Tests still need to be fixed. 2018-03-05 15:16:06 -05:00
Karishma Chadha
089df0a50f Sounds get updated in storage and vm runtime when they are updated in the sound editor. The updateSvg function ensures that the costume that was edited has an updated dataFormat property in the vm runtime. This is specifically for when pngs get edited in the vector editor. Their file format should then get updated to svg. 2018-03-05 15:16:06 -05:00
Karishma Chadha
52c77d9fb0 Updating asset serialization code to get data format from stored asset rather than vm state. Storage seems to be more up to date than vm in the case of editing the blank backdrop, which is stored as a png instead of an svg. 2018-03-05 15:16:06 -05:00
Karishma Chadha
525a8c2ce7 Serializing sounds and costumes into file descriptors upon 'saveProjectSb3'. 2018-03-05 15:16:06 -05:00
Karishma Chadha
1169f5badd Hooking up vm to scratch-parser for sb2 validation. 2018-03-05 15:16:06 -05:00
DD Liu
02c6002bb2
Merge pull request #961 from fsih/returnCostumes
Temporarily return real costumes array. GUI currently relies on this behavior somewhere
2018-03-05 12:02:41 -05:00
DD Liu
97d3785554 Temporarily return real costumes array. GUI currently relies on this behavior somewhere 2018-03-05 11:07:50 -05:00
picklesrus
16ecaab1be Fix up comment. 2018-03-02 11:07:22 -08:00
picklesrus
026b9dc282 Stop wrapping function for no reason. 2018-03-02 11:02:56 -08:00
kchadha
a0c7d9aeb3
Merge pull request #956 from kchadha/validate-sb2
Validate sb2
2018-03-02 10:28:53 -05:00
DD Liu
a907dba639
Merge pull request #943 from fsih/privateSprite
Make sprite.costumes private
2018-03-01 17:34:40 -05:00
DD
b885402081 Merge branch 'develop' into privateSprite 2018-03-01 17:27:10 -05:00
Eric Rosenbaum
5d658b5ecb
Merge pull request #953 from ericrosenbaum/bugfix/load-tempo-from-sb2
Load tempo from sb2
2018-03-01 13:20:37 -05:00
Eric Rosenbaum
981fc57a43
Merge pull request #950 from ericrosenbaum/bugfix/import-music-menus
Fix music extension menu import
2018-02-28 18:47:30 -05:00
kchadha
8bebc1f5a2
Merge pull request #952 from kchadha/duplicate-sprite-names
Duplicating sprite should give new sprite a fresh name.
2018-02-28 17:13:19 -05:00
Karishma Chadha
d9fb315e3b Removing log messages. 2018-02-28 17:10:54 -05:00
Ray Schamp
4e933eed81
Merge pull request #878 from davidaylaian/reduce-peekstack-calls
Optimize stepThread by reducing the number of calls to peekStack
2018-02-28 16:50:20 -05:00
Karishma Chadha
d51a2ad39f Use wasDragged flag to selectively activate 'when this sprite clicked' block on mouse up. 2018-02-28 16:45:26 -05:00
Karishma Chadha
7c7b016643 scratch-parser expects json string... 2018-02-28 11:52:22 -05:00
Karishma Chadha
59d1c2a0b3 Code cleanup and actually throw errors when project fails to load. Depends on scratch-gui loading sb3 version of default project. 2018-02-28 10:02:02 -05:00
Eric Rosenbaum
a0525542fc Stub runtime to fix unit test 2018-02-27 15:38:34 -05:00
Eric Rosenbaum
db795abfbc Use tempo stored in stage 2018-02-27 11:48:49 -05:00
Eric Rosenbaum
7e5e43fbe1 Load tempo from sb2 2018-02-27 11:48:23 -05:00
Eric Rosenbaum
237616490f Add tempo property to rendered target 2018-02-27 11:48:14 -05:00