aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Materials/materials-popup.reel/materials-popup.js
diff options
context:
space:
mode:
authorhwc4872012-02-21 17:02:31 -0800
committerhwc4872012-02-21 17:02:31 -0800
commitf06f44ab3fcca109f126eae4f6fb915c5dd28791 (patch)
treec25fbfedf93c135be53f1e9238f7ddcf498612bc /js/panels/Materials/materials-popup.reel/materials-popup.js
parentbd7bc833895391e4974b8746f31f63ba70689df3 (diff)
parentd2f4d5e5f6742d53b6324d585a700566f73c992a (diff)
downloadninja-f06f44ab3fcca109f126eae4f6fb915c5dd28791.tar.gz
Merge branch 'WebGLMaterials' of github.com:mqg734/ninja-internal into integration
Diffstat (limited to 'js/panels/Materials/materials-popup.reel/materials-popup.js')
-rwxr-xr-xjs/panels/Materials/materials-popup.reel/materials-popup.js47
1 files changed, 16 insertions, 31 deletions
diff --git a/js/panels/Materials/materials-popup.reel/materials-popup.js b/js/panels/Materials/materials-popup.reel/materials-popup.js
index 62ca5395..508b8130 100755
--- a/js/panels/Materials/materials-popup.reel/materials-popup.js
+++ b/js/panels/Materials/materials-popup.reel/materials-popup.js
@@ -11,36 +11,13 @@ var Button = require("js/components/button.reel").Button;
11//////////////////////////////////////////////////////////////////////// 11////////////////////////////////////////////////////////////////////////
12//Exporting as MaterialsPopup 12//Exporting as MaterialsPopup
13exports.MaterialsPopup = Montage.create(Component, { 13exports.MaterialsPopup = Montage.create(Component, {
14 ////////////////////////////////////////////////////////////////////
15 okButton: {
16 enumerable: false,
17 value: null
18 },
19
20 cancelButton: {
21 enumerable: false,
22 value: null
23 },
24
25 //////////////////////////////////////////////////////////////////// 14 ////////////////////////////////////////////////////////////////////
26 // Material Properties 15 // Material Properties
27
28 materialsProperties: {
29 enumerable: true,
30 serializable: true,
31 value: null
32 },
33
34 _materialName: { 16 _materialName: {
35 enumerable: true, 17 enumerable: true,
36 value: "Material" 18 value: ""
37 }, 19 },
38 20
39 materialTitle: {
40 enumerable: true,
41 value: null
42 },
43
44 captureAction: { 21 captureAction: {
45 value:function(event) { 22 value:function(event) {
46 switch(event._currentTarget.label) 23 switch(event._currentTarget.label)
@@ -69,6 +46,9 @@ exports.MaterialsPopup = Montage.create(Component, {
69 } 46 }
70 break; 47 break;
71 } 48 }
49
50 // Notify Materials Library to close popup
51 NJevent("hideMaterialPopup");
72 } 52 }
73 }, 53 },
74 54
@@ -235,12 +215,12 @@ exports.MaterialsPopup = Montage.create(Component, {
235 value: function(materialID) 215 value: function(materialID)
236 { 216 {
237 this._materialName = materialID; 217 this._materialName = materialID;
238 if( 218 if(
239 (materialID === "UberMaterial") || 219 (materialID === "UberMaterial") ||
240 (materialID === "FlatMaterial") || 220 (materialID === "FlatMaterial") ||
241 (materialID === "BumpMetalMaterial") || 221 (materialID === "BumpMetalMaterial") ||
242 (materialID === "LinearGradientMaterial") || 222 (materialID === "LinearGradientMaterial") ||
243 (materialID === "RadialGradientMaterial") 223 (materialID === "RadialGradientMaterial")
244 ) 224 )
245 { 225 {
246 var material = MaterialsLibrary.getMaterial( materialID ); 226 var material = MaterialsLibrary.getMaterial( materialID );
@@ -323,6 +303,8 @@ exports.MaterialsPopup = Montage.create(Component, {
323 { 303 {
324 value: function( label, color ) 304 value: function( label, color )
325 { 305 {
306 var css = 'rgba(' + color[0]*255 + ',' + color[1]*255 + ',' + color[2]*255 + ',' + color[3] + ')';
307 var colorObj = this.application.ninja.colorController.getColorObjFromCss(css)
326 var obj = 308 var obj =
327 { 309 {
328 "label": label, 310 "label": label,
@@ -330,7 +312,7 @@ exports.MaterialsPopup = Montage.create(Component, {
330 "controlType": "ColorChip", 312 "controlType": "ColorChip",
331 "defaults": 313 "defaults":
332 { 314 {
333 "color": { r:color[0]*255, g:color[1]*255, b:color[2]*255, a:color[3] } 315 "color": colorObj
334 } 316 }
335 }; 317 };
336 318
@@ -644,7 +626,7 @@ exports.MaterialsPopup = Montage.create(Component, {
644 _materialsData: { 626 _materialsData: {
645 enumerable: true, 627 enumerable: true,
646 serializable: true, 628 serializable: true,
647 value: this._dummyData1 629 value: []
648 630
649 }, 631 },
650 632
@@ -656,7 +638,10 @@ exports.MaterialsPopup = Montage.create(Component, {
656 }, 638 },
657 set: function(data) { 639 set: function(data) {
658 this._materialsData = data; 640 this._materialsData = data;
659 this.materialsProperties.needsDraw = true; 641 if(this.materialsProperties)
642 {
643 this.materialsProperties.needsDraw = true;
644 }
660 } 645 }
661 } 646 }
662 647