diff options
| author | Dave Parks <davep@lindenlab.com> | 2010-12-31 16:48:50 -0600 | 
|---|---|---|
| committer | Dave Parks <davep@lindenlab.com> | 2010-12-31 16:48:50 -0600 | 
| commit | 33d9b10fbb9d3de79d389174c92e5b852dbbccdc (patch) | |
| tree | be1943037ffa43d3e0daea4daa88dfed0afe3d55 /indra | |
| parent | f41b53059ee76903177b21f2b0d8767b4216f010 (diff) | |
SH-727 Working cancel button and cancel buttons for physics decomp stages.
Diffstat (limited to 'indra')
| -rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 60 | ||||
| -rw-r--r-- | indra/newview/llfloatermodelpreview.h | 1 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/floater_model_preview.xml | 10 | 
3 files changed, 55 insertions, 16 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);
 diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 48263d493a..32cfd94d66 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -187,6 +187,7 @@ protected:  	static void onPhysicsParamCommit(LLUICtrl* ctrl, void* userdata);
  	static void onPhysicsStageExecute(LLUICtrl* ctrl, void* userdata);
 +	static void onCancel(LLUICtrl* ctrl, void* userdata);
  	static void onPhysicsStageCancel(LLUICtrl* ctrl, void* userdata);
  	static void onPhysicsBrowse(LLUICtrl* ctrl, void* userdata);
 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 0fdcf486e7..0fad6a3588 100644 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -169,12 +169,12 @@          Queue Mode:        </text>        <combo_box follows="top|left" name="build_operator" top_pad="5" left="45" width="100" height="20"> -        <combo_item name="half_edge_collapse"> -          Half Edge Collapse -        </combo_item>          <combo_item name="edge_collapse">            Edge Collapse          </combo_item> +        <combo_item name="half_edge_collapse"> +          Half Edge Collapse +        </combo_item>        </combo_box>        <combo_box follows="top|left" name="queue_mode" left_pad="5" width="100" height="20"> @@ -205,7 +205,7 @@            Lock          </combo_item>        </combo_box> -      <spinner follows="left|top" name="share_tolerance" left_pad="5" width="100" height="20"/> +      <spinner follows="left|top" name="share_tolerance" left_pad="5" width="100" decimal_digits="5" initial_value="0.00001" height="20"/>        <text left="10" top_pad="35" follows="top|left" width="240" height="15">          Generate Normals @@ -295,6 +295,7 @@          <check_box name="Close Holes (Slow)" follows="top|left" top_pad="10" height="15" label="Close Holes (slow)"/>          <button left="200" bottom_delta="0" width="90" follows="top|left" label="Analyze" name="Decompose" height="20"/> +        <button left="200" bottom_delta="0" width="90" follows="top|left" label="Cancel" name="decompose_cancel" visble="false" height="20"/>        </panel> @@ -324,6 +325,7 @@          <slider name="Detail Scale" label="Detail Scale:" label_width="120" width="270" follows="top|left" top_pad="10" height="20"/>          <slider name="Retain%" label="Retain:" label_width="120" width="270" follows="top|left" bottom_delta="0" left_delta="0" visible="false" height="20"/>          <button left="190" width="90" follows="top|left" label="Simplify" name="Simplify" height="20"/> +        <button left="190" bottom_delta="0" width="90" follows="top|left" label="Cancel" name="simplify_cancel" height="20"/>        </panel> | 
