aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Reid2012-04-19 14:30:38 -0700
committerJon Reid2012-04-19 14:30:38 -0700
commit71e1e65d6aaa64afc9fffba9b1fd6d19904b52b0 (patch)
tree78292a128cd79f2aa7fbc7a7077dea83389a52e8
parentfc22cd3b5c65dc6f137fbb59443e2061cbbcac26 (diff)
parent4465a66996f2b022ab9e838e028415fd87cfa405 (diff)
downloadninja-71e1e65d6aaa64afc9fffba9b1fd6d19904b52b0.tar.gz
Merge remote-tracking branch 'ninja-jduran/TimelineUber' into timeline-local
Conflicts: js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js Used mine.
-rwxr-xr-xjs/components/layout/bread-crumb.reel/bread-crumb.js4
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js50
-rwxr-xr-xjs/helper-classes/3D/hit-record.js55
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js11
-rwxr-xr-xjs/helper-classes/3D/view-utils.js35
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js91
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js4
-rwxr-xr-xjs/tools/Rotate3DToolBase.js386
-rwxr-xr-xjs/tools/RotateObject3DTool.js4
-rwxr-xr-xjs/tools/RotateStage3DTool.js7
-rwxr-xr-xjs/tools/SelectionTool.js4
-rwxr-xr-xjs/tools/Translate3DToolBase.js134
-rwxr-xr-xjs/tools/TranslateObject3DTool.js1
-rwxr-xr-xjs/tools/modifier-tool-base.js17
14 files changed, 619 insertions, 184 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js
index 4776265a..faf5e2f8 100755
--- a/js/components/layout/bread-crumb.reel/bread-crumb.js
+++ b/js/components/layout/bread-crumb.reel/bread-crumb.js
@@ -71,7 +71,7 @@ exports.Breadcrumb = Montage.create(Component, {
71 71
72 // This is always the top container which is now hardcoded to body 72 // This is always the top container which is now hardcoded to body
73 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": "Body"}); 73 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": "Body"});
74 74 NJevent("breadCrumbBinding",this)
75 75
76 76
77 } 77 }
@@ -80,7 +80,7 @@ exports.Breadcrumb = Montage.create(Component, {
80 handleAction: { 80 handleAction: {
81 value: function(evt) { 81 value: function(evt) {
82 82
83 this.application.ninja.breadCrumbClick=true; 83 this.application.ninja.currentDocument.breadCrumbClick=true;
84 if(evt.target.value === this.container.uuid) { 84 if(evt.target.value === this.container.uuid) {
85 return; 85 return;
86 } 86 }
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index ec8eea0f..7bd77c3a 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -803,20 +803,21 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
803 context.stroke(); 803 context.stroke();
804 804
805 this._selectionCtr = MathUtils.getCenterFromBounds(3, bounds3D); 805 this._selectionCtr = MathUtils.getCenterFromBounds(3, bounds3D);
806 console.log("selection center, single elt case - ", this._selectionCtr); 806// console.log("selection center, single elt case - ", this._selectionCtr);
807 807
808 this.viewUtils.popViewportObj(); 808 this.viewUtils.popViewportObj();
809 } 809 }
810 else 810 else
811 { 811 {
812 // get the plane from the first element to compare against the other elements 812 // get the plane from the first element to compare against the other elements
813 var dot;
813 var flat = true; 814 var flat = true;
814 var plane = this.viewUtils.getElementPlane( eltArray[0] ); 815 var plane = this.viewUtils.getUnprojectedElementPlane( eltArray[0] );
815 for (i=1; i<len; i++) 816 for (i=1; i<len; i++)
816 { 817 {
817 elt = eltArray[i]; 818 elt = eltArray[i];
818 var plane2 = this.viewUtils.getElementPlane( elt ); 819 var plane2 = this.viewUtils.getUnprojectedElementPlane( elt );
819 var dot = MathUtils.dot3(plane,plane2); 820 dot = Math.abs( MathUtils.dot3(plane,plane2) );
820 if (MathUtils.fpCmp(dot, 1) != 0) 821 if (MathUtils.fpCmp(dot, 1) != 0)
821 { 822 {
822 flat = false; 823 flat = false;
@@ -832,6 +833,19 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
832 } 833 }
833 } 834 }
834 835
836 // if all of the planes are aligned, check if they are aligned with the view direction
837 if (flat)
838 {
839 var stage = this.application.ninja.currentDocument.documentRoot;
840 var stageMat = this.viewUtils.getMatrixFromElement(stage);
841 var viewDir = [ stageMat[8], stageMat[9], stageMat[10] ];
842 viewDir = vecUtils.vecNormalize( 3, viewDir );
843 dot = Math.abs( MathUtils.dot3(plane,viewDir) );
844 if (MathUtils.fpCmp(dot, 1) != 0)
845 flat = false;
846 }
847// console.log( "drawSelectionBounds, flat: " + flat );
848
835 // if all the elements share the same plane, draw the 2D rectangle 849 // if all the elements share the same plane, draw the 2D rectangle
836 if (flat) 850 if (flat)
837 { 851 {
@@ -843,12 +857,12 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
843 857
844 // get the element bounds in 'plane' space 858 // get the element bounds in 'plane' space
845 bounds = this.viewUtils.getElementViewBounds3D( elt ); 859 bounds = this.viewUtils.getElementViewBounds3D( elt );
846 ssMat = this.viewUtils.getLocalToGlobalMatrix( elt ); 860 ssMat = this.viewUtils.getLocalToGlobalMatrix( elt );
847 for (j=0; j<4; j++) 861 for (j=0; j<4; j++)
848 { 862 {
849 var localPt = bounds[j]; 863 var localPt = bounds[j];
850 tmpPt = this.viewUtils.localToGlobal2(localPt, ssMat); 864 tmpPt = this.viewUtils.localToGlobal2(localPt, ssMat);
851 pt = tmpPt; 865 pt = tmpPt;
852 866
853 if (!rect) 867 if (!rect)
854 { 868 {
@@ -865,7 +879,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
865 // draw the rectangle 879 // draw the rectangle
866 context.beginPath(); 880 context.beginPath();
867 881
868 pt = MathUtils.makeDimension3(rect.getPoint(3)); 882 pt = MathUtils.makeDimension3(rect.getPoint(3));
869 883
870 bounds3D = [[0,0], [0,0], [0,0], [0,0]]; 884 bounds3D = [[0,0], [0,0], [0,0], [0,0]];
871 this._selectionCtr = pt.slice(0); 885 this._selectionCtr = pt.slice(0);
@@ -873,7 +887,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
873 context.moveTo( pt[0], pt[1] ); 887 context.moveTo( pt[0], pt[1] );
874 for (i=0; i<4; i++) 888 for (i=0; i<4; i++)
875 { 889 {
876 pt = rect.getPoint(i); 890 pt = rect.getPoint(i);
877 context.lineTo( pt[0], pt[1] ); 891 context.lineTo( pt[0], pt[1] );
878 bounds3D[i] = pt.slice(0); 892 bounds3D[i] = pt.slice(0);
879 } 893 }
@@ -890,19 +904,21 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
890 { 904 {
891 var minPt, maxPt; 905 var minPt, maxPt;
892 906
893 // we set the root to "the world". 907 // we set the root to "the world".
894 var saveRoot = this.viewUtils.getRootElement(); 908 var saveRoot = this.viewUtils.getRootElement();
895 this.viewUtils.setRootElement( this.viewUtils.getStageElement() ); 909 this.viewUtils.setRootElement( this.viewUtils.getStageElement() );
896 ssMat = this.viewUtils.getLocalToGlobalMatrix( this._sourceSpaceElt ); 910 ssMat = this.viewUtils.getLocalToGlobalMatrix( this._sourceSpaceElt );
897 911
898 for (i=0; i<len; i++) 912 for (i=0; i<len; i++)
899 { 913 {
900 elt = eltArray[i]; 914 elt = eltArray[i];
901 bounds = this.viewUtils.getElementViewBounds3D( elt ); 915 bounds = this.viewUtils.getElementViewBounds3D( elt );
902 var eltMat = this.viewUtils.getLocalToGlobalMatrix( elt ); 916 var eltMat = this.viewUtils.getLocalToGlobalMatrix( elt );
903 for (j=0; j<4; j++) 917 for (j=0; j<4; j++)
904 { 918 {
905 pt = this.viewUtils.localToGlobal2( bounds[j], eltMat ); 919 pt = this.viewUtils.localToGlobal2( bounds[j], eltMat );
920 var tmpPt = this.viewUtils.localToStageWorld(bounds[j], elt);
921 tmpPt = this.viewUtils.screenToView( tmpPt[0], tmpPt[1], tmpPt[2] );
906 if (!minPt) 922 if (!minPt)
907 { 923 {
908 minPt = pt.slice(0); 924 minPt = pt.slice(0);
@@ -939,7 +955,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
939 955
940 // get the 8 corners of the parallelpiped in world space 956 // get the 8 corners of the parallelpiped in world space
941 var wc = new Array(); // wc == world cube 957 var wc = new Array(); // wc == world cube
942 wc.push( this.viewUtils.localToGlobal2( [x0,y0,z1], ssMat ) ); 958 wc.push( this.viewUtils.localToGlobal2( [x0,y0,z1], ssMat ) );
943 wc.push( this.viewUtils.localToGlobal2( [x0,y1,z1], ssMat ) ); 959 wc.push( this.viewUtils.localToGlobal2( [x0,y1,z1], ssMat ) );
944 wc.push( this.viewUtils.localToGlobal2( [x1,y1,z1], ssMat ) ); 960 wc.push( this.viewUtils.localToGlobal2( [x1,y1,z1], ssMat ) );
945 wc.push( this.viewUtils.localToGlobal2( [x1,y0,z1], ssMat ) ); 961 wc.push( this.viewUtils.localToGlobal2( [x1,y0,z1], ssMat ) );
@@ -970,7 +986,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
970 //context.strokeStyle = ((right > 0) || (back > 0)) ? dark : light; context.beginPath(); 986 //context.strokeStyle = ((right > 0) || (back > 0)) ? dark : light; context.beginPath();
971 if ((right > 0) || (back > 0)) { 987 if ((right > 0) || (back > 0)) {
972 context.beginPath(); 988 context.beginPath();
973 p = this.viewUtils.localToGlobal2( [x1, y0, z0], ssMat ); context.moveTo( p[0], p[1] ); 989 p = this.viewUtils.localToGlobal2( [x1, y0, z0], ssMat ); context.moveTo( p[0], p[1] );
974 p = this.viewUtils.localToGlobal2( [x1, y1, z0], ssMat ); context.lineTo( p[0], p[1] ); 990 p = this.viewUtils.localToGlobal2( [x1, y1, z0], ssMat ); context.lineTo( p[0], p[1] );
975 context.closePath(); context.stroke(); 991 context.closePath(); context.stroke();
976 } 992 }
diff --git a/js/helper-classes/3D/hit-record.js b/js/helper-classes/3D/hit-record.js
index 265bf2a4..d72e33bd 100755
--- a/js/helper-classes/3D/hit-record.js
+++ b/js/helper-classes/3D/hit-record.js
@@ -292,6 +292,59 @@ var HitRecord = exports.HitRecord = Object.create(Object.prototype,
292