summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatermodelpreview.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2010-12-31 16:48:50 -0600
committerDave Parks <davep@lindenlab.com>2010-12-31 16:48:50 -0600
commit33d9b10fbb9d3de79d389174c92e5b852dbbccdc (patch)
treebe1943037ffa43d3e0daea4daa88dfed0afe3d55 /indra/newview/llfloatermodelpreview.cpp
parentf41b53059ee76903177b21f2b0d8767b4216f010 (diff)
SH-727 Working cancel button and cancel buttons for physics decomp stages.
Diffstat (limited to 'indra/newview/llfloatermodelpreview.cpp')
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp60
1 files changed, 48 insertions, 12 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 8302befaad..2f59621e28 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -280,6 +280,7 @@ BOOL LLFloaterModelPreview::postBuild()
childSetAction("lod_browse", onBrowseLOD, this);
+ childSetCommitCallback("cancel_btn", onCancel, this);
childSetCommitCallback("crease_angle", onGenerateNormalsCommit, this);
childSetCommitCallback("generate_normals", onGenerateNormalsCommit, this);
@@ -552,7 +553,14 @@ void LLFloaterModelPreview::draw()
LLMutexLock lock(mStatusLock);
childSetTextArg("status", "[STATUS]", mStatusMessage);
}
-
+ else
+ {
+ childSetVisible("Simplify", true);
+ childSetVisible("simplify_cancel", false);
+ childSetVisible("Decompose", true);
+ childSetVisible("decompose_cancel", false);
+ }
+
U32 resource_cost = mModelPreview->mResourceCost*10;
if (childGetValue("upload_textures").asBoolean())
@@ -728,7 +736,8 @@ void LLFloaterModelPreview::onPhysicsParamCommit(LLUICtrl* ctrl, void* data)
//static
void LLFloaterModelPreview::onPhysicsStageExecute(LLUICtrl* ctrl, void* data)
{
- LLCDStageData* stage = (LLCDStageData*) data;
+ LLCDStageData* stage_data = (LLCDStageData*) data;
+ std::string stage = stage_data->mName;
if (sInstance)
{
@@ -743,11 +752,22 @@ void LLFloaterModelPreview::onPhysicsStageExecute(LLUICtrl* ctrl, void* data)
for (S32 i = 0; i < sInstance->mModelPreview->mModel[LLModel::LOD_PHYSICS].size(); ++i)
{
LLModel* mdl = sInstance->mModelPreview->mModel[LLModel::LOD_PHYSICS][i];
- DecompRequest* request = new DecompRequest(stage->mName, mdl);
+ DecompRequest* request = new DecompRequest(stage, mdl);
sInstance->mCurRequest.insert(request);
gMeshRepo.mDecompThread->submitRequest(request);
}
}
+
+ if (stage == "Decompose")
+ {
+ sInstance->childSetVisible("Decompose", false);
+ sInstance->childSetVisible("decompose_cancel", true);
+ }
+ else if (stage == "Simplify")
+ {
+ sInstance->childSetVisible("Simplify", false);
+ sInstance->childSetVisible("simplify_cancel", true);
+ }
}
}
@@ -770,6 +790,15 @@ void LLFloaterModelPreview::onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata)
sInstance->mModelPreview->setPhysicsFromLOD(which_mode);
}
+//static
+void LLFloaterModelPreview::onCancel(LLUICtrl* ctrl, void* data)
+{
+ if (sInstance)
+ {
+ sInstance->closeFloater(false);
+ }
+}
+
//static
void LLFloaterModelPreview::onPhysicsStageCancel(LLUICtrl* ctrl, void*data)
{
@@ -788,7 +817,9 @@ void LLFloaterModelPreview::initDecompControls()
{
LLSD key;
- childSetCommitCallback("cancel_btn", onPhysicsStageCancel, NULL);
+ childSetCommitCallback("simplify_cancel", onPhysicsStageCancel, NULL);
+ childSetCommitCallback("decompose_cancel", onPhysicsStageCancel, NULL);
+
childSetCommitCallback("physics_lod_combo", onPhysicsUseLOD, NULL);
childSetCommitCallback("physics_browse", onPhysicsBrowse, NULL);
@@ -2029,7 +2060,7 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp)
mBuildShareTolerance = 0.f;
mBuildQueueMode = GLOD_QUEUE_GREEDY;
mBuildBorderMode = GLOD_BORDER_UNLOCK;
- mBuildOperator = GLOD_OPERATOR_HALF_EDGE_COLLAPSE;
+ mBuildOperator = GLOD_OPERATOR_EDGE_COLLAPSE;
mFMP = fmp;
@@ -2732,7 +2763,9 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation)
lod_mode = GLOD_TRIANGLE_BUDGET;
if (which_lod != -1)
{
- limit = mFMP->childGetValue("lod_triangle_limit").asInteger();
+ //SH-632 take budget as supplied limit+1 to prevent GLOD from creating a smaller
+ //decimation when the given decimation is possible
+ limit = mFMP->childGetValue("lod_triangle_limit").asInteger(); //+1;
}
}
else
@@ -2750,11 +2783,11 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation)
if (build_operator == 0)
{
- build_operator = GLOD_OPERATOR_HALF_EDGE_COLLAPSE;
+ build_operator = GLOD_OPERATOR_EDGE_COLLAPSE;
}
else
{
- build_operator = GLOD_OPERATOR_EDGE_COLLAPSE;
+ build_operator = GLOD_OPERATOR_HALF_EDGE_COLLAPSE;
}
U32 queue_mode=0;
@@ -4248,11 +4281,14 @@ void LLFloaterModelPreview::DecompRequest::completed()
if (sInstance)
{
- if (sInstance->mModelPreview)
+ if (mContinue)
{
- sInstance->mModelPreview->mPhysicsMesh[mModel] = mHullMesh;
- sInstance->mModelPreview->mDirty = true;
- LLFloaterModelPreview::sInstance->mModelPreview->refresh();
+ if (sInstance->mModelPreview)
+ {
+ sInstance->mModelPreview->mPhysicsMesh[mModel] = mHullMesh;
+ sInstance->mModelPreview->mDirty = true;
+ LLFloaterModelPreview::sInstance->mModelPreview->refresh();
+ }
}
sInstance->mCurRequest.erase(this);