aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/controllers/elements/canvas-controller.js8
-rw-r--r--js/helper-classes/RDGE/GLWorld.js10
-rw-r--r--js/helper-classes/RDGE/Materials/FlatMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/LinearGradientMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/RadialGradientMaterial.js2
-rw-r--r--js/stage/stage.reel/stage.js51
6 files changed, 55 insertions, 20 deletions
diff --git a/js/controllers/elements/canvas-controller.js b/js/controllers/elements/canvas-controller.js
index 7af7e824..b5df3911 100644
--- a/js/controllers/elements/canvas-controller.js
+++ b/js/controllers/elements/canvas-controller.js
@@ -33,5 +33,13 @@ exports.CanvasController = Montage.create(ElementController, {
33 ElementController.setProperty(el, p, value); 33 ElementController.setProperty(el, p, value);
34 } 34 }
35 } 35 }
36 },
37
38 setProperties: {
39 value: function(el, props, index) {
40 for(var p in props) {
41 el.elementModel.controller.setProperty(el, p, props[p][index]);
42 }
43 }
36 } 44 }
37}); \ No newline at end of file 45}); \ No newline at end of file
diff --git a/js/helper-classes/RDGE/GLWorld.js b/js/helper-classes/RDGE/GLWorld.js
index dd9b6977..b84bb585 100644
--- a/js/helper-classes/RDGE/GLWorld.js
+++ b/js/helper-classes/RDGE/GLWorld.js
@@ -248,9 +248,17 @@ function GLWorld( canvas, use3D )
248 if (!this.hasAnimatedMaterials()) 248 if (!this.hasAnimatedMaterials())
249 { 249 {
250 this.myScene.render(); 250 this.myScene.render();
251 this._canvas.task.stop(); 251 //this._canvas.task.stop();
252 this._renderCount = 3;
252 } 253 }
253 } 254 }
255 else if (this._renderCount >= 0)
256 {
257 this._renderCount--;
258 if (this._renderCount == 0)
259 this._canvas.task.stop();
260 }
261
254 } 262 }
255 } 263 }
256 else 264 else
diff --git a/js/helper-classes/RDGE/Materials/FlatMaterial.js b/js/helper-classes/RDGE/Materials/FlatMaterial.js
index db66ca42..f342eef8 100644
--- a/js/helper-classes/RDGE/Materials/FlatMaterial.js
+++ b/js/helper-classes/RDGE/Materials/FlatMaterial.js
@@ -29,7 +29,7 @@ function FlatMaterial()
29 this.getColor = function() { return this._color; } 29 this.getColor = function() { return this._color; }
30 this.getShaderName = function() { return this._shaderName; } 30 this.getShaderName = function() { return this._shaderName; }
31 31
32 this.isAnimated = function() { return true; } 32 this.isAnimated = function() { return false; }
33 33
34 //////////////////////////////////s///////////////////////////////////// 34 //////////////////////////////////s/////////////////////////////////////
35 // Methods 35 // Methods
diff --git a/js/helper-classes/RDGE/Materials/LinearGradientMaterial.js b/js/helper-classes/RDGE/Materials/LinearGradientMaterial.js
index f026cd15..ce965296 100644
--- a/js/helper-classes/RDGE/Materials/LinearGradientMaterial.js
+++ b/js/helper-classes/RDGE/Materials/LinearGradientMaterial.js
@@ -98,7 +98,7 @@ function LinearGradientMaterial()
98 this._shader.default.u_cos_sin_angle.set([Math.cos(a), Math.sin(a)]); 98 this._shader.default.u_cos_sin_angle.set([Math.cos(a), Math.sin(a)]);
99 } 99 }
100 100
101 this.isAnimated = function() { return true; } 101 this.isAnimated = function() { return false; }
102 102
103 /////////////////////////////////////////////////////////////////////// 103 ///////////////////////////////////////////////////////////////////////
104 // Material Property Accessors 104 // Material Property Accessors
diff --git a/js/helper-classes/RDGE/Materials/RadialGradientMaterial.js b/js/helper-classes/RDGE/Materials/RadialGradientMaterial.js
index 5f912dec..cf91f1aa 100644
--- a/js/helper-classes/RDGE/Materials/RadialGradientMaterial.js
+++ b/js/helper-classes/RDGE/Materials/RadialGradientMaterial.js
@@ -92,7 +92,7 @@ function RadialGradientMaterial()
92 this._shader.default.u_colorCount.set([c]); 92 this._shader.default.u_colorCount.set([c]);
93 } 93 }
94 94
95 this.isAnimated = function() { return true; } 95 this.isAnimated = function() { return false; }
96 96
97 97
98 /////////////////////////////////////////////////////////////////////// 98 ///////////////////////////////////////////////////////////////////////
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 3e0b852e..92ab4033 100644
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -787,14 +787,9 @@ exports.Stage = Montage.create(Component, {
787 var userContent = this.application.ninja.currentDocument.documentRoot; 787 var userContent = this.application.ninja.currentDocument.documentRoot;
788 if (userContent) 788 if (userContent)
789 { 789 {
790 var w = userContent.offsetWidth, 790 var w = this._canvas.width,
791 h = userContent.offsetHeight; 791 h = this._canvas.height;
792 if(userContent.width) 792 var globalPt = [w/2, h/2, 0];
793 w = userContent.width;
794 if(userContent.height)
795 h = userContent.height;
796 var localPt = [ w/2, h/2, 0];
797 var globalPt = this.stageDeps.viewUtils.localToGlobal( localPt, userContent );
798 793
799 this.stageDeps.viewUtils.setStageZoom( globalPt, value/100 ); 794 this.stageDeps.viewUtils.setStageZoom( globalPt, value/100 );
800 795
@@ -811,6 +806,36 @@ exports.Stage = Montage.create(Component, {
811 } 806 }
812 }, 807 },
813 808
809 getPlaneForView:
810 {
811 value: function( side )
812 {
813 var plane = [0,0,1,0];
814 switch(side)
815 {
816 case "top":
817 plane[1] = 1;
818 plane[3] = this.application.ninja.currentDocument.documentRoot.offsetHeight / 2.0;
819 break;
820
821 case "side":
822 plane[0] = 1;
823 plane[3] = this.application.ninja.currentDocument.documentRoot.offsetWidth / 2.0;
824 break;
825
826 case "front":
827 plane = [0,0,1,0];
828 break;
829
830 default:
831 console.log( "unrecognized view in snapManager.getPlaneForView: " + side );
832 break;
833 }
834
835 return plane;
836 }
837 },
838
814 setStageView: { 839 setStageView: {
815 value: function(side) { 840 value: function(side) {
816 var mat, 841 var mat,
@@ -821,32 +846,26 @@ exports.Stage = Montage.create(Component, {
821 currentDoc.elementModel.props3D.ResetRotationValues(); 846 currentDoc.elementModel.props3D.ResetRotationValues();
822 847
823 848
824 switch(side) { 849 switch(side){
825 case "top": 850 case "top":
826 mat = Matrix.RotationX(Math.PI * 270.0/180.0); 851 mat = Matrix.RotationX(Math.PI * 270.0/180.0);
827
828 drawUtils.drawXY = drawUtils.drawYZ = false; 852 drawUtils.drawXY = drawUtils.drawYZ = false;
829 drawUtils.drawXZ = drawUtils.isDrawingGrid(); 853 drawUtils.drawXZ = drawUtils.isDrawingGrid();
830 workingPlane = [0,1,0,0];
831 break; 854 break;
832 855
833 case "side": 856 case "side":
834 mat = Matrix.RotationY(Math.PI * 270/180); 857 mat = Matrix.RotationY(Math.PI * 270/180);
835
836 drawUtils.drawXY = drawUtils.drawXZ = false; 858 drawUtils.drawXY = drawUtils.drawXZ = false;
837 drawUtils.drawYZ = drawUtils.isDrawingGrid(); 859 drawUtils.drawYZ = drawUtils.isDrawingGrid();
838 workingPlane = [1,0,0,0];
839 break; 860 break;
840 861
841 case "front": 862 case "front":
842 mat = Matrix.I(4); 863 mat = Matrix.I(4);
843
844 drawUtils.drawYZ = drawUtils.drawXZ = false; 864 drawUtils.drawYZ = drawUtils.drawXZ = false;
845 drawUtils.drawXY = drawUtils.isDrawingGrid(); 865 drawUtils.drawXY = drawUtils.isDrawingGrid();
846 workingPlane = [0,0,1,0];
847 break; 866 break;
848 } 867 }
849 868 workingPlane = this.getPlaneForView( side );
850 869
851 this.stageDeps.viewUtils.setMatrixForElement(currentDoc, mat, false); 870 this.stageDeps.viewUtils.setMatrixForElement(currentDoc, mat, false);
852 871