aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Materials/materials-popup.reel/materials-popup.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Materials/materials-popup.reel/materials-popup.js')
-rwxr-xr-x[-rw-r--r--]js/panels/Materials/materials-popup.reel/materials-popup.js59
1 files changed, 17 insertions, 42 deletions
diff --git a/js/panels/Materials/materials-popup.reel/materials-popup.js b/js/panels/Materials/materials-popup.reel/materials-popup.js
index afdc3628..508b8130 100644..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,22 +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 === "BrickMaterial") || 219 (materialID === "UberMaterial") ||
240 (materialID === "UberMaterial") ||
241 (materialID === "FlatMaterial") || 220 (materialID === "FlatMaterial") ||
242 (materialID === "BumpMetalMaterial") || 221 (materialID === "BumpMetalMaterial") ||
243 (materialID === "PlasmaMaterial") || 222 (materialID === "LinearGradientMaterial") ||
244 (materialID === "LinearGradientMaterial") || 223 (materialID === "RadialGradientMaterial")
245 (materialID === "RadialGradientMaterial") ||
246 (materialID === "RadialBlurMaterial") ||
247 (materialID === "PulseMaterial") ||
248 (materialID === "TunnelMaterial") ||
249 (materialID === "TwistMaterial") ||
250 (materialID === "KeleidoscopeMaterial") ||
251 (materialID === "JuliaMaterial") ||
252 (materialID === "MandelMaterial") ||
253 (materialID === "IridescentScalesMaterial")
254 ) 224 )
255 { 225 {
256 var material = MaterialsLibrary.getMaterial( materialID ); 226 var material = MaterialsLibrary.getMaterial( materialID );
@@ -333,6 +303,8 @@ exports.MaterialsPopup = Montage.create(Component, {
333 { 303 {
334 value: function( label, color ) 304 value: function( label, color )
335 { 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)
336 var obj = 308 var obj =
337 { 309 {
338 "label": label, 310 "label": label,
@@ -340,7 +312,7 @@ exports.MaterialsPopup = Montage.create(Component, {
340 "controlType": "ColorChip", 312 "controlType": "ColorChip",
341 "defaults": 313 "defaults":
342 { 314 {
343 "color": { r:color[0]*255, g:color[1]*255, b:color[2]*255, a:color[3] } 315 "color": colorObj
344 } 316 }
345 }; 317 };
346 318
@@ -654,7 +626,7 @@ exports.MaterialsPopup = Montage.create(Component, {
654 _materialsData: { 626 _materialsData: {
655 enumerable: true, 627 enumerable: true,
656 serializable: true, 628 serializable: true,
657 value: this._dummyData1 629 value: []
658 630
659 }, 631 },
660 632
@@ -666,7 +638,10 @@ exports.MaterialsPopup = Montage.create(Component, {
666 }, 638 },
667 set: function(data) { 639 set: function(data) {
668 this._materialsData = data; 640 this._materialsData = data;
669 this.materialsProperties.needsDraw = true; 641 if(this.materialsProperties)
642 {
643 this.materialsProperties.needsDraw = true;
644 }
670 } 645 }
671 } 646 }
672 647