From 717ac46bbd5c3aaa2c0b12793f13c71357486597 Mon Sep 17 00:00:00 2001 From: Andrew Sliwinski Date: Mon, 23 Apr 2018 12:57:14 -0400 Subject: [PATCH 1/3] Reorder video motion blocks. Resolves GH-1073 --- .../scratch3_video_sensing/index.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/extensions/scratch3_video_sensing/index.js b/src/extensions/scratch3_video_sensing/index.js index 85767f3e..47cad45c 100644 --- a/src/extensions/scratch3_video_sensing/index.js +++ b/src/extensions/scratch3_video_sensing/index.js @@ -340,6 +340,19 @@ class Scratch3VideoSensingBlocks { id: 'videoSensing', name: 'Video Motion', blocks: [ + { + // @todo this hat needs to be set itself to restart existing + // threads like Scratch 2's behaviour. + opcode: 'whenMotionGreaterThan', + text: 'when video motion > [REFERENCE]', + blockType: BlockType.HAT, + arguments: { + REFERENCE: { + type: ArgumentType.NUMBER, + defaultValue: 10 + } + } + }, { opcode: 'videoOn', blockType: BlockType.REPORTER, @@ -357,19 +370,6 @@ class Scratch3VideoSensingBlocks { } } }, - { - // @todo this hat needs to be set itself to restart existing - // threads like Scratch 2's behaviour. - opcode: 'whenMotionGreaterThan', - text: 'when video motion > [REFERENCE]', - blockType: BlockType.HAT, - arguments: { - REFERENCE: { - type: ArgumentType.NUMBER, - defaultValue: 10 - } - } - }, { opcode: 'videoToggle', text: 'turn video [VIDEO_STATE]', From ced4de8995ff021630d1acfa2b5b25034955901f Mon Sep 17 00:00:00 2001 From: Andrew Sliwinski Date: Mon, 23 Apr 2018 13:00:20 -0400 Subject: [PATCH 2/3] Flip sort order of sensing object menu in video motion extension. Resolves GH-1074 --- src/extensions/scratch3_video_sensing/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/extensions/scratch3_video_sensing/index.js b/src/extensions/scratch3_video_sensing/index.js index 47cad45c..903d78fe 100644 --- a/src/extensions/scratch3_video_sensing/index.js +++ b/src/extensions/scratch3_video_sensing/index.js @@ -289,13 +289,13 @@ class Scratch3VideoSensingBlocks { */ get SUBJECT_INFO () { return [ - { - name: 'stage', - value: SensingSubject.STAGE - }, { name: 'sprite', value: SensingSubject.SPRITE + }, + { + name: 'stage', + value: SensingSubject.STAGE } ]; } @@ -366,7 +366,7 @@ class Scratch3VideoSensingBlocks { SUBJECT: { type: ArgumentType.NUMBER, menu: 'SUBJECT', - defaultValue: SensingSubject.STAGE + defaultValue: SensingSubject.SPRITE } } }, From add879ab0a5a06375545a20d0159bb618e8a7eb5 Mon Sep 17 00:00:00 2001 From: Andrew Sliwinski Date: Mon, 23 Apr 2018 13:03:56 -0400 Subject: [PATCH 3/3] Enable video layer when loading extension. Resolves GH-1072 --- src/extensions/scratch3_video_sensing/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/extensions/scratch3_video_sensing/index.js b/src/extensions/scratch3_video_sensing/index.js index 903d78fe..f0313459 100644 --- a/src/extensions/scratch3_video_sensing/index.js +++ b/src/extensions/scratch3_video_sensing/index.js @@ -336,6 +336,10 @@ class Scratch3VideoSensingBlocks { * @returns {object} metadata for this extension and its blocks. */ getInfo () { + // Enable the video layer + this.runtime.ioDevices.video.enableVideo(); + + // Return extension definition return { id: 'videoSensing', name: 'Video Motion',