diff options
-rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 33 | ||||
-rw-r--r-- | indra/newview/llfloatermodelpreview.h | 4 |
2 files changed, 28 insertions, 9 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 3a7732c7b3..6bf9fdfb9b 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -495,7 +495,8 @@ void LLFloaterModelPreview::onUploadSkinCommit(LLUICtrl*,void* userdata) { return; } - + + fp->mModelPreview->calcResourceCost(); fp->mModelPreview->refresh(); fp->mModelPreview->resetPreviewTarget(); fp->mModelPreview->clearBuffers(); @@ -1480,8 +1481,8 @@ void LLModelLoader::run() //(which means we have all the joints that are required for an avatar versus //a skinned asset attached to a node in a file that contains an entire skeleton, //but does not use the skeleton). - - if ( !model->mJointList.empty() && doesJointArrayContainACompleteRig( model->mJointList ) ) + mPreview->setRigValid( doesJointArrayContainACompleteRig( model->mJointList ) ); + if ( !model->mJointList.empty() && mPreview->isRigValid() ) { mResetJoints = true; } @@ -2233,6 +2234,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 ) +, mRigValid( false ) { mNeedsUpdate = TRUE; mCameraDistance = 0.f; @@ -2293,6 +2295,16 @@ U32 LLModelPreview::calcResourceCost() } } + //Upload skin is selected BUT the joints coming in from the asset + //were malformed. + if ( mFMP && mFMP->childGetValue("upload_skin").asBoolean() ) + { + if ( !isRigValid() ) + { + mFMP->childDisable("ok_btn"); + } + } + U32 cost = 0; std::set<LLModel*> accounted; U32 num_points = 0; @@ -2552,7 +2564,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod) { mFMP->childDisable("ok_btn"); } - + if (lod == mPreviewLOD) { mFMP->childSetText("lod_file", mLODFile[mPreviewLOD]); @@ -3295,15 +3307,18 @@ void LLModelPreview::updateStatusMessages() bool errorStateFromLoader = mModelLoader->getLoadState() == LLModelLoader::ERROR_PARSING ? true : false; - if ( upload_ok && !errorStateFromLoader ) + bool skinAndRigOk = true; + bool uploadingSkin = mFMP->childGetValue("upload_skin").asBoolean(); + if ( uploadingSkin && !isRigValid() ) { - mFMP->childEnable("ok_btn"); + skinAndRigOk = false; } - else + + if ( upload_ok && !errorStateFromLoader && skinAndRigOk ) { - mFMP->childDisable("ok_btn"); + mFMP->childEnable("ok_btn"); } - + //add up physics triangles etc S32 start = 0; S32 end = mModel[LLModel::LOD_PHYSICS].size(); diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index e3b0f7522e..b3053fe73a 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -294,6 +294,8 @@ public: const bool getModelPivot( void ) const { return mHasPivot; } void setHasPivot( bool val ) { mHasPivot = val; } void setModelPivot( const LLVector3& pivot ) { mModelPivot = pivot; } + const bool isRigValid( void ) const { return mRigValid; } + void setRigValid( bool rigValid ) { mRigValid = rigValid; } static void textureLoadedCallback( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); @@ -361,6 +363,8 @@ public: bool mHasPivot; float mPelvisZOffset; + + bool mRigValid; }; |