diff options
author | Dave Parks <davep@lindenlab.com> | 2011-07-06 18:54:50 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-07-06 18:54:50 -0500 |
commit | 71eb68a85d5a5157622ae8f42bac1c21f00d54cd (patch) | |
tree | 60062a3d8b9e6bd6c3d83b8e36ae7e116c84f766 /indra | |
parent | bab80fed2f1404b5b13aed5ac87911f852be3bfb (diff) |
Fix for "set to default" button not resetting some data.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llprimitive/llmodel.cpp | 22 | ||||
-rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 37 | ||||
-rw-r--r-- | indra/newview/llfloatermodelpreview.h | 6 |
3 files changed, 42 insertions, 23 deletions
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index da78b30b34..34b81c9672 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -2171,6 +2171,8 @@ LLSD LLModel::Decomposition::asLLSD() const ret["Min"] = min.getValue(); ret["Max"] = max.getValue(); + LLVector3 range = max-min; + if (!hulls.empty()) { ret["HullList"] = hulls; @@ -2180,10 +2182,6 @@ LLSD LLModel::Decomposition::asLLSD() const { LLSD::Binary p(total*3*2); - LLVector3 min(-0.5f, -0.5f, -0.5f); - LLVector3 max(0.5f, 0.5f, 0.5f); - LLVector3 range = max-min; - U32 vert_idx = 0; for (U32 i = 0; i < mHull.size(); ++i) @@ -2195,11 +2193,11 @@ LLSD LLModel::Decomposition::asLLSD() const for (U32 j = 0; j < mHull[i].size(); ++j) { U64 test = 0; + const F32* src = mHull[i][j].mV; + for (U32 k = 0; k < 3; k++) { - F32* src = (F32*) (mHull[i][j].mV); - - llassert(src[k] <= 0.501f && src[k] >= -0.501f); + llassert(src[k] <= 0.51f && src[k] >= -0.51f); //convert to 16-bit normalized across domain U16 val = (U16) (((src[k]-min.mV[k])/range.mV[k])*65535); @@ -2239,19 +2237,17 @@ LLSD LLModel::Decomposition::asLLSD() const { LLSD::Binary p(mBaseHull.size()*3*2); - LLVector3 min(-0.5f, -0.5f, -0.5f); - LLVector3 max(0.5f, 0.5f, 0.5f); - LLVector3 range = max-min; - U32 vert_idx = 0; for (U32 j = 0; j < mBaseHull.size(); ++j) { + const F32* v = mBaseHull[j].mV; + for (U32 k = 0; k < 3; k++) { - llassert(mBaseHull[j].mV[k] <= 0.51f && mBaseHull[j].mV[k] >= -0.51f); + llassert(v[k] <= 0.51f && v[k] >= -0.51f); //convert to 16-bit normalized across domain - U16 val = (U16) (((mBaseHull[j].mV[k]-min.mV[k])/range.mV[k])*65535); + U16 val = (U16) (((v[k]-min.mV[k])/range.mV[k])*65535); U8* buff = (U8*) &val; //write to binary buffer diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 93607f7a30..a452bcebb2 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -363,6 +363,7 @@ mCalculateBtn(NULL) mLastMouseY = 0; mGLName = 0; mStatusLock = new LLMutex(NULL); + mModelPreview = NULL; mLODMode[LLModel::LOD_HIGH] = 0; for (U32 i = 0; i < LLModel::LOD_HIGH; i++) @@ -446,10 +447,7 @@ BOOL LLFloaterModelPreview::postBuild() mPreviewRect = preview_panel->getRect(); - mModelPreview = new LLModelPreview(512, 512, this ); - mModelPreview->setPreviewTarget(16.f); - mModelPreview->setDetailsCallback(boost::bind(&LLFloaterModelPreview::setDetails, this, _1, _2, _3, _4, _5)); - mModelPreview->setModelUpdatedCallback(boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this, _1)); + initModelPreview(); //set callbacks for left click on line editor rows for (U32 i = 0; i <= LLModel::LOD_HIGH; i++) @@ -510,6 +508,19 @@ LLFloaterModelPreview::~LLFloaterModelPreview() mStatusLock = NULL; } +void LLFloaterModelPreview::initModelPreview() +{ + if (mModelPreview) + { + delete mModelPreview; + } + + mModelPreview = new LLModelPreview(512, 512, this ); + mModelPreview->setPreviewTarget(16.f); + mModelPreview->setDetailsCallback(boost::bind(&LLFloaterModelPreview::setDetails, this, _1, _2, _3, _4, _5)); + mModelPreview->setModelUpdatedCallback(boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this, _1)); +} + void LLFloaterModelPreview::onViewOptionChecked(const LLSD& userdata) { if (mModelPreview) @@ -557,11 +568,11 @@ void LLFloaterModelPreview::loadModel(S32 lod) (new LLMeshFilePicker(mModelPreview, lod))->getFile(); } -void LLFloaterModelPreview::loadModel(S32 lod, const std::string& file_name) +void LLFloaterModelPreview::loadModel(S32 lod, const std::string& file_name, bool force_disable_slm) { mModelPreview->mLoading = true; - mModelPreview->loadModel(file_name, lod); + mModelPreview->loadModel(file_name, lod, force_disable_slm); } void LLFloaterModelPreview::onClickCalculateBtn() @@ -3264,7 +3275,7 @@ void LLModelPreview::clearModel(S32 lod) mScene[lod].clear(); } -void LLModelPreview::loadModel(std::string filename, S32 lod) +void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable_slm) { assert_main_thread(); @@ -3301,6 +3312,11 @@ void LLModelPreview::loadModel(std::string filename, S32 lod) mModelLoader = new LLModelLoader(filename, lod, this, mJointTransformMap, mJointsFromNode ); + if (force_disable_slm) + { + mModelLoader->mTrySLM = false; + } + mModelLoader->start(); mFMP->childSetTextArg("status", "[STATUS]", mFMP->getString("status_reading_file")); @@ -5345,7 +5361,12 @@ void LLFloaterModelPreview::onReset(void* user_data) LLFloaterModelPreview* fmp = (LLFloaterModelPreview*) user_data; LLModelPreview* mp = fmp->mModelPreview; std::string filename = mp->mLODFile[3]; - mp->loadModel(filename,3); + + //reset model preview + fmp->initModelPreview(); + + mp = fmp->mModelPreview; + mp->loadModel(filename,3,true); } //static diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 119c593221..56098c6250 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -162,6 +162,8 @@ public: virtual BOOL postBuild(); + void initModelPreview(); + BOOL handleMouseDown(S32 x, S32 y, MASK mask); BOOL handleMouseUp(S32 x, S32 y, MASK mask); BOOL handleHover(S32 x, S32 y, MASK mask); @@ -187,7 +189,7 @@ public: void updateResourceCost(); void loadModel(S32 lod); - void loadModel(S32 lod, const std::string& file_name); + void loadModel(S32 lod, const std::string& file_name, bool force_disable_slm = false); void onViewOptionChecked(const LLSD& userdata); bool isViewOptionChecked(const LLSD& userdata); @@ -324,7 +326,7 @@ public: virtual BOOL needsRender() { return mNeedsUpdate; } void setPreviewLOD(S32 lod); void clearModel(S32 lod); - void loadModel(std::string filename, S32 lod); + void loadModel(std::string filename, S32 lod, bool force_disable_slm = false); void loadModelCallback(S32 lod); void genLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false); void generateNormals(); |