diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index d4ba039eeb583fc8bafa50aae964baf6d1045e2a..3a7732c7b3afb805dfe680cdcefd37656d4e0c0f 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -469,7 +469,7 @@ void LLFloaterModelPreview::onPelvisOffsetCommit( LLUICtrl*, void* userdata ) { return; } - + fp->mModelPreview->calcResourceCost(); fp->mModelPreview->refresh(); } @@ -2232,6 +2232,7 @@ LLColor4 LLModelLoader::getDaeColor(daeElement* element) LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE), LLMutex(NULL) +, mPelvisZOffset( 0.0f ) { mNeedsUpdate = TRUE; mCameraDistance = 0.f; @@ -2298,13 +2299,14 @@ U32 LLModelPreview::calcResourceCost() U32 num_hulls = 0; F32 debug_scale = mFMP ? mFMP->childGetValue("import_scale").asReal() : 1.f; - + mPelvisZOffset = mFMP ? mFMP->childGetValue("pelvis_offset").asReal() : 32.0f; + F32 streaming_cost = 0.f; F32 physics_cost = 0.f; for (U32 i = 0; i < mUploadData.size(); ++i) { LLModelInstance& instance = mUploadData[i]; - + if (accounted.find(instance.mModel) == accounted.end()) { accounted.insert(instance.mModel); @@ -3746,6 +3748,7 @@ BOOL LLModelPreview::render() { LLModelInstance& instance = *model_iter; LLModel* model = instance.mModel; + model->mPelvisOffset = mPelvisZOffset; if (!model->mSkinWeights.empty()) { has_skin_weights = true; diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index aac20244cc390175d0536ae990bd12f320674b53..e3b0f7522ece844577fd0eb2c6263d069df79634 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -359,6 +359,8 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex LLVector3 mModelPivot; bool mHasPivot; + + float mPelvisZOffset; }; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 8e869b2d5b51bf4600c35b83746b18b2c93ccb3c..93e6c3aafc638bdde18161f60bfe725b70f242b8 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1167,7 +1167,7 @@ bool LLMeshRepoThread::skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 dat { info.mPelvisOffset = skin["pelvis_offset"].asReal(); } - + llinfos<<"info pelvis offset"<<info.mPelvisOffset<<llendl; mSkinInfoQ.push(info); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a73bac39cf25fea3d283274de112339d09b75fed..5f0e4bcded0842a16a4c4b03581bc6bc590f7aeb 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -761,6 +761,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mDebugExistenceTimer.reset(); mPelvisOffset = LLVector3(0.0f,0.0f,0.0f); mLastPelvisToFoot = 0.0f; + mPelvisFixup = 0.0f; } //------------------------------------------------------------------------ @@ -3332,7 +3333,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) mTimeVisible.reset(); } - + //-------------------------------------------------------------------- // the rest should only be done occasionally for far away avatars //-------------------------------------------------------------------- @@ -3786,13 +3787,15 @@ void LLVOAvatar::updateHeadOffset() //------------------------------------------------------------------------ // setPelvisOffset //------------------------------------------------------------------------ -void LLVOAvatar::setPelvisOffset( bool hasOffset, const LLVector3& offsetAmount ) +void LLVOAvatar::setPelvisOffset( bool hasOffset, const LLVector3& offsetAmount, F32 pelvisFixup ) { mHasPelvisOffset = hasOffset; if ( mHasPelvisOffset ) { + //Store off last pelvis to foot value mLastPelvisToFoot = mPelvisToFoot; - mPelvisOffset = offsetAmount; + mPelvisOffset = offsetAmount; + mPelvisFixup = pelvisFixup; } } //------------------------------------------------------------------------ @@ -5882,7 +5885,8 @@ LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* vi // correctly, but putting this check in here to be safe. if (attachmentID & ATTACHMENT_ADD) { - llwarns << "Got an attachment with ATTACHMENT_ADD mask, removing ( attach pt:" << attachmentID << " )" << llendl; attachmentID &= ~ATTACHMENT_ADD; + llwarns << "Got an attachment with ATTACHMENT_ADD mask, removing ( attach pt:" << attachmentID << " )" << llendl; + attachmentID &= ~ATTACHMENT_ADD; } LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 1152475383e5ad03261b883e4b243b850a4c18a3..7209b9f1e5a330f0524f17861e6adacc104c805e 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -292,13 +292,14 @@ class LLVOAvatar : public: void updateHeadOffset(); F32 getPelvisToFoot() const { return mPelvisToFoot; } - void setPelvisOffset( bool hasOffset, const LLVector3& translation ) ; + void setPelvisOffset( bool hasOffset, const LLVector3& translation, F32 offset ) ; bool hasPelvisOffset( void ) { return mHasPelvisOffset; } void postPelvisSetRecalc( void ); bool mHasPelvisOffset; LLVector3 mPelvisOffset; F32 mLastPelvisToFoot; + F32 mPelvisFixup; LLVector3 mHeadOffset; // current head position LLViewerJoint mRoot; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 7f373736fa9e6bdf8902f15c344f7c8e3550bb07..43d8b9d356cce4d72d07a4259bb3e1cd2900ae65 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3941,6 +3941,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if ( bindCnt > 0 ) { const int jointCnt = pSkinData->mJointNames.size(); + const int pelvisZOffset = pSkinData->mPelvisOffset; bool fullRig = (jointCnt>=20) ? true : false; if ( fullRig ) { @@ -3961,7 +3962,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) pJoint->storeCurrentXform( jointPos ); if ( !pAvatarVO->hasPelvisOffset() ) { - pAvatarVO->setPelvisOffset( true, jointPos ); + pAvatarVO->setPelvisOffset( true, jointPos, pelvisZOffset ); //Trigger to rebuild viewer AV pelvisGotSet = true; }