From 5a1965bf2ed9a54601ca16fd67555335c510ce08 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Thu, 26 Apr 2012 16:40:05 -0700 Subject: Update materials to the new texture model. Create local world for deleted source canvases --- .../materials-popup.reel/materials-popup.js | 56 +++++++++++++++------- 1 file changed, 38 insertions(+), 18 deletions(-) (limited to 'js/panels/Materials/materials-popup.reel') diff --git a/js/panels/Materials/materials-popup.reel/materials-popup.js b/js/panels/Materials/materials-popup.reel/materials-popup.js index bd10f7a5..9220659e 100755 --- a/js/panels/Materials/materials-popup.reel/materials-popup.js +++ b/js/panels/Materials/materials-popup.reel/materials-popup.js @@ -164,8 +164,10 @@ exports.MaterialsPopup = Montage.create(Component, { var index = value.lastIndexOf( "/" ); if (index < 0) index = value.lastIndexOf( "\\" ); if (index >= 0) + { value = value.substr( index+1 ); - value = "assets\\images\\" + value; + value = "assets\\images\\" + value; + } rtnValue = value.slice(0); } break; @@ -214,30 +216,48 @@ exports.MaterialsPopup = Montage.create(Component, { enumerable: true, value: function(materialID) { - //TODO - Hack to force repetition to draw. Setting .length = 0 did not work. - this.materialsData = []; - - this._materialName = materialID; - if( - (materialID === "UberMaterial") || - (materialID === "FlatMaterial") || - (materialID === "BumpMetalMaterial") || - (materialID === "LinearGradientMaterial") || - (materialID === "RadialGradientMaterial") + //TODO - Hack to force repetition to draw. Setting .length = 0 did not work. + this.materialsData = []; + + this._materialName = materialID; + if( + (materialID === "BumpMetalMaterial") || + (materialID === "DeformMaterial") || + (materialID === "FlatMaterial") || + (materialID === "FlagMaterial") || + (materialID === "FlyMaterial") || + (materialID === "JuliaMaterial") || + (materialID === "KeleidoscopeMaterial") || + (materialID === "LinearGradientMaterial") || + (materialID === "MandelMaterial") || + (materialID === "PlasmaMaterial") || + (materialID === "PulseMaterial") || + (materialID === "RadialBlurMaterial") || + (materialID === "RadialGradientMaterial") || + (materialID === "ReliefTunnelMaterial") || + (materialID === "SquareTunnelMaterial") || + (materialID === "StarMaterial") || + (materialID === "TaperMaterial") || + (materialID === "TunnelMaterial") || + (materialID === "TwistMaterial") || + (materialID === "TwistVertMaterial") || + (materialID === "UberMaterial") || + (materialID === "WaterMaterial") || + (materialID === "ZInvertMaterial") ) { var material = MaterialsModel.getMaterial( materialID ); if (material) { this._material = material; - this.materialsData = this.getMaterialData( material ); + this.materialsData = this.getMaterialData( material ); } - } - else - { - this.materialsData = this[materialID]; - } - this.needsDraw = true; + } + else + { + this.materialsData = this[materialID]; + } + this.needsDraw = true; } }, -- cgit v1.2.3 From 8eac5582b72115969a9f915f4303535c22018033 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 2 May 2012 17:00:12 -0700 Subject: Material editor --- .../materials-popup.reel/materials-popup.js | 80 +++++++++++++--------- 1 file changed, 49 insertions(+), 31 deletions(-) (limited to 'js/panels/Materials/materials-popup.reel') 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, { _handlePropertyChange: { - value: function(event) + value: function(theEvent) { + var event = theEvent._event; if(typeof event.propertyValue === "object") { console.log(event.propertyLabel + " changed to "); @@ -214,46 +215,63 @@ exports.MaterialsPopup = Montage.create(Component, { loadMaterials: { enumerable: true, - value: function(materialID) + value: function(materialID, useSelection, whichMaterial) { //TODO - Hack to force repetition to draw. Setting .length = 0 did not work. this.materialsData = []; + var material; this._materialName = materialID; - if( - (materialID === "BumpMetalMaterial") || - (materialID === "DeformMaterial") || - (materialID === "FlatMaterial") || - (materialID === "FlagMaterial") || - (materialID === "FlyMaterial") || - (materialID === "JuliaMaterial") || - (materialID === "KeleidoscopeMaterial") || - (materialID === "LinearGradientMaterial") || - (materialID === "MandelMaterial") || - (materialID === "PlasmaMaterial") || - (materialID === "PulseMaterial") || - (materialID === "RadialBlurMaterial") || - (materialID === "RadialGradientMaterial") || - (materialID === "ReliefTunnelMaterial") || - (materialID === "SquareTunnelMaterial") || - (materialID === "StarMaterial") || - (materialID === "TaperMaterial") || - (materialID === "TunnelMaterial") || - (materialID === "TwistMaterial") || - (materialID === "TwistVertMaterial") || - (materialID === "UberMaterial") || - (materialID === "WaterMaterial") || - (materialID === "ZInvertMaterial") - ) + if (useSelection) { - var material = MaterialsModel.getMaterial( materialID ); - if (material) + var selection = this.application.ninja.selectedElements; + if (selection && (selection.length > 0)) { - this._material = material; - this.materialsData = this.getMaterialData( material ); + var canvas = selection[0]; + var obj; + if (canvas.elementModel && canvas.elementModel.shapeModel) obj = canvas.elementModel.shapeModel.GLGeomObj; + if (obj) + material = (whichMaterial === 'stroke') ? obj.getStrokeMaterial() : obj.getFillMaterial(); } } else + { + if( + (materialID === "BumpMetalMaterial") || + (materialID === "DeformMaterial") || + (materialID === "FlatMaterial") || + (materialID === "FlagMaterial") || + (materialID === "FlyMaterial") || + (materialID === "JuliaMaterial") || + (materialID === "KeleidoscopeMaterial") || + (materialID === "LinearGradientMaterial") || + (materialID === "MandelMaterial") || + (materialID === "PlasmaMaterial") || + (materialID === "PulseMaterial") || + (materialID === "RadialBlurMaterial") || + (materialID === "RadialGradientMaterial") || + (materialID === "ReliefTunnelMaterial") || + (materialID === "SquareTunnelMaterial") || + (materialID === "StarMaterial") || + (materialID === "TaperMaterial") || + (materialID === "TunnelMaterial") || + (materialID === "TwistMaterial") || + (materialID === "TwistVertMaterial") || + (materialID === "UberMaterial") || + (materialID === "WaterMaterial") || + (materialID === "ZInvertMaterial") + ) + { + material = MaterialsModel.getMaterial( materialID ); + } + } + + if (material) + { + this._material = material; + this.materialsData = this.getMaterialData( material ); + } + else { this.materialsData = this[materialID]; } -- cgit v1.2.3 From 1e649405d66f17d6acddb9055b181bba7ad70566 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 16 May 2012 13:41:48 -0700 Subject: Exposing parameters in Water Material --- js/panels/Materials/materials-popup.reel/materials-popup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/panels/Materials/materials-popup.reel') diff --git a/js/panels/Materials/materials-popup.reel/materials-popup.js b/js/panels/Materials/materials-popup.reel/materials-popup.js index 5a711455..c54b311e 100755 --- a/js/panels/Materials/materials-popup.reel/materials-popup.js +++ b/js/panels/Materials/materials-popup.reel/materials-popup.js @@ -371,7 +371,7 @@ exports.MaterialsPopup = Montage.create(Component, { "defaults": { "minValue": 0, - "maxValue": 128, + "maxValue": 400, "decimalPlace": 100, "value": value } -- cgit v1.2.3 From cc3b66f817c9d72ca247d5ff789a08ec5b57a2b5 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 22 May 2012 08:38:38 -0700 Subject: Editable material properties --- js/panels/Materials/materials-popup.reel/materials-popup.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'js/panels/Materials/materials-popup.reel') diff --git a/js/panels/Materials/materials-popup.reel/materials-popup.js b/js/panels/Materials/materials-popup.reel/materials-popup.js index c54b311e..1e92e144 100755 --- a/js/panels/Materials/materials-popup.reel/materials-popup.js +++ b/js/panels/Materials/materials-popup.reel/materials-popup.js @@ -18,6 +18,8 @@ exports.MaterialsPopup = Montage.create(Component, { value: "" }, + _useSelection: { value: false, enumerable: true }, + captureAction: { value:function(event) { switch(event._currentTarget.label) @@ -134,6 +136,11 @@ exports.MaterialsPopup = Montage.create(Component, { var value = this.decodeValue( this._propTypes[index], propValue ); this._material.setProperty( this._propNames[index], value ); } + + if (this._useSelection) + { + console.log( "apply to selection" ); + } } } }, @@ -224,6 +231,7 @@ exports.MaterialsPopup = Montage.create(Component, { this._materialName = materialID; if (useSelection) { + this._useSelection = true; var selection = this.application.ninja.selectedElements; if (selection && (selection.length > 0)) { @@ -236,6 +244,8 @@ exports.MaterialsPopup = Montage.create(Component, { } else { + this._useSelection = false; + if( (materialID === "BumpMetalMaterial") || (materialID === "DeformMaterial") || @@ -342,7 +352,7 @@ exports.MaterialsPopup = Montage.create(Component, { { value: function( label, color ) { - var css = 'rgba(' + color[0]*255 + ',' + color[1]*255 + ',' + color[2]*255 + ',' + color[3] + ')'; + var css = 'rgba(' + Math.floor(color[0]*255) + ',' + Math.floor(color[1]*255) + ',' + Math.floor(color[2]*255) + ',' + color[3] + ')'; var colorObj = this.application.ninja.colorController.getColorObjFromCss(css) var obj = { -- cgit v1.2.3 From 725c2175f20b5e0829518f725fd26cc077748bdf Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 25 May 2012 13:35:10 -0700 Subject: Parameters for twistVertex material --- js/panels/Materials/materials-popup.reel/materials-popup.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'js/panels/Materials/materials-popup.reel') diff --git a/js/panels/Materials/materials-popup.reel/materials-popup.js b/js/panels/Materials/materials-popup.reel/materials-popup.js index 1e92e144..1237e602 100755 --- a/js/panels/Materials/materials-popup.reel/materials-popup.js +++ b/js/panels/Materials/materials-popup.reel/materials-popup.js @@ -166,6 +166,10 @@ exports.MaterialsPopup = Montage.create(Component, { rtnValue = value; break; + case "angle": + rtnValue = value*3.14159/180.0; + break; + case "file": if (value && (value.length > 0)) { @@ -324,6 +328,10 @@ exports.MaterialsPopup = Montage.create(Component, { obj = this.createFloatData( propLabels[i], propValues[i] ); break; + case "angle": + obj = this.createFloatData( propLabels[i], propValues[i]*180.0/3.14159 ); + break; + case "file": obj = this.createFileData( propLabels[i], propValues[i] ); break; -- cgit v1.2.3 From 7afe0ddcae8f2f0899bffd16ba171c927b3fca96 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 1 Jun 2012 14:09:05 -0700 Subject: Correction for texture paths. --- js/panels/Materials/materials-popup.reel/materials-popup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/panels/Materials/materials-popup.reel') diff --git a/js/panels/Materials/materials-popup.reel/materials-popup.js b/js/panels/Materials/materials-popup.reel/materials-popup.js index db3f7652..3ef2e4ef 100755 --- a/js/panels/Materials/materials-popup.reel/materials-popup.js +++ b/js/panels/Materials/materials-popup.reel/materials-popup.js @@ -178,7 +178,7 @@ exports.MaterialsPopup = Montage.create(Component, { if (index >= 0) { value = value.substr( index+1 ); - value = "assets\\images\\" + value; + value = "assets/images/" + value; } rtnValue = value.slice(0); } -- cgit v1.2.3 From 6c994c4b90023cecf4fd0caafb404b859fe28f54 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 6 Jun 2012 16:34:41 -0700 Subject: material cleanup and rearchitecture --- .../Materials/materials-popup.reel/materials-popup.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'js/panels/Materials/materials-popup.reel') diff --git a/js/panels/Materials/materials-popup.reel/materials-popup.js b/js/panels/Materials/materials-popup.reel/materials-popup.js index 3ef2e4ef..5b9790b8 100755 --- a/js/panels/Materials/materials-popup.reel/materials-popup.js +++ b/js/panels/Materials/materials-popup.reel/materials-popup.js @@ -19,6 +19,7 @@ exports.MaterialsPopup = Montage.create(Component, { }, _useSelection: { value: false, enumerable: true }, + _whichMaterial: { value: "fill", enumerable: true }, captureAction: { value:function(event) { @@ -140,6 +141,20 @@ exports.MaterialsPopup = Montage.create(Component, { if (this._useSelection) { console.log( "apply to selection" ); + + var selection = this.application.ninja.selectedElements; + if (selection && (selection.length > 0)) + { + var canvas = selection[0]; + var obj; + if (canvas.elementModel && canvas.elementModel.shapeModel) obj = canvas.elementModel.shapeModel.GLGeomObj; + if (obj) + { + var world = obj.getWorld(); + if (world) + world.restartRenderLoop(); + } + } } } } @@ -241,6 +256,7 @@ exports.MaterialsPopup = Montage.create(Component, { { var canvas = selection[0]; var obj; + this._whichMaterial = whichMaterial; if (canvas.elementModel && canvas.elementModel.shapeModel) obj = canvas.elementModel.shapeModel.GLGeomObj; if (obj) material = (whichMaterial === 'stroke') ? obj.getStrokeMaterial() : obj.getFillMaterial(); -- cgit v1.2.3 From f0fc7a5678093cce986bd99fef2c5c88add19b68 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Thu, 14 Jun 2012 16:09:31 -0700 Subject: Fix for line color. Name change for all materials --- .../materials-popup.reel/materials-popup.js | 46 +++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'js/panels/Materials/materials-popup.reel') diff --git a/js/panels/Materials/materials-popup.reel/materials-popup.js b/js/panels/Materials/materials-popup.reel/materials-popup.js index 75843b66..38a6865c 100755 --- a/js/panels/Materials/materials-popup.reel/materials-popup.js +++ b/js/panels/Materials/materials-popup.reel/materials-popup.js @@ -282,29 +282,29 @@ exports.MaterialsPopup = Montage.create(Component, { this._useSelection = false; if( - (materialID === "BumpMetalMaterial") || - (materialID === "DeformMaterial") || - (materialID === "FlatMaterial") || - (materialID === "FlagMaterial") || - (materialID === "FlyMaterial") || - (materialID === "JuliaMaterial") || - (materialID === "KeleidoscopeMaterial") || - (materialID === "LinearGradientMaterial") || - (materialID === "MandelMaterial") || - (materialID === "PlasmaMaterial") || - (materialID === "PulseMaterial") || - (materialID === "RadialBlurMaterial") || - (materialID === "RadialGradientMaterial") || - (materialID === "ReliefTunnelMaterial") || - (materialID === "SquareTunnelMaterial") || - (materialID === "StarMaterial") || - (materialID === "TaperMaterial") || - (materialID === "TunnelMaterial") || - (materialID === "TwistMaterial") || - (materialID === "TwistVertMaterial") || - (materialID === "UberMaterial") || - (materialID === "WaterMaterial") || - (materialID === "ZInvertMaterial") + (materialID === "Bump Metal") || + (materialID === "Deform") || + (materialID === "Flat") || + (materialID === "Flag") || + (materialID === "Fly") || + (materialID === "Julia") || + (materialID === "Keleidoscope") || + (materialID === "Linear Gradient") || + (materialID === "Mandel") || + (materialID === "Plasma") || + (materialID === "Pulse") || + (materialID === "Radial Blur") || + (materialID === "Radial Gradient") || + (materialID === "Relief Tunnel") || + (materialID === "Square Tunnel") || + (materialID === "Star") || + (materialID === "Taper") || + (materialID === "Tunnel") || + (materialID === "Twist") || + (materialID === "Twist Vertex") || + (materialID === "Uber") || + (materialID === "Water") || + (materialID === "Z-Invert") ) { material = MaterialsModel.getMaterial( materialID ); -- cgit v1.2.3 From 8556f19a8691fe72791989014c62cb92b8bddb19 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 15 Jun 2012 10:20:48 -0700 Subject: Material changes through the popup editor can effect multiple material instances within a single object. --- .../materials-popup.reel/materials-popup.js | 26 ++++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'js/panels/Materials/materials-popup.reel') diff --git a/js/panels/Materials/materials-popup.reel/materials-popup.js b/js/panels/Materials/materials-popup.reel/materials-popup.js index 38a6865c..91d50234 100755 --- a/js/panels/Materials/materials-popup.reel/materials-popup.js +++ b/js/panels/Materials/materials-popup.reel/materials-popup.js @@ -160,14 +160,26 @@ exports.MaterialsPopup = Montage.create(Component, { var selection = this.application.ninja.selectedElements; if (selection && (selection.length > 0)) { - var canvas = selection[0]; - var obj; - if (canvas.elementModel && canvas.elementModel.shapeModel) obj = canvas.elementModel.shapeModel.GLGeomObj; - if (obj) + var nObjs = selection.length; + for (var iObj=0; iObj 0)) + { + var nObjs = selection.length; + for (var iObj=0; iObj