summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llpaneleditwearable.cpp51
-rw-r--r--indra/newview/llpaneleditwearable.h2
2 files changed, 53 insertions, 0 deletions
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index f8dbc91036..8e9b164c09 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -57,6 +57,8 @@
#include "lltextureentry.h"
#include "llviewercontrol.h" // gSavedSettings
#include "llviewertexturelist.h"
+#include "llagentcamera.h"
+#include "llmorphview.h"
// register panel with appropriate XML
static LLRegisterPanelClassWrapper<LLPanelEditWearable> t_edit_wearable("panel_edit_wearable");
@@ -951,6 +953,9 @@ void LLPanelEditWearable::initializePanel()
// 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);
@@ -989,6 +994,52 @@ void LLPanelEditWearable::updateTypeSpecificControls(LLWearableType::EType type)
}
}
+void LLPanelEditWearable::onTabExpandedCollapsed(const LLSD& param, U8 index)
+{
+ bool expanded = param.asBoolean();
+
+ if (!mWearablePtr || !gAgentCamera.cameraCustomizeAvatar())
+ {
+ // we don't have a valid wearable we're editing, or we've left the wearable editor
+ return;
+ }
+
+ if (expanded)
+ {
+ const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(mWearablePtr->getType());
+ if (!wearable_entry)
+ {
+ llinfos << "could not get wearable dictionary entry for wearable type: " << mWearablePtr->getType() << llendl;
+ return;
+ }
+
+ if (index >= wearable_entry->mSubparts.size())
+ {
+ llinfos << "accordion tab expanded for invalid subpart. Wearable type: " << mWearablePtr->getType() << " subpart num: " << index << llendl;
+ return;
+ }
+
+ 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;
+ return;
+ }
+
+ // Update the camera
+ gMorphView->setCameraTargetJoint( gAgentAvatarp->getJoint( subpart_entry->mTargetJoint ) );
+ gMorphView->setCameraTargetOffset( subpart_entry->mTargetOffset );
+ gMorphView->setCameraOffset( subpart_entry->mCameraOffset );
+ gMorphView->setCameraDistToDefault();
+ if (gSavedSettings.getBOOL("AppearanceCameraMovement"))
+ {
+ gMorphView->updateCamera();
+ }
+ }
+}
+
void LLPanelEditWearable::updateScrollingPanelUI()
{
// do nothing if we don't have a valid wearable we're editing
diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h
index 04839ca451..6f9ac82407 100644
--- a/indra/newview/llpaneleditwearable.h
+++ b/indra/newview/llpaneleditwearable.h
@@ -66,6 +66,8 @@ public:
static void onRevertButtonClicked(void* userdata);
void onCommitSexChange();
+ void onTabExpandedCollapsed(const LLSD& param, U8 index);
+
private:
typedef std::map<F32, LLViewerVisualParam*> value_map_t;