Commit graph

134 commits

Author SHA1 Message Date
Florrie
430dbf0bd6
Remove old dead import file 2018-01-23 11:53:23 -04:00
Florrie
287222f7ed
Merge branch 'develop' of https://github.com/LLK/scratch-vm into old-text-costumes 2018-01-23 11:37:03 -04:00
Paul Kaplan
4a7ba534c1 Fix linter 2017-09-11 15:15:30 -04:00
Paul Kaplan
81370f7625 Refactor method exports to fix linting and CWF comment 2017-09-11 10:11:48 -04:00
Paul Kaplan
b68b874067 Add sprite duplication method 2017-09-07 11:51:21 -04:00
Florrie
f4488d1b60 Begin work on 'old text' costumes 2017-09-03 20:35:27 -03:00
Paul Kaplan
44298fd71b Use soundId instead of md5 for playing sounds 2017-07-25 12:20:32 -04:00
Christopher Willis-Ford
88e44c65eb Remember the data format when an asset is imported 2017-06-12 12:31:49 -07:00
Christopher Willis-Ford
eb931fd99b Specify dataFormat when loading asset for import
When importing a project we know the file extension for each asset to be
loaded. This change provides that information to the storage system so
that we can load assets which don't use the default. For example, this
allows loading JPG-format backdrops.

In support of this change, there's a new function on `StringUtil` called
`splitFirst`, which splits a string on the first instance of a separator
character. This change includes unit tests for this new function.
2017-05-24 15:35:10 -07:00
Ray Schamp
2181e51c38 Don't store costume data uris on costumes 2017-05-04 12:29:28 -04:00
Ray Schamp
c5cf6d9b40 Use asset id reference on sounds 2017-05-04 12:29:10 -04:00
Ray Schamp
c9ce6776aa Get SB3 imports working
For now, store the md5 + extension on costumes in the VM. This way we can load them the same way as we load SB2 assets.
2017-04-27 17:08:06 -04:00
Ray Schamp
a4cdb027ab Merge branch 'develop' of github.com:morantsur/scratch-vm into feature/serialization
# Conflicts:
#	src/playground/index.html
#	src/serialization/sb2.js
#	src/sprites/rendered-target.js
#	src/virtual-machine.js
#	test/unit/serialization_sb2.js
2017-04-26 11:44:53 -04:00
Christopher Willis-Ford
c750f53c81 Get Asset and AssetType from storage instance 2017-04-20 16:12:17 -07:00
Ray Schamp
9c34b692c0 Fix ES6 lint after merge 2017-04-19 17:54:52 -04:00
Ray Schamp
e96807b399 Merge branch 'develop' of https://github.com/LLK/scratch-vm into es6
# Conflicts:
#	src/import/sb2import.js
#	src/virtual-machine.js
#	webpack.config.js
2017-04-19 17:54:31 -04:00
Ray Schamp
d2343e3601 Fix up some auto-converted weirdness 2017-04-19 17:36:33 -04:00
Paul Kaplan
4b5e7a57a5 Fix binding issues 2017-04-19 08:53:07 -04:00
Paul Kaplan
f161640876 Update tests 2017-04-18 11:55:38 -04:00
Paul Kaplan
d86fe6a075 Do not add targets to runtime until they are fully loaded 2017-04-18 09:27:58 -04:00
Ray Schamp
4455b0694f Fix remaining no-var and no-use-before-define's 2017-04-17 17:15:19 -04:00
Ray Schamp
e01c4ae108 Pass with --fix 2017-04-17 15:10:04 -04:00
Paul Kaplan
771f18e23b Merge pull request #516 from paulkaplan/add-sound-public-api
Expose VM#addSound publicly
2017-04-04 09:05:45 -04:00
Paul Kaplan
2d6eaae01e Update jsdoc 2017-04-03 16:00:58 -04:00
Paul Kaplan
33f436811c return sound in promise 2017-04-03 16:00:31 -04:00
Ray Schamp
57e73a68a6 Add costume dataURI to costumes from storage (#517)
* Add costume dataURI to costumes from storage

Towards #515, LLK/scratch-gui#279

* Fix tests

* Load costumes incrementally

Some of our tests assume that at least some of our costume data is available before the costume data is loaded. So, provide as much costume data as is available.

* Remove unnecessary filter for null costumes

Resolved when we updated to load costumes incrementally.

/ht @cwillisf
2017-04-03 15:58:13 -04:00
Paul Kaplan
251244ce9c Expose VM#addSound publicly 2017-04-03 09:33:23 -04:00
Paul Kaplan
828f7bfd1c Merge pull request #514 from paulkaplan/fix-costume-backdrop-loading
Use costume loading from importer in public costume and backdrop loader
2017-03-31 12:52:06 -04:00
Paul Kaplan
2559f9557f Resolve to null on error 2017-03-31 11:26:20 -04:00
Eric Rosenbaum
5d14315199 Use log.error 2017-03-29 12:28:20 -04:00
Paul Kaplan
6531dbc2fe Add logger (thanks linter) 2017-03-27 15:12:25 -04:00
Paul Kaplan
df44134e1c Use costume loading from importer in public costume and backdrop loader 2017-03-27 15:04:44 -04:00
Eric Rosenbaum
1ec1165905 Audio engine decodes sounds 2017-03-27 11:56:28 -04:00
Christopher Willis-Ford
10cb97c52e Report missing storage module as an error 2017-03-23 16:03:32 -07:00
Christopher Willis-Ford
c945b37288 Fix lint, missing require 2017-03-13 15:44:13 -07:00
Christopher Willis-Ford
6ad0f3351b Check if storage module is present before using it 2017-03-13 15:06:28 -07:00
Christopher Willis-Ford
e4fd9d57a2 Fix tests involving scratch-storage
- Attach the storage module to the VM for tests which load projects or
  other assets.
- Move `import_sb2.js` from `test/unit/ into `test/integration` since it
  now depends heavily on `scratch-storage`.
- Skip loading costumes when there is no renderer.
2017-03-09 15:50:43 -08: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
8dadc42857 Add draggable property to sprites
This property should be managed by the VM so that it can be displayed in the sprite info panel in the GUI.
2017-03-01 18:49:17 -05:00
Eric Rosenbaum
9741dc2e35 Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound 2017-02-02 16:37:07 -05:00
Ray Schamp
727fcc7875 Lint for eslint-config-scratch@3 2017-02-01 16:27:55 -05:00
Eric Rosenbaum
0947775a31 Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound 2017-02-01 10:18:01 -05:00
Andrew Sliwinski
7c18b33f99 Continue import if opcode is not found during SB2 import. Resolves GH-413 2017-01-30 14:32:32 -05:00
Eric Rosenbaum
2d8491123e Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound 2017-01-30 11:28:52 -05:00
Eric Rosenbaum
d5e0d433aa include md5 in sprite sound object 2017-01-30 10:43:28 -05:00
griffpatch
2ac4b73a1f Importers: adjust block coordinate calculation so blocks overlap less. #326
This change imports the scratch blocks much closer to the Scratch 2
spacing.
2017-01-27 13:39:21 +00: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
3344c92f7e change ‘drumtype’ to ‘drum’ in specmap 2017-01-10 18:00:02 -05:00
Eric Rosenbaum
fec9e5b91a add audio to playground 2017-01-06 11:49:25 -05:00
Andrew Sliwinski
6d83931341 WIP clean-up 2016-12-30 10:19:58 -05:00
Eric Rosenbaum
f0e01d3e87 fix name of sounds menu 2016-12-22 14:12:20 -05:00
Eric Rosenbaum
f2793a1d59 Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound
# Conflicts:
#	package.json
#	src/engine/runtime.js
#	src/sprites/clone.js
2016-12-21 15:29:57 -05:00
Tim Mickel
2f0ce7137c Rename Clone -> RenderedTarget (#317) 2016-10-26 11:19:43 -04:00
Tim Mickel
cf20ca1add Fix #313 (block specs in shadow) (#315) 2016-10-26 10:26:56 -04:00
Ray Schamp
7712b2902f Fix quote-props 2016-10-24 11:02:19 -04:00
Ray Schamp
73edb65c4d Replace console with minilog 2016-10-23 22:20:30 -04:00
Ray Schamp
f6c0064235 All linting other than console statements 2016-10-23 22:20:29 -04:00
Ray Schamp
68ed110b49 Pass with eslint --fix
Resolved whitespace issues, e.g., space-before-function-paren and key-spacing
2016-10-23 12:41:45 -04:00
Tim Mickel
84bd42d734 Functions to add Sprite2/costumes/backdrops (#291)
* Functions to add Sprite2/costumes/backdrops

* Have sb2import return the top-level target
2016-10-20 11:44:01 -04:00
Eric Rosenbaum
7bd0142deb Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound
# Conflicts:
#	playground/index.html
2016-10-17 17:13:43 -04:00
Tim Mickel
352c6516d3 Fix parent setting in sb2 importer (#283) 2016-10-17 16:44:33 -04:00
Tim Mickel
3bfd755e60 Complete implementation of stop block (#271)
* "Other scripts in stage" sb2

* Complete implementation of "stop" block
2016-10-13 23:00:46 -04:00
Tim Mickel
8c654bbe60 Procedure blocks (#264) 2016-10-13 13:11:26 -04:00
Eric Rosenbaum
e084a76485 lint 2016-10-13 11:35:52 -04:00
Eric Rosenbaum
ed650ba487 Merge remote-tracking branch 'LLK/develop' into develop 2016-10-05 17:16:13 -04:00
Eric Rosenbaum
0db0783fe8 working on sound font player 2016-10-04 14:19:04 -04:00
Tim Mickel
0a66c62f6a Mutations in block representation; an unfeatured procedure call (#212)
* Add scratch3_procedures and no-op for defnoreturn

* Add mutation adapter to parse mutations in CREATE/CHANGE events

* Add mutation-to-XML

* Update spec map for Blockly procedure names

* Placeholder for procedure special cases

* Basic stepping to procedures

* Remove extra case

* Validation for changeBlock
2016-10-03 17:43:24 -04:00
Eric Rosenbaum
e1df4b3aaf fixed dictionary of loaded sounds 2016-10-01 17:27:28 -04:00
Tim Mickel
2226fda19e Implement rotation style (#223) 2016-09-28 17:09:04 -04:00
Tim Mickel
d10ba11c8f Round costume values (#221) 2016-09-28 16:43:12 -04:00
Eric Rosenbaum
6988cfc0d3 starting to load sounds from project files 2016-09-28 16:42:25 -04:00
Tim Mickel
a118d50056 Variables and lists (#187)
* Import lists and variables from SB2

* Switch to Variable and List objects

* Add Clone.lookupOrCreateVariable, Clone.getVariable, Clone.setVariable

* Add (get, set, change) variable blocks.

* Copy variables and lists on clone instantiation

* Move variable options closer to blocks

* Add list primitives

* Move variable and lists storage to `Target` instead of `Clone`

* Move _computeIndex to a Cast function

* Rename `getList` -> `getListAsString`

* Renames renames

* Remove extra check in Cast.isNaN
2016-09-21 16:38:33 -04:00
Tim Mickel
c02ee88d02 Add some more info/links to sb2specmap (#197) 2016-09-19 15:24:46 -04:00
Tim Mickel
13f287e871 Fix up property imports from SB2 (#196)
* Update target's drawable properties after SB2 import

* Always use `hasOwnProperty` parsing SB2 JSON
2016-09-19 14:40:01 -04:00
Tim Mickel
9744bcbb70 Clones (#150)
* Provide property to Clone to distinguish "original" clones

* Provide method to clone a clone's properties

* Don't report clones in the UI target list

* Add target info to Thread

* Allow hats to skip clones (for green flag)

* Green flag skips clones

* Implement "create clone" and hat

* Pass the runtime to sprites and clones (for start hats)

* Clone disposal; trigger hats after drawable initializes.

* Separate stop threads for target; fix handling of stop button

* Remove extraneous `skipClones` property

* Add global clone limit

* Don't allow a non-clone to delete itself.

* Rename `cloneClone` -> `makeClone`

* Variable updates in runtime.js

* Synchronous drawable initialization (until we put it back to promises)
2016-09-15 19:37:12 -04:00
Tim Mickel
6b3f0d3d8a Playground update; update SB2 spec map for list, _ of _ blocks (#184)
* Playground update

* Update SB2 spec map for list, _ of _ blocks
2016-09-15 17:10:32 -04:00
Tim Mickel
1ebee14eb0 Update sb2specmap.js for droppable broadcast (#182) 2016-09-14 16:43:21 -04:00
TheBrokenRail
40b530fa7e Offline Support [READY TO MERGE?] [ALONG WITH THE SCRATCH-RENDER PR] (#138)
* Remove Fallback Project

* Added A Newline and Removed Fallback Project

* Made The SB2 Project Import Field Fit In  More With All Other Textboxes

* Better Description Of SB2 Import Field

* Oops!

* The XML Import Area Doses Not Need To Be Resizable!

* That Didn't Work As Planned

* Now it won't rezize

* Added SB3New

* Add Code For SB3New

* Better 404

* Indentation

* NodeJS complains about quotes

* Moved And Renamed SB3New

* Renamed Refrences

* Prefix With ./

* Typo

* Newline Fix

* Scratch Cat By Default!

* Single Quotes And Max Legth Fixed

* Better Comment Above loadProject

* Move newProject to index.js

* Added Dependincies to index.js

* Deleted newProject.js

* Removed Unneeeded Semicolon

* @param {?string}

* Added SVG For Scxratch Cat

* Now Uses Scratch Cat Offline (REQUIRES PULL REQUEST MADE TO SCRATCH-RENDER TO BE MERGED OR IT WILL NOT WORK)

* Added Stage PNG

* Added Stage Creation

* Fix Sizing Issues

* Import And Compatibility With Less Hacky Image Import (Scratch-Render)

* Import And Compatibility With Less Hacky Image Import (Scratch-Render)

* Fixed Line Length

* Added Navigation Bar

* Added CSS For Drop Down Menus

* Nicer Scale

* Nicer Dropdowns

* Remobved Dropdown CSS (It Didn't Work)

* Add Scratch Player Bar CSS

* Add Scratch Player Bar HTML
2016-09-12 11:05:16 -04:00
Tim Mickel
d93eeed05d More color utilities, touching color, color touching color (#155)
* Fill out color utilities

* Amend Color.decimalToHex name

* Add `Cast.toScaledRgbColor`

* Add touching color, color touching color blocks

* Fix scale of Cast.toRgbColor

* Fix format of colors to use renderer-style lists

* Update `Color.decimalToRgb`

* Lint self
2016-09-12 10:58:50 -04:00
Tim Mickel
5df0acc895 Better glows (#152)
* Strip out old script glowing in thread management

* Add new tracking mechanism for glowing scripts

* Track parents and use them to determine script glows

* Use top-block for a thread if there's nothing on the stack

* Remove `console.log`
2016-09-08 09:40:53 -04:00
Tim Mickel
797f844de3 Stage, costumes, backdrops (#149)
* Add `Clone.prototype.getCostumeIndexByName`, keep in range

* Add basic costume primitives from Scratch 2.0

* Add costume getter block

* Add properties and methods for distinguishing stage and sprites-vs-clones

* Add backdrop-related looks blocks

* Fix up "switch to backdrop" to be working

* Costume/backdrop reporters are 1-indexed

* Fire "when backdrop switched" hats

* Cut cloning helpers for a separate PR

* Disable many blocks on the stage

* Refactor into _setCostumeOrBackdrop; implement switch backdrop and wait

* Fire hats even when backdrop unchanged
2016-09-08 09:40:27 -04:00
Tim Mickel
3dbfc3fdb6 Tweaks from SB2 importer audit (#137)
* Fix SB2 variable imports!

* Fix expectedArg field types

* motion_pointindirection uses math_angle

* Fix "think for secs" expected input

* Add handling for empty input case (empty if-else, for example)

* Fix opcodes for if_else, repeat_until, set tempo

* Specialized number fields for SB2 import

* Convert color picker numbers to hex in SB2 import

* KEY_OPTIONS -> KEY_OPTION

* Backdrop blocks get BACKDROP

* Update toolbox XML to match naming changes

* Merge in math_angle case

* Move color converter to its own utility

* Fix merge conflicts

* Add negative color check.

* Fix keyoptions naming

* Pen JSON tweak post-scratch-blocks update
2016-09-06 11:46:10 -04:00
Tim Mickel
9a8b68643a Shadow improvements (#135)
* Always add `next` to block representation

* Add `shadow` property to inputs, to maintain obscured shadows

* Create obscured shadows in SB2 import

* Add XML import of obscured shadows

* Alias SB2 shadow inputs to block inputs

* Add shadow to inputs on "delete inputs" test

* Add a small test to ensure obscured shadows are preserved

* Add more obscured shadow tests
2016-09-06 10:55:52 -04:00
Tim Mickel
c70e9759a9 Add initial SB2 importer and spec map 2016-08-31 13:56:05 -04:00