diff options
author | Valerio Virgillito | 2012-03-20 13:38:42 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-03-20 13:38:42 -0700 |
commit | 9facfb41b0b0f9fab9ddc9c8473af1d1d7e1ff18 (patch) | |
tree | b6c35ce69c667f3ee8c16cc5e9a86021a4646288 | |
parent | afe4b3d6567a35586e970682d71cba61c416e496 (diff) | |
parent | 634358d2697d9668bb9406ac7a029aafae542285 (diff) | |
download | ninja-9facfb41b0b0f9fab9ddc9c8473af1d1d7e1ff18.tar.gz |
Merge pull request #129 from mqg734/WebGLMaterials
Added Montage button as a valid PI control and used it to invoke the edit material popup.
-rwxr-xr-x | js/controllers/elements/element-controller.js | 16 | ||||
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 13 | ||||
-rwxr-xr-x | js/controllers/elements/stage-controller.js | 41 | ||||
-rwxr-xr-x | js/data/pi/pi-data.js | 35 | ||||
-rwxr-xr-x | js/helper-classes/3D/draw-utils.js | 4 | ||||
-rwxr-xr-x | js/panels/Materials/Materials.xml | 14 | ||||
-rw-r--r-- | js/panels/Materials/materials-data.json | 43 | ||||
-rwxr-xr-x | js/panels/Materials/materials-library-panel.reel/materials-library-panel.html | 43 | ||||
-rwxr-xr-x | js/panels/Materials/materials-library-panel.reel/materials-library-panel.js | 66 | ||||
-rwxr-xr-x | js/panels/Materials/materials-popup.reel/materials-popup.js | 6 | ||||
-rwxr-xr-x | js/panels/properties.reel/sections/custom-rows/dual-row.reel/dual-row.js | 8 | ||||
-rwxr-xr-x | js/panels/properties.reel/sections/custom.reel/custom.js | 44 |
12 files changed, 247 insertions, 86 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 70aba54e..b35251ad 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -228,22 +228,6 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, | |||
228 | mat = this.transformStringToMat( xformStr ); | 228 | mat = this.transformStringToMat( xformStr ); |
229 | if (!mat) | 229 | if (!mat) |
230 | mat = Matrix.I(4); | 230 | mat = Matrix.I(4); |
231 | |||
232 | var zoom = this.application.ninja.elementMediator.getProperty(el, "zoom"); | ||
233 | if (zoom) | ||
234 | { | ||
235 | zoom = Number(zoom); | ||
236 | if (zoom != 1) | ||
237 | { | ||
238 | var zoomMat = Matrix.create( [ | ||
239 | [ zoom, 0, 0, 0], | ||
240 | [ 0, zoom, 0, 0], | ||
241 | [ 0, 0, zoom, 0], | ||
242 | [ 0, 0, 0, 1] | ||
243 | ] ); | ||
244 | glmat4.multiply( zoomMat, mat, mat ); | ||
245 | } | ||
246 | } | ||
247 | } | 231 | } |
248 | 232 | ||
249 | el.elementModel.props3D.matrix3d = mat; | 233 | el.elementModel.props3D.matrix3d = mat; |
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index d72d9c14..b3ac9ddb 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -6,10 +6,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
6 | 6 | ||
7 | var Montage = require("montage/core/core").Montage, | 7 | var Montage = require("montage/core/core").Montage, |
8 | CanvasController = require("js/controllers/elements/canvas-controller").CanvasController, | 8 | CanvasController = require("js/controllers/elements/canvas-controller").CanvasController, |
9 | njModule = require("js/lib/NJUtils"); | 9 | njModule = require("js/lib/NJUtils"), |
10 | 10 | World = require("js/lib/drawing/world").World, | |
11 | var World = require("js/lib/drawing/world").World; | 11 | MaterialsModel = require("js/models/materials-model").MaterialsModel; |
12 | var MaterialsModel = require("js/models/materials-model").MaterialsModel; | ||
13 | 12 | ||
14 | exports.ShapesController = Montage.create(CanvasController, { | 13 | exports.ShapesController = Montage.create(CanvasController, { |
15 | 14 | ||
@@ -100,6 +99,12 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
100 | el.elementModel.shapeModel.GLWorld.render(); | 99 | el.elementModel.shapeModel.GLWorld.render(); |
101 | } | 100 | } |
102 | break; | 101 | break; |
102 | case "editStrokeMaterial": | ||
103 | NJevent("showMaterialPopup",{materialId : el.elementModel.shapeModel.strokeMaterial.getName()}); | ||
104 | break; | ||
105 | case "editFillMaterial": | ||
106 | NJevent("showMaterialPopup",{materialId : el.elementModel.shapeModel.fillMaterial.getName()}); | ||
107 | break; | ||
103 | default: | 108 | default: |
104 | CanvasController.setProperty(el, p, value); | 109 | CanvasController.setProperty(el, p, value); |
105 | } | 110 | } |
diff --git a/js/controllers/elements/stage-controller.js b/js/controllers/elements/stage-controller.js index 34bb1fb5..97ea3aa5 100755 --- a/js/controllers/elements/stage-controller.js +++ b/js/controllers/elements/stage-controller.js | |||
@@ -129,5 +129,46 @@ exports.StageController = Montage.create(ElementController, { | |||
129 | value: function(el, rule, selector) { | 129 | value: function(el, rule, selector) { |
130 | el.elementModel.transitionStopRule.selectorText = selector; | 130 | el.elementModel.transitionStopRule.selectorText = selector; |
131 | } | 131 | } |
132 | }, | ||
133 | |||
134 | getMatrix: { | ||
135 | value: function(el) { | ||
136 | if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.matrix3d) | ||
137 | { | ||
138 | return el.elementModel.props3D.matrix3d.slice(0); | ||
139 | } | ||
140 | else | ||
141 | { | ||
142 | var mat; | ||
143 | |||
144 | if (el) | ||
145 | { | ||
146 | var xformStr = this.application.ninja.elementMediator.getProperty(el, "-webkit-transform"); | ||
147 | if (xformStr) | ||
148 | mat = this.transformStringToMat( xformStr ); | ||
149 | if (!mat) | ||
150 | mat = Matrix.I(4); | ||
151 | |||
152 | var zoom = this.application.ninja.elementMediator.getProperty(el, "zoom"); | ||
153 | if (zoom) | ||
154 | { | ||
155 | zoom = Number(zoom); | ||
156 | if (zoom != 1) | ||
157 | { | ||
158 | var zoomMat = Matrix.create( [ | ||
159 | [ zoom, 0, 0, 0], | ||
160 | [ 0, zoom, 0, 0], | ||
161 | [ 0, 0, zoom, 0], | ||
162 | [ 0, 0, 0, 1] | ||
163 | ] ); | ||
164 | glmat4.multiply( zoomMat, mat, mat ); | ||
165 | } | ||
166 | } | ||
167 | } | ||
168 | |||
169 | el.elementModel.props3D.matrix3d = mat; | ||
170 | return mat; | ||
171 | } | ||
172 | } | ||
132 | } | 173 | } |
133 | }); | 174 | }); |
diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js index ba03c347..53fec3be 100755 --- a/js/data/pi/pi-data.js +++ b/js/data/pi/pi-data.js | |||
@@ -402,6 +402,13 @@ exports.PiData = Montage.create( Montage, { | |||
402 | items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, | 402 | items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, |
403 | enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }, | 403 | enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }, |
404 | divider : true | 404 | divider : true |
405 | }, | ||
406 | { | ||
407 | type: "button", | ||
408 | id: "editStrokeMaterial", | ||
409 | prop: "editStrokeMaterial", | ||
410 | label: "Edit", | ||
411 | enabled: { boundObject: "this.controls", boundProperty: "useWebGl" } | ||
405 | } | 412 | } |
406 | ], | 413 | ], |
407 | [ | 414 | [ |
@@ -414,6 +421,13 @@ exports.PiData = Montage.create( Montage, { | |||
414 | dataField: "_name", | 421 | dataField: "_name", |
415 | items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, | 422 | items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, |
416 | enabled: { boundObject: "this.controls", boundProperty: "useWebGl" } | 423 | enabled: { boundObject: "this.controls", boundProperty: "useWebGl" } |
424 | }, | ||
425 | { | ||
426 | type: "button", | ||
427 | id: "editFillMaterial", | ||
428 | prop: "editFillMaterial", | ||
429 | label: "Edit", | ||
430 | enabled: { boundObject: "this.controls", boundProperty: "useWebGl" } | ||
417 | } | 431 | } |
418 | ] | 432 | ] |
419 | ] | 433 | ] |
@@ -481,6 +495,13 @@ exports.PiData = Montage.create( Montage, { | |||
481 | items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, | 495 | items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, |
482 | enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }, | 496 | enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }, |
483 | divider : true | 497 | divider : true |
498 | }, | ||
499 | { | ||
500 | type: "button", | ||
501 | id: "editStrokeMaterial", | ||
502 | prop: "editStrokeMaterial", | ||
503 | label: "Edit", | ||
504 | enabled: { boundObject: "this.controls", boundProperty: "useWebGl" } | ||
484 | } | 505 | } |
485 | ] | 506 | ] |
486 | ] | 507 | ] |
@@ -568,6 +589,13 @@ exports.PiData = Montage.create( Montage, { | |||
568 | items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, | 589 | items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, |
569 | enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }, | 590 | enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }, |
570 | divider : true | 591 | divider : true |
592 | }, | ||
593 | { | ||
594 | type: "button", | ||
595 | id: "editStrokeMaterial", | ||
596 | prop: "editStrokeMaterial", | ||
597 | label: "Edit", | ||
598 | enabled: { boundObject: "this.controls", boundProperty: "useWebGl" } | ||
571 | } | 599 | } |
572 | ], | 600 | ], |
573 | [ | 601 | [ |
@@ -580,6 +608,13 @@ exports.PiData = Montage.create( Montage, { | |||
580 | dataField: "_name", | 608 | dataField: "_name", |
581 | items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, | 609 | items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, |
582 | enabled: { boundObject: "this.controls", boundProperty: "useWebGl" } | 610 | enabled: { boundObject: "this.controls", boundProperty: "useWebGl" } |
611 | }, | ||
612 | { | ||
613 | type: "button", | ||
614 | id: "editFillMaterial", | ||
615 | prop: "editFillMaterial", | ||
616 | label: "Edit", | ||
617 | enabled: { boundObject: "this.controls", boundProperty: "useWebGl" } | ||
583 | } | 618 | } |
584 | ] | 619 | ] |
585 | ] | 620 | ] |
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 1c00f7ea..d6334e6c 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js | |||
@@ -139,8 +139,8 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
139 | handleCloseDocument:{ | 139 | handleCloseDocument:{ |
140 | value: function() { | 140 | value: function() { |
141 | if(this.application.ninja.documentController._documents.length === 0){ |