From ad6959619f154bbe984d33aa7e6c60333cbb4438 Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Thu, 15 Nov 2012 18:25:34 -0600 Subject: Initial texture panel rework: moved controls, new labels, eliminated flip checkboxes and apply button, added selection dropdowns. --- indra/newview/llpanelface.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 3b5a9b1398..acac2c1bf5 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -80,6 +80,8 @@ protected: void onSelectColor(const LLSD& data); static void onCommitTextureInfo( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterialsMedia( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata); static void onCommitBump( LLUICtrl* ctrl, void* userdata); static void onCommitTexGen( LLUICtrl* ctrl, void* userdata); static void onCommitShiny( LLUICtrl* ctrl, void* userdata); @@ -87,7 +89,7 @@ protected: static void onCommitGlow( LLUICtrl* ctrl, void *userdata); static void onCommitPlanarAlign( LLUICtrl* ctrl, void* userdata); - static void onClickApply(void*); + static void onCommitRepeatsPerMeter( LLUICtrl* ctrl, void* userinfo); static void onClickAutoFix(void*); static F32 valueGlow(LLViewerObject* object, S32 face); -- cgit v1.2.3 From f4663e098c1f338259b46085188be19f8fad7543 Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Thu, 10 Jan 2013 18:05:39 -0600 Subject: New controls for editing media. --- indra/newview/llpanelface.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index acac2c1bf5..56b4034a2d 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -85,6 +85,7 @@ protected: static void onCommitBump( LLUICtrl* ctrl, void* userdata); static void onCommitTexGen( LLUICtrl* ctrl, void* userdata); static void onCommitShiny( LLUICtrl* ctrl, void* userdata); + static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata); static void onCommitFullbright( LLUICtrl* ctrl, void* userdata); static void onCommitGlow( LLUICtrl* ctrl, void *userdata); static void onCommitPlanarAlign( LLUICtrl* ctrl, void* userdata); -- cgit v1.2.3 From 1751c965ba1ffd1a89a3b94542624e70cbde1060 Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Tue, 29 Jan 2013 21:19:58 -0600 Subject: Editing interface for normal and specular maps and other parameters. --- indra/newview/llpanelface.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 56b4034a2d..c6322d59b2 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -29,6 +29,7 @@ #include "v4color.h" #include "llpanel.h" +#include "llmaterial.h" class LLButton; class LLCheckBoxCtrl; @@ -42,6 +43,7 @@ class LLTextureCtrl; class LLUICtrl; class LLViewerObject; class LLFloater; +class LLMaterialID; class LLPanelFace : public LLPanel { @@ -74,12 +76,19 @@ protected: void onCommitTexture(const LLSD& data); void onCancelTexture(const LLSD& data); void onSelectTexture(const LLSD& data); + void onCommitMaterialTexture(const LLSD& data); + void onCancelMaterialTexture(const LLSD& data); + void onSelectMaterialTexture(const LLSD& data); void onCommitColor(const LLSD& data); + void onCommitShinyColor(const LLSD& data); void onCommitAlpha(const LLSD& data); void onCancelColor(const LLSD& data); void onSelectColor(const LLSD& data); + void onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material); + void updateMaterial(); static void onCommitTextureInfo( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterial( LLUICtrl* ctrl, void* userdata); static void onCommitMaterialsMedia( LLUICtrl* ctrl, void* userdata); static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata); static void onCommitBump( LLUICtrl* ctrl, void* userdata); @@ -103,6 +112,9 @@ private: */ void onTextureSelectionChanged(LLInventoryItem* itemp); + LLMaterialID mMaterialID; + LLMaterialPtr mMaterial; + BOOL mIsAlpha; }; #endif -- cgit v1.2.3 From d53f69b67f2aed05fd763932f25cc8b5c40ec774 Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Thu, 31 Jan 2013 00:36:23 -0600 Subject: Control reorganization and bugfixes. --- indra/newview/llpanelface.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index c6322d59b2..62aa632821 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -93,7 +93,9 @@ protected: static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata); static void onCommitBump( LLUICtrl* ctrl, void* userdata); static void onCommitTexGen( LLUICtrl* ctrl, void* userdata); + static void updateShinyControls( LLUICtrl* ctrl, void* userdata); static void onCommitShiny( LLUICtrl* ctrl, void* userdata); + static void updateAlphaControls( LLUICtrl* ctrl, void* userdata); static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata); static void onCommitFullbright( LLUICtrl* ctrl, void* userdata); static void onCommitGlow( LLUICtrl* ctrl, void *userdata); -- cgit v1.2.3 From f2b026138d5abe5464de6db349b3431c262de53a Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Tue, 5 Feb 2013 03:30:56 -0600 Subject: Don't send a materials update to the sim until the previous one has been acknowledged. --- indra/newview/llpanelface.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 62aa632821..e83a03b0ae 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -116,7 +116,20 @@ private: LLMaterialID mMaterialID; LLMaterialPtr mMaterial; - BOOL mIsAlpha; + bool mIsAlpha; + + /* These variables interlock processing of materials updates sent to + * the sim. mUpdateInFlight is set to flag that an update has been + * sent to the sim and not acknowledged yet, and cleared when an + * update is received from the sim. mUpdatePending is set when + * there's an update in flight and another UI change has been made + * that needs to be sent as a materials update, and cleared when the + * update is sent. This prevents the sim from getting spammed with + * update messages when, for example, the user holds down the + * up-arrow on a spinner, and avoids running afoul of its throttle. + */ + bool mUpdateInFlight; + bool mUpdatePending; }; #endif -- cgit v1.2.3 From 8b24857f6ae7f4d719697f17e664f095a8aa2753 Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Sat, 9 Mar 2013 16:11:55 -0600 Subject: Dynamically add and remove "Use texture" normal/specular setting. --- indra/newview/llpanelface.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index e83a03b0ae..a99b4e772f 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -94,6 +94,7 @@ protected: static void onCommitBump( LLUICtrl* ctrl, void* userdata); static void onCommitTexGen( LLUICtrl* ctrl, void* userdata); static void updateShinyControls( LLUICtrl* ctrl, void* userdata); + static void updateBumpyControls( LLUICtrl* ctrl, void* userdata); static void onCommitShiny( LLUICtrl* ctrl, void* userdata); static void updateAlphaControls( LLUICtrl* ctrl, void* userdata); static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata); -- cgit v1.2.3 From 9e3155c368fba6cb877c55ad4e0c90258a6e9ba9 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Mon, 8 Apr 2013 11:40:10 -0700 Subject: NORSPEC-82 NORSPEC-85 More UI shenanigans --- indra/newview/llpanelface.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index a99b4e772f..2138319365 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -93,8 +93,8 @@ protected: static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata); static void onCommitBump( LLUICtrl* ctrl, void* userdata); static void onCommitTexGen( LLUICtrl* ctrl, void* userdata); - static void updateShinyControls( LLUICtrl* ctrl, void* userdata); - static void updateBumpyControls( LLUICtrl* ctrl, void* userdata); + static void updateShinyControls( LLUICtrl* ctrl, void* userdata, bool mess_with_combobox = false); + static void updateBumpyControls( LLUICtrl* ctrl, void* userdata, bool mess_with_combobox = false); static void onCommitShiny( LLUICtrl* ctrl, void* userdata); static void updateAlphaControls( LLUICtrl* ctrl, void* userdata); static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata); @@ -134,3 +134,4 @@ private: }; #endif + -- cgit v1.2.3 From 8ba1b1f797948ee8b082f045ed444fbcd96c3412 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 9 May 2013 15:04:07 -0700 Subject: NORSPEC-168 separate UI handlers for spec and normal textures to avoid cross-talk and fix handling of bumpy/shiny menu items --- indra/newview/llpanelface.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 2138319365..7fbeef223b 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -76,9 +76,12 @@ protected: void onCommitTexture(const LLSD& data); void onCancelTexture(const LLSD& data); void onSelectTexture(const LLSD& data); - void onCommitMaterialTexture(const LLSD& data); - void onCancelMaterialTexture(const LLSD& data); - void onSelectMaterialTexture(const LLSD& data); + void onCommitSpecularTexture(const LLSD& data); + void onCancelSpecularTexture(const LLSD& data); + void onSelectSpecularTexture(const LLSD& data); + void onCommitNormalTexture(const LLSD& data); + void onCancelNormalTexture(const LLSD& data); + void onSelectNormalTexture(const LLSD& data); void onCommitColor(const LLSD& data); void onCommitShinyColor(const LLSD& data); void onCommitAlpha(const LLSD& data); @@ -93,8 +96,8 @@ protected: static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata); static void onCommitBump( LLUICtrl* ctrl, void* userdata); static void onCommitTexGen( LLUICtrl* ctrl, void* userdata); - static void updateShinyControls( LLUICtrl* ctrl, void* userdata, bool mess_with_combobox = false); - static void updateBumpyControls( LLUICtrl* ctrl, void* userdata, bool mess_with_combobox = false); + static void updateShinyControls( LLUICtrl* ctrl, void* userdata, bool is_setting_texture = false, bool mess_with_combobox = false); + static void updateBumpyControls( LLUICtrl* ctrl, void* userdata, bool is_setting_texture = false, bool mess_with_combobox = false); static void onCommitShiny( LLUICtrl* ctrl, void* userdata); static void updateAlphaControls( LLUICtrl* ctrl, void* userdata); static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata); -- cgit v1.2.3 From f356d7eb9fd730f5f6f5a29fb0706e20876ad3bd Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sat, 11 May 2013 19:58:56 -0700 Subject: Fix many issues with selection misapplication and rendering not matching applied materials --- indra/newview/llpanelface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 7fbeef223b..401dbd1e94 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -87,7 +87,7 @@ protected: void onCommitAlpha(const LLSD& data); void onCancelColor(const LLSD& data); void onSelectColor(const LLSD& data); - void onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material); + void updateMaterial(); static void onCommitTextureInfo( LLUICtrl* ctrl, void* userdata); -- cgit v1.2.3 From c486d9498b8274e0fd9c7cba616df10f6a7d8977 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Sun, 12 May 2013 12:58:46 +0200 Subject: Refactor LLPanelFace to make it clearer that the material is a property of the face(s) and never the panel --- indra/newview/llpanelface.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 401dbd1e94..4e97295b84 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -118,8 +118,6 @@ private: */ void onTextureSelectionChanged(LLInventoryItem* itemp); - LLMaterialID mMaterialID; - LLMaterialPtr mMaterial; bool mIsAlpha; /* These variables interlock processing of materials updates sent to -- cgit v1.2.3 From d9e8ee7cfd323872145c23e4032989f9b7770f55 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 13 May 2013 13:02:53 -0700 Subject: NORSPEC-178 NORSPEC-179 NORSPEC-180 made enable/disable handling more consistent and increased max range on repeats per meter --- indra/newview/llpanelface.h | 52 +++++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 16 deletions(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 4e97295b84..88f32e45f8 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -67,7 +67,7 @@ protected: void sendTexGen(); // applies and sends bump map void sendShiny(); // applies and sends shininess void sendFullbright(); // applies and sends full bright - void sendGlow(); + void sendGlow(); void sendMedia(); // this function is to return TRUE if the drag should succeed. @@ -88,29 +88,49 @@ protected: void onCancelColor(const LLSD& data); void onSelectColor(const LLSD& data); - void updateMaterial(); - - static void onCommitTextureInfo( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterial( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialsMedia( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata); - static void onCommitBump( LLUICtrl* ctrl, void* userdata); + // Make UI reflect state of currently selected material (refresh) + // and UI mode (e.g. editing normal map v diffuse map) + // + void updateUI(); + + // Callback funcs for individual controls + // + static void onCommitTextureInfo( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterial( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterialsMedia( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata); + static void onCommitBump( LLUICtrl* ctrl, void* userdata); static void onCommitTexGen( LLUICtrl* ctrl, void* userdata); - static void updateShinyControls( LLUICtrl* ctrl, void* userdata, bool is_setting_texture = false, bool mess_with_combobox = false); - static void updateBumpyControls( LLUICtrl* ctrl, void* userdata, bool is_setting_texture = false, bool mess_with_combobox = false); - static void onCommitShiny( LLUICtrl* ctrl, void* userdata); - static void updateAlphaControls( LLUICtrl* ctrl, void* userdata); + static void onCommitShiny( LLUICtrl* ctrl, void* userdata); static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata); static void onCommitFullbright( LLUICtrl* ctrl, void* userdata); - static void onCommitGlow( LLUICtrl* ctrl, void *userdata); - static void onCommitPlanarAlign( LLUICtrl* ctrl, void* userdata); - + static void onCommitGlow( LLUICtrl* ctrl, void *userdata); + static void onCommitPlanarAlign( LLUICtrl* ctrl, void* userdata); static void onCommitRepeatsPerMeter( LLUICtrl* ctrl, void* userinfo); static void onClickAutoFix(void*); - static F32 valueGlow(LLViewerObject* object, S32 face); + + static F32 valueGlow(LLViewerObject* object, S32 face); private: + // Update visibility of controls to match current UI mode + // (e.g. materials vs media editing) + // + // Do NOT call updateUI from within this function. + // + void updateVisibility(); + + // Make material reflect current state of UI (apply edit) + // + void updateMaterial(); + + // Update vis and enabling of specific subsets of controls based on material params + // (e.g. hide the spec controls if no spec texture is applied) + // + void updateShinyControls(bool is_setting_texture = false, bool mess_with_combobox = false); + void updateBumpyControls(bool is_setting_texture = false, bool mess_with_combobox = false); + void updateAlphaControls(); + /* * Checks whether the selected texture from the LLFloaterTexturePicker can be applied to the currently selected object. * If agent selects texture which is not allowed to be applied for the currently selected object, -- cgit v1.2.3 From a1a8048d3e1494d50f23bc1b6c66a238128fe82b Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 20 May 2013 16:24:58 -0700 Subject: NORSPEC-188 avoid removing 'Use Texture' item when cancelling from picker back to having prev texture --- indra/newview/llpanelface.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 88f32e45f8..f64564c9a0 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -63,9 +63,9 @@ protected: void sendTextureInfo(); // applies and sends texture scale, offset, etc. void sendColor(); // applies and sends color void sendAlpha(); // applies and sends transparency - void sendBump(); // applies and sends bump map + void sendBump(U32 bumpiness); // applies and sends bump map void sendTexGen(); // applies and sends bump map - void sendShiny(); // applies and sends shininess + void sendShiny(U32 shininess); // applies and sends shininess void sendFullbright(); // applies and sends full bright void sendGlow(); void sendMedia(); -- cgit v1.2.3 From 7e4e59470f36ae7a0e01b8d2613af4c8fb6b0101 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 7 Jun 2013 08:58:15 -0700 Subject: NORSPEC-233 WIP for individual material param edits across hetero object selections --- indra/newview/llpanelface.h | 290 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 288 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index f64564c9a0..b93e214326 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -30,6 +30,9 @@ #include "v4color.h" #include "llpanel.h" #include "llmaterial.h" +#include "llmaterialmgr.h" +#include "lltextureentry.h" +#include "llselectmgr.h" class LLButton; class LLCheckBoxCtrl; @@ -45,6 +48,48 @@ class LLViewerObject; class LLFloater; class LLMaterialID; +// Represents an edit for use in replicating the op across one or more materials in the selection set. +// +// The apply function optionally performs the edit which it implements +// as a functor taking Data that calls member func MaterialFunc taking SetValueType +// on an instance of the LLMaterial class. +// +// boost who? +// +template< + typename DataType, + typename SetValueType, + void (LLMaterial::*MaterialEditFunc)(SetValueType data) > +class LLMaterialEditFunctor +{ +public: + LLMaterialEditFunctor(const DataType& data) : _data(data) {} + virtual ~LLMaterialEditFunctor() {} + virtual void apply(LLMaterialPtr& material) { (material->*(MaterialEditFunc))(_data); } + DataType _data; +}; + +template< + typename DataType, + DataType (LLMaterial::*MaterialGetFunc)() > +class LLMaterialGetFunctor +{ +public: + LLMaterialGetFunctor() : {} + virtual DataType get(LLMaterialPtr& material) { return (material->*(MaterialGetFunc)); } +}; + +template< + typename DataType, + DataType (LLTextureEntry::*TEGetFunc)() > +class LLTEGetFunctor +{ +public: + LLTEGetFunctor() : _data(data) {} + virtual DataType get(LLTextureEntry* entry) { return (entry*(TEGetFunc)); } + DataType _data; +}; + class LLPanelFace : public LLPanel { public: @@ -93,10 +138,31 @@ protected: // void updateUI(); + // Convenience func to determine if all faces in selection have + // identical planar texgen settings during edits + // + bool isIdenticalPlanarTexgen(); + // Callback funcs for individual controls // static void onCommitTextureInfo( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterial( LLUICtrl* ctrl, void* userdata); + + static void onCommitMaterialBumpyScaleX( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterialBumpyScaleY( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterialBumpyRot( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterialBumpyOffsetX( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterialBumpyOffsetY( LLUICtrl* ctrl, void* userdata); + + static void onCommitMaterialShinyScaleX( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterialShinyScaleY( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterialShinyRot( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterialShinyOffsetX( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterialShinyOffsetY( LLUICtrl* ctrl, void* userdata); + + static void onCommitMaterialGloss( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterialEnv( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterialMaskCutoff( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterialsMedia( LLUICtrl* ctrl, void* userdata); static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata); static void onCommitBump( LLUICtrl* ctrl, void* userdata); @@ -113,6 +179,29 @@ protected: private: + bool isAlpha() { return mIsAlpha; } + + // Convenience funcs to keep the visual flack to a minimum + // + LLUUID getCurrentNormalMap(); + LLUUID getCurrentSpecularMap(); + U32 getCurrentShininess(); + U32 getCurrentBumpiness(); + U8 getCurrentDiffuseAlphaMode(); + U8 getCurrentAlphaMaskCutoff(); + U8 getCurrentEnvIntensity(); + U8 getCurrentGlossiness(); + F32 getCurrentBumpyRot(); + F32 getCurrentBumpyScaleU(); + F32 getCurrentBumpyScaleV(); + F32 getCurrentBumpyOffsetU(); + F32 getCurrentBumpyOffsetV(); + F32 getCurrentShinyRot(); + F32 getCurrentShinyScaleU(); + F32 getCurrentShinyScaleV(); + F32 getCurrentShinyOffsetU(); + F32 getCurrentShinyOffsetV(); + // Update visibility of controls to match current UI mode // (e.g. materials vs media editing) // @@ -120,10 +209,106 @@ private: // void updateVisibility(); - // Make material reflect current state of UI (apply edit) + // Make material(s) reflect current state of UI (apply edit) // void updateMaterial(); + // Hey look everyone, a type-safe alternative to copy and paste! :) + // + + // Update material parameters by applying 'edit_func' to selected TEs + // + template< + typename DataType, + typename SetValueType, + void (LLMaterial::*MaterialEditFunc)(SetValueType data) > + static void edit(LLPanelFace* p, DataType data) + { + LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc > edit(data); + struct LLSelectedTEEditMaterial : public LLSelectedTEMaterialFunctor + { + LLSelectedTEEditMaterial(LLPanelFace* panel, LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* editp) : _panel(panel), _edit(editp) {} + virtual ~LLSelectedTEEditMaterial() {}; + virtual LLMaterialPtr apply(LLViewerObject* object, S32 face, LLTextureEntry* tep, LLMaterialPtr& current_material) + { + if (_edit) + { + LLMaterialPtr new_material(!current_material.isNull() ? new LLMaterial(current_material->asLLSD()) : new LLMaterial()); + llassert_always(new_material); + + // Do "It"! + // + _edit->apply(new_material); + + U32 new_alpha_mode = new_material->getDiffuseAlphaMode(); + LLUUID new_normal_map_id = new_material->getNormalID(); + LLUUID new_spec_map_id = new_material->getSpecularID(); + + bool is_default_blend_mode = (new_alpha_mode == (_panel->isAlpha() ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE)); + bool is_need_material = !is_default_blend_mode || !new_normal_map_id.isNull() || !new_spec_map_id.isNull(); + + if (!current_material.isNull() && !is_need_material) + { + LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL; + LLMaterialMgr::getInstance()->remove(object->getID(),face); + } + else + { + // Replicate old init behavior + // + if (current_material.isNull()) + { + U8 current_alpha_mode = _panel->getCurrentDiffuseAlphaMode(); + U8 current_alpha_mask_cutoff = _panel->getCurrentAlphaMaskCutoff(); + + new_material->setDiffuseAlphaMode(current_alpha_mode); + new_material->setAlphaMaskCutoff(current_alpha_mask_cutoff); + } + + LL_DEBUGS("Materials") << "Putting material on object " << object->getID() << " face " << face << ", material: " << new_material->asLLSD() << LL_ENDL; + LLMaterialMgr::getInstance()->put(object->getID(),face,*new_material); + } + + object->setTEMaterialParams(face, new_material); + return new_material; + } + return NULL; + } + LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* _edit; + LLPanelFace* _panel; + } editor(p, &edit); + LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor); + } + + template< + typename DataType, + typename ReturnType, + ReturnType (LLMaterial::* const MaterialGetFunc)() const > + static void getTEMaterialValue(DataType& data_to_return, bool& identical) + { + struct GetTEMaterialVal : public LLSelectedTEGetFunctor + { + DataType get(LLViewerObject* object, S32 face) { return (object && object->getTE(face)) ? ((object->getTE(face)->getMaterialParams()->*(MaterialGetFunc))()) : DataType(); } + } GetFunc; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetFunc, data_to_return); + } + + template< + typename DataType, + typename ReturnType, // some kids just have to different... + ReturnType (LLTextureEntry::* const TEGetFunc)() const > + static void getTEValue(DataType& data_to_return, bool& identical) + { + struct GetTEVal : public LLSelectedTEGetFunctor + { + DataType get(LLViewerObject* object, S32 face) { + LLTextureEntry* tep = object ? object->getTE(face) : NULL; + return tep ? ((tep->*(TEGetFunc))()) : DataType(); + } + } GetTEValFunc; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetTEValFunc, data_to_return ); + } + // Update vis and enabling of specific subsets of controls based on material params // (e.g. hide the spec controls if no spec texture is applied) // @@ -152,6 +337,107 @@ private: */ bool mUpdateInFlight; bool mUpdatePending; + + #if defined(DEF_GET_MAT_STATE) + #undef DEF_GET_MAT_STATE + #endif + + #if defined(DEF_GET_TE_STATE) + #undef DEF_GET_TE_STATE + #endif + + // Accessors for selected TE material state + // + #define DEF_GET_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \ + static void MaterialMemberFunc(DataType& data, bool& identical) \ + { \ + getTEMaterialValue< DataType, ReturnType, &LLMaterial::##MaterialMemberFunc >(data, identical); \ + } + + // Mutators for selected TE material + // + #define DEF_EDIT_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \ + static void MaterialMemberFunc(LLPanelFace* p,DataType data) \ + { \ + edit< DataType, ReturnType, &LLMaterial::##MaterialMemberFunc >(p,data); \ + } + + + // Accessors for selected TE state proper (legacy settings etc) + // + #define DEF_GET_TE_STATE(DataType,ReturnType,TexEntryMemberFunc) \ + static void TexEntryMemberFunc(DataType& data, bool& identical) \ + { \ + getTEValue< DataType, ReturnType, &LLTextureEntry::##TexEntryMemberFunc >(data, identical); \ + } + + class LLSelectedTEMaterial + { + public: + static void getCurrent(LLMaterialPtr& material_ptr, bool& identical_material); + static void getMaxSpecularRepeats(F32& repeats, bool& identical); + static void getMaxNormalRepeats(F32& repeats, bool& identical); + + DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getNormalID) + DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getSpecularID) + DEF_GET_MAT_STATE(U8,U8,getDiffuseAlphaMode) + + DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatX) + DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatY) + DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetX) + DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetY) + DEF_GET_MAT_STATE(F32,F32,getSpecularRotation) + + DEF_GET_MAT_STATE(F32,F32,getNormalRepeatX) + DEF_GET_MAT_STATE(F32,F32,getNormalRepeatY) + DEF_GET_MAT_STATE(F32,F32,getNormalOffsetX) + DEF_GET_MAT_STATE(F32,F32,getNormalOffsetY) + DEF_GET_MAT_STATE(F32,F32,getNormalRotation) + + DEF_EDIT_MAT_STATE(U8,U8,setDiffuseAlphaMode); + DEF_EDIT_MAT_STATE(U8,U8,setAlphaMaskCutoff); + + DEF_EDIT_MAT_STATE(F32,F32,setNormalOffsetX); + DEF_EDIT_MAT_STATE(F32,F32,setNormalOffsetY); + DEF_EDIT_MAT_STATE(F32,F32,setNormalRepeatX); + DEF_EDIT_MAT_STATE(F32,F32,setNormalRepeatY); + DEF_EDIT_MAT_STATE(F32,F32,setNormalRotation); + + DEF_EDIT_MAT_STATE(F32,F32,setSpecularOffsetX); + DEF_EDIT_MAT_STATE(F32,F32,setSpecularOffsetY); + DEF_EDIT_MAT_STATE(F32,F32,setSpecularRepeatX); + DEF_EDIT_MAT_STATE(F32,F32,setSpecularRepeatY); + DEF_EDIT_MAT_STATE(F32,F32,setSpecularRotation); + + DEF_EDIT_MAT_STATE(U8,U8,setEnvironmentIntensity); + DEF_EDIT_MAT_STATE(U8,U8,setSpecularLightExponent); + + DEF_EDIT_MAT_STATE(LLUUID,const LLUUID&,setNormalID); + DEF_EDIT_MAT_STATE(LLUUID,const LLUUID&,setSpecularID); + DEF_EDIT_MAT_STATE(LLColor4U, const LLColor4U&,setSpecularLightColor); + }; + + class LLSelectedTE + { + public: + + static void getFace(LLFace*& face_to_return, bool& identical_face); + static void getImageFormat(LLGLenum& image_format_to_return, bool& identical_face); + static void getTexId(LLUUID& id, bool& identical); + static void getObjectScaleS(F32& scale_s, bool& identical); + static void getObjectScaleT(F32& scale_t, bool& identical); + static void getMaxDiffuseRepeats(F32& repeats, bool& identical); + + DEF_GET_TE_STATE(U8,U8,getBumpmap) + DEF_GET_TE_STATE(U8,U8,getShiny) + DEF_GET_TE_STATE(U8,U8,getFullbright) + DEF_GET_TE_STATE(F32,F32,getRotation) + DEF_GET_TE_STATE(F32,F32,getOffsetS) + DEF_GET_TE_STATE(F32,F32,getOffsetT) + DEF_GET_TE_STATE(F32,F32,getGlow) + DEF_GET_TE_STATE(LLTextureEntry::e_texgen,LLTextureEntry::e_texgen,getTexGen) + DEF_GET_TE_STATE(LLColor4,const LLColor4&,getColor) + }; }; #endif -- cgit v1.2.3 From 646b8c0c15d26cceb50a1ef97531aef7a610f1a0 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 7 Jun 2013 09:10:33 -0700 Subject: NORSPEC-233 WIP make gcc like it and do some clean-up --- indra/newview/llpanelface.h | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index b93e214326..c178ed783f 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -75,7 +75,7 @@ template< class LLMaterialGetFunctor { public: - LLMaterialGetFunctor() : {} + LLMaterialGetFunctor() {} virtual DataType get(LLMaterialPtr& material) { return (material->*(MaterialGetFunc)); } }; @@ -85,9 +85,8 @@ template< class LLTEGetFunctor { public: - LLTEGetFunctor() : _data(data) {} + LLTEGetFunctor() {} virtual DataType get(LLTextureEntry* entry) { return (entry*(TEGetFunc)); } - DataType _data; }; class LLPanelFace : public LLPanel @@ -348,27 +347,27 @@ private: // Accessors for selected TE material state // - #define DEF_GET_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \ - static void MaterialMemberFunc(DataType& data, bool& identical) \ - { \ - getTEMaterialValue< DataType, ReturnType, &LLMaterial::##MaterialMemberFunc >(data, identical); \ + #define DEF_GET_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \ + static void MaterialMemberFunc(DataType& data, bool& identical) \ + { \ + getTEMaterialValue< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(data, identical); \ } // Mutators for selected TE material // - #define DEF_EDIT_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \ - static void MaterialMemberFunc(LLPanelFace* p,DataType data) \ - { \ - edit< DataType, ReturnType, &LLMaterial::##MaterialMemberFunc >(p,data); \ + #define DEF_EDIT_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \ + static void MaterialMemberFunc(LLPanelFace* p,DataType data) \ + { \ + edit< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(p,data); \ } // Accessors for selected TE state proper (legacy settings etc) // - #define DEF_GET_TE_STATE(DataType,ReturnType,TexEntryMemberFunc) \ - static void TexEntryMemberFunc(DataType& data, bool& identical) \ - { \ - getTEValue< DataType, ReturnType, &LLTextureEntry::##TexEntryMemberFunc >(data, identical); \ + #define DEF_GET_TE_STATE(DataType,ReturnType,TexEntryMemberFunc) \ + static void TexEntryMemberFunc(DataType& data, bool& identical) \ + { \ + getTEValue< DataType, ReturnType, &LLTextureEntry::TexEntryMemberFunc >(data, identical); \ } class LLSelectedTEMaterial -- cgit v1.2.3 From af0cc77199f22c223fcdfb8b46241fb6b81e8e27 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 7 Jun 2013 14:17:13 -0700 Subject: NORSPEC-233 WIP cleanup and fix crasher in templated material get driver func --- indra/newview/llpanelface.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index c178ed783f..d76d940d5c 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -287,7 +287,21 @@ private: { struct GetTEMaterialVal : public LLSelectedTEGetFunctor { - DataType get(LLViewerObject* object, S32 face) { return (object && object->getTE(face)) ? ((object->getTE(face)->getMaterialParams()->*(MaterialGetFunc))()) : DataType(); } + DataType get(LLViewerObject* object, S32 face) + { + DataType ret = DataType(); + LLMaterialPtr material_ptr; + LLTextureEntry* tep = object ? object->getTE(face) : NULL; + if (tep) + { + material_ptr = object->getTE(face)->getMaterialParams(); + if (!material_ptr.isNull()) + { + ret = (material_ptr->*(MaterialGetFunc))(); + } + } + return ret; + } } GetFunc; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetFunc, data_to_return); } -- cgit v1.2.3 From c78cd1aae63a7c7c0bf6a9c21380818aa9cd47b7 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 7 Jun 2013 14:37:39 -0700 Subject: NORSPEC-233 WIP fix completely bogus substitution of offsets for scales and make scale accessors get with the program --- indra/newview/llpanelface.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index d76d940d5c..8d267fe723 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -447,6 +447,8 @@ private: DEF_GET_TE_STATE(F32,F32,getRotation) DEF_GET_TE_STATE(F32,F32,getOffsetS) DEF_GET_TE_STATE(F32,F32,getOffsetT) + DEF_GET_TE_STATE(F32,F32,getScaleS) + DEF_GET_TE_STATE(F32,F32,getScaleT) DEF_GET_TE_STATE(F32,F32,getGlow) DEF_GET_TE_STATE(LLTextureEntry::e_texgen,LLTextureEntry::e_texgen,getTexGen) DEF_GET_TE_STATE(LLColor4,const LLColor4&,getColor) -- cgit v1.2.3 From eba7eb2d062c43cd83cb6972e4e05dc54d409582 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sat, 8 Jun 2013 06:28:48 -0700 Subject: NORSPEC-233 fix default value and material apply logic errors --- indra/newview/llpanelface.h | 111 ++++++++++++++++++++++++++------------------ 1 file changed, 65 insertions(+), 46 deletions(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 8d267fe723..b6a8df19fe 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -235,6 +235,15 @@ private: LLMaterialPtr new_material(!current_material.isNull() ? new LLMaterial(current_material->asLLSD()) : new LLMaterial()); llassert_always(new_material); + // Determine correct alpha mode for current diffuse texture + // (i.e. does it have an alpha channel that makes alpha mode useful) + // + U8 default_alpha_mode = (_panel->isAlpha() ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + + // Default to matching expected state of UI + // + new_material->setDiffuseAlphaMode(default_alpha_mode); + // Do "It"! // _edit->apply(new_material); @@ -243,10 +252,10 @@ private: LLUUID new_normal_map_id = new_material->getNormalID(); LLUUID new_spec_map_id = new_material->getSpecularID(); - bool is_default_blend_mode = (new_alpha_mode == (_panel->isAlpha() ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE)); + bool is_default_blend_mode = (new_alpha_mode == default_alpha_mode); bool is_need_material = !is_default_blend_mode || !new_normal_map_id.isNull() || !new_spec_map_id.isNull(); - if (!current_material.isNull() && !is_need_material) + if (!is_need_material) { LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL; LLMaterialMgr::getInstance()->remove(object->getID(),face); @@ -259,7 +268,6 @@ private: { U8 current_alpha_mode = _panel->getCurrentDiffuseAlphaMode(); U8 current_alpha_mask_cutoff = _panel->getCurrentAlphaMaskCutoff(); - new_material->setDiffuseAlphaMode(current_alpha_mode); new_material->setAlphaMaskCutoff(current_alpha_mask_cutoff); } @@ -283,13 +291,16 @@ private: typename DataType, typename ReturnType, ReturnType (LLMaterial::* const MaterialGetFunc)() const > - static void getTEMaterialValue(DataType& data_to_return, bool& identical) + static void getTEMaterialValue(DataType& data_to_return, bool& identical,DataType default_value) { struct GetTEMaterialVal : public LLSelectedTEGetFunctor { + GetTEMaterialVal(DataType default_value) : _default(default_value) {} + virtual ~GetTEMaterialVal() {} + DataType get(LLViewerObject* object, S32 face) { - DataType ret = DataType(); + DataType ret = _default; LLMaterialPtr material_ptr; LLTextureEntry* tep = object ? object->getTE(face) : NULL; if (tep) @@ -302,7 +313,8 @@ private: } return ret; } - } GetFunc; + DataType _default; + } GetFunc(default_value); identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetFunc, data_to_return); } @@ -310,15 +322,19 @@ private: typename DataType, typename ReturnType, // some kids just have to different... ReturnType (LLTextureEntry::* const TEGetFunc)() const > - static void getTEValue(DataType& data_to_return, bool& identical) + static void getTEValue(DataType& data_to_return, bool& identical, DataType default_value) { struct GetTEVal : public LLSelectedTEGetFunctor { + GetTEVal(DataType default_value) : _default(default_value) {} + virtual ~GetTEVal() {} + DataType get(LLViewerObject* object, S32 face) { LLTextureEntry* tep = object ? object->getTE(face) : NULL; - return tep ? ((tep->*(TEGetFunc))()) : DataType(); + return tep ? ((tep->*(TEGetFunc))()) : _default; } - } GetTEValFunc; + DataType _default; + } GetTEValFunc(default_value); identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetTEValFunc, data_to_return ); } @@ -359,29 +375,32 @@ private: #undef DEF_GET_TE_STATE #endif + #if defined(DEF_EDIT_MAT_STATE) + DEF_EDIT_MAT_STATE + #endif + // Accessors for selected TE material state // - #define DEF_GET_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \ - static void MaterialMemberFunc(DataType& data, bool& identical) \ - { \ - getTEMaterialValue< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(data, identical); \ + #define DEF_GET_MAT_STATE(DataType,ReturnType,MaterialMemberFunc,DefaultValue) \ + static void MaterialMemberFunc(DataType& data, bool& identical) \ + { \ + getTEMaterialValue< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(data, identical,DefaultValue); \ } // Mutators for selected TE material // - #define DEF_EDIT_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \ - static void MaterialMemberFunc(LLPanelFace* p,DataType data) \ - { \ - edit< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(p,data); \ + #define DEF_EDIT_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \ + static void MaterialMemberFunc(LLPanelFace* p,DataType data) \ + { \ + edit< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(p,data); \ } - // Accessors for selected TE state proper (legacy settings etc) // - #define DEF_GET_TE_STATE(DataType,ReturnType,TexEntryMemberFunc) \ - static void TexEntryMemberFunc(DataType& data, bool& identical) \ - { \ - getTEValue< DataType, ReturnType, &LLTextureEntry::TexEntryMemberFunc >(data, identical); \ + #define DEF_GET_TE_STATE(DataType,ReturnType,TexEntryMemberFunc,DefaultValue) \ + static void TexEntryMemberFunc(DataType& data, bool& identical) \ + { \ + getTEValue< DataType, ReturnType, &LLTextureEntry::TexEntryMemberFunc >(data, identical,DefaultValue); \ } class LLSelectedTEMaterial @@ -391,21 +410,21 @@ private: static void getMaxSpecularRepeats(F32& repeats, bool& identical); static void getMaxNormalRepeats(F32& repeats, bool& identical); - DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getNormalID) - DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getSpecularID) - DEF_GET_MAT_STATE(U8,U8,getDiffuseAlphaMode) + DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getNormalID,LLUUID::null) + DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getSpecularID,LLUUID::null) + DEF_GET_MAT_STATE(U8,U8,getDiffuseAlphaMode,LLMaterial::DIFFUSE_ALPHA_MODE_NONE) - DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatX) - DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatY) - DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetX) - DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetY) - DEF_GET_MAT_STATE(F32,F32,getSpecularRotation) + DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatX,1.0f) + DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatY,1.0f) + DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetX,0.0f) + DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetY,0.0f) + DEF_GET_MAT_STATE(F32,F32,getSpecularRotation,0.0f) - DEF_GET_MAT_STATE(F32,F32,getNormalRepeatX) - DEF_GET_MAT_STATE(F32,F32,getNormalRepeatY) - DEF_GET_MAT_STATE(F32,F32,getNormalOffsetX) - DEF_GET_MAT_STATE(F32,F32,getNormalOffsetY) - DEF_GET_MAT_STATE(F32,F32,getNormalRotation) + DEF_GET_MAT_STATE(F32,F32,getNormalRepeatX,1.0f) + DEF_GET_MAT_STATE(F32,F32,getNormalRepeatY,1.0f) + DEF_GET_MAT_STATE(F32,F32,getNormalOffsetX,0.0f) + DEF_GET_MAT_STATE(F32,F32,getNormalOffsetY,0.0f) + DEF_GET_MAT_STATE(F32,F32,getNormalRotation,0.0f) DEF_EDIT_MAT_STATE(U8,U8,setDiffuseAlphaMode); DEF_EDIT_MAT_STATE(U8,U8,setAlphaMaskCutoff); @@ -441,17 +460,17 @@ private: static void getObjectScaleT(F32& scale_t, bool& identical); static void getMaxDiffuseRepeats(F32& repeats, bool& identical); - DEF_GET_TE_STATE(U8,U8,getBumpmap) - DEF_GET_TE_STATE(U8,U8,getShiny) - DEF_GET_TE_STATE(U8,U8,getFullbright) - DEF_GET_TE_STATE(F32,F32,getRotation) - DEF_GET_TE_STATE(F32,F32,getOffsetS) - DEF_GET_TE_STATE(F32,F32,getOffsetT) - DEF_GET_TE_STATE(F32,F32,getScaleS) - DEF_GET_TE_STATE(F32,F32,getScaleT) - DEF_GET_TE_STATE(F32,F32,getGlow) - DEF_GET_TE_STATE(LLTextureEntry::e_texgen,LLTextureEntry::e_texgen,getTexGen) - DEF_GET_TE_STATE(LLColor4,const LLColor4&,getColor) + DEF_GET_TE_STATE(U8,U8,getBumpmap,0) + DEF_GET_TE_STATE(U8,U8,getShiny,0) + DEF_GET_TE_STATE(U8,U8,getFullbright,0) + DEF_GET_TE_STATE(F32,F32,getRotation,0.0f) + DEF_GET_TE_STATE(F32,F32,getOffsetS,0.0f) + DEF_GET_TE_STATE(F32,F32,getOffsetT,0.0f) + DEF_GET_TE_STATE(F32,F32,getScaleS,1.0f) + DEF_GET_TE_STATE(F32,F32,getScaleT,1.0f) + DEF_GET_TE_STATE(F32,F32,getGlow,0.0f) + DEF_GET_TE_STATE(LLTextureEntry::e_texgen,LLTextureEntry::e_texgen,getTexGen,LLTextureEntry::TEX_GEN_DEFAULT) + DEF_GET_TE_STATE(LLColor4,const LLColor4&,getColor,LLColor4::white) }; }; -- cgit v1.2.3 From fba40dc4f72ce2aa2dead5c46c1c9dbc18c13866 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sat, 8 Jun 2013 07:25:47 -0700 Subject: NORSPEC-226 NORSPEC-222 fix menu content bugs and alpha mask stomp when editing multiple objects --- indra/newview/llpanelface.h | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index b6a8df19fe..84aba4dc89 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -242,7 +242,7 @@ private: // Default to matching expected state of UI // - new_material->setDiffuseAlphaMode(default_alpha_mode); + new_material->setDiffuseAlphaMode(current_material.isNull() ? default_alpha_mode : current_material->getDiffuseAlphaMode()); // Do "It"! // @@ -262,16 +262,6 @@ private: } else { - // Replicate old init behavior - // - if (current_material.isNull()) - { - U8 current_alpha_mode = _panel->getCurrentDiffuseAlphaMode(); - U8 current_alpha_mask_cutoff = _panel->getCurrentAlphaMaskCutoff(); - new_material->setDiffuseAlphaMode(current_alpha_mode); - new_material->setAlphaMaskCutoff(current_alpha_mask_cutoff); - } - LL_DEBUGS("Materials") << "Putting material on object " << object->getID() << " face " << face << ", material: " << new_material->asLLSD() << LL_ENDL; LLMaterialMgr::getInstance()->put(object->getID(),face,*new_material); } -- cgit v1.2.3 From a4676adebbfb35a0d126c5ae78cd38edb816f6da Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 10 Jun 2013 15:49:09 -0700 Subject: NORSPEC-251 fix issues with not binning objects changed from having a material to using legacy bumps causing incorrect rendering --- indra/newview/llpanelface.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 84aba4dc89..2dd24f4376 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -258,7 +258,8 @@ private: if (!is_need_material) { LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL; - LLMaterialMgr::getInstance()->remove(object->getID(),face); + LLMaterialMgr::getInstance()->remove(object->getID(),face); + object->setTEMaterialID(face, LLMaterialID::null); } else { -- cgit v1.2.3 From e666725f9d71d8a72db3321cb6c88713c31d8430 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 10 Jun 2013 18:49:50 -0700 Subject: NORSPEC-257 fix alpha mode display incorrect default when alpha is present in tex --- indra/newview/llpanelface.h | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 2dd24f4376..79e6898e49 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -284,29 +284,31 @@ private: ReturnType (LLMaterial::* const MaterialGetFunc)() const > static void getTEMaterialValue(DataType& data_to_return, bool& identical,DataType default_value) { - struct GetTEMaterialVal : public LLSelectedTEGetFunctor - { - GetTEMaterialVal(DataType default_value) : _default(default_value) {} - virtual ~GetTEMaterialVal() {} + DataType data_value; + struct GetTEMaterialVal : public LLSelectedTEGetFunctor + { + GetTEMaterialVal(DataType default_value) : _default(default_value) {} + virtual ~GetTEMaterialVal() {} - DataType get(LLViewerObject* object, S32 face) + DataType get(LLViewerObject* object, S32 face) + { + DataType ret = _default; + LLMaterialPtr material_ptr; + LLTextureEntry* tep = object ? object->getTE(face) : NULL; + if (tep) { - DataType ret = _default; - LLMaterialPtr material_ptr; - LLTextureEntry* tep = object ? object->getTE(face) : NULL; - if (tep) + material_ptr = object->getTE(face)->getMaterialParams(); + if (!material_ptr.isNull()) { - material_ptr = object->getTE(face)->getMaterialParams(); - if (!material_ptr.isNull()) - { - ret = (material_ptr->*(MaterialGetFunc))(); - } + ret = (material_ptr->*(MaterialGetFunc))(); } - return ret; } - DataType _default; - } GetFunc(default_value); - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetFunc, data_to_return); + return ret; + } + DataType _default; + } GetFunc(default_value); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetFunc, data_value); + data_to_return = data_value; } template< @@ -315,6 +317,7 @@ private: ReturnType (LLTextureEntry::* const TEGetFunc)() const > static void getTEValue(DataType& data_to_return, bool& identical, DataType default_value) { + DataType data_value; struct GetTEVal : public LLSelectedTEGetFunctor { GetTEVal(DataType default_value) : _default(default_value) {} @@ -326,7 +329,8 @@ private: } DataType _default; } GetTEValFunc(default_value); - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetTEValFunc, data_to_return ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetTEValFunc, data_value ); + data_to_return = data_value; } // Update vis and enabling of specific subsets of controls based on material params -- cgit v1.2.3 From 87946113cc2a6f0d60c11275bf4aa168c2ea19d6 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 11 Jun 2013 12:48:59 -0700 Subject: NORSPEC-257 can't use automated TEMaterialGet functor as we need two possible defaults for diffuse alpha mode based on the alpha content of the diffuse texture --- indra/newview/llpanelface.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 79e6898e49..c6a53b6aef 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -297,8 +297,8 @@ private: LLTextureEntry* tep = object ? object->getTE(face) : NULL; if (tep) { - material_ptr = object->getTE(face)->getMaterialParams(); - if (!material_ptr.isNull()) + material_ptr = tep->getMaterialParams(); + if (!material_ptr.isNull() && !tep->getMaterialID().isNull()) { ret = (material_ptr->*(MaterialGetFunc))(); } @@ -404,11 +404,10 @@ private: static void getCurrent(LLMaterialPtr& material_ptr, bool& identical_material); static void getMaxSpecularRepeats(F32& repeats, bool& identical); static void getMaxNormalRepeats(F32& repeats, bool& identical); + static void getCurrentDiffuseAlphaMode(U8& diffuse_alpha_mode, bool& identical, bool diffuse_texture_has_alpha); DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getNormalID,LLUUID::null) DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getSpecularID,LLUUID::null) - DEF_GET_MAT_STATE(U8,U8,getDiffuseAlphaMode,LLMaterial::DIFFUSE_ALPHA_MODE_NONE) - DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatX,1.0f) DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatY,1.0f) DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetX,0.0f) -- cgit v1.2.3 From 96f7f6d01bb652fb049cd64b55b2933aa436f9d2 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 11 Jun 2013 17:18:20 -0700 Subject: NORSPEC-258 and NORSPEC-226 make tex picker close refresh build tool UI correctly and fix issues with transition from no-bumps to normal maps --- indra/newview/llpanelface.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index c6a53b6aef..222f8f3688 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -132,6 +132,8 @@ protected: void onCancelColor(const LLSD& data); void onSelectColor(const LLSD& data); + void onCloseTexturePicker(const LLSD& data); + // Make UI reflect state of currently selected material (refresh) // and UI mode (e.g. editing normal map v diffuse map) // @@ -298,7 +300,7 @@ private: if (tep) { material_ptr = tep->getMaterialParams(); - if (!material_ptr.isNull() && !tep->getMaterialID().isNull()) + if (!material_ptr.isNull()) { ret = (material_ptr->*(MaterialGetFunc))(); } -- cgit v1.2.3 From b60ea52902c86302bc39bb3812b4d0711eaa9bef Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 12 Jun 2013 14:08:16 -0700 Subject: NORSPEC-251 fixed and 258 not regressed --- indra/newview/llpanelface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 222f8f3688..a324be7e7e 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -300,7 +300,7 @@ private: if (tep) { material_ptr = tep->getMaterialParams(); - if (!material_ptr.isNull()) + if (!material_ptr.isNull() && !tep->getMaterialID().isNull()) { ret = (material_ptr->*(MaterialGetFunc))(); } -- cgit v1.2.3 From 8ad2c0b8fbd586a8a9c4f090180c45eef1810a65 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 12 Jun 2013 15:01:23 -0700 Subject: NORSPEC-260 fix issues with OK after pressing none being intepreted as add a null normal map --- indra/newview/llpanelface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index a324be7e7e..222f8f3688 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -300,7 +300,7 @@ private: if (tep) { material_ptr = tep->getMaterialParams(); - if (!material_ptr.isNull() && !tep->getMaterialID().isNull()) + if (!material_ptr.isNull()) { ret = (material_ptr->*(MaterialGetFunc))(); } -- cgit v1.2.3 From f04e9363b9daca52c1fd2e675c2646f7e1d05054 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 14 Jun 2013 09:41:33 -0700 Subject: NORSPEC-266 fix issues with observer feedback on edits of material map parameters --- indra/newview/llpanelface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 222f8f3688..42c1f6bd48 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -261,7 +261,7 @@ private: { LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL; LLMaterialMgr::getInstance()->remove(object->getID(),face); - object->setTEMaterialID(face, LLMaterialID::null); + new_material = NULL; } else { -- cgit v1.2.3