SL-375, SL-378 - rudimentary logging info to list joint offsets during mesh import. dae_tool.py work to enable joint offset tweaking.
parent
3da9762eee
commit
ec471497f5
|
|
@ -382,6 +382,13 @@ void showJointPosOverrides( const LLJoint& joint, const std::string& note, const
|
|||
LL_DEBUGS("Avatar") << av_info << " joint " << joint.getName() << " " << note << " " << os.str() << LL_ENDL;
|
||||
}
|
||||
|
||||
bool above_joint_pos_threshold(const LLVector3& diff)
|
||||
{
|
||||
//return !diff.isNull();
|
||||
const F32 max_joint_pos_offset = 0.0001f; // 0.1 mm
|
||||
return diff.lengthSquared() > max_joint_pos_offset * max_joint_pos_offset;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// addAttachmentPosOverride()
|
||||
//--------------------------------------------------------------------
|
||||
|
|
@ -391,6 +398,15 @@ void LLJoint::addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh
|
|||
{
|
||||
return;
|
||||
}
|
||||
if (!above_joint_pos_threshold(pos-getDefaultPosition()))
|
||||
{
|
||||
if (do_debug_joint(getName()))
|
||||
{
|
||||
LL_DEBUGS("Avatar") << "Attachment pos override ignored for " << getName()
|
||||
<< ", pos " << pos << " is same as default pos" << LL_ENDL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!m_attachmentOverrides.count())
|
||||
{
|
||||
if (do_debug_joint(getName()))
|
||||
|
|
|
|||
|
|
@ -489,10 +489,18 @@ void LLFloaterModelPreview::onClickCalculateBtn()
|
|||
bool upload_skinweights = childGetValue("upload_skin").asBoolean();
|
||||
bool upload_joint_positions = childGetValue("upload_joints").asBoolean();
|
||||
|
||||
if (upload_joint_positions)
|
||||
{
|
||||
// Diagnostic message showing list of joints for which joint offsets are defined.
|
||||
// FIXME - given time, would be much better to put this in the UI, in updateStatusMessages().
|
||||
mModelPreview->getPreviewAvatar()->showAttachmentPosOverrides();
|
||||
}
|
||||
|
||||
mUploadModelUrl.clear();
|
||||
|
||||
gMeshRepo.uploadModel(mModelPreview->mUploadData, mModelPreview->mPreviewScale,
|
||||
childGetValue("upload_textures").asBoolean(), upload_skinweights, upload_joint_positions, mUploadModelUrl, false,
|
||||
childGetValue("upload_textures").asBoolean(), upload_skinweights, upload_joint_positions,
|
||||
mUploadModelUrl, false,
|
||||
getWholeModelFeeObserverHandle());
|
||||
|
||||
toggleCalculateButton(false);
|
||||
|
|
|
|||
|
|
@ -5315,13 +5315,6 @@ void LLVOAvatar::clearAttachmentPosOverrides()
|
|||
}
|
||||
}
|
||||
|
||||
bool above_joint_pos_threshold(const LLVector3& diff)
|
||||
{
|
||||
//return !diff.isNull();
|
||||
const F32 max_joint_pos_offset = 0.0001f; // 0.1 mm
|
||||
return diff.lengthSquared() > max_joint_pos_offset * max_joint_pos_offset;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// addAttachmentPosOverridesForObject
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -5382,22 +5375,14 @@ void LLVOAvatar::addAttachmentPosOverridesForObject(LLViewerObject *vo)
|
|||
{
|
||||
pJoint->setId( currentId );
|
||||
const LLVector3& jointPos = pSkinData->mAlternateBindMatrix[i].getTranslation();
|
||||
if (!above_joint_pos_threshold(jointPos-pJoint->getDefaultPosition()))
|
||||
{
|
||||
LL_DEBUGS("Avatar") << "Attachment pos override ignored for " << pJoint->getName()
|
||||
<< ", pos " << jointPos << " is same as default pos" << LL_ENDL;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Set the joint position
|
||||
pJoint->addAttachmentPosOverride( jointPos, mesh_id, avString() );
|
||||
//Set the joint position
|
||||
pJoint->addAttachmentPosOverride( jointPos, mesh_id, avString() );
|
||||
|
||||
//If joint is a pelvis then handle old/new pelvis to foot values
|
||||
if ( lookingForJoint == "mPelvis" )
|
||||
{
|
||||
pelvisGotSet = true;
|
||||
}
|
||||
}
|
||||
//If joint is a pelvis then handle old/new pelvis to foot values
|
||||
if ( lookingForJoint == "mPelvis" )
|
||||
{
|
||||
pelvisGotSet = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pelvisZOffset != 0.0F)
|
||||
|
|
@ -5414,22 +5399,68 @@ void LLVOAvatar::addAttachmentPosOverridesForObject(LLViewerObject *vo)
|
|||
{
|
||||
postPelvisSetRecalc();
|
||||
}
|
||||
}
|
||||
|
||||
if (isSelf())
|
||||
{
|
||||
showAttachmentPosOverrides();
|
||||
//-----------------------------------------------------------------------------
|
||||
// getAttachmentOverrideNames
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLVOAvatar::getAttachmentOverrideNames(std::set<std::string>& names) const
|
||||
{
|
||||
LLVector3 pos;
|
||||
LLUUID mesh_id;
|
||||
|
||||
// Bones
|
||||
for (avatar_joint_list_t::const_iterator iter = mSkeleton.begin();
|
||||
iter != mSkeleton.end(); ++iter)
|
||||
{
|
||||
const LLJoint* pJoint = (*iter);
|
||||
if (pJoint && pJoint->hasAttachmentPosOverride(pos,mesh_id))
|
||||
{
|
||||
names.insert(pJoint->getName());
|
||||
}
|
||||
}
|
||||
|
||||
// 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))
|
||||
{
|
||||
names.insert(attachment_pt->getName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// showAttachmentPosOverrides
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLVOAvatar::showAttachmentPosOverrides() const
|
||||
void LLVOAvatar::showAttachmentPosOverrides(bool verbose) const
|
||||
{
|
||||
std::set<std::string> joint_names;
|
||||
getAttachmentOverrideNames(joint_names);
|
||||
if (joint_names.size())
|
||||
{
|
||||
std::stringstream ss;
|
||||
std::copy(joint_names.begin(), joint_names.end(), std::ostream_iterator<std::string>(ss, ","));
|
||||
LL_INFOS() << getFullname() << " attachment positions defined for joints: " << ss.str() << "\n" << LL_ENDL;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_INFOS() << getFullname() << " no attachment positions defined for any joints" << "\n" << LL_ENDL;
|
||||
}
|
||||
|
||||
if (!verbose)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LLVector3 pos;
|
||||
LLUUID mesh_id;
|
||||
S32 count = 0;
|
||||
|
||||
|
||||
// Bones
|
||||
for (avatar_joint_list_t::const_iterator iter = mSkeleton.begin();
|
||||
iter != mSkeleton.end(); ++iter)
|
||||
|
|
|
|||
|
|
@ -206,7 +206,8 @@ public:
|
|||
bool jointIsRiggedTo(const std::string& joint_name);
|
||||
bool jointIsRiggedTo(const std::string& joint_name, const LLViewerObject *vo);
|
||||
void clearAttachmentPosOverrides();
|
||||
void showAttachmentPosOverrides() const;
|
||||
void showAttachmentPosOverrides(bool verbose = false) const;
|
||||
void getAttachmentOverrideNames(std::set<std::string>& names) const;
|
||||
|
||||
/*virtual*/ const LLUUID& getID() const;
|
||||
/*virtual*/ void addDebugText(const std::string& text);
|
||||
|
|
|
|||
|
|
@ -4777,6 +4777,10 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||
if (rigged && pAvatarVO)
|
||||
{
|
||||
pAvatarVO->addAttachmentPosOverridesForObject(vobj);
|
||||
if (pAvatarVO->isSelf())
|
||||
{
|
||||
//pAvatarVO->showAttachmentPosOverrides();
|
||||
}
|
||||
}
|
||||
|
||||
//for each face
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ def mesh_lock_offsets(tree, joints):
|
|||
continue
|
||||
if joint_node.get("type") != "JOINT":
|
||||
continue
|
||||
if joint_node.get("name") in joints:
|
||||
for matrix_node in joint_node.iter():
|
||||
if joint_node.get("name") in joints or "bone" in joints:
|
||||
for matrix_node in list(joint_node):
|
||||
if "matrix" in matrix_node.tag:
|
||||
floats = [float(x) for x in matrix_node.text.split()]
|
||||
if len(floats) == 16:
|
||||
|
|
|
|||
Loading…
Reference in New Issue