Commit graph

1528 commits

Author SHA1 Message Date
Paul Kaplan
f118e912bf
Merge pull request #1081 from paulkaplan/fix-stage-clicks
Activate stage click hats if no other sprites are clicked
2018-04-23 14:47:26 -04:00
Paul Kaplan
978906d926 Activate stage click hats if no other clicks are hit.
Also check the bounds before to make sure clicks are inside the stage bounds.
2018-04-23 14:25:58 -04:00
Andrew Sliwinski
add879ab0a Enable video layer when loading extension. Resolves GH-1072 2018-04-23 13:03:56 -04:00
Andrew Sliwinski
ced4de8995 Flip sort order of sensing object menu in video motion extension. Resolves GH-1074 2018-04-23 13:00:20 -04:00
Andrew Sliwinski
717ac46bbd Reorder video motion blocks. Resolves GH-1073 2018-04-23 12:57:14 -04:00
Karishma Chadha
af7ed61016 Fix bitmap support. In Scratch 3.0, we are defaulting to bitmapResolution = 2 for all costumes. 2018-04-22 21:22:03 -04:00
Karishma Chadha
e1d9df3b1b Undo an unnecessary change from the last commit. 2018-04-20 18:11:14 -04:00
Karishma Chadha
dfa3408add Update sound dataFormat after editing 2018-04-20 14:13:57 -04:00
Andrew Sliwinski
968643ed16
Merge pull request #1069 from thisandagain/bugfix/underscore
Replace extension delimiter with '_'
2018-04-20 11:46:25 -04:00
Paul Kaplan
0f16e2fe65
Merge pull request #1070 from paulkaplan/fix-bubbles
Fix drag and empty costume bugs with say bubbles
2018-04-20 11:43:15 -04:00
Andrew Sliwinski
192084e0e7 Do not load extension if prefix is undefined 2018-04-20 11:36:16 -04:00
Andrew Sliwinski
fd97892eb1 Remove console log 2018-04-20 10:58:35 -04:00
Andrew Sliwinski
57b7e9916d Resolve issue with SB2 import 2018-04-20 10:58:03 -04:00
Andrew Sliwinski
645a42b843 Address feedback from review 2018-04-20 10:49:06 -04:00
Paul Kaplan
393b5d54df Handle positioning bubbles for empty costumes 2018-04-20 10:45:54 -04:00
Paul Kaplan
54d5be8bba Do not bother repositioning bubbles for invisible sprites 2018-04-20 10:45:34 -04:00
Paul Kaplan
9782c137bb Use the new general target visual change for updating bubbles. 2018-04-20 10:44:55 -04:00
Paul Kaplan
c36ff056a2 Add new event for all visual target changes, not just moving. 2018-04-20 10:43:45 -04:00
Andrew Sliwinski
9ec3d41ea1 Clarify 'core' list for SB2 import 2018-04-20 10:34:17 -04:00
Andrew Sliwinski
f86cad3305 Replace extension delimeter with '_' 2018-04-20 07:54:02 -04:00
Karishma Chadha
54b52ba96c Use calculated rotation center from renderer when rotation center is not provided with the costume being loaded. 2018-04-20 00:04:08 -04:00
Karishma Chadha
d6f28f2266 Correct what is being passed into scratch-render if some metadata (rotationCenter, bitmapResolution) is missing. 2018-04-18 14:21:29 -04:00
kchadha
47a2d76a14
Merge pull request #1060 from kchadha/fix-sound-metadata
Update sound metadata and retrieve mp3 correctly from storage
2018-04-17 11:02:56 -04:00
Michael "Z" Goddard
d04d6b2c6a
Revert "Revert "Push reported""
This reverts commit 107adad647.
2018-04-16 13:21:53 -04:00
Paul Kaplan
5b9dc4df77
Merge pull request #1061 from kchadha/video-transparency-save-load-fix
Fix video transparency save/load issue.
2018-04-13 13:58:19 -04:00
Karishma Chadha
bd0bcb9395 video transparency should be a number. 2018-04-13 13:47:05 -04:00
Paul Kaplan
d42135a40a
Merge pull request #1057 from thisandagain/bugfix/1056
Rename pen 'clear' to 'erase all'
2018-04-13 13:26:54 -04:00
Paul Kaplan
aff8f93999 Change displayed name to Video Motion 2018-04-13 12:52:46 -04:00
Karishma Chadha
e71e51866f Fix typo. 2018-04-13 11:28:04 -04:00
Karishma Chadha
dca9270730 Use sound returned from audio engine to set sample rate and sample count since the sound gets resampled by the audio engine. Also, check for an mp3 format in deserialize assets, and otherwise default to wav. 2018-04-13 11:20:16 -04:00
Paul Kaplan
0838f6c875 Remove duplicate play 2018-04-13 11:12:44 -04:00
Paul Kaplan
c46d1157fa Slicing array buffers with no args throws on Safari 2018-04-13 11:08:32 -04:00
Paul Kaplan
71333765c9 Use new mediaDevices API for getUserMedia 2018-04-13 11:08:32 -04:00
Andrew Sliwinski
6f80403e8a Rename pen 'clear' to 'erase all'. Resolves GH-1056 2018-04-13 10:53:13 -04:00
kchadha
0e0d09c235
Merge pull request #1042 from mzgoddard/target-video-state
Configure video device with stage video settings
2018-04-13 09:12:25 -04:00
Andrew Sliwinski
3ac2922a07
Merge pull request #1028 from mzgoddard/motion-detect-4
Motion detect 4
2018-04-13 08:16:34 -04:00
kchadha
8739a524eb
Merge pull request #1031 from kchadha/block_serialization_compression
Block serialization compression
2018-04-11 19:17:42 -04:00
kchadha
7311b103fa
Merge pull request #1045 from kchadha/broadcast-message-shadow-fix
Fix import of broadcast block empty string obscured shadow import
2018-04-11 18:13:20 -04:00
Michael "Z" Goddard
8ebd659094
Use string enumerated values for videoSensing sensor block 2018-04-11 10:30:58 -04:00
Karishma Chadha
6c538d0659 Sounds should still get loaded from storage even if there is not an audio engine present. This is analagous to costumes getting loaded even if there is no renderer present. 2018-04-11 10:28:22 -04:00
Michael "Z" Goddard
cef9f58c2a
Set video device state and transparency from values in stage
Set the video device state and transparency to the values in the stage target
when the video sensing extension is loaded. Changing video state and
transparency from the extension's blocks will also store that setting to the
stage target.
2018-04-11 10:15:53 -04:00
Michael "Z" Goddard
b9911332c7
Default stage.videoState to ON
Set to ON, adding a video extension when a user selects a video extension in
the gui, the video extension will use stage.videoState to turn on the video
device. Adding a video extension as part of loading a project, the stage's
videoState will be set to the stored value in the project's saved data, and the
extension will set the video device's state with that saved value.
2018-04-11 10:15:52 -04:00
Michael "Z" Goddard
044370790c
Merge pull request #1016 from gnarf/io-video
Video IO Device Implementation
2018-04-11 10:14:56 -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
2478f2ff8b
Merge pull request #1040 from paulkaplan/filter-dragging-touching
Filter out dragging targets from touching sprite check.
2018-04-11 09:17:52 -04:00
Paul Kaplan
4a9adcc3d9 Make stopDrag deal with bare targets and add tests 2018-04-11 09:12:43 -04:00
Karishma Chadha
6f3c84bf77 Ensure we are serializing file extensions for costumes and sounds as lower case. 2018-04-10 17:01:31 -04:00
Karishma Chadha
585a46f334 Add one last pass to block serialization to remove orphan primitive shadow blocks. 2018-04-10 16:55:27 -04:00
Karishma Chadha
0df937f5c0 Adding a bit more clarification to comment. 2018-04-10 16:53:07 -04:00
Karishma Chadha
18c1a20eaa Remove unnecessary comments. 2018-04-10 15:44:32 -04:00
Karishma Chadha
2f53996c9c Switch video flipped string back to hyphen. 2018-04-10 15:43:29 -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
Karishma Chadha
a4d9ff9266 Fix issue with importing broadcast block with obscured empty string shadow. 2018-04-10 15:16:18 -04:00
Michael "Z" Goddard
461d523729
Add block comments to videoSensing.videoToggle and setVideoTransparency 2018-04-10 14:34:27 -04:00
Michael "Z" Goddard
d4037808a7
Add VideoState enum to Scratch3VideoSensingBlocks 2018-04-10 14:34:27 -04: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
92d00b5944 Filter out dragging targets from touching sprite check.
This introduces an asymmetry that matches the Scratch 2 behavior, that
is, a sprite that is being dragged can detect other sprites using
touching <sprite>, but cannot be detected by other sprites while it is
being dragged.
2018-04-10 14:20:51 -04:00
Corey Frang
fe7aa8a78f
Add @param documentation for the frameInfo descriptor param 2018-04-10 13:59:23 -04:00
Corey Frang
a86202b8e2
make onError a prototype method 2018-04-10 13:59:23 -04:00
Corey Frang
0180964333
Simplify setup method promise, add onError 2018-04-10 13:59:23 -04:00
Corey Frang
89dd4720a4
store ghost state so previews will use last value whenever setup 2018-04-10 13:59:23 -04:00
Corey Frang
d0a71dcaf9
store the ghost effect in case preview is setup after it was last set 2018-04-10 13:59:23 -04:00
Corey Frang
e20723994f
fix sb2 conversion to load into correct VIDEO_STATE 2018-04-10 13:59:22 -04:00
Corey Frang
9cd5e4da2b
Reduce indentation waterfall 2018-04-10 13:59:22 -04:00
Corey Frang
f3a956af2b
add enabled state tracking, disable state waits for setup complete 2018-04-10 13:59:22 -04:00
Corey Frang
ce03e978dc
stop the track in the "on-off" scenario 2018-04-10 13:59:22 -04:00
Corey Frang
825ff22fa4
Guard against some issues that could happen with enable/disable video quickly 2018-04-10 13:59:22 -04:00
Corey Frang
f19ae793c0
enableVideo - get rid of "requests" 2018-04-10 13:59:22 -04:00
Corey Frang
efa6b3a069
stop track 2018-04-10 13:59:22 -04:00
Corey Frang
46b4ef4d80
Use a global mirror state 2018-04-10 13:59:21 -04:00
Corey Frang
90166dc732
Add extra control blocks for video transparency and on/off control 2018-04-10 13:59:21 -04:00
Corey Frang
e4bd9cf6b2
Move methods around to sort the public interface nearer the top 2018-04-10 13:57:54 -04:00
Corey Frang
992e884668
Make disableVideo a public method 2018-04-10 13:57:54 -04:00
Corey Frang
d512042415
Add set preview ghost 2018-04-10 13:57:54 -04:00
Corey Frang
da05e673fa
_singleSetup makes more sense 2018-04-10 13:57:54 -04:00
Corey Frang
c10696f88c
Rewrite the setup/disable process from review comments 2018-04-10 13:57:53 -04:00
Corey Frang
eef88f6c2d
First draft of video IO device 2018-04-10 13:57:53 -04:00
Michael "Z" Goddard
cd7e03f0f6
Merge pull request #1019 from mzgoddard/motion-detect-3
Test VideoMotion and VideoSensing blocks
2018-04-10 13:06:58 -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
Paul Kaplan
f29482957c Change getSkinSize to getCurrentSkinSize for renderer update. 2018-04-10 09:50:18 -04:00
Christopher Willis-Ford
53b5ba93f5 Add tests for converting extension metadata
These tests convert some extension metadata into scratch-blocks JSON and
XML, then verify that the JSON and XML are as expected.
2018-04-09 15:37:08 -07:00
kchadha
d177f4cd0c
Merge pull request #1033 from towerofnix/counter-vm
Implement counter blocks
2018-04-09 13:55:35 -04:00
kchadha
b794e19c31
Merge pull request #1032 from towerofnix/while-vm
Implement "while" block
2018-04-09 13:48:08 -04:00
Florrie
797d16be26 Implement counter blocks 2018-04-07 16:02:49 -03:00
Florrie
c57d0c94eb Add implementation for while 2018-04-07 14:04:00 -03:00
Florrie
27d053acff Add doWhile -> control_while to specmap 2018-04-07 14:04:00 -03:00
Michael "Z" Goddard
d3ff8b5eed
Test VideoMotion and VideoSensing blocks
- Add pngjs dev dependency to read test images
2018-04-06 18:09:50 -04:00
Karishma Chadha
9ce6040b0f Fix lint error... 2018-04-06 16:57:52 -04:00
Karishma Chadha
1861b5a262 Can't have hyphens in identifiers. 2018-04-06 16:51:46 -04:00
Karishma Chadha
e92db8fa1e Don't really need level 9 compression. 2018-04-06 15:47:24 -04:00
Karishma Chadha
44b1a2f798 List limit should apply to insert block as well. 2018-04-06 15:31:10 -04:00
Karishma Chadha
5d46f8de99 Not providing a zip to deserialize asset functions is not an error. 2018-04-06 15:04:03 -04:00
Michael "Z" Goddard
0591b475f2
Merge pull request #1020 from gnarf/sb2-spec-when-video-motion
Allow specmap to have methods to branch into multiple sb3 opcodes
2018-04-06 14:28:17 -04:00
Eric Rosenbaum
25f1c1a5e6
Merge pull request #1017 from ericrosenbaum/bugfix/clones-inherit-instrument
Clones inherit music custom state
2018-04-06 13:38:03 -04:00
Karishma Chadha
8c1e6095cb Remove code that was temporarily accomodating for the old version of the default project in gui. 2018-04-06 11:33:44 -04:00
Karishma Chadha
4ec25b32b1 Code cleanup and commenting. 2018-04-06 11:33:44 -04:00
Karishma Chadha
9892dac904 Custom state (e.g. tempo, volume, video related state) should show up in a target that has been 'flattened' via JSON.stringify. 2018-04-06 11:33:44 -04:00
Karishma Chadha
2dbcdc2244 The stage should always be called 'Stage'. 2018-04-06 11:33:44 -04:00
Karishma Chadha
b436b5fd82 Add a limit to the number of items a list can have. No-op on 'addToList' block if trying to add to a list that is already at the limit. 2018-04-06 11:33:44 -04:00
Karishma Chadha
6c0d257a63 Deserialize tempo, volume, and video related state. 2018-04-06 11:33:44 -04:00
Karishma Chadha
4dd83cf717 Todo comment for clarity... 2018-04-06 11:33:44 -04:00
Karishma Chadha
118c6f0356 Use bitmap asset type and 'png' for various costume formats. 2018-04-06 11:33:44 -04:00
Karishma Chadha
d61ea23e1e Deserialize compressed primitives. 2018-04-06 11:33:44 -04:00
Karishma Chadha
21d60604ac Some block serialization compression -- compress primitives. This is a WIP since we don't deserialize blocks serialized in this way. 2018-04-06 11:33:44 -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
kchadha
4b62a938c4
Merge pull request #1000 from kchadha/deserialize-assets-in-sb2
Deserialize sb2 assets while loading local .sb2.
2018-04-06 11:33:00 -04:00
Ray Schamp
efb1bdb1ea Remove video motion icon until we have one 2018-04-06 09:55:16 -04:00
Michael "Z" Goddard
91747fd229
Add back missing Scratch3VideoSensingBlocks.INTERVAL
The INTERVAL time defines how often to analyze a frame. Without the value the
test whether a frame should be analyzed will always be false.
2018-04-05 17:47:07 -04:00
Corey Frang
78199c41a5 Allow specmap to have methods to branch into multiple sb3 opcodes 2018-04-05 15:39:41 -04:00
Christopher Willis-Ford
3be16eddb1 Add code to load 'core' extensions 2018-04-05 12:20:03 -07:00
Christopher Willis-Ford
f8db6c3f02 Support extension translation
The new `maybeFormatMessage` function detects whether its argument
looks like a message descriptor object and, if so, will call
`formatMessage` on it. This is now used for all user-visible text fields
in extensions.

Also, messages may use "select" to check the target type with a message
like this: '{targetType, select, stage {text for stage} sprite {text for
sprite} other {text for other}'. Note that the "other" clause is
required by `formatMessage`.
2018-04-05 12:17:05 -07:00
Eric Rosenbaum
2a90e5868d Fix runtime scope and unit test 2018-04-05 15:01:52 -04:00
Ray Schamp
41955913aa
Merge pull request #1007 from mzgoddard/motion-detect-2
Motion detect 2
2018-04-05 11:59:59 -04:00
Eric Rosenbaum
88b13e218d Clones inherit music custom state 2018-04-05 11:27:54 -04:00
Christopher Willis-Ford
defdd42c47 Add TargetType enum for use by/with extensions 2018-04-04 23:45:26 -07:00
Christopher Willis-Ford
de9e2be265 Add EVENT extension block type
An EVENT block is like a HAT block but it has no implementation
function. Its stack runs when the VM emits the corresponding event.
2018-04-04 23:44:59 -07:00
Christopher Willis-Ford
af058b8146 Support LOOP and CONDITIONAL blocks in extensions
A LOOP block is like a conditional, but the LOOP block will be
re-evaluated after any child branch runs.

Also:
- Support using '---' as a block separator
- Refactor common code from `_registerExtensionPrimitives` and
  `_refreshExtensionPrimitives` into new `_fillExtensionCategory`
- Improve error reporting during block conversion
2018-04-04 22:19:48 -07:00
Eric Rosenbaum
21ae14c499
Merge pull request #1014 from ericrosenbaum/bugfix/video-state
Import and store video state
2018-04-04 19:59:14 -04:00
Eric Rosenbaum
5dc8e51c6d Import and store video state 2018-04-03 16:36:58 -04:00
Michael "Z" Goddard
d4bffcbddb
Rename playground/motion.html to video-sensing.html 2018-04-03 16:19:52 -04:00
Michael "Z" Goddard
6d2c29530f
Document VideoMotionView 2018-04-03 16:19:52 -04:00
Michael "Z" Goddard
9a2e937271
Document VideoMotion class
- Rename video_sensing/lib.js to video_sensing/library.js
2018-04-03 16:19:52 -04:00
Michael "Z" Goddard
a32b15a8f9
Add VideoSensing math module
- motionVector takes motion component and returns a 2d vector
- scratchAtan2 takes a y and x value and returns an angle in degrees
  referencing Scratch's coordinate system
2018-04-03 16:19:52 -04:00
Michael "Z" Goddard
b46c956203
Comment items in Scratch3VideoSensingBlocks 2018-04-03 16:19:51 -04:00
Michael "Z" Goddard
c291a04cc7
Add file comment block to video_sensing/debug.js 2018-04-03 16:19:51 -04:00
Michael "Z" Goddard
e65b7985cb
Add whenMotionGreaterThan hat block to video sensing ext 2018-04-03 16:19:51 -04:00
Michael "Z" Goddard
cfd74a7c7f
Add checkboxes for each video sensing debug view 2018-04-03 16:19:51 -04:00
Michael "Z" Goddard
b012d60689
Add video sensing debug C_CELL and AB_CELL views
- Rename UV to UV_CELL, UV cannot be rendered in a non-cell format

Modify C and AB views as well to better represent in color the work being done.
If you watch the debug views with XY_CELL, AB_CELL, C_CELL, and UV_CELL you can
see how AB_CELL and C_CELL affect UV_CELL in similar color patterns.
2018-04-03 16:19:51 -04:00
Michael "Z" Goddard
0a58a6d806
Merge pull request #1001 from mzgoddard/motion-detect
Motion detect
2018-04-03 16:19:26 -04:00
Florrie
b861c78086 Implement 'get item # of (thing) in (list)' 2018-03-31 13:25:50 -03:00
Michael "Z" Goddard
f3d19dc1a1
Use videoSensing extension for sb2 senseVideoMotion 2018-03-29 19:02:07 -04:00
Michael "Z" Goddard
c206dc3241
Add motion playground page for debugging video sensing 2018-03-29 19:02:07 -04:00
Paul Kaplan
2d9bd92140
Merge pull request #930 from ericrosenbaum/bugfix/loudness-performance
Only measure loudness once per step
2018-03-29 16:27:10 -04:00
Michael "Z" Goddard
3c473f6ba8
Translate scratch 2 video sensing into scratch 3 extension
- Add videoSensing extension to extension-manager
2018-03-29 15:15:11 -04:00
kchadha
51306e3492
Merge pull request #963 from towerofnix/foreach-vm
Implement for-each block
2018-03-28 10:52:14 -04:00
Karishma Chadha
b8e67a7727 Hookup sb2 import code to deserialize assets from local sb2 file. 2018-03-25 18:14:30 -04:00
Paul Kaplan
13641297fd
Merge pull request #996 from paulkaplan/fix-bubble-bounds
Position the speech bubble more tightly.
2018-03-23 14:36:52 -04:00
Paul Kaplan
ea534b35ea Position the speech bubble more tightly. 2018-03-23 10:51:19 -04:00
kchadha
dbc7b9597f
Merge pull request #979 from kchadha/serialization-cleanup
SB3 Serialization & Load Project
2018-03-23 10:11:49 -04:00
Paul Kaplan
a27ed888d2
Merge pull request #992 from paulkaplan/stage-clicked
Make "when clicked" blocks  target dependent.
2018-03-23 09:20:22 -04:00
Chris Willis-Ford
9dc3df1fda
Merge pull request #994 from cwillisf/looks-extension-support
Looks extension support
2018-03-22 15:16:21 -07:00
Florrie
1db4a2c7a7 Compatibility implementation 2018-03-22 18:55:36 -03:00
Eric Rosenbaum
4e3c5c7f2e
Merge pull request #991 from ericrosenbaum/bugfix/clones-share-activesoundplayers
Clones share their parent’s activeSoundPlayers object
2018-03-22 16:49:04 -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
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
Christopher Willis-Ford
26bc7851bb Rename ReporterScope.SPRITE to TARGET & add JSDoc 2018-03-20 15:30:34 -07:00
Christopher Willis-Ford
d3352ac54d Add JSDoc tags for ArgumentType & BlockType 2018-03-20 15:26:27 -07:00
Christopher Willis-Ford
1049e90a8f Wrap extension menu function to provide context
When the extension system calls a function to retrieve extension menu
items, it now provides the ID of the current editing target. There's
also now a little bit of error-checking on the results.
2018-03-20 15:26:27 -07:00
Christopher Willis-Ford
2932f232c4 Improve developer feedback for missing block func 2018-03-20 15:26:12 -07:00
Christopher Willis-Ford
4201f212d3 Add JSDoc for extension metadata format
This is a first pass and is probably not 100% correct. It also contains
the new (experimental?) reporter scope field.
2018-03-20 15:05:21 -07:00
Christopher Willis-Ford
6a06984678 Add enum for reporter scope
Some reporters are sprite-specific, such as the costume name/number or
X position of the sprite. Others are global. This enum allows an
extension author to specify the scope of a reporter.
2018-03-20 15:05:21 -07: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
Eric Rosenbaum
2b985fa083
Merge pull request #975 from ericrosenbaum/bugfix/move-volume-to-rendered-target
Move volume to rendered target
2018-03-19 16:45:25 -04:00
Eric Rosenbaum
2527c804ea Clones get ref to parent’s activeSoundPlayers obj 2018-03-19 16:44:49 -04:00
Chris Willis-Ford
4c0e968bec
Merge pull request #978 from cwillisf/fix-saythink-and-wait
Fix say/think and wait
2018-03-19 10:36:01 -07:00
Paul Kaplan
979c8b05e0
Merge pull request #965 from bartljak/issue#960
fixed issue 960
2018-03-19 06:06:00 -07:00
Karishma Chadha
b4f6f24926 Fix up tests. 2018-03-16 11:43:27 -04:00
Florrie
6517bd0974 Make 'key pressed?' block import correctly 2018-03-16 11:58:25 -03:00
Karishma Chadha
003ed01015 Update VM to use scratch-parser callback interface 2018-03-15 22:40:40 -04:00
Andrew Sliwinski
1d90c82fcf
Merge pull request #945 from picklesrus/translate-extension
Translate extension block
2018-03-15 08:36:39 -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
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
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
Karishma Chadha
c0afcd2ab3 Ensure that md5 and assetId stay in sync. 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
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
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
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
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
Karishma Chadha
8c5c68b896 Duplicating sprite should give new sprite a fresh name. 2018-02-26 23:17:25 -05:00
Karishma Chadha
79169c81b3 Use scratch-parser to validate structure of project json files. 2018-02-26 22:43:55 -05:00
Eric Rosenbaum
651d46fff0 Add default values for obscured shadows 2018-02-26 17:28:20 -05:00
Paul Kaplan
1f3c6ac6ad
Merge pull request #939 from fsih/blockDrag
Block drag
2018-02-26 16:26:53 -05:00
Eric Rosenbaum
8b18ff7ae9 make inputOP, arg name and menu name the same 2018-02-26 15:56:37 -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
0a5ccbf42f Use existing UID util 2018-02-23 12:07:07 -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
b4d6db0ad9 Fix tests 2018-02-22 15:45:41 -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
Chris Willis-Ford
8e1719b716
Merge pull request #920 from towerofnix/scroll-detection
Scroll wheel detection for "when key (up/down) pressed" blocks
2018-02-16 12:21:27 -08:00
picklesrus
1910968b13 Fix lint errors. 2018-02-16 10:49:26 -08:00
Eric Rosenbaum
ca08cd69e9
Merge pull request #936 from ericrosenbaum/feature/require-music-assets
Feature/require music assets
2018-02-16 10:25:31 -05:00
Eric Rosenbaum
e67743a4ba Require assets inside a try/catch 2018-02-16 10:05:54 -05:00
Eric Rosenbaum
063ac39019 Load music extension assets with require 2018-02-14 17:53:05 -05:00
Eric Rosenbaum
22038c947c When getting sprite by name, skip the stage 2018-02-12 15:33:27 -05:00
kchadha
9675a1b8cf
Merge pull request #931 from kchadha/bugfix-912
Renaming sprite/costume/sound/backdrop updates corresponding blocks.
2018-02-12 11:53:50 -05:00
Paul Kaplan
8d42db7df8
Merge pull request #925 from LukeSchlangen/fix/rounding-numbers
round numbers but break tests
2018-02-08 08:59:54 -05:00
Luke Schlangen
45cf1f685d add passing unit test 2018-02-07 17:49:18 -06:00
Eric Rosenbaum
33966ba582 Check for runtime.currentStepTime is null 2018-02-06 12:25:44 -05:00
Eric Rosenbaum
0a239005a9 Rename and initialize vars 2018-02-06 11:06:48 -05:00
Karishma Chadha
f5813b1845 Update sprite names, plus some code cleanup. 2018-02-05 16:54:58 -05:00
Karishma Chadha
7faeed7128 Update blocks after sound/costume rename. 2018-02-05 14:35:52 -05:00
kchadha
107adad647
Revert "Push reported" 2018-02-02 12:42:09 -05:00
Eric Rosenbaum
c661ac7cce Only measure loudness once per step 2018-02-01 19:53:41 -05:00
Eric Rosenbaum
f78ddb2072 Change pitch effect range to -360 to 360 2018-01-31 16:44:54 -05:00
Luke Schlangen
f8dced53dc round numbers but break tests 2018-01-31 08:23:08 -06:00
Christopher Willis-Ford
3717394f00 Playground: load renderer as UMD
The recent changes to the renderer's build output packaging broke this
repository's playground / benchmark suite. These changes aren't the only
way to fix the issue, but this is consistent with the way that the
storage module was already being loaded.
2018-01-29 14:04:19 -08:00
kchadha
490248f652
Merge pull request #914 from kchadha/bugfix-909
Keep block xml up-to-date after renaming a variable.
2018-01-29 09:30:10 -05:00
Chris Willis-Ford
188aa990f2
Merge pull request #917 from mzgoddard/push-reported
Push reported
2018-01-26 15:48:05 -08:00
picklesrus
b6bb92d8f6 Adding support for dynamic menus in extensions. 2018-01-26 14:36:36 -08:00
Karishma Chadha
0b2eaa9e19 Moving block updating code into blocks instead of runtime. 2018-01-26 16:58:45 -05:00
Florrie
be83c0ee74 Mouse wheel IO system
Towards fixing #865. This adds an IO class for detecting the mouse wheel
being scrolled. Basic tests are included; they mock the runtime to see
what blocks are activated by scrolling.
2018-01-26 17:13:01 -04:00
Eric Rosenbaum
229cd7a50c
Merge pull request #911 from ericrosenbaum/bugfix/music-ext-safari-onended
Keep playing notes and drums forever on Safari
2018-01-26 13:00:56 -05:00
Michael "Z" Goddard
10acf3c4f5
Add BlocksExecuteCache
Add a Blocks cache available only to execute. This cache lets execute
get a blocks inputs, fields, opcode, and mutation in one request and an
object execute can further modify to store derivative values it use
this and every later execute iteration to perform its duties quicker.
2018-01-24 17:00:42 -05:00
Michael "Z" Goddard
41d6a8f925
Check if a thread's target is null in sequencer
Before calling execute, if a thread's target is null, retire that
thread.

This saves repeatedly checking if the thread's target is null in
recursive calls where even if scratch-gui or blocks, or some other
related library set the target to null, that will not happen during
block execution. It will happen at some time outside of the sequencer
letting the sequencer check once instead of execute checking at every
recursive level.
2018-01-24 17:00:37 -05:00
Michael "Z" Goddard
4286e3e982
Add Thread.blockContainer
Store the thread's blocks at blockContainer letting execute quickly
determine the block source. Monitor threads are a monitor thread. They
do not become a target thread suddenly.
2018-01-24 17:00:35 -05:00
Michael "Z" Goddard
ab8d8e5f34
Add optional recursiveCall argument to execute
When execute calls itself to step into the next stack level, pass
RECURSIVE to the recursiveCall level. This argument provides
opportunity to recursed calls in execute to reduce the time needed for
some checks.

- Reduce time for checking around setting
  thread.requestScriptGlowInFrame
- Call thread.pushReportedValue at end of execute when in a recursive
  call

A boolean check is faster than a type lookup, command blocks will only
be executed in non-recursive calls. This saves a minor amount of time
for any result reporting blocks like blocks that get variables or add
two inputs together.

If the block is not returning a promise and execute is a recursed call,
that implies that the block is neither a hat or that the thread is not
at the top. That reduces handleReport to pushReportedValue. Using the
recursiveCall argument the final block calling handleReport can
shortcut the extra work in handleReport and reduce it to immediately
calling pushReportedValue.
2018-01-24 17:00:24 -05:00
Michael "Z" Goddard
6b7582f1c7
Report block result to stackFrame.justReported
- Add stackFrame.justReported

Report the block result to a known key `justReported` instead of a
dynamic key on `reported`. Assuming blocks with a promised value are
relatively infrequent the most common recursive input flow immediately
reads the value "just" reported. In the assumed uncommon case of a
promised thread status, empty the already argValues assigned values
onto the currentStackFrame's reported member. In the next execute call
on this stackFrame, values assigned to reported are read back off onto
argValues, and execute will returned to the assumed common case. This
is a safe assumption since a thread in the promise state will not exit
that state until the next frame when javascript has a chance to call
the resolve handle, setting the thread's state back to another
executable state.

Using direct assignment to `justReported` saves building an object
dynamically. Instead of always building `reported` and `argValues` only
`argValues` is built until a promised state is reached. This also gives
a known time when `reported` is used, allowing cleanup of a
stackFrame's reported to only happen when it was used to persist
already reported values.
2018-01-24 17:00:12 -05:00
Eric Rosenbaum
115184a2a3
Merge pull request #891 from ericrosenbaum/bugfix/audioplayer-clone-state
Audio effects state for clones
2018-01-23 11:55:39 -05:00
Eric Rosenbaum
275b0c7944 Get customState but don’t create it 2018-01-22 16:38:45 -05:00
Karishma Chadha
784341909b Update block xml for all blocks that use a variable that was just renamed. 2018-01-22 15:14:43 -05:00
Eric Rosenbaum
073ee84a91 Keep bufferSource refs so onended fires on safari 2018-01-22 11:57:06 -05:00
Eric Rosenbaum
9eaf67b504 Fix eslint-disable-line 2018-01-22 10:27:16 -05:00
Eric Rosenbaum
4778ab8d4f Fix music extension asset loading on safari 2018-01-22 10:15:41 -05:00
Ray Schamp
cc1923f982
Merge pull request #901 from mzgoddard/benchmark-prototype
Benchmark prototype
2018-01-19 13:52:13 -05:00
Paul Kaplan
90e9e1c0b0
Merge pull request #889 from paulkaplan/fix-mouse-positions
Fix mouse positions for different stage zoom levels
2018-01-17 13:49:23 -05:00
Michael "Z" Goddard
4d4966cba9
Save and compare results, show individual results in iframe 2018-01-17 12:25:07 -05:00
Michael "Z" Goddard
775d38d8d5
Truncate benchmark selfTime and totalTime values 2018-01-17 12:16:08 -05:00
Michael "Z" Goddard
479f1ba163
Produce a benchmark share link storing the report in the url 2018-01-17 12:16:06 -05:00
Michael "Z" Goddard
c6f4d89371
Add benchmark suite, run and report on multiple benchmark projects 2018-01-17 12:10:27 -05:00
Michael "Z" Goddard
b02d7e8cd8
Read benchmark warm up time and recording time from uri 2018-01-17 11:59: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
301fcdc518
Merge pull request #897 from fsih/textencoding
Use text-encoding library for text encoder
2018-01-17 10:02:10 -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
Paul Kaplan
57f3d43f4f Update specmap for sensing blocks that are now fixed menus. 2018-01-13 13:23:33 -05:00
Paul Kaplan
223575f850 Remove extra call to initDrawable that was erasing existing drawable.
initDrawable is called in createClone previously, where the new costumes
are installed. Calling this again here erases those loaded skins and
causes an error when trying to calculate the uniforms when a drag
starts.
2018-01-12 11:20:17 -05:00
DD Liu
c6c01e7c93
Merge pull request #893 from fsih/nameName
Unique sprite and backdrop names
2018-01-12 10:33:43 -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
DD
323aafd165 Update VM's model of monitored blocks 2018-01-10 17:57:04 -05:00
DD
fce83dc2c3 make it work for non-droppable inputs 2018-01-10 17:50:48 -05:00
Eric Rosenbaum
eca66e9dde Check for runtime 2018-01-09 19:22:33 -05:00
Eric Rosenbaum
283804c21c Init and dispose audio player 2018-01-09 15:57:33 -05:00
Eric Rosenbaum
7c0117e9ed Clones get synced to parent’s sound state 2018-01-09 15:56:58 -05:00
DD
db662b8584 fix lint 2018-01-09 14:55:46 -05:00
Paul Kaplan
327d1179d9 Update the mouse io to give scratch coordinates and client coordinates
Fixes GUI #642 https://github.com/LLK/scratch-gui/issues/642

Fixes GUI #179 https://github.com/LLK/scratch-gui/issues/179
2018-01-09 10:37:16 -05:00
Paul Kaplan
bbcb6bd5b7 Differentiate clamped from non clamped mouse io data (GUI#179) 2018-01-09 09:42:16 -05:00
DD Liu
0b6d7adf3e Update monitor on dropdown change 2018-01-08 20:22:18 -05:00
Paul Kaplan
63be5bc487 Transform sb2 looks reporters to new menu blocks 2018-01-04 10:24:13 -05:00
Paul Kaplan
d6f1c48c08 Add opcodes for new looks reporters with menu for costume number/name 2018-01-04 10:04:54 -05:00
Paul Kaplan
4fd7ba896a
Merge pull request #881 from sjhuang26/issue-gui1127-pen-trails
No pen trails when dragging
2017-12-29 10:22:18 -05:00
Paul Kaplan
6d90a34ff1 Add setDragMode primitive and unit test 2017-12-29 09:38:21 -05:00
sjhuang26
72dee72148 Change let to const 2017-12-29 09:13:18 -05:00
sjhuang26
f7d80459c7 Fixed pen behavior when dragging 2017-12-29 09:01:30 -05:00
sjhuang26
b726c4c18d Changed postSpriteInfo logic 2017-12-29 08:31:59 -05:00