diff options
author | Leyla Farazha <leyla@lindenlab.com> | 2010-06-04 13:23:12 -0700 |
---|---|---|
committer | Leyla Farazha <leyla@lindenlab.com> | 2010-06-04 13:23:12 -0700 |
commit | b1b4e56bcec6718a971f01d51ffe4363e8fba9ac (patch) | |
tree | 82b763d1ed3782fe9ec3f6f0c5f17f2bc0abf7a3 /indra/newview/llpaneleditwearable.cpp | |
parent | c393383f4463f40e4574968c0b440c51022be7b9 (diff) | |
parent | 6d840687a5306f9234444ed1bde1f6b877da3996 (diff) |
Merge
Diffstat (limited to 'indra/newview/llpaneleditwearable.cpp')
-rw-r--r-- | indra/newview/llpaneleditwearable.cpp | 206 |
1 files changed, 109 insertions, 97 deletions
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 527a432a80..6a84886e3b 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -521,7 +521,8 @@ static void init_color_swatch_ctrl(LLPanelEditWearable* self, LLPanel* panel, co LLColorSwatchCtrl* color_swatch_ctrl = panel->getChild<LLColorSwatchCtrl>(entry->mControlName); if (color_swatch_ctrl) { - color_swatch_ctrl->setOriginal(self->getWearable()->getClothesColor(entry->mTextureIndex)); + // Can't get the color from the wearable here, since the wearable may not be set when this is called. + color_swatch_ctrl->setOriginal(LLColor4::white); } } @@ -656,6 +657,49 @@ BOOL LLPanelEditWearable::postBuild() configureAlphaCheckbox(LLVOAvatarDefines::TEX_EYES_ALPHA, "eye alpha texture invisible"); configureAlphaCheckbox(LLVOAvatarDefines::TEX_HAIR_ALPHA, "hair alpha texture invisible"); + // configure tab expanded callbacks + for (U32 type_index = 0; type_index < (U32)LLWearableType::WT_COUNT; ++type_index) + { + LLWearableType::EType type = (LLWearableType::EType) type_index; + const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type); + if (!wearable_entry) + { + llwarns << "could not get wearable dictionary entry for wearable of type: " << type << llendl; + continue; + } + U8 num_subparts = wearable_entry->mSubparts.size(); + + for (U8 index = 0; index < num_subparts; ++index) + { + // dive into data structures to get the panel we need + ESubpart subpart_e = wearable_entry->mSubparts[index]; + const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e); + + if (!subpart_entry) + { + llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl; + continue; + } + + const std::string accordion_tab = subpart_entry->mAccordionTab; + + LLAccordionCtrlTab *tab = getChild<LLAccordionCtrlTab>(accordion_tab); + + if (!tab) + { + llwarns << "could not get llaccordionctrltab from UI with name: " << accordion_tab << llendl; + continue; + } + + // initialize callback to ensure camera view changes appropriately. + tab->setDropDownStateChangedCallback(boost::bind(&LLPanelEditWearable::onTabExpandedCollapsed,this,_2,index)); + } + + // initialize texture and color picker controls + for_each_picker_ctrl_entry <LLColorSwatchCtrl> (getPanel(type), type, boost::bind(init_color_swatch_ctrl, this, _1, _2)); + for_each_picker_ctrl_entry <LLTextureCtrl> (getPanel(type), type, boost::bind(init_texture_ctrl, this, _1, _2)); + } + return TRUE; } @@ -692,10 +736,9 @@ void LLPanelEditWearable::setWearable(LLWearable *wearable) showWearable(mWearablePtr, FALSE); mWearablePtr = wearable; showWearable(mWearablePtr, TRUE); - - initializePanel(); } + //static void LLPanelEditWearable::onRevertButtonClicked(void* userdata) { @@ -904,29 +947,83 @@ void LLPanelEditWearable::showWearable(LLWearable* wearable, BOOL show) std::string title; std::string description_title; - const LLEditWearableDictionary::WearableEntry *entry = LLEditWearableDictionary::getInstance()->getWearable(type); - if (!entry) + const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type); + if (!wearable_entry) { llwarns << "called LLPanelEditWearable::showWearable with an invalid wearable type! (" << type << ")" << llendl; return; } targetPanel = getPanel(type); - title = getString(entry->mTitle); - description_title = getString(entry->mDescTitle); + title = getString(wearable_entry->mTitle); + description_title = getString(wearable_entry->mDescTitle); + + // Update picker controls state + for_each_picker_ctrl_entry <LLColorSwatchCtrl> (targetPanel, type, boost::bind(set_enabled_color_swatch_ctrl, show, _1, _2)); + for_each_picker_ctrl_entry <LLTextureCtrl> (targetPanel, type, boost::bind(set_enabled_texture_ctrl, show, _1, _2)); targetPanel->setVisible(show); + toggleTypeSpecificControls(type); + if (show) { mPanelTitle->setText(title); mDescTitle->setText(description_title); - } + + // set name + mTextEditor->setText(wearable->getName()); - // Update picker controls state - for_each_picker_ctrl_entry <LLColorSwatchCtrl> (targetPanel, type, boost::bind(set_enabled_color_swatch_ctrl, show, _1, _2)); - for_each_picker_ctrl_entry <LLTextureCtrl> (targetPanel, type, boost::bind(set_enabled_texture_ctrl, show, _1, _2)); + updatePanelPickerControls(type); + updateTypeSpecificControls(type); - showDefaultSubpart(); + // clear and rebuild visual param list + U8 num_subparts = wearable_entry->mSubparts.size(); + + for (U8 index = 0; index < num_subparts; ++index) + { + // dive into data structures to get the panel we need + ESubpart subpart_e = wearable_entry->mSubparts[index]; + const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e); + + if (!subpart_entry) + { + llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl; + continue; + } + + 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 (!panel_list) + { + llwarns << "could not get scrolling panel list: " << scrolling_panel << llendl; + continue; + } + + if (!tab) + { + llwarns << "could not get llaccordionctrltab from UI with name: " << accordion_tab << llendl; + continue; + } + + // what edit group do we want to extract params for? + const std::string edit_group = subpart_entry->mEditGroup; + + // storage for ordered list of visual params + value_map_t sorted_params; + getSortedParams(sorted_params, edit_group); + + buildParamList(panel_list, sorted_params, tab); + + updateScrollingPanelUI(); + } + showDefaultSubpart(); + + updateVerbs(); + } } void LLPanelEditWearable::showDefaultSubpart() @@ -991,91 +1088,6 @@ void LLPanelEditWearable::updateScrollingPanelList() updateScrollingPanelUI(); } -void LLPanelEditWearable::initializePanel() -{ - if (!mWearablePtr) - { - // cannot initialize with a null reference. - return; - } - - LLWearableType::EType type = mWearablePtr->getType(); - - // set name - mTextEditor->setText(mWearablePtr->getName()); - - // toggle wearable type-specific controls - toggleTypeSpecificControls(type); - - // clear and rebuild visual param list - const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type); - if (!wearable_entry) - { - llwarns << "could not get wearable dictionary entry for wearable of type: " << type << llendl; - return; - } - U8 num_subparts = wearable_entry->mSubparts.size(); - - for (U8 index = 0; index < num_subparts; ++index) - { - // dive into data structures to get the panel we need - ESubpart subpart_e = wearable_entry->mSubparts[index]; - const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e); - - if (!subpart_entry) - { - llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl; - continue; - } - - 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 (!panel_list) - { - llwarns << "could not get scrolling panel list: " << scrolling_panel << llendl; - continue; - } - - if (!tab) - { - llwarns << "could not get llaccordionctrltab from UI with name: " << accordion_tab << llendl; - continue; - } - - // what edit group do we want to extract params for? - const std::string edit_group = subpart_entry->mEditGroup; - - // initialize callback to ensure camera view changes appropriately. - tab->setDropDownStateChangedCallback(boost::bind(&LLPanelEditWearable::onTabExpandedCollapsed,this,_2,index)); - - // storage for ordered list of visual params - value_map_t sorted_params; - getSortedParams(sorted_params, edit_group); - - buildParamList(panel_list, sorted_params, tab); - - updateScrollingPanelUI(); - } - - // initialize texture and color picker controls - for_each_picker_ctrl_entry <LLColorSwatchCtrl> (getPanel(type), type, boost::bind(init_color_swatch_ctrl, this, _1, _2)); - for_each_picker_ctrl_entry <LLTextureCtrl> (getPanel(type), type, boost::bind(init_texture_ctrl, this, _1, _2)); - - showDefaultSubpart(); - updateVerbs(); - - if (getWearable()) - { - LLWearableType::EType type = getWearable()->getType(); - updatePanelPickerControls(type); - updateTypeSpecificControls(type); - } -} - void LLPanelEditWearable::toggleTypeSpecificControls(LLWearableType::EType type) { // Toggle controls specific to shape editing panel. |