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