summaryrefslogtreecommitdiff
path: root/indra/newview/llpaneleditwearable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpaneleditwearable.cpp')
-rw-r--r--indra/newview/llpaneleditwearable.cpp98
1 files changed, 63 insertions, 35 deletions
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index 6a983245e4..a90c17f56e 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -48,6 +48,7 @@
#include "llscrollingpanelparam.h"
#include "llradiogroup.h"
#include "llnotificationsutil.h"
+#include "lliconctrl.h"
#include "llcolorswatch.h"
#include "lltexturectrl.h"
@@ -299,16 +300,16 @@ LLEditWearableDictionary::Subparts::Subparts()
addEntry(SUBPART_UNDERSHIRT, new SubpartEntry(SUBPART_UNDERSHIRT, "mTorso", "undershirt", "undershirt_main_param_list", "undershirt_main_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(-1.f, 0.15f, 0.3f),SEX_BOTH));
addEntry(SUBPART_UNDERPANTS, new SubpartEntry(SUBPART_UNDERPANTS, "mPelvis", "underpants", "underpants_main_param_list", "underpants_main_tab", LLVector3d(0.f, 0.f, -0.5f), LLVector3d(-1.6f, 0.15f, -0.5f),SEX_BOTH));
addEntry(SUBPART_SKIRT, new SubpartEntry(SUBPART_SKIRT, "mPelvis", "skirt", "skirt_main_param_list", "skirt_main_tab", LLVector3d(0.f, 0.f, -0.5f), LLVector3d(-1.6f, 0.15f, -0.5f),SEX_BOTH));
- addEntry(SUBPART_ALPHA, new SubpartEntry(SUBPART_ALPHA, "mPelvis", "alpha", "alpha_main_param_list", "alpha_main_tab", LLVector3d(0.f, 0.f, 0.1f), LLVector3d(-2.5f, 0.5f, 0.8f),SEX_BOTH));
- addEntry(SUBPART_TATTOO, new SubpartEntry(SUBPART_TATTOO, "mPelvis", "tattoo", "tattoo_main_param_list", "tattoo_main_tab", LLVector3d(0.f, 0.f, 0.1f), LLVector3d(-2.5f, 0.5f, 0.8f),SEX_BOTH));
- addEntry(SUBPART_UNIVERSAL, new SubpartEntry(SUBPART_UNIVERSAL, "mPelvis", "universal", "universal_main_param_list", "universal_main_tab", LLVector3d(0.f, 0.f, 0.1f), LLVector3d(-2.5f, 0.5f, 0.8f), SEX_BOTH));
+ addEntry(SUBPART_ALPHA, new SubpartEntry(SUBPART_ALPHA, "mPelvis", "alpha", "", "", LLVector3d(0.f, 0.f, 0.1f), LLVector3d(-2.5f, 0.5f, 0.8f),SEX_BOTH));
+ addEntry(SUBPART_TATTOO, new SubpartEntry(SUBPART_TATTOO, "mPelvis", "tattoo", "", "", LLVector3d(0.f, 0.f, 0.1f), LLVector3d(-2.5f, 0.5f, 0.8f),SEX_BOTH));
+ addEntry(SUBPART_UNIVERSAL, new SubpartEntry(SUBPART_UNIVERSAL, "mPelvis", "universal", "", "", LLVector3d(0.f, 0.f, 0.1f), LLVector3d(-2.5f, 0.5f, 0.8f), SEX_BOTH));
// WT_PHYSICS
addEntry(SUBPART_PHYSICS_BREASTS_UPDOWN, new SubpartEntry(SUBPART_PHYSICS_BREASTS_UPDOWN, "mTorso", "physics_breasts_updown", "physics_breasts_updown_param_list", "physics_breasts_updown_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f), SEX_FEMALE));
addEntry(SUBPART_PHYSICS_BREASTS_INOUT, new SubpartEntry(SUBPART_PHYSICS_BREASTS_INOUT, "mTorso", "physics_breasts_inout", "physics_breasts_inout_param_list", "physics_breasts_inout_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_FEMALE));
addEntry(SUBPART_PHYSICS_BREASTS_LEFTRIGHT, new SubpartEntry(SUBPART_PHYSICS_BREASTS_LEFTRIGHT, "mTorso", "physics_breasts_leftright", "physics_breasts_leftright_param_list", "physics_breasts_leftright_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_FEMALE));
- addEntry(SUBPART_PHYSICS_BELLY_UPDOWN, new SubpartEntry(SUBPART_PHYSICS_BELLY_UPDOWN, "mTorso", "physics_belly_updown", "physics_belly_updown_param_list", "physics_belly_updown_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH));
- addEntry(SUBPART_PHYSICS_BUTT_UPDOWN, new SubpartEntry(SUBPART_PHYSICS_BUTT_UPDOWN, "mTorso", "physics_butt_updown", "physics_butt_updown_param_list", "physics_butt_updown_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH));
+ addEntry(SUBPART_PHYSICS_BELLY_UPDOWN, new SubpartEntry(SUBPART_PHYSICS_BELLY_UPDOWN, "mTorso", "physics_belly_updown", "physics_belly_updown_param_list", "physics_belly_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH));
+ addEntry(SUBPART_PHYSICS_BUTT_UPDOWN, new SubpartEntry(SUBPART_PHYSICS_BUTT_UPDOWN, "mTorso", "physics_butt_updown", "physics_butt_updown_param_list", "physics_butt_tab", LLVector3d(0.f, 0.f, 0.3f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH));
addEntry(SUBPART_PHYSICS_BUTT_LEFTRIGHT, new SubpartEntry(SUBPART_PHYSICS_BUTT_LEFTRIGHT, "mTorso", "physics_butt_leftright", "physics_butt_leftright_param_list", "physics_butt_leftright_tab", LLVector3d(0.f, 0.f, 0.f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH));
addEntry(SUBPART_PHYSICS_ADVANCED, new SubpartEntry(SUBPART_PHYSICS_ADVANCED, "mTorso", "physics_advanced", "physics_advanced_param_list", "physics_advanced_tab", LLVector3d(0.f, 0.f, 0.f), LLVector3d(0.f, 0.f, 0.f),SEX_BOTH));
}
@@ -727,8 +728,14 @@ bool LLPanelEditWearable::postBuild()
mPanelTitle = getChild<LLTextBox>("edit_wearable_title");
mDescTitle = getChild<LLTextBox>("description_text");
- getChild<LLRadioGroup>("sex_radio")->setCommitCallback(boost::bind(&LLPanelEditWearable::onCommitSexChange, this));
- getChild<LLButton>("save_as_button")->setCommitCallback(boost::bind(&LLPanelEditWearable::onSaveAsButtonClicked, this));
+ mSexRadio = getChild<LLRadioGroup>("sex_radio");
+ mSexRadio->setCommitCallback(boost::bind(&LLPanelEditWearable::onCommitSexChange, this));
+
+ mMaleIcon = getChild<LLIconCtrl>("male_icon");
+ mFemaleIcon = getChild<LLIconCtrl>("female_icon");
+
+ mBtnSaveAs = getChild<LLButton>("save_as_button");
+ mBtnSaveAs->setCommitCallback(boost::bind(&LLPanelEditWearable::onSaveAsButtonClicked, this));
// The following panels will be shown/hidden based on what wearable we're editing
// body parts
@@ -794,16 +801,32 @@ bool LLPanelEditWearable::postBuild()
continue;
}
- const std::string accordion_tab = subpart_entry->mAccordionTab;
- LLAccordionCtrlTab *tab = getChild<LLAccordionCtrlTab>(accordion_tab);
+ const std::string& accordion_tab = subpart_entry->mAccordionTab;
+ if (accordion_tab.empty())
+ {
+ continue;
+ }
+ LLAccordionCtrlTab *tab = findChild<LLAccordionCtrlTab>(accordion_tab);
if (!tab)
{
LL_WARNS() << "could not get llaccordionctrltab from UI with name: " << accordion_tab << LL_ENDL;
continue;
}
+ mAccordionTabs.emplace(accordion_tab, tab);
+
// initialize callback to ensure camera view changes appropriately.
tab->setDropDownStateChangedCallback(boost::bind(&LLPanelEditWearable::onTabExpandedCollapsed,this,_2,index));
+
+ const std::string& scrolling_panel = subpart_entry->mParamList;
+ if (!scrolling_panel.empty())
+ {
+ LLScrollingPanelList* panel_list = tab->findChild<LLScrollingPanelList>(scrolling_panel);
+ if (panel_list)
+ {
+ mParamPanels.emplace(scrolling_panel, panel_list);
+ }
+ }
}
// initialize texture and color picker controls
@@ -1199,23 +1222,29 @@ void LLPanelEditWearable::showWearable(LLViewerWearable* wearable, bool show, bo
continue;
}
- const std::string scrolling_panel = subpart_entry->mParamList;
- const std::string accordion_tab = subpart_entry->mAccordionTab;
+ const std::string& scrolling_panel = subpart_entry->mParamList;
+ const std::string& accordion_tab = subpart_entry->mAccordionTab;
- LLScrollingPanelList *panel_list = getChild<LLScrollingPanelList>(scrolling_panel);
- LLAccordionCtrlTab *tab = getChild<LLAccordionCtrlTab>(accordion_tab);
+ if (scrolling_panel.empty() || accordion_tab.empty())
+ {
+ continue;
+ }
- if (!panel_list)
+ auto accord_it = mAccordionTabs.find(accordion_tab);
+ if (accord_it == mAccordionTabs.end())
{
- LL_WARNS() << "could not get scrolling panel list: " << scrolling_panel << LL_ENDL;
- continue;
+ LL_WARNS() << "could not get llaccordionctrltab from UI with name: " << accordion_tab << LL_ENDL;
+ continue;
}
+ LLAccordionCtrlTab* tab = accord_it->second;
- if (!tab)
+ auto panel_it = mParamPanels.find(scrolling_panel);
+ if (panel_it == mParamPanels.end())
{
- LL_WARNS() << "could not get llaccordionctrltab from UI with name: " << accordion_tab << LL_ENDL;
- continue;
+ LL_WARNS() << "could not get scrolling panel list: " << scrolling_panel << LL_ENDL;
+ continue;
}
+ LLScrollingPanelList *panel_list = panel_it->second;
// Don't show female subparts if you're not female, etc.
if (!(gAgentAvatarp->getSex() & subpart_entry->mSex))
@@ -1229,7 +1258,7 @@ void LLPanelEditWearable::showWearable(LLViewerWearable* wearable, bool show, bo
}
// what edit group do we want to extract params for?
- const std::string edit_group = subpart_entry->mEditGroup;
+ const std::string& edit_group = subpart_entry->mEditGroup;
// storage for ordered list of visual params
value_map_t sorted_params;
@@ -1329,9 +1358,9 @@ void LLPanelEditWearable::toggleTypeSpecificControls(LLWearableType::EType type)
// Toggle controls specific to shape editing panel.
{
bool is_shape = (type == LLWearableType::WT_SHAPE);
- getChildView("sex_radio")->setVisible( is_shape);
- getChildView("female_icon")->setVisible( is_shape);
- getChildView("male_icon")->setVisible( is_shape);
+ mSexRadio->setVisible(is_shape);
+ mFemaleIcon->setVisible(is_shape);
+ mMaleIcon->setVisible(is_shape);
}
}
@@ -1392,15 +1421,15 @@ void LLPanelEditWearable::updateScrollingPanelUI()
ESubpart subpart_e = wearable_entry->mSubparts[index];
const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e);
- const std::string scrolling_panel = subpart_entry->mParamList;
+ const std::string& scrolling_panel = subpart_entry->mParamList;
- LLScrollingPanelList *panel_list = getChild<LLScrollingPanelList>(scrolling_panel);
-
- if (!panel_list)
+ auto panel_it = mParamPanels.find(scrolling_panel);
+ if (panel_it == mParamPanels.end())
{
- LL_WARNS() << "could not get scrolling panel list: " << scrolling_panel << LL_ENDL;
- continue;
+ LL_WARNS() << "could not get scrolling panel list: " << scrolling_panel << LL_ENDL;
+ continue;
}
+ LLScrollingPanelList* panel_list = panel_it->second;
panel_list->updatePanels(true);
}
@@ -1534,7 +1563,7 @@ void LLPanelEditWearable::updateVerbs()
bool is_dirty = isDirty();
mBtnRevert->setEnabled(is_dirty);
- getChildView("save_as_button")->setEnabled(is_dirty && can_copy);
+ mBtnSaveAs->setEnabled(is_dirty && can_copy);
if (isAgentAvatarValid())
{
@@ -1572,7 +1601,7 @@ void LLPanelEditWearable::configureAlphaCheckbox(LLAvatarAppearanceDefines::ETex
LLCheckBoxCtrl* checkbox = mPanelAlpha->getChild<LLCheckBoxCtrl>(name);
checkbox->setCommitCallback(boost::bind(&LLPanelEditWearable::onInvisibilityCommit, this, checkbox, te));
- mAlphaCheckbox2Index[name] = te;
+ mAlphaCheckbox2Index.push_back(std::make_pair(checkbox,te));
}
void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLAvatarAppearanceDefines::ETextureIndex te)
@@ -1629,11 +1658,10 @@ void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LL
void LLPanelEditWearable::updateAlphaCheckboxes()
{
- for (string_texture_index_map_t::iterator iter = mAlphaCheckbox2Index.begin();
- iter != mAlphaCheckbox2Index.end(); ++iter )
+ for (const auto& check_pair : mAlphaCheckbox2Index)
{
- LLAvatarAppearanceDefines::ETextureIndex te = (LLAvatarAppearanceDefines::ETextureIndex)iter->second;
- LLCheckBoxCtrl* ctrl = mPanelAlpha->getChild<LLCheckBoxCtrl>(iter->first);
+ LLAvatarAppearanceDefines::ETextureIndex te = (LLAvatarAppearanceDefines::ETextureIndex)check_pair.second;
+ LLCheckBoxCtrl* ctrl = check_pair.first;
if (ctrl)
{
ctrl->set(!gAgentAvatarp->isTextureVisible(te, mWearablePtr));