From 453386a49ac98733e7c77f97662016ffc9741025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Liru=20F=C3=A6rs?= Date: Mon, 14 Oct 2019 22:05:53 -0400 Subject: [PATCH] Prevent warnings about missing ui from places it would never be Layer interaction buttons for single layer wearable types Buttons for subparts in types with only a single subpart Take Off button for body parts --- indra/newview/llpaneleditwearable.cpp | 65 ++++++++++++------- .../default/xui/en-us/floater_customize.xml | 4 -- 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index cc5de6817..52370d119 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -712,19 +712,28 @@ BOOL LLPanelEditWearable::postBuild() mCreateNew = getChild("Create New"); mCreateNew->setCommitCallback(boost::bind(&LLPanelEditWearable::onBtnCreateNew, this)); - mCreateNewLayer = getChild("New Layer"); - mCreateNewLayer->setCommitCallback(boost::bind(&LLPanelEditWearable::onBtnCreateNew, this)); + if (mCreateNewLayer = findChild("New Layer")) + { + mCreateNewLayer->setCommitCallback(boost::bind(&LLPanelEditWearable::onBtnCreateNew, this)); + } - mTakeOff = getChild("Take Off"); - // If PG, can't take off underclothing or shirt - mCanTakeOff = !(gAgent.isTeen() && (mType == LLWearableType::WT_UNDERSHIRT || mType == LLWearableType::WT_UNDERPANTS) ); - mTakeOff->setVisible(mCanTakeOff); - mTakeOff->setCommitCallback(boost::bind(&LLPanelEditWearable::onBtnTakeOff, this)); + if (mTakeOff = findChild("Take Off")) + { + // If PG, can't take off underclothing or shirt + mCanTakeOff = !(gAgent.isTeen() && (mType == LLWearableType::WT_UNDERSHIRT || mType == LLWearableType::WT_UNDERPANTS) ); + mTakeOff->setVisible(mCanTakeOff); + mTakeOff->setCommitCallback(boost::bind(&LLPanelEditWearable::onBtnTakeOff, this)); + } - mArrowLeft = getChild("Arrow Left"); - mArrowLeft->setCommitCallback(boost::bind(&LLPanelEditWearable::onMoveToLayer, this, true)); - mArrowRight = getChild("Arrow Right"); - mArrowRight->setCommitCallback(boost::bind(&LLPanelEditWearable::onMoveToLayer, this, false)); + if (mArrowLeft = findChild("Arrow Left")) + { + mArrowLeft->setCommitCallback(boost::bind(&LLPanelEditWearable::onMoveToLayer, this, true)); + } + + if (mArrowRight = findChild("Arrow Right")) + { + mArrowRight->setCommitCallback(boost::bind(&LLPanelEditWearable::onMoveToLayer, this, false)); + } if (mSexRadio = findChild("sex radio")) @@ -764,9 +773,9 @@ BOOL LLPanelEditWearable::postBuild() { LL_WARNS() << "could not get wearable dictionary entry for wearable of type: " << mType << LL_ENDL; } - U8 num_subparts = (U8) wearable_entry->mSubparts.size(); + const U8 num_subparts = (U8) wearable_entry->mSubparts.size(); - for (U8 index = 0; index < num_subparts; ++index) + for (U8 index = 0; num_subparts > 1 && index < num_subparts; ++index) { // dive into data structures to get the panel we need ESubpart subpart_e = wearable_entry->mSubparts[index]; @@ -870,9 +879,9 @@ void LLPanelEditWearable::draw() const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(mType); if (wearable_entry) { - U8 num_subparts = (U8) wearable_entry->mSubparts.size(); + const U8 num_subparts = (U8) wearable_entry->mSubparts.size(); - for (U8 index = 0; index < num_subparts; ++index) + for (U8 index = 0; num_subparts > 1 && index < num_subparts; ++index) { // dive into data structures to get the panel we need ESubpart subpart_e = wearable_entry->mSubparts[index]; @@ -1497,13 +1506,25 @@ void LLPanelEditWearable::updateScrollingPanelUI() bool max_layers = gAgentWearables.getClothingLayerCount() == LLAgentWearables::MAX_CLOTHING_LAYERS; bool show_create_new = !has_wearable && !max_layers; - mTakeOff->setEnabled(has_wearable); - if (mCanTakeOff) mTakeOff->setVisible(has_wearable); - mCreateNewLayer->setVisible(has_wearable && !max_layers); - mArrowLeft->setEnabled(has_wearable && gAgentWearables.getBottomWearable(mType) != wearable); - mArrowLeft->setVisible(has_wearable); - mArrowRight->setEnabled(has_wearable && gAgentWearables.getTopWearable(mType) != wearable); - mArrowRight->setVisible(has_wearable); + if (mTakeOff) + { + mTakeOff->setEnabled(has_wearable); + if (mCanTakeOff) mTakeOff->setVisible(has_wearable); + } + if (mCreateNewLayer) + { + mCreateNewLayer->setVisible(has_wearable && !max_layers); + } + if (mArrowLeft) + { + mArrowLeft->setEnabled(has_wearable && gAgentWearables.getBottomWearable(mType) != wearable); + mArrowLeft->setVisible(has_wearable); + } + if (mArrowRight) + { + mArrowRight->setEnabled(has_wearable && gAgentWearables.getTopWearable(mType) != wearable); + mArrowRight->setVisible(has_wearable); + } mCreateNew->setVisible(show_create_new); mNotWornI->setVisible(show_create_new); mNotWornT->setVisible(show_create_new); diff --git a/indra/newview/skins/default/xui/en-us/floater_customize.xml b/indra/newview/skins/default/xui/en-us/floater_customize.xml index dfff39d27..150c43957 100644 --- a/indra/newview/skins/default/xui/en-us/floater_customize.xml +++ b/indra/newview/skins/default/xui/en-us/floater_customize.xml @@ -131,7 +131,6 @@ new one from scratch and wear it.