summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llcharacter/lljoint.cpp2
-rw-r--r--indra/llcharacter/lljoint.h2
-rw-r--r--indra/newview/llfloatermodelpreview.cpp87
-rw-r--r--indra/newview/llfloatermodelpreview.h7
-rw-r--r--indra/newview/skins/default/xui/en/floater_model_preview.xml14
5 files changed, 76 insertions, 36 deletions
diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp
index 441ef1a352..bf99db2ce4 100644
--- a/indra/llcharacter/lljoint.cpp
+++ b/indra/llcharacter/lljoint.cpp
@@ -407,7 +407,7 @@ void showJointScaleOverrides( const LLJoint& joint, const std::string& note, con
bool LLJoint::aboveJointPosThreshold(const LLVector3& pos) const
{
LLVector3 diff = pos - getDefaultPosition();
- const F32 max_joint_pos_offset = 0.0001f; // 0.1 mm
+ const F32 max_joint_pos_offset = LL_JOINT_TRESHOLD_POS_OFFSET; // 0.1 mm
return diff.lengthSquared() > max_joint_pos_offset * max_joint_pos_offset;
}
diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h
index 6f69786f53..79d9637f21 100644
--- a/indra/llcharacter/lljoint.h
+++ b/indra/llcharacter/lljoint.h
@@ -53,6 +53,8 @@ const U32 LL_FACE_JOINT_NUM = (LL_CHARACTER_MAX_ANIMATED_JOINTS-2);
const S32 LL_CHARACTER_MAX_PRIORITY = 7;
const F32 LL_MAX_PELVIS_OFFSET = 5.f;
+const F32 LL_JOINT_TRESHOLD_POS_OFFSET = 0.0001f; //0.1 mm
+
class LLVector3OverrideMap
{
public:
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index c791ca8e77..b30054c818 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -641,17 +641,14 @@ void LLFloaterModelPreview::onJointListSelection()
std::string label = selected->getValue().asString();
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);
}
else
{
// temporary value (shouldn't happen)
std::string label = "mPelvis";
joint_pos_descr->setTextArg("[JOINT]", label);
- //joint_scale_descr->setTextArg("[JOINT]", label);
}
}
@@ -1433,7 +1430,6 @@ void LLFloaterModelPreview::addStringToLog(const std::ostringstream& strm, bool
}
}
-
void LLFloaterModelPreview::clearOverridesTab()
{
LLPanel *panel = mTabContainer->getPanelByName("overrides_panel");
@@ -1446,6 +1442,16 @@ void LLFloaterModelPreview::clearOverridesTab()
}
}
+void LLFloaterModelPreview::resetOverridesTab()
+{
+ clearOverridesTab();
+
+ for (U32 i = 0; i < LLModel::NUM_LODS; ++i)
+ {
+ mJointOverrides[i].clear();
+ }
+}
+
void LLFloaterModelPreview::showOverridesTab()
{
S32 display_lod = mModelPreview->mPreviewLOD;
@@ -1453,11 +1459,13 @@ void LLFloaterModelPreview::showOverridesTab()
{
return;
}
-
- // Todo: Are overrides identical for all lods?
+
+ // Joints will be listed as long as they are listed in mAlternateBindMatrix
+ // even if they are for some reason identical to defaults.
+ // Todo: Are overrides always identical for all lods? They normally are, but there might be situations where they aren't.
if (mJointOverrides[display_lod].empty())
{
- // populate list
+ // populate map
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)
@@ -1473,10 +1481,11 @@ void LLFloaterModelPreview::showOverridesTab()
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))
+ && (data.mPosOverrides.begin()->second - jointPos).lengthSquared() > (LL_JOINT_TRESHOLD_POS_OFFSET * LL_JOINT_TRESHOLD_POS_OFFSET))
{
// File contains multiple meshes with conflicting joint offsets
- // preview may be incorrect, upload result might wary (depends onto mesh_id).
+ // preview may be incorrect, upload result might wary (depends onto
+ // mesh_id that hasn't been generated yet).
data.mHasConflicts = true;
}
data.mPosOverrides[model->getName()] = jointPos;
@@ -1486,36 +1495,45 @@ void LLFloaterModelPreview::showOverridesTab()
}
}
}
-
+
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)
+ if (joints_list->isEmpty())
{
- const std::string& listName = joint_iter->first;
+ // Populate table
+ S32 conflicts = 0;
+ 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);
+ 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;
- }
+ LLScrollListCell::Params cell_params;
+ cell_params.font = LLFontGL::getFontSansSerif();
+ cell_params.value = listName;
+ if (joint_iter->second.mHasConflicts)
+ {
+ cell_params.color = LLColor4::orange;
+ conflicts++;
+ }
- item_params.columns.add(cell_params);
+ item_params.columns.add(cell_params);
- joints_list->addRow(item_params, ADD_BOTTOM);
- joint_iter++;
+ joints_list->addRow(item_params, ADD_BOTTOM);
+ joint_iter++;
+ }
+ joints_list->selectFirstItem();
+
+ LLTextBox *joint_pos_descr = panel->getChild<LLTextBox>("conflicts_description");
+ joint_pos_descr->setTextArg("[CONFLICTS]", llformat("%d", conflicts));
+ joint_pos_descr->setTextArg("[JOINTS_COUNT]", llformat("%d", mJointOverrides[display_lod].size()));
}
- joints_list->selectFirstItem();
}
void LLFloaterModelPreview::hideOverridesTab()
@@ -2451,7 +2469,7 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod)
}
else
{
- fmp->clearOverridesTab();
+ fmp->resetOverridesTab();
fmp->hideOverridesTab();
}
@@ -4051,6 +4069,8 @@ void LLModelPreview::addEmptyFace( LLModel* pTarget )
//-----------------------------------------------------------------------------
// render()
//-----------------------------------------------------------------------------
+// Todo: we shouldn't be setting all those UI elements on render.
+// Note: Render happens each frame with skinned avatars
BOOL LLModelPreview::render()
{
assert_main_thread();
@@ -4824,6 +4844,13 @@ void LLModelPreview::setPreviewLOD(S32 lod)
mFMP->childSetColor(lod_triangles_name[i], color);
mFMP->childSetColor(lod_vertices_name[i], color);
}
+
+ LLFloaterModelPreview* fmp = (LLFloaterModelPreview*)mFMP;
+ if (fmp)
+ {
+ // make preview repopulate tab
+ fmp->clearOverridesTab();
+ }
}
refresh();
updateStatusMessages();
@@ -4845,7 +4872,7 @@ void LLFloaterModelPreview::onReset(void* user_data)
LLFloaterModelPreview* fmp = (LLFloaterModelPreview*) user_data;
fmp->childDisable("reset_btn");
fmp->clearLogTab();
- fmp->clearOverridesTab();
+ fmp->resetOverridesTab();
LLModelPreview* mp = fmp->mModelPreview;
std::string filename = mp->mLODFile[LLModel::LOD_HIGH];
diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h
index f53478f31b..2adbfc1e79 100644
--- a/indra/newview/llfloatermodelpreview.h
+++ b/indra/newview/llfloatermodelpreview.h
@@ -107,9 +107,10 @@ public:
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);
- void clearOverridesTab();
- void showOverridesTab();
+ static void addStringToLog(const std::ostringstream& strm, bool flash);
+ void clearOverridesTab(); // clears table
+ void resetOverridesTab(); // clears table and cleans all data
+ void showOverridesTab(); // populates table and data as nessesary
void hideOverridesTab();
void setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost);
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 a69fa8c57c..9ebcb0c09d 100644
--- a/indra/newview/skins/default/xui/en/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml
@@ -1279,10 +1279,20 @@
draw_stripes="false"
commit_on_selection_change="true"
heading_height="23"
- height="253"
+ height="238"
left="6"
top_pad="0"
- width="150"/>
+ width="200"/>
+ <text
+ layout="topleft"
+ follows="top|left"
+ height="15"
+ left="6"
+ name="conflicts_description"
+ top_pad="2"
+ width="200">
+ [CONFLICTS] conflicts in [JOINTS_COUNT] joints
+ </text>
<text
layout="topleft"
follows="top|left"