Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blockly Updates from Mars Game #527

Open
wants to merge 38 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
eb31746
Remove blockly xml log statement
Jan 21, 2015
fc37efe
Remove console.log in blockly driver
Jan 21, 2015
abe8d1a
Comment out line generating errors with repeat blocks
Jan 22, 2015
d137c84
we can now stop execution on a particular Blockly node,as opposed to
Mar 11, 2015
579961d
Now, per Brett's suggestion, we changed stopExecutingForNode in
Mar 13, 2015
682ab19
Remove UI visibility code from blockly_activeNodeID handler
Mar 12, 2015
432ab44
Add blockly_interfaceVisible property
Mar 12, 2015
86be9af
Only fire blocklyVisibleChanged if active node is defined
Mar 12, 2015
25655c1
Fire blocklyVisibleChanged when active node changes
Mar 12, 2015
554d2f0
Brings back the trashcan and removes an offset that isn't needed (whi…
AmbientOSX Apr 7, 2015
c376e3b
Clean up changes
AmbientOSX Apr 7, 2015
4406299
Adds support to change the execution time of Blockly depending on the…
AmbientOSX Apr 9, 2015
54e7bdc
Remove log messages
AmbientOSX Apr 10, 2015
84141c7
Refinements in progress...
AmbientOSX Apr 28, 2015
fb1c255
Speed up working.
AmbientOSX Apr 28, 2015
9b5e74b
Remove a log message
AmbientOSX Apr 30, 2015
0019b82
Fix error message
AmbientOSX May 5, 2015
5864930
Prevents invalid xml from being loaded
AmbientOSX May 18, 2015
41862ee
Fix handling of Blockly clear
AmbientOSX May 18, 2015
1904ada
Adds a grid and updates blockly version for new goodness.
AmbientOSX May 19, 2015
6d6166a
Check if blocklyNode and previousBlocklyNode are defined before setti…
May 21, 2015
65a2622
Start of refactor for new version of blockly.
AmbientOSX Jul 8, 2015
27cbc14
Refactor in progress... addressing some deprecated Blockly function c…
AmbientOSX Jul 8, 2015
31ebccf
Fix width issue with retrieving old blocks
AmbientOSX Jul 9, 2015
6ec5a95
Undo changes to make rollback of Blockly work.
AmbientOSX Jul 10, 2015
d460105
Core changes made (trashcan, toolbox autoclose, tooltip speed, select…
AmbientOSX Jul 22, 2015
06599e0
Core changes that support some flyout/aesthetic/UI changes
AmbientOSX Jul 29, 2015
976b98c
Fix alignment, fix coloring, update closing dropdown window, add vari…
AmbientOSX Jul 31, 2015
42768ef
Really update variable
AmbientOSX Jul 31, 2015
6c9f072
Reduces time between lines for Blockly.
AmbientOSX Aug 4, 2015
1b9681f
Changes radial select to use 90 degree angles only, removes comment a…
AmbientOSX Aug 3, 2015
9dbd3a5
Makes disabled blocks more visibly disabled - removes some dropdown c…
AmbientOSX Aug 12, 2015
c7b6b38
Fixes satProperty for blockly_xml
AmbientOSX Aug 24, 2015
f3c23be
Revert change/clean up code
AmbientOSX Aug 24, 2015
7f91bd0
Another reversion
AmbientOSX Aug 24, 2015
ddc4de7
Add support for reset.
AmbientOSX Aug 24, 2015
94217d0
Address disabled block coloring issue, address behind toolbox issue, …
AmbientOSX Sep 2, 2015
931bc2a
Remove getPrototypes function
Dec 15, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 44 additions & 23 deletions support/client/lib/vwf/model/blockly.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ define( [ "module", "vwf/model", "vwf/utility",
"defaultXml": undefined,
"code": undefined,
"lastLineExeTime": undefined,
"timeBetweenLines": 1,
"timeBetweenLines": 0.5,
"baseExecutionSpeed": 1,
"interpreter": undefined,
"interpreterStatus": ""
};
Expand Down Expand Up @@ -226,9 +227,30 @@ define( [ "module", "vwf/model", "vwf/utility",
case "blockly_code":
value = node.code = propertyValue;
break;


case "new_xml":
node.blocks = propertyValue;
value = propertyValue;
break;

case "blockly_xml":
value = node.blocks = propertyValue;
node.blocks = propertyValue;
value = propertyValue;
break;

case "blockly_timeBetweenLines":
this.state.blockly.node.timeBetweenLines = propertyValue;
break;

case "blockly_baseExecutionSpeed":

if ( propertyValue > 0 && propertyValue <= 10 ) {
this.state.blockly.node.baseExecutionSpeed = propertyValue;
} else {
this.logger.errorx("baseExecutionSpeed", "Blockly node with", nodeID,
"must be in the range (0,10).");
}

break;

case "blockly_executing":
Expand Down Expand Up @@ -307,7 +329,7 @@ define( [ "module", "vwf/model", "vwf/utility",

// -- callingMethod --------------------------------------------------------------------------

callingMethod: function( nodeID, methodName /* [, parameter1, parameter2, ... ] */ ) { // TODO: parameters
callingMethod: function( nodeID, methodName, methodParameters ) {
var node = this.state.nodes[ nodeID ];

if ( this.debug.methods ) {
Expand All @@ -317,7 +339,7 @@ define( [ "module", "vwf/model", "vwf/utility",
if ( nodeID == this.kernel.application() ) {

switch ( methodName ) {

case "stopAllExecution":
for ( var id in this.state.executingBlocks ) {
this.state.executingBlocks[ id ].interpreterStatus = "completed";
Expand All @@ -332,8 +354,6 @@ define( [ "module", "vwf/model", "vwf/utility",
this.kernel.fireEvent( id, "blocklyStarted", [ true ] );
}
break;


}
} else if ( node !== undefined ) {
switch ( methodName ) {
Expand All @@ -344,6 +364,17 @@ define( [ "module", "vwf/model", "vwf/utility",
this.kernel.setProperty( nodeID, "blockly_xml", '<xml></xml>' );
}
break;
case "stopExecution":
var currBlockly3Node = this.state.executingBlocks[ nodeID ];
if ( currBlockly3Node ) {
currBlockly3Node.interpreterStatus = "completed";
this.kernel.setProperty( nodeID, 'blockly_executing', false );
this.kernel.fireEvent( nodeID, "blocklyStopped", [ true ] );
} else {
this.logger.errorx("stopExecutionForNode", "Node with", nodeID,
"is not currently executing Blockly!");
}
break;
}
}
},
Expand All @@ -367,8 +398,9 @@ define( [ "module", "vwf/model", "vwf/utility",
for ( var nodeID in this.state.executingBlocks ) {

blocklyNode = this.state.executingBlocks[ nodeID ];
var executeNextLine = false;

var executeNextLine = false;

if ( blocklyNode.interpreter === undefined ||
blocklyNode.interpreterStatus === "completed" ) {
blocklyNode.interpreter = createInterpreter( acorn, blocklyNode.code );
Expand All @@ -377,7 +409,7 @@ define( [ "module", "vwf/model", "vwf/utility",
executeNextLine = true;
} else {
var elaspedTime = vwfTime - blocklyNode.lastLineExeTime;
if ( elaspedTime >= blocklyNode.timeBetweenLines ) {
if ( elaspedTime >= ( blocklyNode.timeBetweenLines * blocklyNode.baseExecutionSpeed ) ) {
executeNextLine = true;
blocklyNode.lastLineExeTime = vwfTime;
}
Expand All @@ -386,10 +418,11 @@ define( [ "module", "vwf/model", "vwf/utility",
if ( executeNextLine ) {

self.state.executionHalted = false;

nextStep( blocklyNode );

this.kernel.fireEvent( nodeID, "blocklyExecuted", [ blocklyNode.interpreter.value ] );
// Does this serve any real purpose? It's not handled in any application.
// Certain blocks, such as repeat blocks, break with the recursive node reference changes.
// this.kernel.fireEvent( nodeID, "blocklyExecuted", [ blocklyNode.interpreter.value ] );
}
}
}
Expand All @@ -398,18 +431,6 @@ define( [ "module", "vwf/model", "vwf/utility",

} );

function getPrototypes( extendsID ) {
var prototypes = [];
var id = extendsID;

while ( id !== undefined ) {
prototypes.push( id );
id = self.kernel.prototype( id );
}

return prototypes;
}

function isBlockly3Node( nodeID ) {
return self.kernel.test( nodeID,
"self::element(*,'http://vwf.example.com/blockly/controller.vwf')",
Expand Down
Loading