Commit graph

254 commits

Author SHA1 Message Date
Michael "Z" Goddard
5593b28984
try handling as a Scratch 1 file after scratch-parser validation fails 2018-12-20 13:55:49 -05:00
Michael "Z" Goddard
a92f33960f
fix: use ValidationError to determine if an SB1File error should throw 2018-12-20 13:32:30 -05:00
Michael "Z" Goddard
f43163fc73
depend on scratch-sb1-converter and convert sb1 files to sb2 2018-12-20 12:09:58 -05:00
DD Liu
fe375fa672
Merge pull request #1849 from fsih/addCostumeFromLibrary
Add addCostumeFromLibrary
2018-12-18 12:12:18 -05:00
DD
a4744f5ac9 Add addCostumeFromLibrary 2018-12-14 14:20:42 -05:00
picklesrus
ebe06a97d9
Merge pull request #1818 from picklesrus/monitor-vars-project-load
Clear out the blocks in dispose. Fixes #1758 where old monitored vari…
2018-12-07 15:08:09 -05:00
picklesrus
3f3c34b43a Given the bug found with the old approach, fix this by going and deleting all of the monitor blocks for each sprite and the global variables. 2018-12-06 18:59:58 -05:00
Paul Kaplan
8405ff00d4
Merge pull request #1825 from paulkaplan/emit-start-publicly
Emit PROJECT_START event publicly on green flag click.
2018-12-06 15:38:05 -05:00
Paul Kaplan
56c062eee3 re-emit the PROJECT_START event publicly, add unit test 2018-12-06 11:47:09 -05:00
Karishma Chadha
dc4fd15197 Make a cloud device requestVariableUpdate when setting a variable through the vm's top level setVariableValue API. Add unit test for new functionality. 2018-12-05 22:38:06 -05:00
Paul Kaplan
7e96ef2985 Serialize Infinity and NaN to 0 2018-12-04 10:52:49 -05:00
Karishma Chadha
ff2566fec4
Merge pull request #1778 from kchadha/emit-cloud-data-update
Emit cloud data update
2018-11-28 17:23:29 -05:00
Karishma Chadha
86d61a4c20 Emit event tracking when the project's hasCloudData status changes. Cloud var creation now happens regardless of connectivity to the provider. 2018-11-28 15:03:19 -05:00
picklesrus
f214d3a191 VM changes for the sensing_of block. This handles lists properly (by ignoring them like Scratch2 and makes the attribute menu update based on what was chosen in the target menu. 2018-11-28 10:35:35 -05:00
Chris Willis-Ford
05979e2e93
Merge pull request #1784 from cwillisf/setLocale-always-refreshBlocks
Make setLocale consistently refresh blocks
2018-11-27 19:19:41 -08:00
Paul Kaplan
ffb02c607d
Merge pull request #1783 from paulkaplan/emit-start-event
Emit a RUNTIME_STARTED event to track if the vm has been started
2018-11-27 16:38:27 -05:00
Christopher Willis-Ford
4256f86ac3 Make setLocale consistently refresh blocks
This change makes the VM's `setLocale` method call `refreshBlocks` even
when not changing the language, though it still skips an unnecessary
call to `formatMessage.setup` in this case.
2018-11-27 10:26:04 -08:00
Paul Kaplan
cc4751228e Emit a RUNTIME_STARTED event to track if the vm has been started 2018-11-27 11:37:01 -05:00
Ray Schamp
5022227c15 Add "project changed" event
And emit it whenever we think the project has changed. Try to not emit it when a change has happened internally that shouldn't affect the serialized project.

This iteration fires the event too frequently, e.g., when switching sprites. This is meant as a simple initial implementation that can be improved.
2018-11-26 17:10:43 -05:00
Ray Schamp
f2550d582c
Merge pull request #1750 from rschamp/feature/sb3-json-assets
Add method for collecting all targets' assets
2018-11-15 10:31:58 +00:00
Ray Schamp
bcd1c5b13a Consolidate collectAssets into getter 2018-11-15 10:26:05 +00:00
Ray Schamp
df56e615ec Add method for collecting all targets' assets
Resolves #1601. Does not include the project JSON since that would require knowledge of a project ID, which the VM has not been responsible for so far.

For now, it is the responsibility of the consumer to determine if these assets should be saved or not. Otherwise the VM would need to be responsible for saving, which has been out of its scope.
2018-11-12 15:13:02 +00:00
Paul Kaplan
c8ad1955d4 Load extensions before sharing blocks.
This commit fixes the unit tests so the assertions are made after the promise resolves
2018-11-05 13:00:35 -05:00
Paul Kaplan
596d0c4f5f Include the origin blockId of the top block being dragged.
This is required by the GUI in order to take a snapshot of the blocks for the backpack. Only the ID is needed, the rest can be done by the GUI.
2018-11-01 14:13:07 -04:00
Katie Broida
6ef600dc2c
Add runtime event for when the project is loaded (#1669) 2018-10-30 15:26:22 -04:00
Karishma Chadha
aa200e6df3 Set the cloud provider and request updates to the cloud var when updating the variable through blocks. 2018-10-29 00:59:06 -04:00
Ray Schamp
b47912dce4 Store asset objects on costumes and sounds
Stop using storage for in-memory storage, and keep these on the vm objects. Towards https://github.com/LLK/scratch-vm/issues/1577
2018-10-23 11:10:50 +01:00
Evelyn Eastmond
2564b24d71 Differentiate peripheral errors: request vs. disconnect (#1654)
* Beginning to add differentiation for hardware disconnect alerts.

* Set connected status after error is sent.
2018-10-17 15:48:07 -04:00
Evelyn Eastmond
ad3328197e Testing adding message/extensionId passing into specific, custom alerts. 2018-09-22 14:04:37 -04:00
Evelyn Eastmond
96327c66f3 Passing custom alert messages with PERIPHERAL_ERROR. 2018-09-22 14:04:37 -04:00
Ray Schamp
e2c6c7667b
Merge pull request #1604 from ericrosenbaum/feature/listening-indicator
Add event to show and hide a mic indicator for Speech to Text
2018-09-21 09:24:59 -04:00
Eric Rosenbaum
e2a79ed58f VM emits MIC_LISTENING 2018-09-20 17:13:51 -04:00
Ray Schamp
6c94c85c9a Add API for the attached renderer
Resolves #1281
2018-09-18 15:47:47 -04:00
Evelyn Eastmond
ec432e3b2f Refactor for hardware extensions (#1555)
* Beginning refactor: renaming 'device' to 'peripheral', shortening function names, reordering functions, etc.

* Continuing refactoring: renaming some functions to be more verbose in the runtime, adding JSDocs, etc.

* Changing 'device' to 'peripheral', etc.

* Changing 'session' to 'socket'.

* Fixing EV3 menus and menu arg validation, reordering functions, etc.

* Add _send, add some references to documentation, etc.

* Factored out _outputCommand and _inputCommand, renamed some enums, etc.

* Fixed _outputCommand, some other minor cleanup.

* Make _outputCommand and _inputCommand public.

* Added TODO.

* Renamed BLE UUID enums to be clearer.

* Change WeDo2 in comments to WeDo 2.0, etc.

* Changed some WeDo2Motor command names, cleaned up some JSDocs.

* Beginning a major EV3 refactor.

* WeDo2 formatting and comment changes.

* Motor refactoring in EV3: motorTurnClockwise and motorTurnCounterClockwise initial working state.

* Add reminders to possibly cast motor menu args in WeDo2.

* Continue to move motor commands in EV3 to EV3Motor class, don't create new EV3Motor on every poll cycle, etc.

* Factoring EV3 polling value commands, etc.

* Fixing EV3 motor power, position and button pressed, and some commenting, etc.

* Move EV3 motor position parsing to EV3Motor class, move directCommand and directCompoundCommand functions, some commenting, etc.

* Changed WeDo2 motor label enum name.

* Removed some EV3 motor functions that aren't needed, changed menu label enum names, moved some opcodes up to enums.

* Fixing comments and documentation.

* Some commenting.

* Adding further documentation and references to PDFs, changed reply check to be safer, etc.

* Some comment changes.

* Moving some functions around in EV3 and WeDo2 to match.

* Commenting, etc.

* Some renaming of session, etc.

* Fix stopAllMotors in EV3.

* Fixing clearing of motors in EV3.

* Some comment changes.

* Change runtime .extensions/registerExtension to .peripheralExtensions/registerPeripheralExtension.

* Renaming outputCommand/inputCommand to generateOutputCommand/generateInputCommand, etc.

* Moved motorCommandIDs to EV3Motor class, renamed directCommand to generateCommand, etc.

* Adding a reminder to rename something.

* JSDoc fix in EV3Motor class.

* Fixing microbit function name.

* Adding a todo item.

* Changing Ev3 menu formats to be backwards compatible, moving a BLE function up.

* Fixing EV3 ports again, and button pressed returning a boolean.

* Fixing menu value to be a string in EV3.
2018-09-07 17:01:23 -04:00
Karishma Chadha
e5ca208a41 Return function to restore a costume when it gets deleted. 2018-08-21 15:33:19 -04:00
Karishma Chadha
24b098257b Return restore sound function when deleting a sound. 2018-08-17 14:01:24 -04:00
Karishma Chadha
b95350da6e Fix issue where deleting a sprite with a monitored local variable creates that local variable on all other sprites after switching sprites twice or more. 2018-08-15 14:31:40 -04:00
kchadha
ec41b4a113
Merge pull request #1438 from kchadha/return-add-sprite-function-when-deleting
Export the sprite and return an add function when deleting the sprite.
2018-08-09 15:25:45 -04:00
Karishma Chadha
a1f03f58e1 Add integration test for deleting and restoring a sprite, and restoreFunciton should return a promise. 2018-08-09 11:53:37 -04:00
Karishma Chadha
5ef246a2b0 Export the sprite and return an add function when deleting the sprite. 2018-08-08 18:29:54 -04:00
Ray Schamp
4b5cf6505a
Merge pull request #1398 from paulkaplan/publish-docs
Publish jsdoc to gh-pages
2018-08-08 16:46:48 -04:00
Paul Kaplan
79ab2fcb72 Add turbo mode events 2018-08-02 10:00:21 -04:00
Paul Kaplan
138d7136af Fix various jsdoc issues preventing the docs from building 2018-07-31 11:22:42 -04:00
Paul Kaplan
8540c139dc Add an extra param for adding sounds and costumes to specific targets 2018-07-31 09:47:48 -04:00
chrisgarrity
d4f20522b8
Merge pull request #1367 from chrisgarrity/issue/gui2530-blockwidth-locale
Add function to return the current VM/blocks locale
2018-07-18 10:57:24 -04:00
chrisgarrity
4ba7e9373f Add function to return the current VM/blocks locale 2018-07-18 09:52:55 -04:00
Evelyn Eastmond
c4ee7065a2 EV3/Microbit critical fixes for code freeze (#1354)
* Resolves - BLESession and BTSession should emit PERIPHERAL_SCAN_TIMEOUT #1348.

* Resolves - BLESession should handle 'could not find service' error #1350.

* Resolves - BTSession should handle 'no peripheral connected' error #1351.

* Fixing a typo that caused device scan timeout bugs.

* Resolves - Add casting and clamping throughout the EV3 extension #1352.

* Fixing a linting error.

* Further fixes for issue #1351.
2018-07-17 16:03:05 -04:00
Karishma Chadha
2b2fc2e561 Code cleanup, refactor, abstraction 2018-07-13 12:58:45 -04:00
Karishma Chadha
13df3e7bd6 Add unit tests and fix object shallow vs. deep copying bug. 2018-07-13 09:36:43 -04:00
Karishma Chadha
406e59fc18 Fix variable conflicts that arise when sharing the love of a sprite-local variable with the stage. 2018-07-13 09:36:43 -04:00