aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-03-23 13:23:12 -0700
committerJose Antonio Marquez2012-03-23 13:23:12 -0700
commit67aaba2e752ea1964356f487269cafc686abb9a7 (patch)
treec3794257facf5992aff796b1ef11ae661b2aa3cb /js
parent7e61ce5aba0c8465595804da21e365baf4d8c15d (diff)
parent3ac73ef7f5de7fb3869c4b84537a6dc6ef86b859 (diff)
downloadninja-67aaba2e752ea1964356f487269cafc686abb9a7.tar.gz
Merge branch 'refs/heads/Ninja-Montage-Integration' into FileIO-Montage-Components
Diffstat (limited to 'js')
-rwxr-xr-xjs/components/checkbox.reel/checkbox.js21
-rwxr-xr-xjs/components/tools-properties/rect-properties.reel/rect-properties.js4
-rwxr-xr-xjs/controllers/elements/shapes-controller.js15
-rwxr-xr-xjs/data/pi/pi-data.js33
-rwxr-xr-xjs/lib/drawing/world.js6
-rwxr-xr-xjs/models/shape-model.js3
-rwxr-xr-xjs/ninja.reel/ninja.js21
-rw-r--r--js/panels/presets/default-animation-presets.js48
-rwxr-xr-xjs/panels/properties.reel/sections/custom.reel/custom.js13
9 files changed, 161 insertions, 3 deletions
diff --git a/js/components/checkbox.reel/checkbox.js b/js/components/checkbox.reel/checkbox.js
index f06e5830..be331f4e 100755
--- a/js/components/checkbox.reel/checkbox.js
+++ b/js/components/checkbox.reel/checkbox.js
@@ -58,6 +58,26 @@ exports.Checkbox = Montage.create(Component, {
58 } 58 }
59 }, 59 },
60 60
61 _enabled: {
62 enumerable: false,
63 value: true
64 },
65
66 enabled: {
67 enumerable: true,
68 serializable: true,
69 get: function() {
70 return this._enabled;
71 },
72 set: function(value) {
73 if(value !== this._enabled)
74 {
75 this._enabled = value;
76 this.needsDraw = true;
77 }
78 }
79 },
80
61 handleChange: 81 handleChange:
62 { 82 {
63 value:function(event) 83 value:function(event)
@@ -76,6 +96,7 @@ exports.Checkbox = Montage.create(Component, {
76 96
77 draw: { 97 draw: {
78 value: function() { 98 value: function() {
99 this.element.disabled = !this._enabled;
79 if(!this._valueSyncedWithInputField) 100 if(!this._valueSyncedWithInputField)
80 { 101 {
81 this.element.checked = this._checked; 102 this.element.checked = this._checked;
diff --git a/js/components/tools-properties/rect-properties.reel/rect-properties.js b/js/components/tools-properties/rect-properties.reel/rect-properties.js
index b4085eea..f023f4bb 100755
--- a/js/components/tools-properties/rect-properties.reel/rect-properties.js
+++ b/js/components/tools-properties/rect-properties.reel/rect-properties.js
@@ -33,9 +33,9 @@ exports.RectProperties = Montage.create(ToolProperties, {
33 this.TRRadiusControl.enabled = this.BLRadiusControl.enabled = this.BRRadiusControl.enabled = !this.lockButton.pressed; 33 this.TRRadiusControl.enabled = this.BLRadiusControl.enabled = this.BRRadiusControl.enabled = !this.lockButton.pressed;
34 34
35 if(this.lockButton.pressed) { 35 if(this.lockButton.pressed) {
36 this._removeBindings([this.TRRadiusControl, this.BLRadiusControl, this.BRRadiusControl]);
37 } else {
38 this._setBindings([this.TRRadiusControl, this.BLRadiusControl, this.BRRadiusControl]); 36 this._setBindings([this.TRRadiusControl, this.BLRadiusControl, this.BRRadiusControl]);
37 } else {
38 this._removeBindings([this.TRRadiusControl, this.BLRadiusControl, this.BRRadiusControl]);
39 } 39 }
40 40
41 } 41 }
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index b3ac9ddb..b060b751 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -105,6 +105,20 @@ exports.ShapesController = Montage.create(CanvasController, {
105 case "editFillMaterial": 105 case "editFillMaterial":
106 NJevent("showMaterialPopup",{materialId : el.elementModel.shapeModel.fillMaterial.getName()}); 106 NJevent("showMaterialPopup",{materialId : el.elementModel.shapeModel.fillMaterial.getName()});
107 break; 107 break;
108 case "animate":
109 if(value)
110 {
111 el.elementModel.shapeModel.animate = true;
112 el.elementModel.shapeModel.GLWorld._previewAnimation = true;
113 el.elementModel.shapeModel.GLWorld.restartRenderLoop();
114 }
115 else
116 {
117 el.elementModel.shapeModel.animate = false;
118 el.elementModel.shapeModel.GLWorld._previewAnimation = false;
119 el.elementModel.shapeModel.GLWorld._canvas.task.stop();
120 }
121 break;
108 default: 122 default:
109 CanvasController.setProperty(el, p, value); 123 CanvasController.setProperty(el, p, value);
110 } 124 }
@@ -123,6 +137,7 @@ exports.ShapesController = Montage.create(CanvasController, {
123 case "border": 137 case "border":
124 case "background": 138 case "background":
125 case "useWebGl": 139 case "useWebGl":
140 case "animate":
126 return this.getShapeProperty(el, p); 141 return this.getShapeProperty(el, p);
127 case "strokeMaterial": 142 case "strokeMaterial":
128 case "fillMaterial": 143 case "fillMaterial":
diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js
index 53fec3be..52360302 100755
--- a/js/data/pi/pi-data.js
+++ b/js/data/pi/pi-data.js
@@ -393,6 +393,17 @@ exports.PiData = Montage.create( Montage, {
393 ], 393 ],
394 [ 394 [
395 { 395 {
396 type: "checkbox",
397 id: "animate",
398 prop: "animate",
399 defaultValue: true,
400 value: "Animate",
401 checked: true,
402 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }
403 }
404 ],
405 [
406 {
396 type: "dropdown", 407 type: "dropdown",
397 id: "strokeMaterial", 408 id: "strokeMaterial",
398 prop: "strokeMaterial", 409 prop: "strokeMaterial",
@@ -486,6 +497,17 @@ exports.PiData = Montage.create( Montage, {
486 ], 497 ],
487 [ 498 [
488 { 499 {
500 type: "checkbox",
501 id: "animate",
502 prop: "animate",
503 defaultValue: true,
504 value: "Animate",
505 checked: true,
506 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }
507 }
508 ],
509 [
510 {
489 type: "dropdown", 511 type: "dropdown",
490 id: "strokeMaterial", 512 id: "strokeMaterial",
491 prop: "strokeMaterial", 513 prop: "strokeMaterial",
@@ -580,6 +602,17 @@ exports.PiData = Montage.create( Montage, {
580 ], 602 ],
581 [ 603 [
582 { 604 {
605 type: "checkbox",
606 id: "animate",
607 prop: "animate",
608 defaultValue: true,
609 value: "Animate",
610 checked: true,
611 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }
612 }
613 ],
614 [
615 {
583 type: "dropdown", 616 type: "dropdown",
584 id: "strokeMaterial", 617 id: "strokeMaterial",
585 prop: "strokeMaterial", 618 prop: "strokeMaterial",
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/models/shape-model.js b/js/models/shape-model.js
index 58a88fd0..ea8c2cfc 100755
--- a/js/models/shape-model.js
+++ b/js/models/shape-model.js
@@ -10,7 +10,8 @@ var Montage = require("montage/core/core").Montage,
10exports.ShapeModel = Montage.create(Component, { 10exports.ShapeModel = Montage.create(Component, {
11 11
12 shapeCount: { value: 0 }, 12 shapeCount: { value: 0 },
13 useWebGl: { value: false }, 13 useWebGl: { value: false },
14 animate: { value: true },
14 15
15 GLWorld: { value: null }, 16 GLWorld: { value: null },
16 GLGeomObj: { value: null }, 17 GLGeomObj: { value: null },
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js
index 2a6e49f7..c76c7d46 100755
--- a/js/ninja.reel/ninja.js
+++ b/js/ninja.reel/ninja.js
@@ -166,6 +166,27 @@ exports.Ninja = Montage.create(Component, {
166 this.currentDocument.documentRoot.elementModel.controller.setProperty(this.currentDocument.documentRoot, "overflow", overflow); 166 this.currentDocument.documentRoot.elementModel.controller.setProperty(this.currentDocument.documentRoot, "overflow", overflow);
167 this.currentDocument.documentRoot.elementModel.controller.changeSelector(this.currentDocument.documentRoot, "transitionStopRule", transitionStopRule); 167 this.currentDocument.documentRoot.elementModel.controller.changeSelector(this.currentDocument.documentRoot, "transitionStopRule", transitionStopRule);
168 168
169 this._toggleWebGlAnimation(this.appModel.livePreview);
170 }
171 },
172
173 // Turn on WebGL animation during preview
174 _toggleWebGlAnim