Merged in euclid-525 (pull request #499)

Merge recent fixes into LMR#5 RC
meow-7.2.2
Euclid Linden 2021-03-26 22:38:19 +00:00
commit d353c9ae0f
8 changed files with 92 additions and 67 deletions

View File

@ -434,7 +434,7 @@ void LLModel::generateNormals(F32 angle_cutoff)
if (vol_face.mNumIndices > 65535)
{
LL_WARNS() << "Too many vertices for normal generation to work." << LL_ENDL;
LL_WARNS("MESHSKININFO") << "Too many vertices for normal generation to work." << LL_ENDL;
continue;
}
@ -1100,7 +1100,7 @@ bool LLModel::loadModel(std::istream& is)
{
if (!LLSDSerialize::fromBinary(header, is, 1024*1024*1024))
{
LL_WARNS() << "Mesh header parse error. Not a valid mesh asset!" << LL_ENDL;
LL_WARNS("MESHSKININFO") << "Mesh header parse error. Not a valid mesh asset!" << LL_ENDL;
return false;
}
}
@ -1132,7 +1132,7 @@ bool LLModel::loadModel(std::istream& is)
if (header[lod_name[lod]]["offset"].asInteger() == -1 ||
header[lod_name[lod]]["size"].asInteger() == 0 )
{ //cannot load requested LOD
LL_WARNS() << "LoD data is invalid!" << LL_ENDL;
LL_WARNS("MESHSKININFO") << "LoD data is invalid!" << LL_ENDL;
return false;
}
@ -1195,7 +1195,7 @@ bool LLModel::loadModel(std::istream& is)
}
else
{
LL_WARNS() << "unpackVolumeFaces failed!" << LL_ENDL;
LL_WARNS("MESHSKININFO") << "unpackVolumeFaces failed!" << LL_ENDL;
}
return false;
@ -1223,7 +1223,7 @@ bool LLModel::isMaterialListSubset( LLModel* ref )
if (!foundRef)
{
LL_INFOS() << "Could not find material " << mMaterialList[src] << " in reference model " << ref->mLabel << LL_ENDL;
LL_INFOS("MESHSKININFO") << "Could not find material " << mMaterialList[src] << " in reference model " << ref->mLabel << LL_ENDL;
return false;
}
}
@ -1259,7 +1259,7 @@ bool LLModel::matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCn
bool isASubset = isMaterialListSubset( ref );
if ( !isASubset )
{
LL_INFOS()<<"Material of model is not a subset of reference."<<LL_ENDL;
LL_INFOS("MESHSKININFO")<<"Material of model is not a subset of reference."<<LL_ENDL;
return false;
}
@ -1398,6 +1398,14 @@ void LLMeshSkinInfo::fromLLSD(LLSD& skin)
mInvBindMatrix.push_back(mat);
}
if (mJointNames.size() != mInvBindMatrix.size())
{
LL_WARNS("MESHSKININFO") << "Joints vs bind matrix count mismatch. Dropping joint bindings." << LL_ENDL;
mJointNames.clear();
mJointNums.clear();
mInvBindMatrix.clear();
}
}
if (skin.has("bind_shape_matrix"))
@ -1842,14 +1850,14 @@ bool validate_face(const LLVolumeFace& face)
{
if (face.mIndices[i] >= face.mNumVertices)
{
LL_WARNS() << "Face has invalid index." << LL_ENDL;
LL_WARNS("MESHSKININFO") << "Face has invalid index." << LL_ENDL;
return false;
}
}
if (face.mNumIndices % 3 != 0 || face.mNumIndices == 0)
{
LL_WARNS() << "Face has invalid number of indices." << LL_ENDL;
LL_WARNS("MESHSKININFO") << "Face has invalid number of indices." << LL_ENDL;
return false;
}
@ -1879,7 +1887,7 @@ bool validate_model(const LLModel* mdl)
{
if (mdl->getNumVolumeFaces() == 0)
{
LL_WARNS() << "Model has no faces!" << LL_ENDL;
LL_WARNS("MESHSKININFO") << "Model has no faces!" << LL_ENDL;
return false;
}
@ -1887,13 +1895,13 @@ bool validate_model(const LLModel* mdl)
{
if (mdl->getVolumeFace(i).mNumVertices == 0)
{
LL_WARNS() << "Face has no vertices." << LL_ENDL;
LL_WARNS("MESHSKININFO") << "Face has no vertices." << LL_ENDL;
return false;
}
if (mdl->getVolumeFace(i).mNumIndices == 0)
{
LL_WARNS() << "Face has no indices." << LL_ENDL;
LL_WARNS("MESHSKININFO") << "Face has no indices." << LL_ENDL;
return false;
}

View File

@ -355,7 +355,7 @@ LLConversationItemParticipant* LLConversationItemSession::findParticipant(const
for (iter = mChildren.begin(); iter != mChildren.end(); iter++)
{
participant = dynamic_cast<LLConversationItemParticipant*>(*iter);
if (participant->hasSameValue(participant_id))
if (participant && participant->hasSameValue(participant_id))
{
break;
}
@ -466,7 +466,7 @@ const bool LLConversationItemSession::getTime(F64& time) const
{
participant = dynamic_cast<LLConversationItemParticipant*>(*iter);
F64 participant_time;
if (participant->getTime(participant_time))
if (participant && participant->getTime(participant_time))
{
has_time = true;
most_recent_time = llmax(most_recent_time,participant_time);

View File

@ -617,10 +617,13 @@ void LLConversationViewParticipant::refresh()
{
// Refresh the participant view from its model data
LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem());
participant_model->resetRefresh();
// *TODO: We should also do something with vmi->isModerator() to echo that state in the UI somewhat
mSpeakingIndicator->setIsModeratorMuted(participant_model->isModeratorMuted());
if (participant_model)
{
participant_model->resetRefresh();
// *TODO: We should also do something with vmi->isModerator() to echo that state in the UI somewhat
mSpeakingIndicator->setIsModeratorMuted(participant_model->isModeratorMuted());
}
// Do the regular upstream refresh
LLFolderViewItem::refresh();

View File

@ -59,7 +59,9 @@
#include "boost/foreach.hpp"
const S32 EVENTS_PER_IDLE_LOOP = 100;
const S32 EVENTS_PER_IDLE_LOOP_CURRENT_SESSION = 80;
const S32 EVENTS_PER_IDLE_LOOP_BACKGROUND = 40;
const F32 EVENTS_PER_IDLE_LOOP_MIN_PERCENTAGE = 0.01f; // process a minimum of 1% of total events per frame
//
// LLFloaterIMContainer
@ -416,8 +418,11 @@ void LLFloaterIMContainer::processParticipantsStyleUpdate()
while (current_participant_model != end_participant_model)
{
LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model);
// Get the avatar name for this participant id from the cache and update the model
participant_model->updateName();
if (participant_model)
{
// Get the avatar name for this participant id from the cache and update the model
participant_model->updateName();
}
// Next participant
current_participant_model++;
}
@ -464,8 +469,11 @@ void LLFloaterIMContainer::idleUpdate()
while (current_participant_model != end_participant_model)
{
LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model);
participant_model->setModeratorOptionsVisible(is_moderator);
participant_model->setGroupBanVisible(can_ban && participant_model->getUUID() != gAgentID);
if (participant_model)
{
participant_model->setModeratorOptionsVisible(is_moderator);
participant_model->setGroupBanVisible(can_ban && participant_model->getUUID() != gAgentID);
}
current_participant_model++;
}
@ -498,20 +506,49 @@ void LLFloaterIMContainer::idleUpdate()
void LLFloaterIMContainer::idleProcessEvents()
{
if (!mConversationEventQueue.empty())
{
S32 events_to_handle = llmin((S32)mConversationEventQueue.size(), EVENTS_PER_IDLE_LOOP);
for (S32 i = 0; i < events_to_handle; i++)
{
handleConversationModelEvent(mConversationEventQueue.back());
mConversationEventQueue.pop_back();
}
}
LLUUID current_session_id = getSelectedSession();
conversations_items_deque::iterator iter = mConversationEventQueue.begin();
conversations_items_deque::iterator end = mConversationEventQueue.end();
while (iter != end)
{
std::deque<LLSD> &events = iter->second;
if (!events.empty())
{
S32 events_to_handle;
S32 query_size = (S32)events.size();
if (current_session_id == iter->first)
{
events_to_handle = EVENTS_PER_IDLE_LOOP_CURRENT_SESSION;
}
else
{
events_to_handle = EVENTS_PER_IDLE_LOOP_BACKGROUND;
}
if (events_to_handle <= query_size)
{
// Some groups can be very large and can generate huge amount of updates, scale processing up to keep up
events_to_handle = llmax(events_to_handle, (S32)(query_size * EVENTS_PER_IDLE_LOOP_MIN_PERCENTAGE));
}
else
{
events_to_handle = query_size;
}
for (S32 i = 0; i < events_to_handle; i++)
{
handleConversationModelEvent(events.back());
events.pop_back();
}
}
iter++;
}
}
bool LLFloaterIMContainer::onConversationModelEvent(const LLSD& event)
{
mConversationEventQueue.push_front(event);
LLUUID id = event.get("session_uuid").asUUID();
mConversationEventQueue[id].push_front(event);
return true;
}
@ -1822,6 +1859,8 @@ bool LLFloaterIMContainer::removeConversationListItem(const LLUUID& uuid, bool c
// Suppress the conversation items and widgets from their respective maps
mConversationsItems.erase(uuid);
mConversationsWidgets.erase(uuid);
// Clear event query (otherwise reopening session in some way can bombard session with stale data)
mConversationEventQueue.erase(uuid);
// Don't let the focus fall IW, select and refocus on the first conversation in the list
if (change_focus)

View File

@ -229,9 +229,10 @@ private:
conversations_widgets_map mConversationsWidgets;
LLConversationViewModel mConversationViewModel;
LLFolderView* mConversationsRoot;
LLEventStream mConversationsEventStream;
LLEventStream mConversationsEventStream;
std::deque<LLSD> mConversationEventQueue;
typedef std::map<LLUUID, std::deque<LLSD> > conversations_items_deque;
conversations_items_deque mConversationEventQueue;
LLTimer mParticipantRefreshTimer;
};

View File

@ -492,7 +492,10 @@ void LLFloaterIMSessionTab::buildConversationViewParticipant()
while (current_participant_model != end_participant_model)
{
LLConversationItem* participant_model = dynamic_cast<LLConversationItem*>(*current_participant_model);
addConversationViewParticipant(participant_model);
if (participant_model)
{
addConversationViewParticipant(participant_model);
}
current_participant_model++;
}
}

View File

@ -309,7 +309,8 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a
if (vol_face.mJointRiggingInfoTab.needsUpdate())
{
S32 num_verts = vol_face.mNumVertices;
if (num_verts>0 && vol_face.mWeights && (skin->mJointNames.size()>0))
S32 num_joints = skin->mJointNames.size();
if (num_verts > 0 && vol_face.mWeights && num_joints > 0)
{
initJointNums(const_cast<LLMeshSkinInfo*>(skin), avatar);
if (vol_face.mJointRiggingInfoTab.size()==0)
@ -343,7 +344,7 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a
for (U32 k=0; k<4; ++k)
{
S32 joint_index = idx[k];
if (wght[k] > 0.0f)
if (wght[k] > 0.0f && num_joints > joint_index)
{
S32 joint_num = skin->mJointNums[joint_index];
if (joint_num >= 0 && joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS)
@ -394,35 +395,6 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a
}
}
void LLSkinningUtil::updateRiggingInfo_(LLMeshSkinInfo* skin, LLVOAvatar *avatar, S32 num_verts, LLVector4a* weights, LLVector4a* positions, U8* joint_indices, LLJointRiggingInfoTab &rig_info_tab)
{
LL_RECORD_BLOCK_TIME(FTM_FACE_RIGGING_INFO);
for (S32 i=0; i < num_verts; i++)
{
LLVector4a& pos = positions[i];
LLVector4a& wght = weights[i];
for (U32 k=0; k<4; ++k)
{
S32 joint_num = skin->mJointNums[joint_indices[k]];
llassert(joint_num >= 0 && joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS);
{
rig_info_tab[joint_num].setIsRiggedTo(true);
LLMatrix4a bind_shape;
bind_shape.loadu(skin->mBindShapeMatrix);
LLMatrix4a inv_bind;
inv_bind.loadu(skin->mInvBindMatrix[joint_indices[k]]);
LLMatrix4a mat;
matMul(bind_shape, inv_bind, mat);
LLVector4a pos_joint_space;
mat.affineTransform(pos, pos_joint_space);
pos_joint_space.mul(wght[k]);
LLVector4a *extents = rig_info_tab[joint_num].getRiggedExtents();
update_min_max(extents[0], extents[1], pos_joint_space);
}
}
}
}
// This is used for extracting rotation from a bind shape matrix that
// already has scales baked in
LLQuaternion LLSkinningUtil::getUnscaledQuaternion(const LLMatrix4& mat4)

View File

@ -67,7 +67,6 @@ namespace LLSkinningUtil
void initJointNums(LLMeshSkinInfo* skin, LLVOAvatar *avatar);
void updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *avatar, LLVolumeFace& vol_face);
void updateRiggingInfo_(LLMeshSkinInfo* skin, LLVOAvatar *avatar, S32 num_verts, LLVector4a* weights, LLVector4a* positions, U8* joint_indices, LLJointRiggingInfoTab &rig_info_tab);
LLQuaternion getUnscaledQuaternion(const LLMatrix4& mat4);
};