SL-379 Render selected joint yellow when Avatar tab is open
parent
aaddcc0b70
commit
3c2f3edb5f
|
|
@ -266,7 +266,8 @@ LLFloaterModelUploadBase(key),
|
|||
mUploadBtn(NULL),
|
||||
mCalculateBtn(NULL),
|
||||
mUploadLogText(NULL),
|
||||
mTabContainer(NULL)
|
||||
mTabContainer(NULL),
|
||||
mAvatarTabIndex(0)
|
||||
{
|
||||
sInstance = this;
|
||||
mLastMouseX = 0;
|
||||
|
|
@ -408,15 +409,10 @@ BOOL LLFloaterModelPreview::postBuild()
|
|||
mUploadLogText = getChild<LLViewerTextEditor>("log_text");
|
||||
mTabContainer = getChild<LLTabContainer>("import_tab");
|
||||
|
||||
// Disable Overrides tab untill it has something to show and set callbacks
|
||||
LLPanel *panel = mTabContainer->getPanelByName("overrides_panel");
|
||||
S32 index = mTabContainer->getIndexForPanel(panel);
|
||||
LLPanel *panel = mTabContainer->getPanelByName("avatar_panel");
|
||||
mAvatarTabIndex = mTabContainer->getIndexForPanel(panel);
|
||||
panel->getChild<LLScrollListCtrl>("joints_list")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onJointListSelection, this));
|
||||
|
||||
// Disable Logs tab untill it has something to show
|
||||
panel = mTabContainer->getPanelByName("logs_panel");
|
||||
index = mTabContainer->getIndexForPanel(panel);
|
||||
|
||||
if (LLConvexDecomposition::getInstance() != NULL)
|
||||
{
|
||||
mCalculateBtn->setClickedCallback(boost::bind(&LLFloaterModelPreview::onClickCalculateBtn, this));
|
||||
|
|
@ -635,7 +631,7 @@ void populate_list_with_map(LLScrollListCtrl *list, const std::map<std::string,
|
|||
void LLFloaterModelPreview::onJointListSelection()
|
||||
{
|
||||
S32 display_lod = mModelPreview->mPreviewLOD;
|
||||
LLPanel *panel = mTabContainer->getPanelByName("overrides_panel");
|
||||
LLPanel *panel = mTabContainer->getPanelByName("avatar_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");
|
||||
|
|
@ -652,12 +648,14 @@ void LLFloaterModelPreview::onJointListSelection()
|
|||
populate_list_with_map(joints_pos, data.mPosOverrides);
|
||||
|
||||
joint_pos_descr->setTextArg("[JOINT]", label);
|
||||
mSelectedJointName = label;
|
||||
}
|
||||
else
|
||||
{
|
||||
// temporary value (shouldn't happen)
|
||||
std::string label = "mPelvis";
|
||||
joint_pos_descr->setTextArg("[JOINT]", label);
|
||||
mSelectedJointName.clear();
|
||||
}
|
||||
|
||||
// Note: We can make a version of renderBones() to highlight selected joint
|
||||
|
|
@ -1440,14 +1438,13 @@ void LLFloaterModelPreview::addStringToLog(const std::ostringstream& strm, bool
|
|||
}
|
||||
}
|
||||
|
||||
void LLFloaterModelPreview::clearOverridesTab()
|
||||
void LLFloaterModelPreview::clearAvatarTab()
|
||||
{
|
||||
LLPanel *panel = mTabContainer->getPanelByName("overrides_panel");
|
||||
LLPanel *panel = mTabContainer->getPanelByName("avatar_panel");
|
||||
LLScrollListCtrl *joints_list = panel->getChild<LLScrollListCtrl>("joints_list");
|
||||
joints_list->deleteAllItems();
|
||||
LLScrollListCtrl *joints_pos = panel->getChild<LLScrollListCtrl>("pos_overrides_list");
|
||||
joints_pos->deleteAllItems();
|
||||
|
||||
joints_pos->deleteAllItems(); mSelectedJointName.clear();
|
||||
|
||||
for (U32 i = 0; i < LLModel::NUM_LODS; ++i)
|
||||
{
|
||||
|
|
@ -1463,11 +1460,12 @@ void LLFloaterModelPreview::clearOverridesTab()
|
|||
joint_pos_descr->setTextArg("[JOINT]", std::string("mPelvis")); // Might be better to hide it
|
||||
}
|
||||
|
||||
void LLFloaterModelPreview::updateOverridesTab()
|
||||
void LLFloaterModelPreview::updateAvatarTab()
|
||||
{
|
||||
S32 display_lod = mModelPreview->mPreviewLOD;
|
||||
if (mModelPreview->mModel[display_lod].empty())
|
||||
{
|
||||
mSelectedJointName.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1507,7 +1505,7 @@ void LLFloaterModelPreview::updateOverridesTab()
|
|||
}
|
||||
}
|
||||
|
||||
LLPanel *panel = mTabContainer->getPanelByName("overrides_panel");
|
||||
LLPanel *panel = mTabContainer->getPanelByName("avatar_panel");
|
||||
LLScrollListCtrl *joints_list = panel->getChild<LLScrollListCtrl>("joints_list");
|
||||
|
||||
if (joints_list->isEmpty())
|
||||
|
|
@ -1548,6 +1546,11 @@ void LLFloaterModelPreview::updateOverridesTab()
|
|||
joint_iter++;
|
||||
}
|
||||
joints_list->selectFirstItem();
|
||||
LLScrollListItem *selected = joints_list->getFirstSelected();
|
||||
if (selected)
|
||||
{
|
||||
mSelectedJointName = selected->getValue().asString();
|
||||
}
|
||||
|
||||
LLTextBox *joint_conf_descr = panel->getChild<LLTextBox>("conflicts_description");
|
||||
joint_conf_descr->setTextArg("[CONFLICTS]", llformat("%d", conflicts));
|
||||
|
|
@ -2482,7 +2485,7 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod)
|
|||
}
|
||||
else
|
||||
{
|
||||
fmp->clearOverridesTab();
|
||||
fmp->clearAvatarTab();
|
||||
}
|
||||
|
||||
if (lock_scale_if_joint_position)
|
||||
|
|
@ -4237,7 +4240,7 @@ BOOL LLModelPreview::render()
|
|||
mFMP->childEnable("lock_scale_if_joint_position");
|
||||
if (fmp)
|
||||
{
|
||||
fmp->updateOverridesTab();
|
||||
fmp->updateAvatarTab();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -4246,7 +4249,7 @@ BOOL LLModelPreview::render()
|
|||
mFMP->childSetValue("lock_scale_if_joint_position", false);
|
||||
if (fmp)
|
||||
{
|
||||
fmp->clearOverridesTab();
|
||||
fmp->clearAvatarTab();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4774,7 +4777,14 @@ BOOL LLModelPreview::render()
|
|||
gDebugProgram.bind();
|
||||
}
|
||||
getPreviewAvatar()->renderCollisionVolumes();
|
||||
getPreviewAvatar()->renderBones();
|
||||
if (fmp->mTabContainer->getCurrentPanelIndex() == fmp->mAvatarTabIndex)
|
||||
{
|
||||
getPreviewAvatar()->renderBones(fmp->mSelectedJointName);
|
||||
}
|
||||
else
|
||||
{
|
||||
getPreviewAvatar()->renderBones();
|
||||
}
|
||||
if (shader)
|
||||
{
|
||||
shader->bind();
|
||||
|
|
@ -4865,7 +4875,7 @@ void LLModelPreview::setPreviewLOD(S32 lod)
|
|||
if (fmp)
|
||||
{
|
||||
// make preview repopulate tab
|
||||
fmp->clearOverridesTab();
|
||||
fmp->clearAvatarTab();
|
||||
}
|
||||
}
|
||||
refresh();
|
||||
|
|
@ -4888,7 +4898,7 @@ void LLFloaterModelPreview::onReset(void* user_data)
|
|||
LLFloaterModelPreview* fmp = (LLFloaterModelPreview*) user_data;
|
||||
fmp->childDisable("reset_btn");
|
||||
fmp->clearLogTab();
|
||||
fmp->clearOverridesTab();
|
||||
fmp->clearAvatarTab();
|
||||
LLModelPreview* mp = fmp->mModelPreview;
|
||||
std::string filename = mp->mLODFile[LLModel::LOD_HIGH];
|
||||
|
||||
|
|
|
|||
|
|
@ -108,8 +108,8 @@ public:
|
|||
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(); // clears table
|
||||
void updateOverridesTab(); // populates table and data as nessesary
|
||||
void clearAvatarTab(); // clears table
|
||||
void updateAvatarTab(); // populates table and data as nessesary
|
||||
|
||||
void setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost);
|
||||
void setPreviewLOD(S32 lod);
|
||||
|
|
@ -249,6 +249,9 @@ private:
|
|||
LLViewerTextEditor* mUploadLogText;
|
||||
LLTabContainer* mTabContainer;
|
||||
|
||||
S32 mAvatarTabIndex; // just to avoid any issues in case of xml changes
|
||||
std::string mSelectedJointName;
|
||||
|
||||
joint_override_data_map_t mJointOverrides[LLModel::NUM_LODS];
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1574,13 +1574,16 @@ void LLVOAvatar::renderCollisionVolumes()
|
|||
}
|
||||
}
|
||||
|
||||
void LLVOAvatar::renderBones()
|
||||
void LLVOAvatar::renderBones(const std::string &selected_joint)
|
||||
{
|
||||
LLGLEnable blend(GL_BLEND);
|
||||
|
||||
avatar_joint_list_t::iterator iter = mSkeleton.begin();
|
||||
avatar_joint_list_t::iterator end = mSkeleton.end();
|
||||
avatar_joint_list_t::iterator end = mSkeleton.end();
|
||||
|
||||
// For selected joints
|
||||
static LLVector3 SELECTED_COLOR_OCCLUDED(1.0f, 1.0f, 0.0f);
|
||||
static LLVector3 SELECTED_COLOR_VISIBLE(0.5f, 0.5f, 0.5f);
|
||||
// For bones with position overrides defined
|
||||
static LLVector3 OVERRIDE_COLOR_OCCLUDED(1.0f, 0.0f, 0.0f);
|
||||
static LLVector3 OVERRIDE_COLOR_VISIBLE(0.5f, 0.5f, 0.5f);
|
||||
|
|
@ -1607,7 +1610,18 @@ void LLVOAvatar::renderBones()
|
|||
|
||||
LLVector3 pos;
|
||||
LLUUID mesh_id;
|
||||
if (jointp->hasAttachmentPosOverride(pos,mesh_id))
|
||||
F32 sphere_scale = SPHERE_SCALEF;
|
||||
|
||||
// We are in render, so it is preferable to implement selection
|
||||
// in a different way, but since this is for debug/preview, this
|
||||
// is low priority
|
||||
if (jointp->getName() == selected_joint)
|
||||
{
|
||||
sphere_scale *= 16;
|
||||
occ_color = SELECTED_COLOR_OCCLUDED;
|
||||
visible_color = SELECTED_COLOR_VISIBLE;
|
||||
}
|
||||
else if (jointp->hasAttachmentPosOverride(pos,mesh_id))
|
||||
{
|
||||
occ_color = OVERRIDE_COLOR_OCCLUDED;
|
||||
visible_color = OVERRIDE_COLOR_VISIBLE;
|
||||
|
|
@ -1628,7 +1642,6 @@ void LLVOAvatar::renderBones()
|
|||
LLVector3 begin_pos(0,0,0);
|
||||
LLVector3 end_pos(jointp->getEnd());
|
||||
|
||||
F32 sphere_scale = SPHERE_SCALEF;
|
||||
|
||||
gGL.pushMatrix();
|
||||
gGL.multMatrix( &jointp->getXform()->getWorldMatrix().mMatrix[0][0] );
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ public:
|
|||
F32 getLastSkinTime() { return mLastSkinTime; }
|
||||
U32 renderTransparent(BOOL first_pass);
|
||||
void renderCollisionVolumes();
|
||||
void renderBones();
|
||||
void renderBones(const std::string &selected_joint = std::string());
|
||||
void renderJoints();
|
||||
static void deleteCachedImages(bool clearAll=true);
|
||||
static void destroyGL();
|
||||
|
|
|
|||
|
|
@ -1169,7 +1169,7 @@
|
|||
<panel
|
||||
label="Overrides"
|
||||
layout="topleft"
|
||||
name="overrides_panel"
|
||||
name="avatar_panel"
|
||||
title="Avatar">
|
||||
<view_border
|
||||
bevel_style="none"
|
||||
|
|
|
|||
Loading…
Reference in New Issue