summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorNyx (Neal Orman) <nyx@lindenlab.com>2010-05-25 19:02:39 -0400
committerNyx (Neal Orman) <nyx@lindenlab.com>2010-05-25 19:02:39 -0400
commit9b57c13efcc2c4f1de6cfd07322beffc89f5c3a0 (patch)
tree4f2e561a93368e9beed62ea64a7555e2d879fca9 /indra/newview
parent7100d1ce00177e41dec3b88f5550ec675d14efd5 (diff)
EXT-7209 EXT-7366 WIP better handling of wearable editor camera views
Added code to get camera change to trigger on first opening a wearable editor. Also fixed a minor label issue that was causing skirt editor to fail. Code reviewed by Seraph
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpaneleditwearable.cpp111
-rw-r--r--indra/newview/llpaneleditwearable.h7
-rw-r--r--indra/newview/skins/default/xui/en/panel_edit_wearable.xml2
3 files changed, 71 insertions, 49 deletions
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index 8e9b164c09..359b523dd6 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -215,7 +215,9 @@ LLEditWearableDictionary::~LLEditWearableDictionary()
LLEditWearableDictionary::Wearables::Wearables()
{
- addEntry(LLWearableType::WT_SHAPE, new WearableEntry(LLWearableType::WT_SHAPE,"edit_shape_title","shape_desc_text",0,0,9, SUBPART_SHAPE_HEAD, SUBPART_SHAPE_EYES, SUBPART_SHAPE_EARS, SUBPART_SHAPE_NOSE, SUBPART_SHAPE_MOUTH, SUBPART_SHAPE_CHIN, SUBPART_SHAPE_TORSO, SUBPART_SHAPE_LEGS, SUBPART_SHAPE_WHOLE));
+ // note the subpart that is listed first is treated as "default", regardless of what order is in enum.
+ // Please match the order presented in XUI. -Nyx
+ addEntry(LLWearableType::WT_SHAPE, new WearableEntry(LLWearableType::WT_SHAPE,"edit_shape_title","shape_desc_text",0,0,9, SUBPART_SHAPE_WHOLE, SUBPART_SHAPE_HEAD, SUBPART_SHAPE_EYES, SUBPART_SHAPE_EARS, SUBPART_SHAPE_NOSE, SUBPART_SHAPE_MOUTH, SUBPART_SHAPE_CHIN, SUBPART_SHAPE_TORSO, SUBPART_SHAPE_LEGS ));
addEntry(LLWearableType::WT_SKIN, new WearableEntry(LLWearableType::WT_SKIN,"edit_skin_title","skin_desc_text",0,3,4, TEX_HEAD_BODYPAINT, TEX_UPPER_BODYPAINT, TEX_LOWER_BODYPAINT, SUBPART_SKIN_COLOR, SUBPART_SKIN_FACEDETAIL, SUBPART_SKIN_MAKEUP, SUBPART_SKIN_BODYDETAIL));
addEntry(LLWearableType::WT_HAIR, new WearableEntry(LLWearableType::WT_HAIR,"edit_hair_title","hair_desc_text",0,1,4, TEX_HAIR, SUBPART_HAIR_COLOR, SUBPART_HAIR_STYLE, SUBPART_HAIR_EYEBROWS, SUBPART_HAIR_FACIAL));
addEntry(LLWearableType::WT_EYES, new WearableEntry(LLWearableType::WT_EYES,"edit_eyes_title","eyes_desc_text",0,1,1, TEX_EYES_IRIS, SUBPART_EYES));
@@ -893,8 +895,68 @@ void LLPanelEditWearable::showWearable(LLWearable* wearable, BOOL show)
// 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));
+
+ showDefaultSubpart();
+}
+
+void LLPanelEditWearable::showDefaultSubpart()
+{
+ changeCamera(0);
+}
+
+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)
+ {
+ changeCamera(index);
+ }
+
}
+void LLPanelEditWearable::changeCamera(U8 subpart)
+{
+ 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 (subpart >= wearable_entry->mSubparts.size())
+ {
+ llinfos << "accordion tab expanded for invalid subpart. Wearable type: " << mWearablePtr->getType() << " subpart num: " << subpart << llendl;
+ return;
+ }
+
+ ESubpart subpart_e = wearable_entry->mSubparts[subpart];
+ 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->setCameraDistToDefault();
+ gMorphView->setCameraTargetJoint( gAgentAvatarp->getJoint( subpart_entry->mTargetJoint ) );
+ gMorphView->setCameraTargetOffset( subpart_entry->mTargetOffset );
+ gMorphView->setCameraOffset( subpart_entry->mCameraOffset );
+ if (gSavedSettings.getBOOL("AppearanceCameraMovement"))
+ {
+ gMorphView->updateCamera();
+ }
+}
+
+
void LLPanelEditWearable::initializePanel()
{
if (!mWearablePtr)
@@ -969,6 +1031,7 @@ void LLPanelEditWearable::initializePanel()
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();
}
@@ -994,52 +1057,6 @@ 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 6f9ac82407..5de2bcb170 100644
--- a/indra/newview/llpaneleditwearable.h
+++ b/indra/newview/llpaneleditwearable.h
@@ -63,10 +63,12 @@ public:
void saveChanges();
void revertChanges();
+ void showDefaultSubpart();
+ void onTabExpandedCollapsed(const LLSD& param, U8 index);
+
static void onRevertButtonClicked(void* userdata);
void onCommitSexChange();
- void onTabExpandedCollapsed(const LLSD& param, U8 index);
private:
typedef std::map<F32, LLViewerVisualParam*> value_map_t;
@@ -86,6 +88,9 @@ private:
void toggleTypeSpecificControls(LLWearableType::EType type);
void updateTypeSpecificControls(LLWearableType::EType type);
+ // changes camera angle to default for selected subpart
+ void changeCamera(U8 subpart);
+
// the pointer to the wearable we're editing. NULL means we're not editing a wearable.
LLWearable *mWearablePtr;
LLViewerInventoryItem* mWearableItem;
diff --git a/indra/newview/skins/default/xui/en/panel_edit_wearable.xml b/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
index 71f740590b..0455086ef3 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
@@ -107,7 +107,7 @@ left="0"
Jacket:
</string>
<string
- name="skirt_skirt_desc_text">
+ name="skirt_desc_text">
Skirt:
</string>
<string