summaryrefslogtreecommitdiff
path: root/indra/newview/llpaneleditwearable.cpp
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-05-19 10:04:23 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-05-19 10:04:23 +0100
commit02fe5d60c0a6664bb86254347ce31467da2d90c3 (patch)
treefe1420806e453a14a63b4f16ad2d566a8c9a0d1a /indra/newview/llpaneleditwearable.cpp
parentcd0ab5b41eda85b9cb4855f61c3f7e4ca5150797 (diff)
parentb550bb0f09197c35b80d18d540761a7831c3e89b (diff)
merge from viewer-public
Diffstat (limited to 'indra/newview/llpaneleditwearable.cpp')
-rw-r--r--indra/newview/llpaneleditwearable.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index 557fb399be..5ad68ea4db 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -50,6 +50,7 @@
#include "llaccordionctrltab.h"
#include "llagentwearables.h"
#include "llscrollingpanelparam.h"
+#include "llradiogroup.h"
#include "llcolorswatch.h"
#include "lltexturectrl.h"
@@ -615,6 +616,8 @@ BOOL LLPanelEditWearable::postBuild()
mPanelTitle = getChild<LLTextBox>("edit_wearable_title");
mDescTitle = getChild<LLTextBox>("description_text");
+ getChild<LLRadioGroup>("sex_radio")->setCommitCallback(boost::bind(&LLPanelEditWearable::onCommitSexChange, this));
+
// The following panels will be shown/hidden based on what wearable we're editing
// body parts
mPanelShape = getChild<LLPanel>("edit_shape_panel");
@@ -687,6 +690,40 @@ void LLPanelEditWearable::onRevertButtonClicked(void* userdata)
panel->revertChanges();
}
+
+void LLPanelEditWearable::onCommitSexChange()
+{
+ if (!isAgentAvatarValid()) return;
+
+ LLWearableType::EType type = mWearablePtr->getType();
+ U32 index = gAgentWearables.getWearableIndex(mWearablePtr);
+
+ if( !gAgentWearables.isWearableModifiable(type, index))
+ {
+ return;
+ }
+
+ LLViewerVisualParam* param = static_cast<LLViewerVisualParam*>(gAgentAvatarp->getVisualParam( "male" ));
+ if( !param )
+ {
+ return;
+ }
+
+ bool is_new_sex_male = (gSavedSettings.getU32("AvatarSex") ? SEX_MALE : SEX_FEMALE) == SEX_MALE;
+ LLWearable* wearable = gAgentWearables.getWearable(type, index);
+ if (wearable)
+ {
+ wearable->setVisualParamWeight(param->getID(), is_new_sex_male, FALSE);
+ }
+ param->setWeight( is_new_sex_male, FALSE );
+
+ gAgentAvatarp->updateSexDependentLayerSets( FALSE );
+
+ gAgentAvatarp->updateVisualParams();
+
+ updateScrollingPanelUI();
+}
+
void LLPanelEditWearable::onTexturePickerCommit(const LLUICtrl* ctrl)
{
const LLTextureCtrl* texture_ctrl = dynamic_cast<const LLTextureCtrl*>(ctrl);
@@ -1118,6 +1155,14 @@ void LLPanelEditWearable::updateVerbs()
mBtnRevert->setEnabled(is_dirty);
childSetEnabled("save_as_button", is_dirty && can_copy);
+
+ if(isAgentAvatarValid())
+ {
+ // Update viewer's radio buttons (of RadioGroup with control_name="AvatarSex") of Avatar's gender
+ // with value from "AvatarSex" setting
+ gSavedSettings.setU32("AvatarSex", (gAgentAvatarp->getSex() == SEX_MALE) );
+ }
+
}
// EOF