SL-779 - refactoring related to rigged-mesh determination. animated objects must contain some triangles even if not at the root

meow-7.2.2
Brad Payne (Vir Linden) 2017-10-25 20:16:39 +01:00
parent 6b6807598f
commit 96bc66a557
5 changed files with 35 additions and 38 deletions

View File

@ -1681,13 +1681,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
continue;
}
LLUUID mesh_id = volume->getParams().getSculptID();
if (mesh_id.isNull())
{
continue;
}
const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(mesh_id, vobj);
const LLMeshSkinInfo* skin = vobj->getSkinInfo();
if (!skin)
{
continue;
@ -1901,13 +1895,7 @@ void LLDrawPoolAvatar::updateRiggedVertexBuffers(LLVOAvatar* avatar)
continue;
}
LLUUID mesh_id = volume->getParams().getSculptID();
if (mesh_id.isNull())
{
continue;
}
const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(mesh_id, vobj);
const LLMeshSkinInfo* skin = vobj->getSkinInfo();
if (!skin)
{
continue;

View File

@ -232,6 +232,7 @@ public:
virtual BOOL isFlexible() const { return FALSE; }
virtual BOOL isSculpted() const { return FALSE; }
virtual BOOL isMesh() const { return FALSE; }
virtual BOOL isRiggedMesh() const { return FALSE; }
virtual BOOL hasLightTexture() const { return FALSE; }
// This method returns true if the object is over land owned by

View File

@ -5655,14 +5655,14 @@ bool LLVOAvatar::getRiggedMeshID(LLViewerObject* pVO, LLUUID& mesh_id)
LLVOVolume* pVObj = pVO->mDrawable->getVOVolume();
if ( pVObj )
{
const LLMeshSkinInfo* pSkinData = gMeshRepo.getSkinInfo( pVObj->getVolume()->getParams().getSculptID(), pVObj );
const LLMeshSkinInfo* pSkinData = pVObj->getSkinInfo();
if (pSkinData
&& pSkinData->mJointNames.size() > JOINT_COUNT_REQUIRED_FOR_FULLRIG // full rig
&& pSkinData->mAlternateBindMatrix.size() > 0 )
{
mesh_id = pSkinData->mMeshID;
return true;
}
{
mesh_id = pSkinData->mMeshID;
return true;
}
}
}
return false;
@ -5709,8 +5709,7 @@ bool LLVOAvatar::jointIsRiggedTo(const std::string& joint_name, const LLViewerOb
return false;
}
LLUUID currentId = vobj->getVolume()->getParams().getSculptID();
const LLMeshSkinInfo* pSkinData = gMeshRepo.getSkinInfo( currentId, vobj );
const LLMeshSkinInfo* pSkinData = vobj->getSkinInfo();
if ( vobj && vobj->isAttachment() && vobj->isMesh() && pSkinData )
{
@ -5814,8 +5813,7 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo)
{
return;
}
LLUUID currentId = vobj->getVolume()->getParams().getSculptID();
const LLMeshSkinInfo* pSkinData = gMeshRepo.getSkinInfo( currentId, vobj );
const LLMeshSkinInfo* pSkinData = vobj->getSkinInfo();
if ( vobj && vobj->isMesh() && pSkinData )
{

View File

@ -3314,6 +3314,24 @@ BOOL LLVOVolume::setIsFlexible(BOOL is_flexible)
return res;
}
const LLMeshSkinInfo* LLVOVolume::getSkinInfo() const
{
if (getVolume())
{
return gMeshRepo.getSkinInfo(getVolume()->getParams().getSculptID(), this);
}
else
{
return NULL;
}
}
// virtual
BOOL LLVOVolume::isRiggedMesh() const
{
return isMesh() && getSkinInfo();
}
//----------------------------------------------------------------------------
// AXON - methods related to extended mesh flags
@ -3382,18 +3400,12 @@ void LLVOVolume::setExtendedMeshFlags(U32 flags)
bool LLVOVolume::canBeAnimatedObject() const
{
#if 0
// AXON: we used to enforce that root had to be mesh. Should we at
// least require that some element of the linkset is mesh? Only
// problem with this is failures while mesh header is still being
// loaded.
F32 est_tris = recursiveGetEstTrianglesMax();
if (est_tris <= 0 || est_tris > getAnimatedObjectMaxTris())
{
LL_INFOS() << "est_tris " << est_tris << " is outside limit of 1-" << getAnimatedObjectMaxTris() << LL_ENDL;
return false;
}
#endif
return true;
}
@ -3685,7 +3697,7 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const
S32 size = gMeshRepo.getMeshSize(volume_params.getSculptID(), getLOD());
if ( size > 0)
{
if (gMeshRepo.getSkinInfo(volume_params.getSculptID(), this))
if (isRiggedMesh())
{
// weighted attachment - 1 point for every 3 bytes
weighted_mesh = 1;
@ -4393,9 +4405,7 @@ void LLVOVolume::updateRiggedVolume(bool force_update)
}
LLVolume* volume = getVolume();
const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(volume->getParams().getSculptID(), this);
const LLMeshSkinInfo* skin = getSkinInfo();
if (!skin)
{
clearRiggedVolume();
@ -4403,7 +4413,6 @@ void LLVOVolume::updateRiggedVolume(bool force_update)
}
LLVOAvatar* avatar = getAvatar();
if (!avatar)
{
clearRiggedVolume();
@ -4418,7 +4427,6 @@ void LLVOVolume::updateRiggedVolume(bool force_update)
}
mRiggedVolume->update(skin, avatar, volume);
}
static LLTrace::BlockTimerStatHandle FTM_SKIN_RIGGED("Skin");
@ -5081,9 +5089,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
drawablep->clearState(LLDrawable::HAS_ALPHA);
bool rigged = vobj->isMesh() &&
vobj->isAttachment() &&
gMeshRepo.getSkinInfo(vobj->getVolume()->getParams().getSculptID(), vobj);
// AXON this includes attached animeshes but leaves out standalone ones. Fix.
bool rigged = vobj->isRiggedMesh() && vobj->isAttachment();
if (vobj->isAnimatedObject())
{

View File

@ -262,6 +262,7 @@ public:
virtual BOOL isFlexible() const;
virtual BOOL isSculpted() const;
virtual BOOL isMesh() const;
virtual BOOL isRiggedMesh() const;
virtual BOOL hasLightTexture() const;
@ -269,6 +270,8 @@ public:
BOOL canBeFlexible() const;
BOOL setIsFlexible(BOOL is_flexible);
const LLMeshSkinInfo* getSkinInfo() const;
// Extended Mesh Properties
U32 getExtendedMeshFlags() const;
void onSetExtendedMeshFlags(U32 flags);