aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorValerio Virgillito2012-03-23 12:19:22 -0700
committerValerio Virgillito2012-03-23 12:19:22 -0700
commit80aa8696aca8df6081e4e5d23bf35ed6e3155a7a (patch)
tree7263d112fb30137e3122c4ca9405097fa8bd9d13 /js
parent388d8e469e4641553b67aece4fc1d56d9789fff5 (diff)
parent8e9ac98ea1001289cb3834b262200eee253cb408 (diff)
downloadninja-80aa8696aca8df6081e4e5d23bf35ed6e3155a7a.tar.gz
Merge pull request #135 from mqg734/WebGL-Animation-CheckBox
We have to add a flag in GLWorld so that any changes in geometry that forces a render will only render once.
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/elements/shapes-controller.js2
-rwxr-xr-xjs/lib/drawing/world.js6
-rwxr-xr-xjs/ninja.reel/ninja.js2
3 files changed, 10 insertions, 0 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 9b2fa618..b060b751 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -109,11 +109,13 @@ exports.ShapesController = Montage.create(CanvasController, {
109 if(value) 109 if(value)
110 { 110 {
111 el.elementModel.shapeModel.animate = true; 111 el.elementModel.shapeModel.animate = true;
112 el.elementModel.shapeModel.GLWorld._previewAnimation = true;
112 el.elementModel.shapeModel.GLWorld.restartRenderLoop(); 113 el.elementModel.shapeModel.GLWorld.restartRenderLoop();
113 } 114 }
114 else 115 else
115 { 116 {
116 el.elementModel.shapeModel.animate = false; 117 el.elementModel.shapeModel.animate = false;
118 el.elementModel.shapeModel.GLWorld._previewAnimation = false;
117 el.elementModel.shapeModel.GLWorld._canvas.task.stop(); 119 el.elementModel.shapeModel.GLWorld._canvas.task.stop();
118 } 120 }
119 break; 121 break;
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js
index 07a2c3ae..b87c6272 100755
--- a/js/lib/drawing/world.js
+++ b/js/lib/drawing/world.js
@@ -117,6 +117,8 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
117 117
118 this.getRenderer = function() { return this.renderer; }; 118 this.getRenderer = function() { return this.renderer; };
119 119
120 // Flag to play/pause animation at authortime
121 this._previewAnimation = true;
120 //////////////////////////////////////////////////////////////////////////////////// 122 ////////////////////////////////////////////////////////////////////////////////////
121 // RDGE 123 // RDGE
122 // local variables 124 // local variables
@@ -475,6 +477,10 @@ World.prototype.restartRenderLoop = function() {
475 if (this._allMapsLoaded) { 477 if (this._allMapsLoaded) {
476 //console.log( "starting task" ); 478 //console.log( "starting task" );
477 this._canvas.task.start(); 479 this._canvas.task.start();
480 if(!this._previewAnimation) {
481 //render only once if authortime animation is turned off
482 this._canvas.task.stop();
483 }
478 } else { 484 } else {
479 //console.log( "stopping task" ); 485 //console.log( "stopping task" );
480 this._canvas.task.stop(); 486 this._canvas.task.stop();
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js
index 7db2a82c..c76c7d46 100755
--- a/js/ninja.reel/ninja.js
+++ b/js/ninja.reel/ninja.js
@@ -179,8 +179,10 @@ exports.Ninja = Montage.create(Component, {
179 for(var i = 0, len = glCanvases.length; i<len; i++) { 179 for(var i = 0, len = glCanvases.length; i<len; i++) {
180 glShapeModel = glCanvases[i].elementModel.shapeModel; 180 glShapeModel = glCanvases[i].elementModel.shapeModel;
181 if(inLivePreview) { 181 if(inLivePreview) {
182 glShapeModel.GLWorld._previewAnimation = true;
182 glShapeModel.GLWorld.restartRenderLoop(); 183 glShapeModel.GLWorld.restartRenderLoop();
183 } else if (!glShapeModel.animate ) { 184 } else if (!glShapeModel.animate ) {
185 glShapeModel.GLWorld._previewAnimation = false;
184 glShapeModel.GLWorld._canvas.task.stop(); 186 glShapeModel.GLWorld._canvas.task.stop();
185 } 187 }
186 } 188 }