From 2bb855d13795672302486fef1e4fa5b132054dcf Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 6 Dec 2017 15:28:30 +0100 Subject: [PATCH] Fix a bunch of XUI warnings and as a result the long-standing bug of camera not switching properly when editing appearance LLView::getChild: Found child named "wearable_accordion" but of wrong type class LLTabContainer, expecting class LLAccordionCtrl * __ptr64 LLView::getChild: Making dummy class LLAccordionCtrl named "wearable_accordion" in edit_shape_panel LLView::getChild: Found child named "wearable_accordion" but of wrong type class LLTabContainer, expecting class LLAccordionCtrl * __ptr64 LLView::getChild: Making dummy class LLAccordionCtrl named "wearable_accordion" in edit_skin_panel LLView::getChild: Making dummy class LLAccordionCtrl named "wearable_accordion" in edit_eyes_panel LLView::getChild: Found child named "wearable_accordion" but of wrong type class LLTabContainer, expecting class LLAccordionCtrl * __ptr64 LLView::getChild: Making dummy class LLAccordionCtrl named "wearable_accordion" in edit_hair_panel LLView::getChild: Making dummy class LLAccordionCtrlTab named "shape_ears_tab" in panel_edit_wearable LLView::getChild: Making dummy class LLAccordionCtrlTab named "alpha_main_tab" in panel_edit_wearable LLView::getChild: Making dummy class LLAccordionCtrlTab named "tattoo_main_tab" in panel_edit_wearable LLView::getChild: Making dummy class LLAccordionCtrlTab named "physics_belly_updown_tab" in panel_edit_wearable LLView::getChild: Making dummy class LLAccordionCtrlTab named "physics_butt_updown_tab" in panel_edit_wearable --- indra/newview/llpaneleditwearable.cpp | 102 ++++++++++++++++-- indra/newview/llpaneleditwearable.h | 1 + .../ansastorm/xui/de/panel_edit_shape.xml | 2 +- .../ansastorm/xui/en/panel_edit_shape.xml | 2 +- .../ansastorm/xui/es/panel_edit_shape.xml | 2 +- .../ansastorm/xui/pl/panel_edit_shape.xml | 2 +- .../ansastorm/xui/ru/panel_edit_shape.xml | 2 +- .../firestorm/xui/de/panel_edit_shape.xml | 2 +- .../firestorm/xui/en/panel_edit_shape.xml | 2 +- .../firestorm/xui/es/panel_edit_shape.xml | 2 +- .../firestorm/xui/fr/panel_edit_shape.xml | 2 +- .../firestorm/xui/it/panel_edit_shape.xml | 2 +- .../firestorm/xui/pl/panel_edit_shape.xml | 2 +- .../firestorm/xui/ru/panel_edit_shape.xml | 2 +- .../skins/vintage/xui/en/panel_edit_shape.xml | 2 +- 15 files changed, 107 insertions(+), 22 deletions(-) diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index aee99a39d2..48822f0451 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -64,6 +64,7 @@ // [FS:CR] FIRE-10986 #include "llfilepicker.h" +#include "lltabcontainer.h" // register panel with appropriate XML static LLPanelInjector t_edit_wearable("panel_edit_wearable"); @@ -315,13 +316,21 @@ LLEditWearableDictionary::Subparts::Subparts() addEntry(SUBPART_GLOVES, new SubpartEntry(SUBPART_GLOVES, "mTorso", "gloves", "gloves_main_param_list", "gloves_main_tab", LLVector3d(0.f, 0.f, 0.f), LLVector3d(-1.f, 0.15f, 0.f),SEX_BOTH)); 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_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)); + // Alpha and tattoo don't adhere to the usual panel layout and don't have a param list and main tab + //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_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_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)); + // Fix XUI warning + //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)); } @@ -748,10 +757,16 @@ BOOL LLPanelEditWearable::postBuild() // Setting the visibility callback is applied only to the bodyparts panel // because currently they are the only ones whose 'wearable_accordion' has // multiple accordion tabs (see EXT-8164 for details). - setWearablePanelVisibilityChangeCallback(mPanelShape); - setWearablePanelVisibilityChangeCallback(mPanelSkin); - setWearablePanelVisibilityChangeCallback(mPanelEyes); - setWearablePanelVisibilityChangeCallback(mPanelHair); + // Commenting out these calls fix XUI parser warnings. + // While it would be easy to fix those by using the correct + // widget classes, we comment it out because the LL default + // behavior is to always switch to the first tab when editing + // appearance which is highly annoying when fine-tuning shapes + //setWearablePanelVisibilityChangeCallback(mPanelShape); + //setWearablePanelVisibilityChangeCallback(mPanelSkin); + //setWearablePanelVisibilityChangeCallback(mPanelEyes); + //setWearablePanelVisibilityChangeCallback(mPanelHair); + // //clothes mPanelShirt = getChild("edit_shirt_panel"); @@ -788,6 +803,9 @@ BOOL LLPanelEditWearable::postBuild() continue; } U8 num_subparts = wearable_entry->mSubparts.size(); + + // Appearance panel not updating camera position + bool tab_container_cb_set = false; for (U8 index = 0; index < num_subparts; ++index) { @@ -803,7 +821,16 @@ BOOL LLPanelEditWearable::postBuild() const std::string accordion_tab = subpart_entry->mAccordionTab; - LLAccordionCtrlTab *tab = getChild(accordion_tab); + // Alpha and tattoo don't adhere to the usual panel layout and don't have a param list and main tab + // We can safely skip here as the wearables having no accordion tabs only have one sub-part, + // so no camera switch is needed + //LLAccordionCtrlTab *tab = getChild(accordion_tab); + if (accordion_tab.empty()) + { + continue; + } + LLAccordionCtrlTab *tab = findChild(accordion_tab); + // if (!tab) { @@ -813,6 +840,19 @@ BOOL LLPanelEditWearable::postBuild() // initialize callback to ensure camera view changes appropriately. tab->setDropDownStateChangedCallback(boost::bind(&LLPanelEditWearable::onTabExpandedCollapsed,this,_2,index)); + + // Appearance panel not updating camera position; Some skins use tabs - in this case + // set a callback on the tab container when the tab is changed to switch the camera position + if (!tab_container_cb_set) + { + LLTabContainer* tab_container = dynamic_cast(tab->getParent()->getParent()->getParent()); + if (tab_container) + { + tab_container->setCommitCallback(boost::bind(&LLPanelEditWearable::onTabChanged, this, _1, type)); + tab_container_cb_set = true; + } + } + // } // initialize texture and color picker controls @@ -1227,6 +1267,14 @@ void LLPanelEditWearable::showWearable(LLViewerWearable* wearable, BOOL show, BO const std::string scrolling_panel = subpart_entry->mParamList; const std::string accordion_tab = subpart_entry->mAccordionTab; + + // Alpha and tattoo don't adhere to the usual panel layout and don't have a param list and main tab + // Since there are no sex-based differences, we can skip here + if (scrolling_panel.empty() || accordion_tab.empty()) + { + continue; + } + // LLScrollingPanelList *panel_list = getChild(scrolling_panel); LLAccordionCtrlTab *tab = getChild(accordion_tab); @@ -1306,6 +1354,42 @@ void LLPanelEditWearable::onTabExpandedCollapsed(const LLSD& param, U8 index) } +// Appearance panel not updating camera position +void LLPanelEditWearable::onTabChanged(LLUICtrl* ctrl, LLWearableType::EType type) +{ + LLTabContainer* container = dynamic_cast(ctrl); + if (!container) + { + return; + } + + if (!mWearablePtr || !gAgentCamera.cameraCustomizeAvatar()) + { + // we don't have a valid wearable we're editing, or we've left the wearable editor + return; + } + + const LLEditWearableDictionary::WearableEntry* wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type); + if (!wearable_entry) + { + return; + } + + U8 num_subparts = wearable_entry->mSubparts.size(); + for (U8 index = 0; index < num_subparts; ++index) + { + ESubpart subpart_e = wearable_entry->mSubparts[index]; + const LLEditWearableDictionary::SubpartEntry* subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e); + + if (subpart_entry && container->getCurrentPanel()->hasChild(subpart_entry->mAccordionTab, TRUE)) + { + changeCamera(index); + break; + } + } +} +// + void LLPanelEditWearable::changeCamera(U8 subpart) { // Don't change the camera if this type doesn't have a camera switch. diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h index 26983ad2fa..8d859dcc35 100644 --- a/indra/newview/llpaneleditwearable.h +++ b/indra/newview/llpaneleditwearable.h @@ -72,6 +72,7 @@ public: void showDefaultSubpart(); void onTabExpandedCollapsed(const LLSD& param, U8 index); + void onTabChanged(LLUICtrl* ctrl, LLWearableType::EType type); // Appearance panel not updating camera position void updateScrollingPanelList(); diff --git a/indra/newview/skins/ansastorm/xui/de/panel_edit_shape.xml b/indra/newview/skins/ansastorm/xui/de/panel_edit_shape.xml index 29508b30d2..21d7b18fd6 100644 --- a/indra/newview/skins/ansastorm/xui/de/panel_edit_shape.xml +++ b/indra/newview/skins/ansastorm/xui/de/panel_edit_shape.xml @@ -29,7 +29,7 @@ - + diff --git a/indra/newview/skins/ansastorm/xui/en/panel_edit_shape.xml b/indra/newview/skins/ansastorm/xui/en/panel_edit_shape.xml index a61a1d5c26..4a388598d6 100644 --- a/indra/newview/skins/ansastorm/xui/en/panel_edit_shape.xml +++ b/indra/newview/skins/ansastorm/xui/en/panel_edit_shape.xml @@ -184,7 +184,7 @@ header_visible="false" layout="topleft" min_height="150" - name="shape_head_tab" + name="shape_ears_tab" fit_panel="false" title="Ears"> diff --git a/indra/newview/skins/ansastorm/xui/es/panel_edit_shape.xml b/indra/newview/skins/ansastorm/xui/es/panel_edit_shape.xml index ba9c8a4553..d4e788056b 100644 --- a/indra/newview/skins/ansastorm/xui/es/panel_edit_shape.xml +++ b/indra/newview/skins/ansastorm/xui/es/panel_edit_shape.xml @@ -27,7 +27,7 @@ - + diff --git a/indra/newview/skins/ansastorm/xui/pl/panel_edit_shape.xml b/indra/newview/skins/ansastorm/xui/pl/panel_edit_shape.xml index e7f962d7c4..4815ed42b1 100644 --- a/indra/newview/skins/ansastorm/xui/pl/panel_edit_shape.xml +++ b/indra/newview/skins/ansastorm/xui/pl/panel_edit_shape.xml @@ -27,7 +27,7 @@ - + diff --git a/indra/newview/skins/ansastorm/xui/ru/panel_edit_shape.xml b/indra/newview/skins/ansastorm/xui/ru/panel_edit_shape.xml index 94b7e39aae..df88c137ff 100644 --- a/indra/newview/skins/ansastorm/xui/ru/panel_edit_shape.xml +++ b/indra/newview/skins/ansastorm/xui/ru/panel_edit_shape.xml @@ -27,7 +27,7 @@ - + diff --git a/indra/newview/skins/firestorm/xui/de/panel_edit_shape.xml b/indra/newview/skins/firestorm/xui/de/panel_edit_shape.xml index 29508b30d2..21d7b18fd6 100644 --- a/indra/newview/skins/firestorm/xui/de/panel_edit_shape.xml +++ b/indra/newview/skins/firestorm/xui/de/panel_edit_shape.xml @@ -29,7 +29,7 @@ - + diff --git a/indra/newview/skins/firestorm/xui/en/panel_edit_shape.xml b/indra/newview/skins/firestorm/xui/en/panel_edit_shape.xml index 7308778ee1..f00f6192b9 100644 --- a/indra/newview/skins/firestorm/xui/en/panel_edit_shape.xml +++ b/indra/newview/skins/firestorm/xui/en/panel_edit_shape.xml @@ -180,7 +180,7 @@ diff --git a/indra/newview/skins/firestorm/xui/es/panel_edit_shape.xml b/indra/newview/skins/firestorm/xui/es/panel_edit_shape.xml index 5473963097..ba764afbef 100644 --- a/indra/newview/skins/firestorm/xui/es/panel_edit_shape.xml +++ b/indra/newview/skins/firestorm/xui/es/panel_edit_shape.xml @@ -24,7 +24,7 @@ - + diff --git a/indra/newview/skins/firestorm/xui/fr/panel_edit_shape.xml b/indra/newview/skins/firestorm/xui/fr/panel_edit_shape.xml index d0136f3012..6dfc7d460a 100644 --- a/indra/newview/skins/firestorm/xui/fr/panel_edit_shape.xml +++ b/indra/newview/skins/firestorm/xui/fr/panel_edit_shape.xml @@ -21,7 +21,7 @@ - + diff --git a/indra/newview/skins/firestorm/xui/it/panel_edit_shape.xml b/indra/newview/skins/firestorm/xui/it/panel_edit_shape.xml index 7a5297d55f..56210c665d 100644 --- a/indra/newview/skins/firestorm/xui/it/panel_edit_shape.xml +++ b/indra/newview/skins/firestorm/xui/it/panel_edit_shape.xml @@ -24,7 +24,7 @@ - + diff --git a/indra/newview/skins/firestorm/xui/pl/panel_edit_shape.xml b/indra/newview/skins/firestorm/xui/pl/panel_edit_shape.xml index e7f962d7c4..4815ed42b1 100644 --- a/indra/newview/skins/firestorm/xui/pl/panel_edit_shape.xml +++ b/indra/newview/skins/firestorm/xui/pl/panel_edit_shape.xml @@ -27,7 +27,7 @@ - + diff --git a/indra/newview/skins/firestorm/xui/ru/panel_edit_shape.xml b/indra/newview/skins/firestorm/xui/ru/panel_edit_shape.xml index 94b7e39aae..df88c137ff 100644 --- a/indra/newview/skins/firestorm/xui/ru/panel_edit_shape.xml +++ b/indra/newview/skins/firestorm/xui/ru/panel_edit_shape.xml @@ -27,7 +27,7 @@ - + diff --git a/indra/newview/skins/vintage/xui/en/panel_edit_shape.xml b/indra/newview/skins/vintage/xui/en/panel_edit_shape.xml index 7308778ee1..f00f6192b9 100644 --- a/indra/newview/skins/vintage/xui/en/panel_edit_shape.xml +++ b/indra/newview/skins/vintage/xui/en/panel_edit_shape.xml @@ -180,7 +180,7 @@