diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2011-01-11 16:42:24 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2011-01-11 16:42:24 -0500 |
commit | 86482ce1d7dbd01e1ebad4d18565bd979a11aa30 (patch) | |
tree | 8f77212384a9302d24cde4d196e6443273ceba20 /indra/newview/llfloatermodelpreview.cpp | |
parent | 997c0d3924015910b62acaa85e46844fcfb43ec0 (diff) | |
parent | 3fcdd7f41581e2e724be703687e717ea6ddc91ba (diff) |
merge
Diffstat (limited to 'indra/newview/llfloatermodelpreview.cpp')
-rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 59 |
1 files changed, 45 insertions, 14 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 02dc1ec8be..0346b06e2f 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -340,6 +340,7 @@ BOOL LLFloaterModelPreview::postBuild() mModelPreview = new LLModelPreview(512, 512, this); mModelPreview->setPreviewTarget(16.f); + mModelPreview->setDetailsCallback(boost::bind(&LLFloaterModelPreview::setDetails, this, _1, _2, _3, _4, _5)); //set callbacks for left click on line editor rows for (U32 i = 0; i <= LLModel::LOD_HIGH; i++) @@ -379,7 +380,8 @@ LLFloaterModelPreview::~LLFloaterModelPreview() { sInstance = NULL; - if ( mModelPreview->mModelLoader->mResetJoints ) + const LLModelLoader *model_loader = mModelPreview->mModelLoader; + if (model_loader && model_loader->mResetJoints) { gAgentAvatarp->resetJointPositions(); } @@ -1669,6 +1671,8 @@ void LLModelLoader::run() setLoadState( ERROR_PARSING ); return; } + setLoadState( DONE ); + processElement(scene); doOnIdleOneTime(boost::bind(&LLModelPreview::loadModelCallback,mPreview,mLod)); @@ -1794,7 +1798,25 @@ void LLModelLoader::processJointNode( domNode* pNode, std::map<std::string,LLMat daeElement* pTranslateElement = getChildFromElement( pNode, "translate" ); if ( !pTranslateElement || pTranslateElement->typeID() != domTranslate::ID() ) { - llwarns<< "The found element is not a translate node" <<llendl; + //llwarns<< "The found element is not a translate node" <<llendl; + daeSIDResolver jointResolver( pNode, "./matrix" ); + domMatrix* pMatrix = daeSafeCast<domMatrix>( jointResolver.getElement() ); + if ( pMatrix ) + { + //llinfos<<"A matrix SID was however found!"<<llendl; + domFloat4x4 domArray = pMatrix->getValue(); + for ( int i = 0; i < 4; i++ ) + { + for( int j = 0; j < 4; j++ ) + { + workingTransform.mMatrix[i][j] = domArray[i + j*4]; + } + } + } + else + { + llwarns<< "The found element is not translate or matrix node - most likely a corrupt export!" <<llendl; + } } else { @@ -2250,18 +2272,24 @@ U32 LLModelPreview::calcResourceCost() //mFMP->childSetTextArg(info_name[LLModel::LOD_PHYSICS], "[HULLS]", llformat("%d",num_hulls)); //mFMP->childSetTextArg(info_name[LLModel::LOD_PHYSICS], "[POINTS]", llformat("%d",num_points)); - mFMP->childSetTextArg("streaming cost", "[COST]", llformat("%.3f", streaming_cost)); - mFMP->childSetTextArg("physics cost", "[COST]", llformat("%.3f", physics_cost)); F32 scale = mFMP->childGetValue("import_scale").asReal()*2.f; - mFMP->childSetTextArg("import_dimensions", "[X]", llformat("%.3f", mPreviewScale[0]*scale)); - mFMP->childSetTextArg("import_dimensions", "[Y]", llformat("%.3f", mPreviewScale[1]*scale)); - mFMP->childSetTextArg("import_dimensions", "[Z]", llformat("%.3f", mPreviewScale[2]*scale)); + + mDetailsSignal(mPreviewScale[0]*scale, mPreviewScale[1]*scale, mPreviewScale[2]*scale, streaming_cost, physics_cost); updateStatusMessages(); return cost; } +void LLFloaterModelPreview::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost) +{ + childSetTextArg("import_dimensions", "[X]", llformat("%.3f", x)); + childSetTextArg("import_dimensions", "[Y]", llformat("%.3f", y)); + childSetTextArg("import_dimensions", "[Z]", llformat("%.3f", z)); + childSetTextArg("streaming cost", "[COST]", llformat("%.3f", streaming_cost)); + childSetTextArg("physics cost", "[COST]", llformat("%.3f", physics_cost)); +} + void LLModelPreview::rebuildUploadData() { assert_main_thread(); @@ -2378,11 +2406,9 @@ void LLModelPreview::loadModel(std::string filename, S32 lod) LLMutexLock lock(this); - if (mModelLoader) - { - delete mModelLoader; - mModelLoader = NULL; - } + // This triggers if you bring up the file picker and then hit CANCEL. + // Just use the previous model (if any) and ignore that you brought up + // the file picker. if (filename.empty()) { @@ -2391,12 +2417,17 @@ void LLModelPreview::loadModel(std::string filename, S32 lod) // this is the initial file picking. Close the whole floater // if we don't have a base model to show for high LOD. mFMP->closeFloater(false); + mLoading = false; } - - mLoading = false; return; } + if (mModelLoader) + { + delete mModelLoader; + mModelLoader = NULL; + } + mLODFile[lod] = filename; if (lod == LLModel::LOD_HIGH) |