From d2bb490702921b5ca9fdcd562c67844e2d4802e1 Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 24 Mar 2011 09:48:34 -0400 Subject: Crash fix for SH-1176 and WIP for pelvis z offset --- indra/newview/llfloatermodelpreview.cpp | 20 ++++++++++++++------ indra/newview/llmeshrepository.cpp | 2 +- indra/newview/llvoavatar.cpp | 20 +++++++++++++++++++- indra/newview/llvoavatar.h | 1 + .../skins/default/xui/en/floater_model_preview.xml | 2 +- 5 files changed, 36 insertions(+), 9 deletions(-) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 6145c6c16d..2587ab69c3 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1873,8 +1873,7 @@ void LLModelLoader::loadModelCallback() { if (mPreview) { - mPreview->loadModelCallback(mLod); - mPreview->mModelLoader = NULL; + mPreview->loadModelCallback(mLod); } while (!isStopped()) @@ -2494,8 +2493,13 @@ 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; - + mPelvisZOffset = mFMP ? mFMP->childGetValue("pelvis_offset").asReal() : 8.0f; + + //if ( mFMP && mFMP->childGetValue("upload_joints").asBoolean() ) + //{ + // gAgentAvatarp->setPelvisOffset( mPelvisZOffset ); + //} + F32 streaming_cost = 0.f; F32 physics_cost = 0.f; for (U32 i = 0; i < mUploadData.size(); ++i) @@ -2990,8 +2994,12 @@ void LLModelPreview::loadModelCallback(S32 lod) void LLModelPreview::resetPreviewTarget() { - mPreviewTarget = (mModelLoader->mExtents[0] + mModelLoader->mExtents[1]) * 0.5f; - mPreviewScale = (mModelLoader->mExtents[1] - mModelLoader->mExtents[0]) * 0.5f; + if ( mModelLoader ) + { + mPreviewTarget = (mModelLoader->mExtents[0] + mModelLoader->mExtents[1]) * 0.5f; + mPreviewScale = (mModelLoader->mExtents[1] - mModelLoader->mExtents[0]) * 0.5f; + } + setPreviewTarget(mPreviewScale.magVec()*2.f); } diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index a227627bc1..60cbdcc98b 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1179,7 +1179,7 @@ bool LLMeshRepoThread::decompositionReceived(const LLUUID& mesh_id, U8* data, S3 LLSD decomp; if (data_size > 0) - { + { std::string res_str((char*) data, data_size); std::istringstream stream(res_str); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5f0e4bcded..7468281f65 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1333,7 +1333,17 @@ const LLVector3 LLVOAvatar::getRenderPosition() const } else if (isRoot()) { - return mDrawable->getPositionAgent(); + if ( !mHasPelvisOffset ) + { + return mDrawable->getPositionAgent(); + } + else + { + //Apply a pelvis fixup (as defined by the avs skin) + LLVector3 pos = mDrawable->getPositionAgent(); + pos[VZ] += mPelvisFixup; + return pos; + } } else { @@ -3810,6 +3820,14 @@ void LLVOAvatar::postPelvisSetRecalc( void ) updateHeadOffset(); } //------------------------------------------------------------------------ +// pelisPoke +//------------------------------------------------------------------------ +void LLVOAvatar::setPelvisOffset( F32 pelvisFixupAmount ) +{ + mHasPelvisOffset = true; + mPelvisFixup = pelvisFixupAmount; +} +//------------------------------------------------------------------------ // updateVisibility() //------------------------------------------------------------------------ void LLVOAvatar::updateVisibility() diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 7209b9f1e5..1552532a97 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -295,6 +295,7 @@ public: void setPelvisOffset( bool hasOffset, const LLVector3& translation, F32 offset ) ; bool hasPelvisOffset( void ) { return mHasPelvisOffset; } void postPelvisSetRecalc( void ); + void setPelvisOffset( F32 pelvixFixupAmount ); bool mHasPelvisOffset; LLVector3 mPelvisOffset; diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml index e79dfcbc7d..5a726d1821 100644 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -393,7 +393,7 @@ Pelvis Offset: - + -- cgit v1.2.3