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 @@