summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/CMakeLists.txt1
-rw-r--r--indra/newview/llfloatermodelpreview.cpp191
-rw-r--r--indra/newview/llfloatermodelpreview.h24
-rw-r--r--indra/newview/lljointoverridedata.h53
-rw-r--r--indra/newview/llvoavatar.cpp50
-rw-r--r--indra/newview/llvoavatar.h26
-rw-r--r--indra/newview/skins/default/xui/en/floater_model_preview.xml53
7 files changed, 156 insertions, 242 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index caa636cc83..cf8f99ed25 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -996,7 +996,6 @@ set(viewer_HEADER_FILES
llinventorymodelbackgroundfetch.h
llinventoryobserver.h
llinventorypanel.h
- lljointoverridedata.h
lljoystickbutton.h
lllandmarkactions.h
lllandmarklist.h
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 4e9e4754b3..c791ca8e77 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -568,16 +568,6 @@ void LLFloaterModelPreview::onClickCalculateBtn()
bool upload_joint_positions = childGetValue("upload_joints").asBoolean();
bool lock_scale_if_joint_position = childGetValue("lock_scale_if_joint_position").asBoolean();
- if (upload_joint_positions)
- {
- // Todo: this probably should be enabled when checkbox enables, not on calculate
- populateOverridesTab();
- }
- else
- {
- disableOverridesTab();
- }
-
mUploadModelUrl.clear();
gMeshRepo.uploadModel(mModelPreview->mUploadData, mModelPreview->mPreviewScale,
@@ -590,9 +580,9 @@ void LLFloaterModelPreview::onClickCalculateBtn()
mUploadBtn->setEnabled(false);
}
-void populate_list_with_vectors(LLScrollListCtrl *list, const std::set<LLVector3> &vector_set, const LLVector3 &active)
+void populate_list_with_map(LLScrollListCtrl *list, const std::map<std::string, LLVector3> &vector_map)
{
- if (vector_set.empty())
+ if (vector_map.empty())
{
return;
}
@@ -602,35 +592,28 @@ void populate_list_with_vectors(LLScrollListCtrl *list, const std::set<LLVector3
// Start out right justifying numeric displays
cell_params.font_halign = LLFontGL::HCENTER;
- std::set<LLVector3>::const_iterator iter = vector_set.begin();
- std::set<LLVector3>::const_iterator end = vector_set.end();
+ std::map<std::string, LLVector3>::const_iterator iter = vector_map.begin();
+ std::map<std::string, LLVector3>::const_iterator end = vector_map.end();
while (iter != end)
{
LLScrollListItem::Params item_params;
item_params.value = LLSD::Integer(count);
- cell_params.column = "override";
- if (*iter != active)
- {
- cell_params.value = "";
- }
- else
- {
- cell_params.value = "active"; //todo: localize
- }
+ cell_params.column = "model_name";
+ cell_params.value = iter->first;
item_params.columns.add(cell_params);
cell_params.column = "axis_x";
- cell_params.value = iter->mV[VX];
+ cell_params.value = iter->second.mV[VX];
item_params.columns.add(cell_params);
cell_params.column = "axis_y";
- cell_params.value = iter->mV[VY];
+ cell_params.value = iter->second.mV[VY];
item_params.columns.add(cell_params);
cell_params.column = "axis_z";
- cell_params.value = iter->mV[VZ];
+ cell_params.value = iter->second.mV[VZ];
item_params.columns.add(cell_params);
@@ -642,12 +625,12 @@ void populate_list_with_vectors(LLScrollListCtrl *list, const std::set<LLVector3
void LLFloaterModelPreview::onJointListSelection()
{
+ S32 display_lod = mModelPreview->mPreviewLOD;
LLPanel *panel = mTabContainer->getPanelByName("overrides_panel");
LLScrollListCtrl *joints_list = panel->getChild<LLScrollListCtrl>("joints_list");
LLScrollListCtrl *joints_pos = panel->getChild<LLScrollListCtrl>("pos_overrides_list");
LLScrollListCtrl *joints_scale = panel->getChild<LLScrollListCtrl>("scale_overrides_list");
LLTextBox *joint_pos_descr = panel->getChild<LLTextBox>("pos_overrides_descr");
- LLTextBox *joint_scale_descr = panel->getChild<LLTextBox>("scale_overrides_descr");
joints_pos->deleteAllItems();
joints_scale->deleteAllItems();
@@ -656,19 +639,19 @@ void LLFloaterModelPreview::onJointListSelection()
if (selected)
{
std::string label = selected->getValue().asString();
- LLJointOverrideData *data = &mJointOverrides[label];
- populate_list_with_vectors(joints_pos, data->mPosOverrides, data->mActivePosOverride);
- populate_list_with_vectors(joints_scale, data->mScaleOverrides, data->mActiveScaleOverride);
+ LLJointOverrideData &data = mJointOverrides[display_lod][label];
+ populate_list_with_map(joints_pos, data.mPosOverrides);
+ //populate_list_with_vectors(joints_scale, data.mScaleOverrides, data.mActiveScaleOverride);
joint_pos_descr->setTextArg("[JOINT]", label);
- joint_scale_descr->setTextArg("[JOINT]", label);
+ //joint_scale_descr->setTextArg("[JOINT]", label);
}
else
{
// temporary value (shouldn't happen)
std::string label = "mPelvis";
joint_pos_descr->setTextArg("[JOINT]", label);
- joint_scale_descr->setTextArg("[JOINT]", label);
+ //joint_scale_descr->setTextArg("[JOINT]", label);
}
}
@@ -1450,6 +1433,98 @@ void LLFloaterModelPreview::addStringToLog(const std::ostringstream& strm, bool
}
}
+
+void LLFloaterModelPreview::clearOverridesTab()
+{
+ LLPanel *panel = mTabContainer->getPanelByName("overrides_panel");
+ LLScrollListCtrl *joints_list = panel->getChild<LLScrollListCtrl>("joints_list");
+ joints_list->deleteAllItems();
+
+ for (U32 i = 0; i < LLModel::NUM_LODS; ++i)
+ {
+ mJointOverrides[i].clear();
+ }
+}
+
+void LLFloaterModelPreview::showOverridesTab()
+{
+ S32 display_lod = mModelPreview->mPreviewLOD;
+ if (mModelPreview->mModel[display_lod].empty())
+ {
+ return;
+ }
+
+ // Todo: Are overrides identical for all lods?
+ if (mJointOverrides[display_lod].empty())
+ {
+ // populate list
+ for (LLModelLoader::scene::iterator iter = mModelPreview->mScene[display_lod].begin(); iter != mModelPreview->mScene[display_lod].end(); ++iter)
+ {
+ for (LLModelLoader::model_instance_list::iterator model_iter = iter->second.begin(); model_iter != iter->second.end(); ++model_iter)
+ {
+ LLModelInstance& instance = *model_iter;
+ LLModel* model = instance.mModel;
+ const LLMeshSkinInfo *skin = &model->mSkinInfo;
+ if (skin->mAlternateBindMatrix.size() > 0)
+ {
+ U32 count = LLSkinningUtil::getMeshJointCount(skin);
+ for (U32 j = 0; j < count; ++j)
+ {
+ const LLVector3& jointPos = skin->mAlternateBindMatrix[j].getTranslation();
+ LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j]];
+ if (data.mPosOverrides.size() > 0
+ && (data.mPosOverrides.begin()->second - jointPos).inRange(-F_APPROXIMATELY_ZERO, F_APPROXIMATELY_ZERO))
+ {
+ // File contains multiple meshes with conflicting joint offsets
+ // preview may be incorrect, upload result might wary (depends onto mesh_id).
+ data.mHasConflicts = true;
+ }
+ data.mPosOverrides[model->getName()] = jointPos;
+
+ }
+ }
+ }
+ }
+ }
+
+ LLPanel *panel = mTabContainer->getPanelByName("overrides_panel");
+ S32 index = mTabContainer->getIndexForPanel(panel);
+ mTabContainer->enableTabButton(index, true);
+
+ LLScrollListCtrl *joints_list = panel->getChild<LLScrollListCtrl>("joints_list");
+
+ joint_override_data_map_t::iterator joint_iter = mJointOverrides[display_lod].begin();
+ joint_override_data_map_t::iterator joint_end = mJointOverrides[display_lod].end();
+ while (joint_iter != joint_end)
+ {
+ const std::string& listName = joint_iter->first;
+
+ LLScrollListItem::Params item_params;
+ item_params.value(listName);
+
+ LLScrollListCell::Params cell_params;
+ cell_params.font = LLFontGL::getFontSansSerif();
+ cell_params.value = listName;
+ if (joint_iter->second.mHasConflicts)
+ {
+ cell_params.color = LLColor4::orange;
+ }
+
+ item_params.columns.add(cell_params);
+
+ joints_list->addRow(item_params, ADD_BOTTOM);
+ joint_iter++;
+ }
+ joints_list->selectFirstItem();
+}
+
+void LLFloaterModelPreview::hideOverridesTab()
+{
+ LLPanel *panel = mTabContainer->getPanelByName("overrides_panel");
+ S32 index = mTabContainer->getIndexForPanel(panel);
+ mTabContainer->enableTabButton(index, false);
+}
+
//-----------------------------------------------------------------------------
// addStringToLogTab()
//-----------------------------------------------------------------------------
@@ -2374,6 +2449,11 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod)
mViewOption["show_joint_positions"] = true;
fmp->childSetValue("upload_joints", true);
}
+ else
+ {
+ fmp->clearOverridesTab();
+ fmp->hideOverridesTab();
+ }
if (lock_scale_if_joint_position)
{
@@ -4119,11 +4199,19 @@ BOOL LLModelPreview::render()
if (upload_skin && upload_joints)
{
mFMP->childEnable("lock_scale_if_joint_position");
+ if (fmp)
+ {
+ fmp->showOverridesTab();
+ }
}
else
{
mFMP->childDisable("lock_scale_if_joint_position");
mFMP->childSetValue("lock_scale_if_joint_position", false);
+ if (fmp)
+ {
+ fmp->hideOverridesTab();
+ }
}
//Only enable joint offsets if it passed the earlier critiquing
@@ -4757,6 +4845,7 @@ void LLFloaterModelPreview::onReset(void* user_data)
LLFloaterModelPreview* fmp = (LLFloaterModelPreview*) user_data;
fmp->childDisable("reset_btn");
fmp->clearLogTab();
+ fmp->clearOverridesTab();
LLModelPreview* mp = fmp->mModelPreview;
std::string filename = mp->mLODFile[LLModel::LOD_HIGH];
@@ -4975,44 +5064,6 @@ void LLFloaterModelPreview::clearLogTab()
mTabContainer->setTabPanelFlashing(panel, false);
}
-void LLFloaterModelPreview::populateOverridesTab()
-{
- mJointOverrides.clear();
- attach_override_data_map_t attach_not_in_use;
- // Todo: use mAlternateBindMatrix
- mModelPreview->getPreviewAvatar()->getAttachmentOverrides(mJointOverrides, attach_not_in_use);
-
- if (mJointOverrides.empty())
- {
- disableOverridesTab();
- return;
- }
-
- LLPanel *panel = mTabContainer->getPanelByName("overrides_panel");
- S32 index = mTabContainer->getIndexForPanel(panel);
- mTabContainer->enableTabButton(index, true);
-
- LLScrollListCtrl *joints_list = panel->getChild<LLScrollListCtrl>("joints_list");
- joints_list->deleteAllItems();
-
- joint_override_data_map_t::iterator joint_iter = mJointOverrides.begin();
- joint_override_data_map_t::iterator joint_end = mJointOverrides.end();
- while (joint_iter != joint_end)
- {
- const std::string& listName = joint_iter->first;
- joints_list->addSimpleElement(listName);
- joint_iter++;
- }
- joints_list->selectFirstItem();
-}
-
-void LLFloaterModelPreview::disableOverridesTab()
-{
- LLPanel *panel = mTabContainer->getPanelByName("overrides_panel");
- S32 index = mTabContainer->getIndexForPanel(panel);
- mTabContainer->enableTabButton(index, false);
-}
-
void LLFloaterModelPreview::onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url)
{
mModelPhysicsFee = result;
diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h
index 8988dd2565..f53478f31b 100644
--- a/indra/newview/llfloatermodelpreview.h
+++ b/indra/newview/llfloatermodelpreview.h
@@ -30,7 +30,6 @@
#include "llfloaternamedesc.h"
#include "lldynamictexture.h"
-#include "lljointoverridedata.h"
#include "llquaternion.h"
#include "llmeshrepository.h"
#include "llmodel.h"
@@ -62,6 +61,16 @@ class LLTabContainer;
class LLToggleableMenu;
class LLViewerTextEditor;
+
+class LLJointOverrideData
+{
+public:
+ LLJointOverrideData() : mHasConflicts(false) {};
+ std::map<std::string, LLVector3> mPosOverrides;
+ bool mHasConflicts;
+};
+typedef std::map<std::string, LLJointOverrideData> joint_override_data_map_t;
+
class LLFloaterModelPreview : public LLFloaterModelUploadBase
{
public:
@@ -95,10 +104,13 @@ public:
/*virtual*/ void onClose(bool app_quitting);
static void onMouseCaptureLostModelPreview(LLMouseHandler*);
- static void setUploadAmount(S32 amount) { sUploadAmount = amount; }
- static void addStringToLog(const std::string& message, const LLSD& args, bool flash, S32 lod = -1);
+ static void setUploadAmount(S32 amount) { sUploadAmount = amount; }
+ static void addStringToLog(const std::string& message, const LLSD& args, bool flash, S32 lod = -1);
static void addStringToLog(const std::string& str, bool flash);
- static void addStringToLog(const std::ostringstream& strm, bool flash);
+ static void addStringToLog(const std::ostringstream& strm, bool flash);
+ void clearOverridesTab();
+ void showOverridesTab();
+ void hideOverridesTab();
void setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost);
void setPreviewLOD(S32 lod);
@@ -227,8 +239,6 @@ private:
void resetUploadOptions();
void clearLogTab();
- void populateOverridesTab();
- void disableOverridesTab();
void createSmoothComboBox(LLComboBox* combo_box, float min, float max);
@@ -237,7 +247,7 @@ private:
LLViewerTextEditor* mUploadLogText;
LLTabContainer* mTabContainer;
- joint_override_data_map_t mJointOverrides;
+ joint_override_data_map_t mJointOverrides[LLModel::NUM_LODS];
};
class LLMeshFilePicker : public LLFilePickerThread
diff --git a/indra/newview/lljointoverridedata.h b/indra/newview/lljointoverridedata.h
deleted file mode 100644
index 99baa5f334..0000000000
--- a/indra/newview/lljointoverridedata.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * @file lljointoverridedata.h
- * @brief Declaration of LLJointOverrideData and LLAttachmentOverrideData
- *
- * $LicenseInfo:firstyear=2020&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2020, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_JOINTOVERRIDEDATA_H
-#define LL_JOINTOVERRIDEDATA_H
-
-//#include <map>
-//#include <string>
-//#include <vector>
-
-
-struct LLJointOverrideData
-{
- std::set<LLVector3> mPosOverrides;
- LLVector3 mActivePosOverride;
- std::set<LLVector3> mScaleOverrides;
- LLVector3 mActiveScaleOverride;
-};
-
-struct LLAttachmentOverrideData
-{
- std::set<LLVector3> mPosOverrides;
- LLVector3 mActivePosOverride;
-};
-
-typedef std::map<std::string, LLJointOverrideData> joint_override_data_map_t;
-typedef std::map<std::string, LLAttachmentOverrideData> attach_override_data_map_t;
-
-#endif // LL_JOINTOVERRIDEDATA_H
-
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index dac516d15c..3b51d07f96 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -6376,56 +6376,6 @@ void LLVOAvatar::showAttachmentOverrides(bool verbose) const
}
//-----------------------------------------------------------------------------
-// getAttachmentOverrides
-//-----------------------------------------------------------------------------
-void LLVOAvatar::getAttachmentOverrides(joint_override_data_map_t &joint_overrides, attach_override_data_map_t &attach_overrides) const
-{
- LLVector3 pos, scale;
- LLUUID mesh_id;
- S32 count = 0;
-
- // Bones
- for (avatar_joint_list_t::const_iterator iter = mSkeleton.begin();
- iter != mSkeleton.end(); ++iter)
- {
- const LLJoint* pJoint = (*iter);
- LLJointOverrideData data;
- bool joint_override = false;
- if (pJoint && pJoint->hasAttachmentPosOverride(pos, mesh_id))
- {
- pJoint->getAllAttachmentPosOverrides(count, data.mPosOverrides);
- data.mActivePosOverride = pos;
- joint_override = true;
- }
- if (pJoint && pJoint->hasAttachmentScaleOverride(scale, mesh_id))
- {
- pJoint->getAllAttachmentScaleOverrides(count, data.mPosOverrides);
- data.mActiveScaleOverride = scale;
- joint_override = true;
- }
- if (joint_override)
- {
- joint_overrides[pJoint->getName()] = data;
- }
- }
-
- // Attachment points
- for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
- iter != mAttachmentPoints.end();
- ++iter)
- {
- const LLViewerJointAttachment *attachment_pt = (*iter).second;
- if (attachment_pt && attachment_pt->hasAttachmentPosOverride(pos, mesh_id))
- {
- LLAttachmentOverrideData data;
- attachment_pt->getAllAttachmentPosOverrides(count, data.mPosOverrides);
- data.mActivePosOverride = pos;
- attach_overrides[attachment_pt->getName()] = data;
- }
- }
-}
-
-//-----------------------------------------------------------------------------
// removeAttachmentOverridesForObject
//-----------------------------------------------------------------------------
void LLVOAvatar::removeAttachmentOverridesForObject(LLViewerObject *vo)
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 53a1d48d72..00dccc5d12 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -36,25 +36,23 @@
#include <boost/signals2/trackable.hpp>
#include "llavatarappearance.h"
-#include "llavatarappearancedefines.h"
-#include "llavatarrendernotifier.h"
-#include "llcontrol.h"
-#include "llcharacter.h"
#include "llchat.h"
#include "lldrawpoolalpha.h"
-#include "lldriverparam.h"
-#include "lljointoverridedata.h"
-#include "llrendertarget.h"
-#include "llrigginginfo.h"
-#include "lltexglobalcolor.h"
+#include "llviewerobject.h"
+#include "llcharacter.h"
+#include "llcontrol.h"
#include "llviewerjointmesh.h"
#include "llviewerjointattachment.h"
-#include "llviewerobject.h"
-#include "llviewerstats.h"
+#include "llrendertarget.h"
+#include "llavatarappearancedefines.h"
+#include "lltexglobalcolor.h"
+#include "lldriverparam.h"
#include "llviewertexlayer.h"
-#include "llvovolume.h"
-
#include "material_codes.h" // LL_MCODE_END
+#include "llrigginginfo.h"
+#include "llviewerstats.h"
+#include "llvovolume.h"
+#include "llavatarrendernotifier.h"
extern const LLUUID ANIM_AGENT_BODY_NOISE;
extern const LLUUID ANIM_AGENT_BREATHE_ROT;
@@ -217,8 +215,6 @@ public:
void rebuildAttachmentOverrides();
void updateAttachmentOverrides();
void showAttachmentOverrides(bool verbose = false) const;
- void getAttachmentOverrides(joint_override_data_map_t& joint_overrides,
- attach_override_data_map_t& attach_overrides) const;
void getAttachmentOverrideNames(std::set<std::string>& pos_names,
std::set<std::string>& scale_names) const;
diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml
index 9009eeeb04..a69fa8c57c 100644
--- a/indra/newview/skins/default/xui/en/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml
@@ -1304,62 +1304,23 @@
height="100"
left_delta="0"
top_pad="0"
- width="310">
+ width="330">
<scroll_list.columns
- label="*"
- name="override"
- relative_width="0.22" />
+ label="Model"
+ name="model_name"
+ relative_width="0.40" />
<scroll_list.columns
label="X"
name="axis_x"
- relative_width="0.26" />
+ relative_width="0.20" />
<scroll_list.columns
label="Y"
name="axis_y"
- relative_width="0.26" />
+ relative_width="0.20" />
<scroll_list.columns
label="Z"
name="axis_z"
- relative_width="0.26" />
- </scroll_list>
- <text
- layout="topleft"
- follows="top|left"
- height="15"
- left_delta="0"
- name="scale_overrides_descr"
- top_pad="3"
- width="300">
- Scale overrides for joint '[JOINT]':
- </text>
- <scroll_list
- layout="topleft"
- follows="top|left"
- name="scale_overrides_list"
- column_padding="0"
- draw_heading="true"
- draw_stripes="false"
- heading_height="23"
- height="100"
- left_delta="0"
- top_pad="0"
- width="310">
- <scroll_list.columns
- label="*"
- name="override"
- relative_width="0.22" />
- <scroll_list.columns
- label="X"
- name="axis_x"
- relative_width="0.26" />
- <scroll_list.columns
- label="Y"
- name="axis_y"
- relative_width="0.26" />
- <scroll_list.columns
- label="Z"
- name="axis_z"
- relative_width="0.26" />
+ relative_width="0.20" />
</scroll_list>
</panel>
<panel