Commit graph

1947 commits

Author SHA1 Message Date
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
Christopher Willis-Ford
4210c6dd4c Fix stack check in stepThread
The previous logic seemed to be expecting `peekStack` to return 0 when
the stack was empty, but its return type is `?string` and it returns
`undefined` when the stack is empty. The `!== 0` check would never pass,
then, leading to problems with (for example) the "say/think and wait"
blocks.
2018-03-14 16:17:29 -07:00
Christopher Willis-Ford
b5d7602f4f Add test for say/think and wait
This test currently fails due to a bug in the sequencer's `stepThread`
method. The bug affects real projects, too, but was not caught by any
test prior to this one.
2018-03-14 16:16:59 -07:00
Christopher Willis-Ford
b61c6a8f76 Don't render say/think bubbles during tests
This change makes say & think commands work during headless tests.
2018-03-14 16:07:05 -07:00
Eric Rosenbaum
a652156032 Sensing-of block gets target volume 2018-03-13 11:45:11 -04:00
Eric Rosenbaum
f8c2771776 Use target volume, not custom state 2018-03-13 11:43:53 -04:00
Eric Rosenbaum
a7c6c430b8 Add volume to rendered target 2018-03-13 11:43:33 -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
picklesrus
39d2559e37 Initial version of translate extension. 2018-03-11 12:18:21 -07: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
Jake Bartles
11e12cca4f fixed issue 960 2018-03-05 20:15:49 -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
Florrie
00b151b9ff Add doForLoop to sb2 specmap 2018-03-05 17:36:17 -04:00
Florrie
a03f45d1d7 Add tests for forEach block 2018-03-05 16:18:09 -04: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
Florrie
928df260ff Fix lint errors 2018-03-05 15:46:54 -04:00
Florrie
defcc45419 Implement foreach block 2018-03-05 15:36:26 -04: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