Commit graph

255 commits

Author SHA1 Message Date
Eric Rosenbaum
5e6187bee7 Add blockly extension for scratch extensions 2017-12-14 14:37:08 -05:00
Eric Rosenbaum
25ded4cff7 Fix spelling of coloUrTertiary 2017-12-11 17:01:23 -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
Chris Willis-Ford
e7bbad60e8
Merge pull request #793 from cwillisf/remove-threads-safely
Make _removeThread safe during thread iteration
2017-12-06 17:18:10 -08:00
sjhuang26
eede8105d1 Clear answer on green flag 2017-12-01 20:06:55 -05:00
DD Liu
58dd57fe48
Merge pull request #784 from fsih/perSpriteMonitors
Execute monitors on a given target ID when block is sprite-specific
2017-11-21 10:23:53 -05:00
DD
ec9d8094bd fix review comments 2017-11-20 17:23:59 -05:00
Christopher Willis-Ford
b19af399fa Make _removeThread safe during thread iteration
Before: `_removeThread` stops a thread and immediately removes it from
the runtime's thread array. If this happens while iterating over the
thread array, such as in the case of clone deletion, some elements of
the array can be missed.

After: `_removeThread` has been renamed to `_stopThread`. It still stops
the thread immediately but it no longer removes the thread from the
runtime's thread array. Instead, `_stopThread` marks the thread for
later removal. Such threads are removed at the top of the next `_step`.
2017-11-17 12:56:25 -08:00
Michael "Z" Goddard
3d92553459
Return restarted threads in list from startHats
Add restarted threads to the list of newThreads returned by startHats.
2017-11-16 11:23:51 -05:00
Michael "Z" Goddard
9864403bc9
A thread in the runtime but with the DONE status is not active
return false from isActiveThread if thread's status is done even when
its contained in the runtime threads list. As it is done, the thread
will not be run until either its replaced by a new copy of the thread
or the thread is removed from the list and another is added at a later
time.
2017-11-16 11:23: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
Michael "Z" Goddard
f73dae828e
Add enableProfiling and disableProfiling to Runtime 2017-11-14 14:57:32 -05:00
Michael "Z" Goddard
516d4f6f30
Add Profiler events to Runtime, Sequencer and execute 2017-11-14 14:57:32 -05:00
DD
9048a9b9e7 Pipe through whether a monitor is sprite-specific 2017-11-14 12:20:24 -05:00
Eric Rosenbaum
0540640684
Merge pull request #754 from ericrosenbaum/feature/pen-block-icon
Extension block icons (including pen icon)
2017-11-06 10:02:23 -05:00
Paul Kaplan
c1ba902ebb Use category info that has colors when building menu blocks 2017-11-03 13:50:50 -04:00
Eric Rosenbaum
2ac464c53e Prepend icon to each extension block 2017-11-03 11:35:42 -04:00
Paul Kaplan
18398d010b Add hideFromPalette flag for hiding legacy blocks 2017-11-01 11:30:15 -04:00
Chris Willis-Ford
c4e79c9732 Merge pull request #713 from cwillisf/fix-extension-hats
Fix extension hats
2017-10-13 16:03:51 -07:00
Chris Willis-Ford
a8ae7bc5b4 Merge pull request #700 from cwillisf/extension-menus
Extensions: implement drop-down menus
2017-10-13 09:49:42 -07:00
Chris Willis-Ford
7051ccfd69 Merge pull request #687 from cwillisf/builtin-extensions
Builtin extensions
2017-10-13 09:48:56 -07:00
Christopher Willis-Ford
96fa7315d5 Don't overwrite hat block's fields
Due to a typo (I believe) we were overwriting a horizontal hat block's
fields list when collecting hat block inputs. Now we collect inputs into
a temporary object in this case.
2017-10-13 01:46:35 -07:00
Christopher Willis-Ford
309f02542f Throw if extension tries to build a dynamic menu
Dynamic menus are not yet supported for extension menus, though they are
part of the extension spec. This change provides more thorough feedback
if an extension tries to register an unsupported dynamic menu.
2017-10-11 11:41:03 -07:00
Paul Kaplan
f09c4d0bb9 Merge pull request #691 from paulkaplan/say-think
Add say/think functionality to looks blocks
2017-10-11 14:24:10 -04:00
Paul Kaplan
fa2db053a7 Fix copy paste error on targetWasRemoved 2017-10-11 14:19:15 -04:00
Christopher Willis-Ford
2f9796c163 Fix escapeHtml error caused by rebase 2017-10-06 23:44:27 -07:00
Christopher Willis-Ford
67c788ec8d Extensions: fix Boolean inputs 2017-10-06 23:33:33 -07:00
Christopher Willis-Ford
c1681e54d5 Implement drop-down menus for extension blocks
Also, add `ANGLE` argument type (like `NUMBER` but adds an angle picker)
2017-10-06 23:33:33 -07:00
Paul Kaplan
14600d7893 Update looks implementation 2017-10-06 13:43:07 -04:00
Christopher Willis-Ford
7297341c51 Fixups from code review
- Remove WeDo 2 extension from the runtime's default block packages list
- The WeDo 2.0 extension now calls its own `connect` method on startup

I also renamed `EXTENSION_NAME` to `EXTENSION_ID` for consistency with
the rest of the extension system.
2017-10-06 09:55:19 -07:00
Christopher Willis-Ford
dd20e09774 Extensions: escape HTML entities in default values
This prevents generation of invalid XML due to characters like '<' or
'>' in fields' default values. Unfortunately the value comes back in its
escaped form, so there's still more work to be done.
2017-10-04 13:00:45 -07:00
Christopher Willis-Ford
6757fb6de9 Convert pen blocks into an "internal" extension 2017-10-04 12:54:30 -07:00
Paul Kaplan
e4830dfe51 Merge pull request #686 from paulkaplan/fix-extension-labels
Remove label generation for extensions
2017-10-04 15:37:06 -04:00
Paul Kaplan
0358d6c0c3 Remove label generation for extensions 2017-10-04 15:02:09 -04:00
Christopher Willis-Ford
99b868c0f0 Explain when it's OK to omit <field> element
Also, alphabetize the `ArgumentType` and `BlockType` enums.
2017-10-02 15:29:32 -07:00
Christopher Willis-Ford
06252e020b Extensions: add support for color-picker arguments 2017-09-27 00:02:53 -04:00
Christopher Willis-Ford
635c7966eb Fix tests: don't require('scratch-blocks') 2017-09-06 01:24:24 -06:00
Christopher Willis-Ford
799d61ac98 Cleanup 2017-09-06 00:57:03 -06:00
Christopher Willis-Ford
d99c11ef91 Fix extension conditional blocks' appearance
The JSON generated for conditional blocks had slightly incorrect
structure for its `argsN` items and was missing some necessary
`messageN` items.
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
aaa7784d39 Add methods to fetch scratch-blocks XML and JSON 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
Andrew Sliwinski
d1af3ef808 Merge pull request #562 from bigeyex/feature/fix-deleted-clone-sequence-order
Fix the next thread is skipped after clone deleted
2017-08-23 09:51:38 -04:00
DD Liu
a48efe681e tests 2017-07-31 17:57:51 -04:00
DD Liu
cc1678fa9e Also run monitor blocks every frame 2017-07-28 14:38:26 -04:00
DD Liu
3722aefb17 fix greater than hat block click activation, and also event activation which was only on half the time 2017-07-12 15:46:23 -04:00
Paul Kaplan
6fa49b1e7a Merge pull request #629 from marisaleung/develop
ChangeBlock uses id's of variable instead of name.
2017-06-30 08:10:55 -04:00
marisaleung
22f87e32f8 ChangeBlock uses id's of variable instead of name. 2017-06-27 16:28:37 -07:00
Christopher Willis-Ford
06d5994a32 Use targetWasCreated event to clone pen state
Remove explicit cloning of `_customState` in favor of smarter,
state-specific cloning.
2017-06-16 14:22:51 -07:00
Chris Willis-Ford
d41997b58b Merge pull request #556 from cwillisf/wedo2-blocks
Add WeDo 2.0 blocks
2017-06-07 09:57:36 -07:00
DD Liu
809760b954 Merge branch 'develop' into immutableState 2017-05-26 13:50:50 -04:00
Christopher Willis-Ford
2625529ebe Create WeDo 2.0 device communication classes 2017-05-24 16:40:55 -07:00
Chris Willis-Ford
3970883e45 Merge pull request #549 from cwillisf/device-manager-client
Device manager client
2017-05-24 14:43:28 -07:00
DD Liu
18282fc1d0 remove get for records 2017-05-24 16:33:22 -04:00
DD Liu
1902848ea4 Switch to ordered maps of monitor records for monitor state 2017-05-24 15:42:29 -04:00
DD Liu
acdc783f27 emit immutable 2017-05-22 17:31:53 -04:00
DD Liu
48c51ab2ec switch to nested immutables state 2017-05-19 17:28:00 -04:00
DD Liu
9645a513b1 Only send monitor update on change 2017-05-19 12:28:05 -04:00
DD Liu
adc60001ee Merge branch 'develop' into updateMonitorsAction 2017-05-18 16:50:34 -04:00
Paul Kaplan
2c4361b830 Fix refreshTargets race condition 2017-05-16 09:20:52 -04:00
DD Liu
f1208720f6 restore things lost in bad merge 2017-05-15 16:25:34 -04:00
DD Liu
65d998f473 attach issue to todo 2017-05-15 10:47:36 -04:00
DD Liu
dcdb806b57 fix merge more 2017-05-15 10:45:20 -04:00
DD Liu
4cfedc8d9d fix merge conflicts 2017-05-15 10:18:48 -04:00
DD Liu
9060a35350 Merge branch 'develop' into updateMonitorsAction 2017-05-15 10:16:12 -04:00
DD Liu
6ee1e6614c Remove leftover instances of MONITORS_ADDED and MONITORS_REMOVED, change updateMonitor to requestUpdateMonitor, update some todos with tracking numbers. 2017-05-15 10:12:25 -04:00
Ray Schamp
20337b53f2 Stop emitting SPRITE_INFO_REPORT
Instead, set the `_refreshTargets` flag, and emit a full target list at the end of the step.
2017-05-12 11:42:22 -04:00
Wang Yu
6ec231db9d Fix the next thread is skipped after clone deleted
Problem:
When a clone is deleted, its thread is removed from the thread
list; but the index "i" in the execution for-loop will still +1,
making the next thread skipped.

Changes:
Added a flag "isKilled" on a thread;
Set the flag when a thread is removed from the thread list;
reduce the "i" counter if the thread of the current loop is removed.
2017-05-12 14:01:37 +08:00
DD Liu
7a1b3eccd0 fix Object.values is not a function test 2017-05-11 17:28:48 -04:00
DD Liu
2a7f3edda6 Fix some issues: 1. Monitors not running anymore if you change categories 2. Visual reports not showing 3. threads acquiring properties of old thread when restarting thread 2017-05-11 17:12:19 -04:00
DD Liu
6b774c58f5 Update some comments 2017-05-11 15:23:11 -04:00
DD Liu
1ea69dd504 Rename functions to be less wordy 2017-05-11 10:20:33 -04:00
DD Liu
b2e0a632e3 add add monitor action 2017-05-10 17:00:08 -04:00
DD Liu
b1355c6b0b Fire remove monitors VM event 2017-05-10 15:47:06 -04:00
DD Liu
4687fe41fe don't show green flag when monitor running 2017-05-10 14:06:02 -04:00
DD Liu
4ae1321252 indicate show visual report or update monitor on the thread 2017-05-09 17:34:13 -04:00
DD Liu
35a208d1d3 make it possible for VM to emit update monitors action 2017-05-09 12:10:11 -04:00
DD Liu
26a5098347 don't show visual report when monitor is running 2017-05-08 16:51:45 -04:00
DD Liu
706e112082 Add a block container for monitors that will run in the sequencer 2017-05-08 15:45:55 -04:00
Christopher Willis-Ford
f3c6be2881 Add an I/O device to represent the Device Manager 2017-04-28 13:40:13 -07:00
Ray Schamp
a4f095db5e Use ES6 style classes 2017-04-17 19:42:48 -04:00
Ray Schamp
e01c4ae108 Pass with --fix 2017-04-17 15:10:04 -04:00
Chris Willis-Ford
a4aa3810ae Merge pull request #462 from griffpatch/optimise/reduceGetBlockCalls
Optimise reducegetblockcalls
2017-04-03 13:00:05 -04:00
griffpatch
220d854f28 Merge remote-tracking branch 'refs/remotes/LLK/develop' into optimise/reduceGetBlockCalls
# Conflicts:
#	src/engine/execute.js
2017-03-22 08:58:01 +00:00
griffpatch
a5ce0f60cf Merge remote-tracking branch 'refs/remotes/LLK/develop' into optimise/reduceGetBlockCalls 2017-03-22 07:56:04 +00:00
Christopher Willis-Ford
c23e9c6bf8 Load projects & costumes through scratch-storage
This also sets up the framework to load sounds through scratch-storage,
to be finished in a later change.
2017-03-09 11:25:55 -08:00
Ray Schamp
d0cd9cd897 Add methods for dragging and dropping sprites
* Add `getTargetIdForDrawableId` to translate between renderer picks and VM targets
* Add `startDrag` to stop sprite motion while dragging
* Add `stopDrag` to return sprite motion after dragging
2017-03-03 09:43:31 -05:00
Chris Willis-Ford
a56db95aba Merge pull request #446 from magmaboat/hasownproperty
Perform hasOwnProperty validation
2017-02-22 13:55:54 -08:00
Christopher Willis-Ford
18107cde7b Reverse target iteration in allScriptsDo
The `allStacksAndOwnersDo` function in Scratch 2.0 runtime iterates
targets in reverse and projects sometimes rely on that for correct
initialization. If, for example, each sprite runs a "go back 999 layers"
or "go to front" block as its first action, the order of execution will
determine the ordering of the layers.

This change makes Scratch 3.0 match the Scratch 2.0 execution order.
2017-02-13 14:45:29 -08:00
griffpatch
ea59f8cd66 Reduce calls to getBlock 2017-02-11 14:26:23 +00:00
Magmaboat
85eee4f18e Perform hasOwnProperty validation 2017-02-09 21:12:47 -05:00
griffpatch
276ae82769 Fixes Case Insensitive Broadcast Bug
Broadcasts are case sensitive #433
2017-02-08 10:05:48 +00:00
Ray Schamp
727fcc7875 Lint for eslint-config-scratch@3 2017-02-01 16:27:55 -05:00
Christopher Willis-Ford
369c02b5d5 Implement pen blocks
These blocks implement pen features as found in Scratch 2.0

Supporting changes include:
- `Target` is now an event emitter
- `RenderedTarget` now emits an event when it moves
- `Target` can now store arbitrary "extra" data, called "custom state"
  in the code, using a `Target`'s `setCustomState` and `getCustomState`
  methods. This is used to store per-target pen state without requiring
  `Target` or `RenderedTarget` to know anything about the pen.
- `Cast` can now cast to an RGB color object.
- `Color` now has functions to convert between RGB and HSV, constants
  for for black & white, and a `mixRgb` function to lerp between two
  colors.
2017-01-19 11:51:22 -08:00
Eric Rosenbaum
dc9126e067 Merge pull request #373 from ericrosenbaum/sound
Integrate audio engine
2017-01-06 16:28:09 -05:00
Eric Rosenbaum
9980f4da3f lint 2017-01-06 16:13:43 -05:00
Eric Rosenbaum
c0d57b4b6b separate out main audioengine from audioplayer for each clone 2017-01-04 18:37:55 -05:00
Andrew Sliwinski
5daaaa4438 Merge pull request #362 from thisandagain/bugfix/coverage
Add integration test coverage
2017-01-03 09:38:14 -05:00