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-xjs/panels/Materials/materials-popup.reel/materials-popup.js80
1 files changed, 49 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 9220659e..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 ");
@@ -214,47 +215,64 @@ exports.MaterialsPopup = Montage.create(Component, {
214 loadMaterials: 215 loadMaterials:
215 { 216 {
216 enumerable: true, 217 enumerable: true,
217 value: function(materialID) 218 value: function(materialID, useSelection, whichMaterial)
218 { 219 {
219 //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.
220 this.materialsData = []; 221 this.materialsData = [];
221 222
223 var material;
222 this._materialName = materialID; 224 this._materialName = materialID;
223 if( 225 if (useSelection)
224 (materialID === "BumpMetalMaterial") ||
225 (materialID === "DeformMaterial") ||
226 (materialID === "FlatMaterial") ||
227 (materialID === "FlagMaterial") ||
228 (materialID === "FlyMaterial") ||
229 (materialID === "JuliaMaterial") ||
230 (materialID === "KeleidoscopeMaterial") ||
231 (materialID === "LinearGradientMaterial") ||
232 (materialID === "MandelMaterial") ||
233 (materialID === "PlasmaMaterial") ||
234 (materialID === "PulseMaterial") ||
235 (materialID === "RadialBlurMaterial") ||
236 (materialID === "RadialGradientMaterial") ||
237 (materialID === "ReliefTunnelMaterial") ||
238 (materialID === "SquareTunnelMaterial") ||
239 (materialID === "StarMaterial") ||
240 (materialID === "TaperMaterial") ||
241 (materialID === "TunnelMaterial") ||
242 (materialID === "TwistMaterial") ||
243 (materialID === "TwistVertMaterial") ||
244 (materialID === "UberMaterial") ||
245 (materialID === "WaterMaterial") ||
246 (materialID === "ZInvertMaterial")
247 )
248 { 226 {
249 var material = MaterialsModel.getMaterial( materialID ); 227 var selection = this.application.ninja.selectedElements;
250 if (material) 228 if (selection && (selection.length > 0))
251 { 229 {
252 this._material = material; 230 var canvas = selection[0];
253 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();
254 } 235 }
255 } 236 }
256 else 237 else
257 { 238 {
239 if(
240 (materialID === "BumpMetalMaterial") ||
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 {
258 this.materialsData = this[materialID]; 276 this.materialsData = this[materialID];
259 } 277 }
260 this.needsDraw = true; 278 this.needsDraw = true;