aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Materials/materials-popup.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Materials/materials-popup.reel')
-rwxr-xr-xjs/panels/Materials/materials-popup.reel/materials-popup.js86
1 files changed, 62 insertions, 24 deletions
diff --git a/js/panels/Materials/materials-popup.reel/materials-popup.js b/js/panels/Materials/materials-popup.reel/materials-popup.js
index bd10f7a5..5a711455 100755
--- a/js/panels/Materials/materials-popup.reel/materials-popup.js
+++ b/js/panels/Materials/materials-popup.reel/materials-popup.js
@@ -88,8 +88,9 @@ exports.MaterialsPopup = Montage.create(Component, {
88 88
89 _handlePropertyChange: 89 _handlePropertyChange:
90 { 90 {
91 value: function(event) 91 value: function(theEvent)
92 { 92 {
93 var event = theEvent._event;
93 if(typeof event.propertyValue === "object") 94 if(typeof event.propertyValue === "object")
94 { 95 {
95 console.log(event.propertyLabel + " changed to "); 96 console.log(event.propertyLabel + " changed to ");
@@ -164,8 +165,10 @@ exports.MaterialsPopup = Montage.create(Component, {
164 var index = value.lastIndexOf( "/" ); 165 var index = value.lastIndexOf( "/" );
165 if (index < 0) index = value.lastIndexOf( "\\" ); 166 if (index < 0) index = value.lastIndexOf( "\\" );
166 if (index >= 0) 167 if (index >= 0)
168 {
167 value = value.substr( index+1 ); 169 value = value.substr( index+1 );
168 value = "assets\\images\\" + value; 170 value = "assets\\images\\" + value;
171 }
169 rtnValue = value.slice(0); 172 rtnValue = value.slice(0);
170 } 173 }
171 break; 174 break;
@@ -212,32 +215,67 @@ exports.MaterialsPopup = Montage.create(Component, {
212 loadMaterials: 215 loadMaterials:
213 { 216 {
214 enumerable: true, 217 enumerable: true,
215 value: function(materialID) 218 value: function(materialID, useSelection, whichMaterial)
216 { 219 {
217 //TODO - Hack to force repetition to draw. Setting .length = 0 did not work. 220 //TODO - Hack to force repetition to draw. Setting .length = 0 did not work.
218 this.materialsData = []; 221 this.materialsData = [];
219 222
220 this._materialName = materialID; 223 var material;
221 if( 224 this._materialName = materialID;
222 (materialID === "UberMaterial") || 225 if (useSelection)
223 (materialID === "FlatMaterial") ||
224 (materialID === "BumpMetalMaterial") ||
225 (materialID === "LinearGradientMaterial") ||
226 (materialID === "RadialGradientMaterial")
227 )
228 { 226 {
229 var material = MaterialsModel.getMaterial( materialID ); 227 var selection = this.application.ninja.selectedElements;
230 if (material) 228 if (selection && (selection.length > 0))
231 { 229 {
232 this._material = material; 230 var canvas = selection[0];
233 this.materialsData = this.getMaterialData( material ); 231 var obj;
232 if (canvas.elementModel && canvas.elementModel.shapeModel) obj = canvas.elementModel.shapeModel.GLGeomObj;
233 if (obj)
234 material = (whichMaterial === 'stroke') ? obj.getStrokeMaterial() : obj.getFillMaterial();
234 } 235 }
235 } 236 }
236 else 237 else
237 { 238 {
238 this.materialsData = this[materialID]; 239 if(
239 } 240 (materialID === "BumpMetalMaterial") ||
240 this.needsDraw = true; 241 (materialID === "DeformMaterial") ||
242 (materialID === "FlatMaterial") ||
243 (materialID === "FlagMaterial") ||
244 (materialID === "FlyMaterial") ||
245 (materialID === "JuliaMaterial") ||
246 (materialID === "KeleidoscopeMaterial") ||
247 (materialID === "LinearGradientMaterial") ||
248 (materialID === "MandelMaterial") ||
249 (materialID === "PlasmaMaterial") ||
250 (materialID === "PulseMaterial") ||
251 (materialID === "RadialBlurMaterial") ||
252 (materialID === "RadialGradientMaterial") ||
253 (materialID === "ReliefTunnelMaterial") ||
254 (materialID === "SquareTunnelMaterial") ||
255 (materialID === "StarMaterial") ||
256 (materialID === "TaperMaterial") ||
257 (materialID === "TunnelMaterial") ||
258 (materialID === "TwistMaterial") ||
259 (materialID === "TwistVertMaterial") ||
260 (materialID === "UberMaterial") ||
261 (materialID === "WaterMaterial") ||
262 (materialID === "ZInvertMaterial")
263 )
264 {
265 material = MaterialsModel.getMaterial( materialID );
266 }
267 }
268
269 if (material)
270 {
271 this._material = material;
272 this.materialsData = this.getMaterialData( material );
273 }
274 else
275 {
276 this.materialsData = this[materialID];
277 }
278 this.needsDraw = true;
241 } 279 }
242 }, 280 },
243 281