diff options
-rw-r--r-- | indra/newview/llspatialpartition.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 28 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 40 |
4 files changed, 39 insertions, 37 deletions
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 7633e46200..2594e3397c 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -466,8 +466,6 @@ public: virtual LLCamera transformCamera(LLCamera& camera); LLDrawable* mDrawable; - LLPointer<LLVOAvatar> mAvatar; - }; class LLCullResult diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index fdfc54b67e..147aa1b713 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -388,7 +388,7 @@ void LLViewerObject::markDead() if (av && LLVOAvatar::getRiggedMeshID(this,mesh_id)) { // This case is needed for indirectly attached mesh objects. - av->removeAttachmentOverridesForObject(mesh_id); + av->rebuildAttachmentOverrides(); } } if (getControlAvatar()) @@ -2989,7 +2989,7 @@ void LLViewerObject::linkControlAvatar() } if (getControlAvatar()) { - getControlAvatar()->addAttachmentOverridesForObject(this); + getControlAvatar()->rebuildAttachmentOverrides(); } else { @@ -3001,7 +3001,7 @@ void LLViewerObject::unlinkControlAvatar() { if (getControlAvatar()) { - getControlAvatar()->removeAttachmentOverridesForObject(this); + getControlAvatar()->rebuildAttachmentOverrides(); } if (isRootEdit()) { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 060e93ac9a..0688a57439 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5762,6 +5762,17 @@ void LLVOAvatar::clearAttachmentOverrides() pJoint->clearAttachmentScaleOverrides(); } } + + if (mPelvisFixups.count()>0) + { + mPelvisFixups.clear(); + LLJoint* pJointPelvis = getJoint("mPelvis"); + if (pJointPelvis) + { + pJointPelvis->setPosition( LLVector3( 0.0f, 0.0f, 0.0f) ); + } + postPelvisSetRecalc(); + } } //----------------------------------------------------------------------------- @@ -5771,6 +5782,8 @@ void LLVOAvatar::rebuildAttachmentOverrides() { LLScopedContextString str("rebuildAttachmentOverrides " + getFullname()); + clearAttachmentOverrides(); + // Handle the case that we're resetting the skeleton of an animated object. LLControlAvatar *control_av = dynamic_cast<LLControlAvatar*>(this); if (control_av) @@ -5806,7 +5819,7 @@ void LLVOAvatar::rebuildAttachmentOverrides() } //----------------------------------------------------------------------------- -// addAttachmentPosOverridesForObject +// addAttachmentOverridesForObject //----------------------------------------------------------------------------- void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo) { @@ -6638,6 +6651,11 @@ const LLViewerJointAttachment *LLVOAvatar::attachObject(LLViewerObject *viewer_o return 0; } + if (!viewer_object->isAnimatedObject()) + { + rebuildAttachmentOverrides(); + } + updateVisualComplexity(); if (viewer_object->isSelected()) @@ -6814,7 +6832,7 @@ void LLVOAvatar::cleanupAttachedMesh( LLViewerObject* pVO ) LLUUID mesh_id; if (getRiggedMeshID(pVO, mesh_id)) { - removeAttachmentOverridesForObject(mesh_id); + // FIXME this seems like an odd place for this code. if ( gAgentCamera.cameraCustomizeAvatar() ) { gAgent.unpauseAnimation(); @@ -6839,9 +6857,13 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) if (attachment->isObjectAttached(viewer_object)) { updateVisualComplexity(); + bool is_animated_object = viewer_object->isAnimatedObject(); cleanupAttachedMesh( viewer_object ); - attachment->removeObject(viewer_object); + if (!is_animated_object) + { + rebuildAttachmentOverrides(); + } LL_DEBUGS() << "Detaching object " << viewer_object->mID << " from " << attachment->getName() << LL_ENDL; return TRUE; } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 1725ae4c8a..588f57576e 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1121,6 +1121,14 @@ void LLVOVolume::notifyMeshLoaded() mSculptChanged = TRUE; gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY, TRUE); + if (getAvatar() && !isAnimatedObject()) + { + getAvatar()->addAttachmentOverridesForObject(this); + } + if (getControlAvatar() && isAnimatedObject()) + { + getControlAvatar()->addAttachmentOverridesForObject(this); + } updateVisualComplexity(); } @@ -3368,12 +3376,12 @@ void LLVOVolume::onSetExtendedMeshFlags(U32 flags) if (flags & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG) { // Making a rigged mesh into an animated object - getAvatarAncestor()->removeAttachmentOverridesForObject(this); + getAvatarAncestor()->rebuildAttachmentOverrides(); } else { // Making an animated object into a rigged mesh - getAvatarAncestor()->addAttachmentOverridesForObject(this); + getAvatarAncestor()->rebuildAttachmentOverrides(); } } } @@ -3445,7 +3453,7 @@ void LLVOVolume::updateAnimatedObjectStateOnReparent(LLViewerObject *old_parent, if (old_volp->getControlAvatar()) { // We have been removed from an animated object, need to do cleanup. - old_volp->getControlAvatar()->removeAttachmentOverridesForObject(this); + old_volp->getControlAvatar()->rebuildAttachmentOverrides(); } } } @@ -4918,8 +4926,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) group->mBuilt = 1.f; - LLVOAvatar *rigged_av = NULL; - LLSpatialBridge* bridge = group->getSpatialPartition()->asBridge(); LLViewerObject *vobj = NULL; LLVOVolume *vol_obj = NULL; @@ -4928,14 +4934,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) { vobj = bridge->mDrawable->getVObj(); vol_obj = dynamic_cast<LLVOVolume*>(vobj); - if (bridge->mAvatar.isNull()) - { - if (vobj) - { - bridge->mAvatar = vobj->getAvatar(); - } - } - rigged_av = bridge->mAvatar; } if (vol_obj) { @@ -5047,26 +5045,10 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) vobj->getControlAvatar() && vobj->getControlAvatar()->mPlaying); vobj->updateControlAvatar(); - if (vobj->getControlAvatar()) - { - rigged_av = vobj->getControlAvatar(); - rigged_av->rebuildAttachmentOverrides(); - } bool bake_sunlight = LLPipeline::sBakeSunlight && drawablep->isStatic(); - bool any_rigged_face = false; - if (rigged && rigged_av) - { - rigged_av->addAttachmentOverridesForObject(vobj); - if (!LLApp::isExiting() && rigged_av->isSelf() && debugLoggingEnabled("AvatarAttachments")) - { - bool verbose = true; - rigged_av->showAttachmentOverrides(verbose); - } - } - //for each face for (S32 i = 0; i < drawablep->getNumFaces(); i++) { |