diff options
author | Nyx (Neal Orman) <nyx@lindenlab.com> | 2010-05-24 16:16:28 -0400 |
---|---|---|
committer | Nyx (Neal Orman) <nyx@lindenlab.com> | 2010-05-24 16:16:28 -0400 |
commit | 7be50ad3a578ba8ffc55f664640195a985e29b71 (patch) | |
tree | 224584dcdc0e6009aaffaeccec5dcad29b8d33be /indra/newview/llpaneleditwearable.cpp | |
parent | 0c55c8a0b8fa7befcb5303bf5858501ff7bb872e (diff) |
AVP-60 EXT-7366 EXT-7209 WIP Camera views not correct when editing wearable
Added code to shift camera focus to appropriate section of the avatar when
wearable editor accordion tabs are expanded / collapsed.
Known issue: camera does not shift properly when first opening wearable editor.
Will implement a selectDefaultSubpart() function later.
Code reviewed by Prep
Diffstat (limited to 'indra/newview/llpaneleditwearable.cpp')
-rw-r--r-- | indra/newview/llpaneleditwearable.cpp | 51 |
1 files changed, 51 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 |