aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-02-07 11:42:10 -0800
committerNivesh Rajbhandari2012-02-07 11:42:10 -0800
commit8ad767b61460984a4031ba630f76ac8247a61857 (patch)
tree67c178dfa5e88f95a95af419f8e2ce6a72127b80 /js
parent486842239c71e7964f38a09aacda4970f2a82e1a (diff)
downloadninja-8ad767b61460984a4031ba630f76ac8247a61857.tar.gz
Fixed PI to support WebGL materials.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js')
-rw-r--r--js/components/combobox.reel/combobox.js4
-rw-r--r--js/controllers/elements/shapes-controller.js23
-rw-r--r--js/data/pi/pi-data.js5
-rw-r--r--js/panels/properties/sections/custom.reel/custom.js2
4 files changed, 30 insertions, 4 deletions
diff --git a/js/components/combobox.reel/combobox.js b/js/components/combobox.reel/combobox.js
index 8906a649..ebbfbffa 100644
--- a/js/components/combobox.reel/combobox.js
+++ b/js/components/combobox.reel/combobox.js
@@ -15,7 +15,7 @@ exports.Combobox = Montage.create(Component, {
15 }, 15 },
16 16
17 _wasSetByCode: { 17 _wasSetByCode: {
18 enumerable: false, 18 enumerable: true,
19 value: true 19 value: true
20 }, 20 },
21 21
@@ -79,7 +79,7 @@ exports.Combobox = Montage.create(Component, {
79 e.value = this._value; 79 e.value = this._value;
80 this.dispatchEvent(e); 80 this.dispatchEvent(e);
81 81
82 this._wasSetByCode = false; 82 this._wasSetByCode = true;
83 } 83 }
84 } 84 }
85 }, 85 },
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 3f1ccc3d..21373aca 100644
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -68,6 +68,24 @@ exports.ShapesController = Montage.create(CanvasController, {
68 this.toggleWebGlMode(el, value); 68 this.toggleWebGlMode(el, value);
69 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 69 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
70 break; 70 break;
71 case "strokeMaterial":
72 var sm = Object.create(MaterialsLibrary.getMaterial(value));
73 if(sm)
74 {
75 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm);
76 el.elementModel.shapeModel.strokeMaterial = sm;
77 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
78 }
79 break;
80 case "fillMaterial":
81 var fm = Object.create(MaterialsLibrary.getMaterial(value));
82 if(fm)
83 {
84 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm);
85 el.elementModel.shapeModel.strokeMaterial = fm;
86 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
87 }
88 break;
71 default: 89 default:
72 CanvasController.setProperty(el, p, value); 90 CanvasController.setProperty(el, p, value);
73 } 91 }
@@ -84,12 +102,13 @@ exports.ShapesController = Montage.create(CanvasController, {
84 case "trRadius": 102 case "trRadius":
85 case "blRadius": 103 case "blRadius":
86 case "brRadius": 104 case "brRadius":
87 case "strokeMaterial":
88 case "fillMaterial":
89 case "border": 105 case "border":
90 case "background": 106 case "background":
91 case "useWebGl": 107 case "useWebGl":
92 return this.getShapeProperty(el, p); 108 return this.getShapeProperty(el, p);
109 case "strokeMaterial":
110 case "fillMaterial":
111 return this.getShapeProperty(el, p).getName();
93 default: 112 default:
94 return CanvasController.getProperty(el, p); 113 return CanvasController.getProperty(el, p);
95 } 114 }
diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js
index de192b57..10b33a0e 100644
--- a/js/data/pi/pi-data.js
+++ b/js/data/pi/pi-data.js
@@ -384,6 +384,7 @@ exports.PiData = Montage.create( Montage, {
384 prop: "strokeMaterial", 384 prop: "strokeMaterial",
385 label: "Stroke", 385 label: "Stroke",
386 labelField: "_name", 386 labelField: "_name",
387 dataField: "_name",
387 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, 388 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" },
388 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }, 389 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" },
389 divider : true 390 divider : true
@@ -396,6 +397,7 @@ exports.PiData = Montage.create( Montage, {
396 prop: "fillMaterial", 397 prop: "fillMaterial",
397 label: "Fill", 398 label: "Fill",
398 labelField: "_name", 399 labelField: "_name",
400 dataField: "_name",
399 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, 401 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" },
400 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" } 402 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }
401 } 403 }
@@ -460,6 +462,7 @@ exports.PiData = Montage.create( Montage, {
460 id: "stroke", 462 id: "stroke",
461 label: "Stroke", 463 label: "Stroke",
462 labelField: "_name", 464 labelField: "_name",
465 dataField: "_name",
463 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, 466 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" },
464 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" } 467 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }
465 } 468 }
@@ -545,6 +548,7 @@ exports.PiData = Montage.create( Montage, {
545 prop: "strokeMaterial", 548 prop: "strokeMaterial",
546 label: "Stroke", 549 label: "Stroke",
547 labelField: "_name", 550 labelField: "_name",
551 dataField: "_name",
548 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, 552 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" },
549 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }, 553 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" },
550 divider : true 554 divider : true
@@ -557,6 +561,7 @@ exports.PiData = Montage.create( Montage, {
557 prop: "fillMaterial", 561 prop: "fillMaterial",
558 label: "Fill", 562 label: "Fill",
559 labelField: "_name", 563 labelField: "_name",
564 dataField: "_name",
560 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, 565 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" },
561 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" } 566 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }
562 } 567 }
diff --git a/js/panels/properties/sections/custom.reel/custom.js b/js/panels/properties/sections/custom.reel/custom.js
index e92a39fd..992db8e6 100644
--- a/js/panels/properties/sections/custom.reel/custom.js
+++ b/js/panels/properties/sections/custom.reel/custom.js
@@ -186,6 +186,8 @@ exports.CustomSection = Montage.create(Component, {
186 if (aField.value) obj.value = aField.value; 186 if (aField.value) obj.value = aField.value;
187 if (aField.labelField) obj.labelField = aField.labelField; 187 if (aField.labelField) obj.labelField = aField.labelField;
188 if (aField.labelFunction) obj.labelFunction = aField.labelFunction; 188 if (aField.labelFunction) obj.labelFunction = aField.labelFunction;
189 if (aField.dataField) obj.dataField = aField.dataField;
190 if (aField.dataFunction) obj.dataFunction = aField.dataFunction;
189 if (aField.items) { 191 if (aField.items) {
190 if(aField.items.boundObject) { 192 if(aField.items.boundObject) {
191 obj.items = eval(aField.items.boundObject)[aField.items.boundProperty]; 193 obj.items = eval(aField.items.boundObject)[aField.items.boundProperty];