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 --- js/panels/Materials/materials-data.json | 84 ++++++++++++++++++++-- .../materials-popup.reel/materials-popup.js | 56 ++++++++++----- 2 files changed, 116 insertions(+), 24 deletions(-) (limited to 'js/panels') diff --git a/js/panels/Materials/materials-data.json b/js/panels/Materials/materials-data.json index f06ab6c8..5e86793e 100644 --- a/js/panels/Materials/materials-data.json +++ b/js/panels/Materials/materials-data.json @@ -4,25 +4,97 @@ { "label": "Ninja Materials", "children": [ - { - "label": "Uber", - "id" : "UberMaterial" - }, { "label": "Bump Metal", "id" : "BumpMetalMaterial" }, + { + "label": "Deform", + "id" : "DeformMaterial" + }, + { + "label": "Flat", + "id" : "FlatMaterial" + }, + { + "label": "Flag", + "id" : "FlagMaterial" + }, + { + "label": "Fly", + "id" : "FlyMaterial" + }, + { + "label": "Julia", + "id" : "JuliaMaterial" + }, + { + "label": "Keleidoscope", + "id" : "KeleidoscopeMaterial" + }, { "label": "Linear Gradient", "id" : "LinearGradientMaterial" }, + { + "label": "Mandel", + "id" : "MandelMaterial" + }, + { + "label": "Plasma", + "id" : "PlasmaMaterial" + }, + { + "label": "Pulse", + "id" : "PulseMaterial" + }, + { + "label": "Radial Blur", + "id" : "RadialBlurMaterial" + }, { "label": "Radial Gradient", "id" : "RadialGradientMaterial" }, { - "label": "Flat", - "id" : "FlatMaterial" + "label": "Relief Tunnel", + "id" : "ReliefTunnelMaterial" + }, + { + "label": "Square Tunnel", + "id" : "SquareTunnelMaterial" + }, + { + "label": "Star", + "id" : "StarMaterial" + }, + { + "label": "Taper", + "id" : "TaperMaterial" + }, + { + "label": "Tunnel", + "id" : "TunnelMaterial" + }, + { + "label": "Twist", + "id" : "TwistMaterial" + }, + { + "label": "Twist Vertex", + "id" : "TwistVertMaterial" + }, + { + "label": "Uber", + "id" : "UberMaterial" + }, + { + "label": "Water", + "id" : "WaterMaterial" + }, + { + "label": "Z-Invert", + "id" : "ZInvertMaterial" } ] }, 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-library-panel.js | 13 ++-- .../materials-popup.reel/materials-popup.js | 80 +++++++++++++--------- 2 files changed, 57 insertions(+), 36 deletions(-) (limited to 'js/panels') diff --git a/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js b/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js index 2176c6d5..205ecd90 100755 --- a/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js +++ b/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js @@ -51,14 +51,15 @@ exports.MaterialsLibraryPanel = Montage.create(Component, { handleNodeActivation: { value:function(obj) { - this._showMaterialPopup(obj.id); + this._showMaterialPopup({ materialId: obj.id }); } }, handleShowMaterialPopup: { enumerable: false, value: function (event) { - this._showMaterialPopup(event.detail.materialId); + //this._showMaterialPopup(event.detail.materialId); + this._showMaterialPopup(event.detail); } }, @@ -73,9 +74,9 @@ exports.MaterialsLibraryPanel = Montage.create(Component, { _showMaterialPopup: { enumerable: false, - value: function (materialID) { + value: function (materialObj) { - if(!this._materialPopup) + if(!this._materialPopup) { this._materialPopup = Popup.create(); this._materialPopup.content = this._materialInfo; @@ -84,7 +85,9 @@ exports.MaterialsLibraryPanel = Montage.create(Component, { this._materialPopup.addEventListener("show", this, false); } this._materialPopup.show(); - this._materialInfo.loadMaterials(materialID); + + materialID = materialObj.materialId; + this._materialInfo.loadMaterials(materialID, materialObj.useSelection, materialObj.whichMaterial); } }, 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') 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') 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') 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') 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') 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 b7a41cbd5a30d32f524ee60e2dfdf9c65c7ec55b Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 12 Jun 2012 15:44:52 -0700 Subject: Disabled the add, copy, and delete buttons in the material library panel. Also removed the Custom Materials section. --- js/panels/Materials/materials-data.json | 13 ------------- .../materials-library-panel.html | 13 ++++++++----- 2 files changed, 8 insertions(+), 18 deletions(-) (limited to 'js/panels') diff --git a/js/panels/Materials/materials-data.json b/js/panels/Materials/materials-data.json index 5e86793e..893489fc 100644 --- a/js/panels/Materials/materials-data.json +++ b/js/panels/Materials/materials-data.json @@ -97,19 +97,6 @@ "id" : "ZInvertMaterial" } ] - }, - { - "label": "Custom Materials", - "children": [ - { - "label": "Checker Board", - "id" : "CheckerBoard" - }, - { - "label": "Shiny Metal", - "id" : "ShinyMetal" - } - ] } ] } \ No newline at end of file diff --git a/js/panels/Materials/materials-library-panel.reel/materials-library-panel.html b/js/panels/Materials/materials-library-panel.reel/materials-library-panel.html index b5d7a869..6fa54495 100755 --- a/js/panels/Materials/materials-library-panel.reel/materials-library-panel.html +++ b/js/panels/Materials/materials-library-panel.reel/materials-library-panel.html @@ -13,7 +13,8 @@ "addButton": { "prototype": "montage/ui/button.reel", "properties": { - "element": {"#": "ml_add_btn"} + "element": {"#": "ml_add_btn"}, + "enabled": false }, "listeners": [ { @@ -25,8 +26,9 @@ "copyButton": { "prototype": "montage/ui/button.reel", "properties": { - "element": {"#": "ml_copy_btn"} - }, + "element": {"#": "ml_copy_btn"}, + "enabled": false + }, "listeners": [ { "type": "action", @@ -37,8 +39,9 @@ "deleteButton": { "prototype": "montage/ui/button.reel", "properties": { - "element": {"#": "ml_delete_btn"} - }, + "element": {"#": "ml_delete_btn"}, + "enabled": false + }, "listeners": [ { "type": "action", -- cgit v1.2.3 From 708d6d4736cdb67bde5ecfb31b34e19d26eef611 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 14 Jun 2012 15:22:28 -0700 Subject: Cleaning up references Still need to do more cleaning up. --- .../colorpanelpopup.reel/colorpanelpopup.html | 33 ++++-- .../color/colorpanelpopup.reel/colorpanelpopup.js | 113 ++++++++++----------- 2 files changed, 77 insertions(+), 69 deletions(-) (limited to 'js/panels') diff --git a/js/panels/color/colorpanelpopup.reel/colorpanelpopup.html b/js/panels/color/colorpanelpopup.reel/colorpanelpopup.html index 5ad5c615..596580b4 100755 --- a/js/panels/color/colorpanelpopup.reel/colorpanelpopup.html +++ b/js/panels/color/colorpanelpopup.reel/colorpanelpopup.html @@ -21,7 +21,18 @@ "images": {"#": "cntnr_images"}, "gradients": {"#": "cntnr_gradients"}, "palettes": {"#": "cntnr_palettes"}, - "alpha": {"#": "cntnr_alpha"} + "alpha": {"#": "cntnr_alpha"}, + "alphaSlider": {"#": "alpha_slider"}, + "alphaHottext": {"#": "alpha_hottext"}, + "btnPrevious": {"#": "btn_previous"}, + "btnCurrent": {"#": "btn_current"}, + "btnWheel": {"#": "btn_wheel"}, + "btnImage": {"#": "btn_images"}, + "btnGradient": {"#": "btn_gradients"}, + "btnPalette": {"#": "btn_palettes"}, + "btnNocolor": {"#": "btn_nocolor"}, + "inputHex": {"#": "input_hex"} + } } } @@ -36,18 +47,18 @@
- - + +
-
#
+
#
- - - - - + + + + + @@ -60,8 +71,8 @@
Alpha
-
- +
+
%
diff --git a/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js b/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js index aebbbd41..4161cb50 100755 --- a/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js +++ b/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js @@ -23,19 +23,13 @@ exports.ColorPanelPopup = Montage.create(Component, { //////////////////////////////////////////////////////////////////// //Storing color manager _colorManager: { - value: false + value: null }, //////////////////////////////////////////////////////////////////// //Color manager colorManager: { - get: function() { - return this._colorManager; - }, - set: function(value) { - if (value !== this._colorManager) { - this._colorManager = value; - } - } + get: function() {return this._colorManager;}, + set: function(value) {if (value !== this._colorManager) this._colorManager = value;} }, //////////////////////////////////////////////////////////////////// //Storing color panel @@ -45,18 +39,19 @@ exports.ColorPanelPopup = Montage.create(Component, { //////////////////////////////////////////////////////////////////// //Color panel colorPanel: { - get: function() { - return this._colorPanel; - }, - set: function(value) { - this._colorPanel = value; - } + get: function() {return this._colorPanel;}, + set: function(value) {this._colorPanel = value;} + }, + //////////////////////////////////////////////////////////////////// + // + _components: { + value: null }, //////////////////////////////////////////////////////////////////// // setNoColor: { value: function (e) { - this.colorManager.applyNoColor(); + if (this.colorManager) this.colorManager.applyNoColor(); } }, //////////////////////////////////////////////////////////////////// @@ -64,7 +59,8 @@ exports.ColorPanelPopup = Montage.create(Component, { prepareForDraw: { value: function () { // - this.element._components = {wheel: null, combo: null}; + this._components = null; + this._components = {wheel: null, combo: null}; } }, //////////////////////////////////////////////////////////////////// @@ -74,14 +70,14 @@ exports.ColorPanelPopup = Montage.create(Component, { // this.element.style.opacity = 0; // - this.element._components.combo = {}; - this.element._components.combo.slider = Slider.create(); - this.element._components.combo.hottext = HotText.create(); - this.element._components.combo.slider.element = this.element.getElementsByClassName('cp_pu_a_slider')[0]; - this.element._components.combo.hottext.element = this.element.getElementsByClassName('cp_pu_a_hottext')[0]; + this._components.combo = {}; + this._components.combo.slider = Slider.create(); + this._components.combo.hottext = HotText.create(); + this._components.combo.slider.element = this.alphaSlider; + this._components.combo.hottext.element = this.alphaHottext; // - Object.defineBinding(this.element._components.combo.hottext, "_value", { - boundObject: this.element._components.combo.slider, + Object.defineBinding(this._components.combo.hottext, "_value", { + boundObject: this._components.combo.slider, boundObjectPropertyPath: "value", oneway: false, boundValueMutator: function(value) { @@ -89,8 +85,8 @@ exports.ColorPanelPopup = Montage.create(Component, { } }); // - Object.defineBinding(this.element._components.combo.hottext, "value", { - boundObject: this.element._components.combo.slider, + Object.defineBinding(this._components.combo.hottext, "value", { + boundObject: this._components.combo.slider, boundObjectPropertyPath: "value", oneway: false, boundValueMutator: function(value) { @@ -98,7 +94,7 @@ exports.ColorPanelPopup = Montage.create(Component, { } }); if (this.application.ninja.colorController.colorView) { - Object.defineBinding(this.element._components.combo.slider, "value", { + Object.defineBinding(this._components.combo.slider, "value", { boundObject: this.application.ninja.colorController.colorView._combo[3].slider, boundObjectPropertyPath: "value", oneway: false, @@ -108,25 +104,26 @@ exports.ColorPanelPopup = Montage.create(Component, { }); } // - this.element._components.combo.slider.maxValue = this.element._components.combo.hottext.maxValue = 100; + this._components.combo.slider.maxValue = this._components.combo.hottext.maxValue = 100; + // if (this.application.ninja.colorController.colorView) { - this.element._components.combo.slider.customBackground = this.application.ninja.colorController.colorView._slider3Background.bind(this.application.ninja.colorController.colorView); + this._components.combo.slider.customBackground = this.application.ninja.colorController.colorView._slider3Background.bind(this.application.ninja.colorController.colorView); } // - this.element._components.combo.slider.addEventListener('change', this.alphaChange.bind(this), true); - this.element._components.combo.hottext.addEventListener('change', this.alphaChange.bind(this), true); + this._components.combo.slider.addEventListener('change', this.alphaChange.bind(this), true); + this._components.combo.hottext.addEventListener('change', this.alphaChange.bind(this), true); // - this.element._components.wheel = ColorWheel.create(); - this.element._components.wheel.element = this.wheel; - this.element._components.wheel.element.style.display = 'block'; - this.element._components.wheel.rimWidth = 14; - this.element._components.wheel.strokeWidth = 2; + this._components.wheel = ColorWheel.create(); + this._components.wheel.element = this.wheel; + this._components.wheel.element.style.display = 'block'; + this._components.wheel.rimWidth = 14; + this._components.wheel.strokeWidth = 2; // - this.element._components.wheel.value = this.colorManager.hsv; - this.element._components.wheel.addEventListener('change', this, true); - this.element._components.wheel.addEventListener('changing', this, true); + this._components.wheel.value = this.colorManager.hsv; + this._components.wheel.addEventListener('change', this, true); + this._components.wheel.addEventListener('changing', this, true); // - Object.defineBinding(this.element._components.wheel, "value", { + Object.defineBinding(this._components.wheel, "value", { boundObject: this.colorManager, boundObjectPropertyPath: "_hsv", boundValueMutator: function(value) { @@ -148,8 +145,8 @@ exports.ColorPanelPopup = Montage.create(Component, { // this.application.ninja.colorController.colorView.addButton('hexinput', this.element.getElementsByClassName('cp_pu_hottext_hex')[0]); // - this.element._components.combo.slider.needsDraw = true; - this.element._components.combo.hottext.needsDraw = true; + this._components.combo.slider.needsDraw = true; + this._components.combo.hottext.needsDraw = true; // this.element.getElementsByClassName('cp_pu_nocolor')[0].addEventListener('click', function () { this.setNoColor(); @@ -175,9 +172,9 @@ exports.ColorPanelPopup = Montage.create(Component, { this.application.ninja.colorController.colorView.addButton('current', this.element.getElementsByClassName('cp_pu_color_current')[0]); this.application.ninja.colorController.colorView.addButton('previous', this.element.getElementsByClassName('cp_pu_color_previous')[0]); // - this.element._components.wheel.addEventListener('firstDraw', this, false); + this._components.wheel.addEventListener('firstDraw', this, false); // - this.element._components.wheel.needsDraw = true; + this._components.wheel.needsDraw = true; } }, //////////////////////////////////////////////////////////////////// @@ -193,9 +190,9 @@ exports.ColorPanelPopup = Montage.create(Component, { handleFirstDraw: { value: function (e) { // - if (this.element._components.wheel) { + if (this._components.wheel) { //Only using it for one instance, no need to check target - this.element._components.wheel.removeEventListener('firstDraw', this, false); + this._components.wheel.removeEventListener('firstDraw', this, false); } //Switching to tab from previous selection switch (this.application.ninja.colorController.popupTab) { @@ -241,10 +238,10 @@ exports.ColorPanelPopup = Montage.create(Component, { this.application.ninja.colorController.popupTab = 'palette'; } // - if (tab !== this.wheel && this.element._components.wheel.element) { - this.element._components.wheel.element.style.display = 'none'; - } else if (this.element._components.wheel.element && this.element._components.wheel.element.style.display !== 'block'){ - this.element._components.wheel.element.style.display = 'block'; + if (tab !== this.wheel && this._components.wheel.element) { + this._components.wheel.element.style.display = 'none'; + } else if (this._components.wheel.element && this._components.wheel.element.style.display !== 'block'){ + this._components.wheel.element.style.display = 'block'; this.alpha.style.display = 'block'; // this.application.ninja.colorController.popupTab = 'wheel'; @@ -264,10 +261,10 @@ exports.ColorPanelPopup = Montage.create(Component, { if (tab !== this.gradients) { this.gradients.style.display = 'none'; // - if (this.element._components.wheel._value) { - this.element._components.wheel.value = {h: this.element._components.wheel._value.h, s: this.element._components.wheel._value.s, v: this.element._components.wheel._value.v, wasSetByCode: false}; + if (this._components.wheel._value) { + this._components.wheel.value = {h: this._components.wheel._value.h, s: this._components.wheel._value.s, v: this._components.wheel._value.v, wasSetByCode: false}; } else { - this.element._components.wheel.value = {h: 0, s: 1, v: 1, wasSetByCode: false}; + this._components.wheel.value = {h: 0, s: 1, v: 1, wasSetByCode: false}; } } else { this.gradients.style.display = 'block'; @@ -389,7 +386,7 @@ exports.ColorPanelPopup = Montage.create(Component, { alphaChange: { value: function (e) { if (!e._event.wasSetByCode) { - var update = {value: this.element._components.combo.slider.value/100, wasSetByCode: false, type: 'change'}; + var update = {value: this._components.combo.slider.value/100, wasSetByCode: false, type: 'change'}; this.colorManager.alpha = update; } } @@ -425,10 +422,10 @@ exports.ColorPanelPopup = Montage.create(Component, { value: function() { // this.application.ninja.colorController.colorView.removeButton('hexinput', this.element.getElementsByClassName('cp_pu_hottext_hex')[0]); - Object.deleteBinding(this.element._components.combo.hottext, "value"); - Object.deleteBinding(this.element._components.combo.slider, "value"); - Object.deleteBinding(this.element._components.wheel, "value"); - this.element._components.wheel = null; + Object.deleteBinding(this._components.combo.hottext, "value"); + Object.deleteBinding(this._components.combo.slider, "value"); + Object.deleteBinding(this._components.wheel, "value"); + this._components.wheel = null; } } //////////////////////////////////////////////////////////////////// -- 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 --- js/panels/Materials/materials-data.json | 46 +++++++++++----------- .../materials-popup.reel/materials-popup.js | 46 +++++++++++----------- 2 files changed, 46 insertions(+), 46 deletions(-) (limited to 'js/panels') diff --git a/js/panels/Materials/materials-data.json b/js/panels/Materials/materials-data.json index 893489fc..ad0c1f56 100644 --- a/js/panels/Materials/materials-data.json +++ b/js/panels/Materials/materials-data.json @@ -6,95 +6,95 @@ "children": [ { "label": "Bump Metal", - "id" : "BumpMetalMaterial" + "id" : "Bump Metal" }, { "label": "Deform", - "id" : "DeformMaterial" + "id" : "Deform" }, { "label": "Flat", - "id" : "FlatMaterial" + "id" : "Flat" }, { "label": "Flag", - "id" : "FlagMaterial" + "id" : "Flag" }, { "label": "Fly", - "id" : "FlyMaterial" + "id" : "Fly" }, { "label": "Julia", - "id" : "JuliaMaterial" + "id" : "Julia" }, { "label": "Keleidoscope", - "id" : "KeleidoscopeMaterial" + "id" : "Keleidoscope" }, { "label": "Linear Gradient", - "id" : "LinearGradientMaterial" + "id" : "Linear Gradient" }, { "label": "Mandel", - "id" : "MandelMaterial" + "id" : "Mandel" }, { "label": "Plasma", - "id" : "PlasmaMaterial" + "id" : "Plasma" }, { "label": "Pulse", - "id" : "PulseMaterial" + "id" : "Pulse" }, { "label": "Radial Blur", - "id" : "RadialBlurMaterial" + "id" : "Radial Blur" }, { "label": "Radial Gradient", - "id" : "RadialGradientMaterial" + "id" : "Radial Gradient" }, { "label": "Relief Tunnel", - "id" : "ReliefTunnelMaterial" + "id" : "Relief Tunnel" }, { "label": "Square Tunnel", - "id" : "SquareTunnelMaterial" + "id" : "Square Tunnel" }, { "label": "Star", - "id" : "StarMaterial" + "id" : "Star" }, { "label": "Taper", - "id" : "TaperMaterial" + "id" : "Taper" }, { "label": "Tunnel", - "id" : "TunnelMaterial" + "id" : "Tunnel" }, { "label": "Twist", - "id" : "TwistMaterial" + "id" : "Twist" }, { "label": "Twist Vertex", - "id" : "TwistVertMaterial" + "id" : "Twist Vertex" }, { "label": "Uber", - "id" : "UberMaterial" + "id" : "Uber" }, { "label": "Water", - "id" : "WaterMaterial" + "id" : "Water" }, { "label": "Z-Invert", - "id" : "ZInvertMaterial" + "id" : "Z-Invert" } ] } 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') 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