finalized video ops

pull/89/head
jmoenig 2019-05-08 10:40:46 +02:00
rodzic 03acf231cd
commit f1e49f7cde
4 zmienionych plików z 42 dodań i 12 usunięć

Wyświetl plik

@ -80,6 +80,7 @@
### 2019-05-08
* Blocks, Objects, Threads: integrated video capture control into global settings prims in Sensing
* Blocks, Threads: added a %self menu
* Blocks, Threads, Objects: Finalized Video ops
### 2019-05-07
* Blocks, Objects, Threads, Video: optimized video motion detection

Wyświetl plik

@ -1723,6 +1723,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) {
// Video motion
/* // +++ to be removed
case '%vid': // video modes
part = new InputSlotMorph(
null,
@ -1734,7 +1735,8 @@ SyntaxElementMorph.prototype.labelPart = function (spec) {
true
);
break;
case '%motype':
*/
case '%vid':
part = new InputSlotMorph(
null,
false, {
@ -2407,7 +2409,7 @@ SyntaxElementMorph.prototype.endLayout = function () {
%f - round function slot, unevaluated if replaced,
%r - round reporter slot
%p - hexagonal predicate slot
%vid - chameleon colored rectangular drop-down for video modes
%vid - chameleon colored rectangular drop-down for video modes // +++ check these
%motype - chameleon colored rectangular drop-down for motion type
%on - chameleon colored rectangular drop-down for motion detection scope

Wyświetl plik

@ -1369,17 +1369,19 @@ SpriteMorph.prototype.initBlocks = function () {
spec: 'set video transparency to %n',
defaults: [50]
},
reportMotionOn: {
reportVideo: {
type: 'reporter',
category: 'sensing',
spec: 'video %motype on %on',
defaults: ['motion', 'this sprite']
spec: 'video %vid on %self',
defaults: [['motion'], ['myself']]
},
/* // +++ to be removed
reportMotionOnStage: {
type: 'reporter',
category: 'sensing',
spec: 'video %motype on stage'
}
*/
};
};
@ -2334,7 +2336,7 @@ SpriteMorph.prototype.blockTemplates = function (category) {
if (SpriteMorph.prototype.enableVideo) {
blocks.push(block('doSetVideoTransparency'));
blocks.push(block('reportMotionOn'));
blocks.push(block('reportVideo'));
blocks.push('-');
}
@ -8054,7 +8056,7 @@ StageMorph.prototype.blockTemplates = function (category) {
if (SpriteMorph.prototype.enableVideo) {
blocks.push(block('doSetVideoTransparency'));
blocks.push(block('reportMotionOnStage'));
blocks.push(block('reportVideo'));
blocks.push('-');
}

Wyświetl plik

@ -4442,17 +4442,41 @@ Process.prototype.doSetVideoTransparency = function(factor) {
}
};
/* // +++ to be removed
Process.prototype.reportMotionOnStage = function(motionType) {
return this.reportMotionOn(motionType, 'stage');
};
*/
Process.prototype.reportMotionOn = function(motionType, on) {
var stage = this.homeContext.receiver.parentThatIsA(StageMorph),
sprite = this.blockReceiver(),
result;
if (stage === null || !stage.videoElement) {
Process.prototype.reportVideo = function(attribute, name) { // +++
var thisObj = this.blockReceiver(),
stage = thisObj.parentThatIsA(StageMorph),
thatObj = this.getOtherObject(name, thisObj, stage);
if (!stage || !stage.videoElement) {
return null;
}
switch (this.inputOption(attribute)) {
case 'motion':
if (thatObj instanceof SpriteMorph) {
stage.videoMotion.getLocalMotion(thatObj);
return thatObj.motionAmount;
}
stage.videoMotion.getStageMotion();
return stage.videoMotion.motionAmount;
case 'direction':
if (thatObj instanceof SpriteMorph) {
stage.videoMotion.getLocalMotion(thatObj);
return thatObj.motionDirection;
}
stage.videoMotion.getStageMotion();
return stage.videoMotion.motionDirection;
}
return -1;
/* // +++ remove
switch (this.inputOption(on)) {
case 'stage':
stage.videoMotion.getStageMotion();
@ -4474,6 +4498,7 @@ Process.prototype.reportMotionOn = function(motionType, on) {
break;
}
return result;
*/
};
// Process code mapping