Commit graph

205 commits

Author SHA1 Message Date
Karishma Chadha
dfa3408add Update sound dataFormat after editing 2018-04-20 14:13:57 -04:00
kchadha
8739a524eb
Merge pull request #1031 from kchadha/block_serialization_compression
Block serialization compression
2018-04-11 19:17:42 -04:00
Paul Kaplan
f23b5a9625
Merge pull request #1041 from paulkaplan/fix-clone-drag
Only select the original target after a drag.
2018-04-11 10:04:25 -04:00
Paul Kaplan
64c2d1f7b1
Merge pull request #1038 from paulkaplan/skin-size
Attach the costume size to the costume when loaded and modified
2018-04-11 09:30:02 -04:00
Paul Kaplan
4a9adcc3d9 Make stopDrag deal with bare targets and add tests 2018-04-11 09:12:43 -04:00
Chris Willis-Ford
631d7fb4de
Merge pull request #1021 from cwillisf/features-for-control-extension
Features for control extension
2018-04-10 12:17:43 -07:00
Paul Kaplan
da539ea6cd Only select the original target after a drag.
This allows you to still drag clones around, but when you stop dragging,
the original sprite gets selected.
2018-04-10 14:31:49 -04:00
Paul Kaplan
89eb1ce39b Set the costume asset size when a costume is loaded or modified. 2018-04-10 09:51:29 -04:00
Karishma Chadha
e92db8fa1e Don't really need level 9 compression. 2018-04-06 15:47:24 -04:00
Karishma Chadha
334058b081 Block and variable compression. No need to serialize uid of block and shadow if they are the same, reduce duplication of information. 2018-04-06 11:33:44 -04:00
Christopher Willis-Ford
3be16eddb1 Add code to load 'core' extensions 2018-04-05 12:20:03 -07:00
Karishma Chadha
b8e67a7727 Hookup sb2 import code to deserialize assets from local sb2 file. 2018-03-25 18:14:30 -04:00
kchadha
dbc7b9597f
Merge pull request #979 from kchadha/serialization-cleanup
SB3 Serialization & Load Project
2018-03-23 10:11:49 -04:00
Karishma Chadha
c4ad76eef1 Turns out ArrayBuffers are not views of themselves. 2018-03-22 16:19:36 -04:00
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
Paul Kaplan
140094a7ad Make "when clicked" blocks target dependent.
This involves adding a new opcode, event_whenstageclicked, and adding a
method to the blocks container to update the opcode pair depending on
whether the target is the stage. This method is then called in two
places: first after the sb2 import parses the blocks (not done in the
sb2 parsing itself because no other blocks are target specific) and then
again when blocks are shared between targets.

Also added tests for the block container method, and a fixture project
that tests the opcode splitting on sb2 import.
2018-03-20 10:41:50 -04:00
Karishma Chadha
003ed01015 Update VM to use scratch-parser callback interface 2018-03-15 22:40:40 -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
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
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
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
525a8c2ce7 Serializing sounds and costumes into file descriptors upon 'saveProjectSb3'. 2018-03-05 15:16:06 -05:00
kchadha
a0c7d9aeb3
Merge pull request #956 from kchadha/validate-sb2
Validate sb2
2018-03-02 10:28:53 -05:00
DD
b885402081 Merge branch 'develop' into privateSprite 2018-03-01 17:27:10 -05:00
Karishma Chadha
d9fb315e3b Removing log messages. 2018-02-28 17:10:54 -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
Karishma Chadha
79169c81b3 Use scratch-parser to validate structure of project json files. 2018-02-26 22:43:55 -05:00
Paul Kaplan
1f3c6ac6ad
Merge pull request #939 from fsih/blockDrag
Block drag
2018-02-26 16:26:53 -05:00
DD
9a65df4c12 Make index optional 2018-02-23 16:24:18 -05:00
DD
10789cd779 Bring in Karishmas changes from save-load to ensure the sound gets updated in storage when edited 2018-02-23 16:21:07 -05:00
DD
bb0394a668 Fix lint 2018-02-23 16:09:38 -05:00
DD
8355dd662f Switch to sending end drag event to be handled by gui 2018-02-23 11:57:19 -05:00
DD
2239d1b92b Use promises 2018-02-23 11:09:19 -05:00
DD
75cf6407d4 Duplicate costume 2018-02-23 10:50:45 -05:00
DD
d6bcfae526 Remove costume ID 2018-02-23 10:25:14 -05:00
DD
729fc3d303 Make sprite.costumes private so that I can enforce that when you add costumes, they get assigned a unique ID 2018-02-21 19:59:35 -05:00
DD
51fd97ee54 fix lint 2018-02-20 16:09:08 -05:00
DD
2545d1955d Repopulate blocks with ids 2018-02-20 16:09:08 -05:00
DD
31def7d03d Track hovered sprite. End drag may transfer blocks from one sprite to another. 2018-02-20 16:09:08 -05:00
DD
fe4b3d3c01 Pass through block drag event 2018-02-20 16:09:08 -05:00
Karishma Chadha
f5813b1845 Update sprite names, plus some code cleanup. 2018-02-05 16:54:58 -05:00
Paul Kaplan
d649b2555b Require TextEncoder correctly 2018-01-17 11:41:24 -05:00
Ray Schamp
e83141e810
Revert "Use text-encoding library for text encoder" 2018-01-17 10:59:28 -05:00
Ray Schamp
c0db708986 Fix import syntax 2018-01-17 09:47:01 -05:00
DD
2c1412dda4 Use text-encoding library for text encoder 2018-01-16 17:41:18 -05:00
DD
7ed58da1cf fix set editing target function 2018-01-11 16:43:18 -05:00
DD
bc64e6ed3e Unique sprite and backdrop names 2018-01-11 11:28:21 -05:00
Karishma Chadha
6fc554daa5 Implicit deletion behavior for broadcast blocks. 2017-12-21 19:06:11 -05:00
Andrew Sliwinski
05a1a668b3 Accept both objects and strings for 'loadProject'. Resolves GH-733 2017-12-20 11:49:40 -05:00
Paul Kaplan
39115169ca Return promise from backdrop loading 2017-12-19 11:11:38 -05:00
Paul Kaplan
cbebc28307 Return a promise to indicate when a costume has loaded.
Parallels the way the `addSound` method works. Needed to enable
selecting new assets automatically from GUI.
2017-12-14 16:46:31 -05:00
Paul Kaplan
8411ef1c86
Merge pull request #810 from paulkaplan/select-after-drag
Select target after drag end
2017-12-12 10:55:27 -05:00
chrisgarrity
f51cf9877e
Preliminary localization (#777)
* localize the block and menu strings in the pen extension
* adds .tx/config to be able to push translations to transifex
* includes format-message to localize strings and extracting them.
* add setLocale function to VM to allow GUI to pass in locale data.
* refresh block definitions when the locale changes.

### Still to be decided
For now just extracting messages from the pen extension into their own file. We’ll need to decide if each category gets its own file, or group all the strings into one resource.
2017-12-11 15:41:45 -05:00
Paul Kaplan
fc61f9e547 Select target after drag end 2017-11-21 11:45:11 -05:00
DD
255e160ebb Change it so we dont have to do string manipulation on IDs to get data out of events 2017-11-16 17:19:51 -05:00
DD
0958db2618 Move data to blocks files 2017-11-15 17:53:43 -05:00
DD
757dccd565 Move is sprite specific verification into VM in a temporary way. Remove monitors when their sprites are deleted. 2017-11-14 18:25:54 -05:00
Karishma Chadha
c31fff8c4c Fixing linter errors. 2017-11-09 09:18:44 -05:00
Karishma Chadha
7fae93f6e6 Removing unnecessary comments from edits. 2017-11-08 15:59:35 -05:00
Karishma Chadha
70081132cb Changes to src/virtual-machine based on minor bugs found during testing. This was supposed to be included with the previous commit. 2017-11-08 15:49:51 -05:00
Karishma Chadha
cb31f206a0 Improved test coverage of deleteSprite() in src/virtual-machine. Fixed bug where null check was happening after looking up property of given target. 2017-11-06 17:41:57 -05:00
Christopher Willis-Ford
51dcfb954d Pen integration test: don't pre-load pen extension 2017-11-03 12:50:37 -07:00
Christopher Willis-Ford
0af3de9bf0 Load extensions when loading a project or sprite
- Accumulate extension info while deserializing JSON
- Install extensions (if any) before installing target(s)
- Merged 'install' steps of the "add sprite" and "load project" paths
2017-11-03 11:20:24 -07:00
DD
82efc42a13 Update storage when the SVG updates 2017-10-13 17:45:03 -04:00
Christopher Willis-Ford
e9aed49a05 Make loadExtensionURL handle built-in extensions
WeDo2 and Pen blocks have been converted to internal extensions, and can
now be loaded by giving `loadExtensionURL` the string 'pen' or 'wedo2'
instead of an actual URL.
2017-10-04 13:00:39 -07:00
Chris Willis-Ford
6087b5346c Merge pull request #675 from cwillisf/feature/extensions
Feature/extensions
2017-09-14 13:34:18 -07:00
Paul Kaplan
0f04c99e67 Merge pull request #676 from paulkaplan/duplicate
Add sprite duplication method
2017-09-13 11:57:13 -04:00
Paul Kaplan
a885e7d619 Refactor error throwing 2017-09-12 10:16:26 -04:00
Paul Kaplan
81370f7625 Refactor method exports to fix linting and CWF comment 2017-09-11 10:11:48 -04:00
Paul Kaplan
b68b874067 Add sprite duplication method 2017-09-07 11:51:21 -04:00
Christopher Willis-Ford
799d61ac98 Cleanup 2017-09-06 00:57:03 -06:00
Christopher Willis-Ford
e7c727977a Adjust for LLK/scratch-gui#655 & code review
- Move extension from this repository into LLK/scratch-gui
- Rename `EXTENSION_WAS_ADDED` event to `EXTENSION_ADDED`
2017-09-06 00:57:03 -06:00
Christopher Willis-Ford
d43749d675 WIP for demo 2017-09-06 00:57:03 -06:00
Christopher Willis-Ford
403adb743c Track extension blocks in the Runtime 2017-09-06 00:57:03 -06:00
DD
caf98cb185 change order 2017-09-05 17:53:27 -04:00
DD
48fec12391 add jsdoc 2017-09-05 17:49:30 -04:00
DD
29540e705e Add updating the rotation center to updateSvg 2017-09-05 16:51:03 -04:00
DD
5606b067e5 More comment fixes 2017-08-31 13:41:47 -04:00
DD
7d3b9a866c Fix comment 2017-08-31 11:55:17 -04:00
DD
e5208445ac Add updateSVG to tell the renderer about the updated drawing 2017-08-31 11:43:41 -04:00
DD
5f5f7b1684 add get svg function 2017-08-30 14:23:03 -04:00
Paul Kaplan
f2bd32a81a Merge pull request #653 from paulkaplan/sound-ids
Use sound ID instead of md5 for playing sounds
2017-07-26 09:00:00 -04:00
Paul Kaplan
25a0e2ffaf Use new audio engine api to retreive and set sound buffers 2017-07-25 17:03:26 -04:00
Paul Kaplan
0cf05647d2 Merge branch 'develop' into fix-asset-naming 2017-07-25 10:48:25 -04:00
Paul Kaplan
f96a92b4d1 Move renaming and adding into rendered-target with tests 2017-07-25 10:32:25 -04:00
Paul Kaplan
bd3a29650b Fix variable import scoping 2017-07-17 12:28:44 -04:00
Paul Kaplan
a83c0808a0 Add public API for costume and sound renaming with tests 2017-07-07 08:19:32 -04:00
Paul Kaplan
b0fb4f0b55 Merge pull request #614 from marisaleung/develop_cherry-picks
Updated variables and var_fire event listener.
2017-06-23 13:05:03 -04:00
marisaleung
875ccf5b88 Updated variables and var_fire event listener. 2017-06-23 09:57:01 -07:00
DD Liu
2fb502fb70 add ability to refresh workspace for current editing target 2017-06-15 11:53:30 -04:00
Paul Kaplan
9c5d43e9d3 Enhance sprite delete behavior 2017-06-12 08:35:27 -04:00
Paul Kaplan
40345384aa Select the last target instead of the first 2017-06-07 09:06:46 -04:00
Paul Kaplan
77cc01a38a Add variable creation and variable serialization 2017-05-25 11:44:49 -04:00
Paul Kaplan
a608ca4fed Make rendered targets in charge of deleting their own sounds and costumes 2017-05-22 08:17:28 -04:00