Commit graph

1289 commits

Author SHA1 Message Date
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
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