summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2010-12-20 17:11:34 -0500
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2010-12-20 17:11:34 -0500
commit4bd6edc6b037195012583467a3e5e754f6a5af77 (patch)
tree6713363bb6c5af098f5eef1c255efbb5baa88b84 /indra/newview
parent6a0e8fc13ec246f69e5718ee91a30117ae703c2a (diff)
SH-682 FIX, SH-594 FIX - removed mFMP wrapper, added thread checking. Moved onIdle functions to llcallbacklist.
Diffstat (limited to 'indra/newview')
-rwxr-xr-x[-rw-r--r--]indra/newview/llappearancemgr.cpp69
-rwxr-xr-x[-rw-r--r--]indra/newview/llappearancemgr.h9
-rwxr-xr-x[-rw-r--r--]indra/newview/llcallbacklist.cpp65
-rwxr-xr-x[-rw-r--r--]indra/newview/llcallbacklist.h9
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp196
-rwxr-xr-xindra/newview/llfloatermodelpreview.h1
6 files changed, 177 insertions, 172 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 80734b0d41..0e080e713b 100644..100755
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -2759,75 +2759,6 @@ BOOL LLAppearanceMgr::getIsProtectedCOFItem(const LLUUID& obj_id) const
*/
}
-// Shim class to allow arbitrary boost::bind
-// expressions to be run as one-time idle callbacks.
-//
-// TODO: rework idle function spec to take a boost::function in the first place.
-class OnIdleCallbackOneTime
-{
-public:
- OnIdleCallbackOneTime(nullary_func_t callable):
- mCallable(callable)
- {
- }
- static void onIdle(void *data)
- {
- gIdleCallbacks.deleteFunction(onIdle, data);
- OnIdleCallbackOneTime* self = reinterpret_cast<OnIdleCallbackOneTime*>(data);
- self->call();
- delete self;
- }
- void call()
- {
- mCallable();
- }
-private:
- nullary_func_t mCallable;
-};
-
-void doOnIdleOneTime(nullary_func_t callable)
-{
- OnIdleCallbackOneTime* cb_functor = new OnIdleCallbackOneTime(callable);
- gIdleCallbacks.addFunction(&OnIdleCallbackOneTime::onIdle,cb_functor);
-}
-
-// Shim class to allow generic boost functions to be run as
-// recurring idle callbacks. Callable should return true when done,
-// false to continue getting called.
-//
-// TODO: rework idle function spec to take a boost::function in the first place.
-class OnIdleCallbackRepeating
-{
-public:
- OnIdleCallbackRepeating(bool_func_t callable):
- mCallable(callable)
- {
- }
- // Will keep getting called until the callable returns true.
- static void onIdle(void *data)
- {
- OnIdleCallbackRepeating* self = reinterpret_cast<OnIdleCallbackRepeating*>(data);
- bool done = self->call();
- if (done)
- {
- gIdleCallbacks.deleteFunction(onIdle, data);
- delete self;
- }
- }
- bool call()
- {
- return mCallable();
- }
-private:
- bool_func_t mCallable;
-};
-
-void doOnIdleRepeating(bool_func_t callable)
-{
- OnIdleCallbackRepeating* cb_functor = new OnIdleCallbackRepeating(callable);
- gIdleCallbacks.addFunction(&OnIdleCallbackRepeating::onIdle,cb_functor);
-}
-
class CallAfterCategoryFetchStage2: public LLInventoryFetchItemsObserver
{
public:
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index c65d9dc9ee..4b1d95cf25 100644..100755
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -248,15 +248,6 @@ private:
LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id,const std::string& name);
-typedef boost::function<void ()> nullary_func_t;
-typedef boost::function<bool ()> bool_func_t;
-
-// Call a given callable once in idle loop.
-void doOnIdleOneTime(nullary_func_t callable);
-
-// Repeatedly call a callable in idle loop until it returns true.
-void doOnIdleRepeating(bool_func_t callable);
-
// Invoke a given callable after category contents are fully fetched.
void callAfterCategoryFetch(const LLUUID& cat_id, nullary_func_t cb);
diff --git a/indra/newview/llcallbacklist.cpp b/indra/newview/llcallbacklist.cpp
index a54c77b4a0..357a6582d1 100644..100755
--- a/indra/newview/llcallbacklist.cpp
+++ b/indra/newview/llcallbacklist.cpp
@@ -115,6 +115,71 @@ void LLCallbackList::callFunctions()
}
}
+// Shim class to allow arbitrary boost::bind
+// expressions to be run as one-time idle callbacks.
+class OnIdleCallbackOneTime
+{
+public:
+ OnIdleCallbackOneTime(nullary_func_t callable):
+ mCallable(callable)
+ {
+ }
+ static void onIdle(void *data)
+ {
+ gIdleCallbacks.deleteFunction(onIdle, data);
+ OnIdleCallbackOneTime* self = reinterpret_cast<OnIdleCallbackOneTime*>(data);
+ self->call();
+ delete self;
+ }
+ void call()
+ {
+ mCallable();
+ }
+private:
+ nullary_func_t mCallable;
+};
+
+void doOnIdleOneTime(nullary_func_t callable)
+{
+ OnIdleCallbackOneTime* cb_functor = new OnIdleCallbackOneTime(callable);
+ gIdleCallbacks.addFunction(&OnIdleCallbackOneTime::onIdle,cb_functor);
+}
+
+// Shim class to allow generic boost functions to be run as
+// recurring idle callbacks. Callable should return true when done,
+// false to continue getting called.
+class OnIdleCallbackRepeating
+{
+public:
+ OnIdleCallbackRepeating(bool_func_t callable):
+ mCallable(callable)
+ {
+ }
+ // Will keep getting called until the callable returns true.
+ static void onIdle(void *data)
+ {
+ OnIdleCallbackRepeating* self = reinterpret_cast<OnIdleCallbackRepeating*>(data);
+ bool done = self->call();
+ if (done)
+ {
+ gIdleCallbacks.deleteFunction(onIdle, data);
+ delete self;
+ }
+ }
+ bool call()
+ {
+ return mCallable();
+ }
+private:
+ bool_func_t mCallable;
+};
+
+void doOnIdleRepeating(bool_func_t callable)
+{
+ OnIdleCallbackRepeating* cb_functor = new OnIdleCallbackRepeating(callable);
+ gIdleCallbacks.addFunction(&OnIdleCallbackRepeating::onIdle,cb_functor);
+}
+
#ifdef _DEBUG
void test1(void *data)
diff --git a/indra/newview/llcallbacklist.h b/indra/newview/llcallbacklist.h
index 07ac21f5e9..97f3bfd9ee 100644..100755
--- a/indra/newview/llcallbacklist.h
+++ b/indra/newview/llcallbacklist.h
@@ -52,6 +52,15 @@ protected:
callback_list_t mCallbackList;
};
+typedef boost::function<void ()> nullary_func_t;
+typedef boost::function<bool ()> bool_func_t;
+
+// Call a given callable once in idle loop.
+void doOnIdleOneTime(nullary_func_t callable);
+
+// Repeatedly call a callable in idle loop until it returns true.
+void doOnIdleRepeating(bool_func_t callable);
+
extern LLCallbackList gIdleCallbacks;
#endif
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 4d8e71918f..f9648b0e3b 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -94,8 +94,7 @@
#include "lltoggleablemenu.h"
#include "llvfile.h"
#include "llvfs.h"
-
-
+#include "llcallbacklist.h"
#include "glod/glod.h"
@@ -1600,8 +1599,8 @@ void LLModelLoader::run()
}
processElement(scene);
-
- mPreview->loadModelCallback(mLod);
+
+ doOnIdleOneTime(boost::bind(&LLModelPreview::loadModelCallback,mPreview,mLod));
}
}
@@ -2053,11 +2052,13 @@ LLModelPreview::~LLModelPreview()
U32 LLModelPreview::calcResourceCost()
{
+ assert_main_thread();
+
rebuildUploadData();
if ( mModelLoader->getLoadState() != LLModelLoader::ERROR_PARSING )
{
- getFMP()->childEnable("ok_btn");
+ mFMP->childEnable("ok_btn");
}
U32 cost = 0;
@@ -2065,7 +2066,7 @@ U32 LLModelPreview::calcResourceCost()
U32 num_points = 0;
U32 num_hulls = 0;
- F32 debug_scale = getFMP()->childGetValue("import_scale").asReal();
+ F32 debug_scale = mFMP->childGetValue("import_scale").asReal();
F32 streaming_cost = 0.f;
for (U32 i = 0; i < mUploadData.size(); ++i)
@@ -2089,8 +2090,8 @@ U32 LLModelPreview::calcResourceCost()
instance.mLOD[1],
instance.mLOD[0],
decomp,
- getFMP()->childGetValue("upload_skin").asBoolean(),
- getFMP()->childGetValue("upload_joints").asBoolean(),
+ mFMP->childGetValue("upload_skin").asBoolean(),
+ mFMP->childGetValue("upload_joints").asBoolean(),
TRUE);
cost += gMeshRepo.calcResourceCost(ret);
@@ -2119,13 +2120,13 @@ U32 LLModelPreview::calcResourceCost()
}
}
- //getFMP()->childSetTextArg(info_name[LLModel::LOD_PHYSICS], "[HULLS]", llformat("%d",num_hulls));
- //getFMP()->childSetTextArg(info_name[LLModel::LOD_PHYSICS], "[POINTS]", llformat("%d",num_points));
- getFMP()->childSetTextArg("streaming cost", "[COST]", llformat("%.3f", streaming_cost));
- F32 scale = getFMP()->childGetValue("import_scale").asReal()*2.f;
- getFMP()->childSetTextArg("import_dimensions", "[X]", llformat("%.3f", mPreviewScale[0]*scale));
- getFMP()->childSetTextArg("import_dimensions", "[Y]", llformat("%.3f", mPreviewScale[1]*scale));
- getFMP()->childSetTextArg("import_dimensions", "[Z]", llformat("%.3f", mPreviewScale[2]*scale));
+ //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));
+ 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));
updateStatusMessages();
@@ -2134,15 +2135,17 @@ U32 LLModelPreview::calcResourceCost()
void LLModelPreview::rebuildUploadData()
{
+ assert_main_thread();
+
mUploadData.clear();
mTextureSet.clear();
//fill uploaddata instance vectors from scene data
- std::string requested_name = getFMP()->getChild<LLUICtrl>("description_form")->getValue().asString();
+ std::string requested_name = mFMP->getChild<LLUICtrl>("description_form")->getValue().asString();
- LLSpinCtrl* scale_spinner = getFMP()->getChild<LLSpinCtrl>("import_scale");
+ LLSpinCtrl* scale_spinner = mFMP->getChild<LLSpinCtrl>("import_scale");
if (!scale_spinner)
{
@@ -2158,7 +2161,7 @@ void LLModelPreview::rebuildUploadData()
if ( mBaseScene.size() > 0 )
{
- getFMP()->childEnable("ok_btn");
+ mFMP->childEnable("ok_btn");
}
for (LLModelLoader::scene::iterator iter = mBaseScene.begin(); iter != mBaseScene.end(); ++iter)
@@ -2226,7 +2229,7 @@ void LLModelPreview::rebuildUploadData()
}
//refill "layer" combo in physics panel
- LLComboBox* combo_box = getFMP()->getChild<LLComboBox>("physics_layer");
+ LLComboBox* combo_box = mFMP->getChild<LLComboBox>("physics_layer");
if (combo_box)
{
S32 current = combo_box->getCurrentIndex();
@@ -2256,6 +2259,8 @@ void LLModelPreview::clearModel(S32 lod)
void LLModelPreview::loadModel(std::string filename, S32 lod)
{
+ assert_main_thread();
+
LLMutexLock lock(this);
if (mModelLoader)
@@ -2270,7 +2275,7 @@ 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.
- getFMP()->closeFloater(false);
+ mFMP->closeFloater(false);
}
mLoading = false;
@@ -2288,35 +2293,37 @@ void LLModelPreview::loadModel(std::string filename, S32 lod)
mModelLoader->start();
- getFMP()->childSetTextArg("status", "[STATUS]", getFMP()->getString("status_reading_file"));
+ mFMP->childSetTextArg("status", "[STATUS]", mFMP->getString("status_reading_file"));
setPreviewLOD(lod);
if ( mModelLoader->getLoadState() == LLModelLoader::ERROR_PARSING )
{
- getFMP()->childDisable("ok_btn");
+ mFMP->childDisable("ok_btn");
}
if (lod == mPreviewLOD)
{
- getFMP()->childSetText("lod_file", mLODFile[mPreviewLOD]);
+ mFMP->childSetText("lod_file", mLODFile[mPreviewLOD]);
}
else if (lod == LLModel::LOD_PHYSICS)
{
- getFMP()->childSetText("physics_file", mLODFile[lod]);
+ mFMP->childSetText("physics_file", mLODFile[lod]);
}
- getFMP()->openFloater();
+ mFMP->openFloater();
}
void LLModelPreview::setPhysicsFromLOD(S32 lod)
{
+ assert_main_thread();
+
if (lod >= 0 && lod <= 3)
{
mModel[LLModel::LOD_PHYSICS] = mModel[lod];
mScene[LLModel::LOD_PHYSICS] = mScene[lod];
mLODFile[LLModel::LOD_PHYSICS].clear();
- getFMP()->childSetText("physics_file", mLODFile[LLModel::LOD_PHYSICS]);
+ mFMP->childSetText("physics_file", mLODFile[LLModel::LOD_PHYSICS]);
mVertexBuffer[LLModel::LOD_PHYSICS].clear();
rebuildUploadData();
refresh();
@@ -2365,15 +2372,10 @@ void LLModelPreview::clearGLODGroup()
}
}
-LLFloater* LLModelPreview::getFMP()
+void LLModelPreview::loadModelCallback(S32 lod)
{
- // Shouldn't be accessing this outside the main UI thread.
assert_main_thread();
- return mFMP;
-}
-void LLModelPreview::loadModelCallback(S32 lod)
-{ //NOT the main thread
LLMutexLock lock(this);
if (!mModelLoader)
{
@@ -2428,6 +2430,8 @@ void LLModelPreview::resetPreviewTarget()
void LLModelPreview::generateNormals()
{
+ assert_main_thread();
+
S32 which_lod = mPreviewLOD;
@@ -2437,7 +2441,7 @@ void LLModelPreview::generateNormals()
return;
}
- F32 angle_cutoff = getFMP()->childGetValue("crease_angle").asReal();
+ F32 angle_cutoff = mFMP->childGetValue("crease_angle").asReal();
angle_cutoff *= DEG_TO_RAD;
@@ -2731,20 +2735,20 @@ void LLModelPreview::genLODs(S32 which_lod)
U32 lod_mode = 0;
- LLCtrlSelectionInterface* iface = getFMP()->childGetSelectionInterface("lod_mode");
+ LLCtrlSelectionInterface* iface = mFMP->childGetSelectionInterface("lod_mode");
if (iface)
{
lod_mode = iface->getFirstSelectedIndex();
}
- F32 lod_error_threshold = getFMP()->childGetValue("lod_error_threshold").asReal();
+ F32 lod_error_threshold = mFMP->childGetValue("lod_error_threshold").asReal();
if (lod_mode == 0)
{
lod_mode = GLOD_TRIANGLE_BUDGET;
if (which_lod != -1)
{
- limit = getFMP()->childGetValue("lod_triangle_limit").asInteger();
+ limit = mFMP->childGetValue("lod_triangle_limit").asInteger();
}
}
else
@@ -2754,7 +2758,7 @@ void LLModelPreview::genLODs(S32 which_lod)
U32 build_operator = 0;
- iface = getFMP()->childGetSelectionInterface("build_operator");
+ iface = mFMP->childGetSelectionInterface("build_operator");
if (iface)
{
build_operator = iface->getFirstSelectedIndex();
@@ -2770,7 +2774,7 @@ void LLModelPreview::genLODs(S32 which_lod)
}
U32 queue_mode=0;
- iface = getFMP()->childGetSelectionInterface("queue_mode");
+ iface = mFMP->childGetSelectionInterface("queue_mode");
if (iface)
{
queue_mode = iface->getFirstSelectedIndex();
@@ -2791,7 +2795,7 @@ void LLModelPreview::genLODs(S32 which_lod)
U32 border_mode = 0;
- iface = getFMP()->childGetSelectionInterface("border_mode");
+ iface = mFMP->childGetSelectionInterface("border_mode");
if (iface)
{
border_mode = iface->getFirstSelectedIndex();
@@ -2825,7 +2829,7 @@ void LLModelPreview::genLODs(S32 which_lod)
object_dirty = true;
}
- F32 share_tolerance = getFMP()->childGetValue("share_tolerance").asReal();
+ F32 share_tolerance = mFMP->childGetValue("share_tolerance").asReal();
if (share_tolerance != mBuildShareTolerance)
{
mBuildShareTolerance = share_tolerance;
@@ -3070,6 +3074,8 @@ void LLModelPreview::genLODs(S32 which_lod)
void LLModelPreview::updateStatusMessages()
{
+ assert_main_thread();
+
//triangle/vertex/submesh count for each mesh asset for each lod
std::vector<S32> tris[LLModel::NUM_LODS];
std::vector<S32> verts[LLModel::NUM_LODS];
@@ -3116,9 +3122,9 @@ void LLModelPreview::updateStatusMessages()
}
- getFMP()->childSetTextArg("submeshes_info", "[SUBMESHES]", llformat("%d", total_submeshes[LLModel::LOD_HIGH]));
+ mFMP->childSetTextArg("submeshes_info", "[SUBMESHES]", llformat("%d", total_submeshes[LLModel::LOD_HIGH]));
- std::string mesh_status_na = getFMP()->getString("mesh_status_na");
+ std::string mesh_status_na = mFMP->getString("mesh_status_na");
S32 upload_status[LLModel::LOD_HIGH+1];
@@ -3132,8 +3138,8 @@ void LLModelPreview::updateStatusMessages()
if (total_tris[lod] > 0)
{
- getFMP()->childSetText(lod_triangles_name[lod], llformat("%d", total_tris[lod]));
- getFMP()->childSetText(lod_vertices_name[lod], llformat("%d", total_verts[lod]));
+ mFMP->childSetText(lod_triangles_name[lod], llformat("%d", total_tris[lod]));
+ mFMP->childSetText(lod_vertices_name[lod], llformat("%d", total_verts[lod]));
}
else
{
@@ -3154,8 +3160,8 @@ void LLModelPreview::updateStatusMessages()
}
}
- getFMP()->childSetText(lod_triangles_name[lod], mesh_status_na);
- getFMP()->childSetText(lod_vertices_name[lod], mesh_status_na);
+ mFMP->childSetText(lod_triangles_name[lod], mesh_status_na);
+ mFMP->childSetText(lod_vertices_name[lod], mesh_status_na);
}
const U32 lod_high = LLModel::LOD_HIGH;
@@ -3190,7 +3196,7 @@ void LLModelPreview::updateStatusMessages()
}
}
- LLIconCtrl* icon = getFMP()->getChild<LLIconCtrl>(lod_icon_name[lod]);
+ LLIconCtrl* icon = mFMP->getChild<LLIconCtrl>(lod_icon_name[lod]);
LLUIImagePtr img = LLUI::getUIImage(lod_status_image[upload_status[lod]]);
icon->setVisible(true);
icon->setImage(img);
@@ -3202,8 +3208,8 @@ void LLModelPreview::updateStatusMessages()
if (lod == mPreviewLOD)
{
- getFMP()->childSetText("lod_status_message_text", getFMP()->getString(message));
- icon = getFMP()->getChild<LLIconCtrl>("lod_status_message_icon");
+ mFMP->childSetText("lod_status_message_text", mFMP->getString(message));
+ icon = mFMP->getChild<LLIconCtrl>("lod_status_message_icon");
icon->setImage(img);
}
}
@@ -3212,18 +3218,18 @@ void LLModelPreview::updateStatusMessages()
if ( upload_ok && !errorStateFromLoader )
{
- getFMP()->childEnable("ok_btn");
+ mFMP->childEnable("ok_btn");
}
else
{
- getFMP()->childDisable("ok_btn");
+ mFMP->childDisable("ok_btn");
}
//add up physics triangles etc
S32 start = 0;
S32 end = mModel[LLModel::LOD_PHYSICS].size();
- S32 idx = getFMP()->childGetValue("physics_layer").asInteger();
+ S32 idx = mFMP->childGetValue("physics_layer").asInteger();
if (idx >= 0 && idx < mModel[LLModel::LOD_PHYSICS].size())
{
@@ -3262,22 +3268,22 @@ void LLModelPreview::updateStatusMessages()
if (phys_tris > 0)
{
- getFMP()->childSetTextArg("physics_triangles", "[TRIANGLES]", llformat("%d", phys_tris));
+ mFMP->childSetTextArg("physics_triangles", "[TRIANGLES]", llformat("%d", phys_tris));
}
else
{
- getFMP()->childSetTextArg("physics_triangles", "[TRIANGLES]", mesh_status_na);
+ mFMP->childSetTextArg("physics_triangles", "[TRIANGLES]", mesh_status_na);
}
if (phys_hulls > 0)
{
- getFMP()->childSetTextArg("physics_hulls", "[HULLS]", llformat("%d", phys_hulls));
- getFMP()->childSetTextArg("physics_points", "[POINTS]", llformat("%d", phys_points));
+ mFMP->childSetTextArg("physics_hulls", "[HULLS]", llformat("%d", phys_hulls));
+ mFMP->childSetTextArg("physics_points", "[POINTS]", llformat("%d", phys_points));
}
else
{
- getFMP()->childSetTextArg("physics_hulls", "[HULLS]", mesh_status_na);
- getFMP()->childSetTextArg("physics_points", "[POINTS]", mesh_status_na);
+ mFMP->childSetTextArg("physics_hulls", "[HULLS]", mesh_status_na);
+ mFMP->childSetTextArg("physics_points", "[POINTS]", mesh_status_na);
}
LLFloaterModelPreview* fmp = LLFloaterModelPreview::sInstance;
@@ -3322,43 +3328,43 @@ void LLModelPreview::updateStatusMessages()
const U32 num_file_controls = sizeof(file_controls)/sizeof(char*);
//enable/disable controls based on radio groups
- if (getFMP()->childGetValue("lod_from_file").asBoolean())
+ if (mFMP->childGetValue("lod_from_file").asBoolean())
{
for (U32 i = 0; i < num_file_controls; ++i)
{
- getFMP()->childEnable(file_controls[i]);
+ mFMP->childEnable(file_controls[i]);
}
for (U32 i = 0; i < num_lod_controls; ++i)
{
- getFMP()->childDisable(lod_controls[i]);
+ mFMP->childDisable(lod_controls[i]);
}
}
- else if (getFMP()->childGetValue("lod_auto_generate").asBoolean())
+ else if (mFMP->childGetValue("lod_auto_generate").asBoolean())
{
for (U32 i = 0; i < num_file_controls; ++i)
{
- getFMP()->childDisable(file_controls[i]);
+ mFMP->childDisable(file_controls[i]);
}
for (U32 i = 0; i < num_lod_controls; ++i)
{
- getFMP()->childEnable(lod_controls[i]);
+ mFMP->childEnable(lod_controls[i]);
}
//if (threshold)
{
U32 lod_mode = 0;
- LLCtrlSelectionInterface* iface = getFMP()->childGetSelectionInterface("lod_mode");
+ LLCtrlSelectionInterface* iface = mFMP->childGetSelectionInterface("lod_mode");
if (iface)
{
lod_mode = iface->getFirstSelectedIndex();
}
- LLSpinCtrl* threshold = getFMP()->getChild<LLSpinCtrl>("lod_error_threshold");
- LLSpinCtrl* limit = getFMP()->getChild<LLSpinCtrl>("lod_triangle_limit");
+ LLSpinCtrl* threshold = mFMP->getChild<LLSpinCtrl>("lod_error_threshold");
+ LLSpinCtrl* limit = mFMP->getChild<LLSpinCtrl>("lod_triangle_limit");
limit->setMaxValue(mMaxTriangleLimit);
limit->setValue(total_tris[mPreviewLOD]);
@@ -3381,12 +3387,12 @@ void LLModelPreview::updateStatusMessages()
{ // "None" is chosen
for (U32 i = 0; i < num_file_controls; ++i)
{
- getFMP()->childDisable(file_controls[i]);
+ mFMP->childDisable(file_controls[i]);
}
for (U32 i = 0; i < num_lod_controls; ++i)
{
- getFMP()->childDisable(lod_controls[i]);
+ mFMP->childDisable(lod_controls[i]);
}
if (!mModel[mPreviewLOD].empty())
@@ -3401,17 +3407,17 @@ void LLModelPreview::updateStatusMessages()
}
}
- if (getFMP()->childGetValue("physics_load_from_file").asBoolean())
+ if (mFMP->childGetValue("physics_load_from_file").asBoolean())
{
- getFMP()->childDisable("physics_lod_combo");
- getFMP()->childEnable("physics_file");
- getFMP()->childEnable("physics_browse");
+ mFMP->childDisable("physics_lod_combo");
+ mFMP->childEnable("physics_file");
+ mFMP->childEnable("physics_browse");
}
else
{
- getFMP()->childEnable("physics_lod_combo");
- getFMP()->childDisable("physics_file");
- getFMP()->childDisable("physics_browse");
+ mFMP->childEnable("physics_lod_combo");
+ mFMP->childDisable("physics_file");
+ mFMP->childDisable("physics_browse");
}
}
@@ -3636,8 +3642,8 @@ BOOL LLModelPreview::render()
}
bool has_skin_weights = false;
- bool upload_skin = getFMP()->childGetValue("upload_skin").asBoolean();
- bool upload_joints = getFMP()->childGetValue("upload_joints").asBoolean();
+ bool upload_skin = mFMP->childGetValue("upload_skin").asBoolean();
+ bool upload_joints = mFMP->childGetValue("upload_joints").asBoolean();
for (LLModelLoader::scene::iterator iter = mScene[mPreviewLOD].begin(); iter != mScene[mPreviewLOD].end(); ++iter)
{
@@ -3659,11 +3665,11 @@ BOOL LLModelPreview::render()
fmp->enableViewOption("show_skin_weight");
fmp->setViewOptionEnabled("show_joint_positions", skin_weight);
}
- getFMP()->childEnable("upload_skin");
+ mFMP->childEnable("upload_skin");
}
else
{
- getFMP()->childDisable("upload_skin");
+ mFMP->childDisable("upload_skin");
if (fmp)
{
fmp->setViewOption("show_skin_weight", false);
@@ -3675,23 +3681,23 @@ BOOL LLModelPreview::render()
if (upload_skin && !has_skin_weights)
{ //can't upload skin weights if model has no skin weights
- getFMP()->childSetValue("upload_skin", false);
+ mFMP->childSetValue("upload_skin", false);
upload_skin = false;
}
if (!upload_skin && upload_joints)
{ //can't upload joints if not uploading skin weights
- getFMP()->childSetValue("upload_joints", false);
+ mFMP->childSetValue("upload_joints", false);
upload_joints = false;
}
- getFMP()->childSetEnabled("upload_joints", upload_skin);
+ mFMP->childSetEnabled("upload_joints", upload_skin);
- F32 explode = getFMP()->childGetValue("physics_explode").asReal();
+ F32 explode = mFMP->childGetValue("physics_explode").asReal();
glClear(GL_DEPTH_BUFFER_BIT);
- LLRect preview_rect = getFMP()->getChildView("preview_panel")->getRect();
+ LLRect preview_rect = mFMP->getChildView("preview_panel")->getRect();
F32 aspect = (F32) preview_rect.getWidth()/preview_rect.getHeight();
LLViewerCamera::getInstance()->setAspect(aspect);
@@ -3745,7 +3751,7 @@ BOOL LLModelPreview::render()
//genLODs();
}
- S32 physics_idx = getFMP()->childGetValue("physics_layer").asInteger();
+ S32 physics_idx = mFMP->childGetValue("physics_layer").asInteger();
if (!mModel[mPreviewLOD].empty())
{
@@ -4125,10 +4131,10 @@ void LLModelPreview::setPreviewLOD(S32 lod)
{
mPreviewLOD = lod;
- LLComboBox* combo_box = getFMP()->getChild<LLComboBox>("preview_lod_combo");
+ LLComboBox* combo_box = mFMP->getChild<LLComboBox>("preview_lod_combo");
combo_box->setCurrentByIndex((NUM_LOD-1)-mPreviewLOD); // combo box list of lods is in reverse order
- getFMP()->childSetTextArg("lod_table_footer", "[DETAIL]", getFMP()->getString(lod_name[mPreviewLOD]));
- getFMP()->childSetText("lod_file", mLODFile[mPreviewLOD]);
+ mFMP->childSetTextArg("lod_table_footer", "[DETAIL]", mFMP->getString(lod_name[mPreviewLOD]));
+ mFMP->childSetText("lod_file", mLODFile[mPreviewLOD]);
LLColor4 highlight_color = LLUIColorTable::instance().getColor("MeshImportTableHighlightColor");
LLColor4 normal_color = LLUIColorTable::instance().getColor("MeshImportTableNormalColor");
@@ -4137,10 +4143,10 @@ void LLModelPreview::setPreviewLOD(S32 lod)
{
const LLColor4& color = (i == lod) ? highlight_color : normal_color;
- getFMP()->childSetColor(lod_status_name[i], color);
- getFMP()->childSetColor(lod_label_name[i], color);
- getFMP()->childSetColor(lod_triangles_name[i], color);
- getFMP()->childSetColor(lod_vertices_name[i], color);
+ mFMP->childSetColor(lod_status_name[i], color);
+ mFMP->childSetColor(lod_label_name[i], color);
+ mFMP->childSetColor(lod_triangles_name[i], color);
+ mFMP->childSetColor(lod_vertices_name[i], color);
}
}
refresh();
@@ -4150,6 +4156,8 @@ void LLModelPreview::setPreviewLOD(S32 lod)
//static
void LLFloaterModelPreview::onBrowseLOD(void* data)
{
+ assert_main_thread();
+
LLFloaterModelPreview* mp = (LLFloaterModelPreview*) data;
mp->loadModel(mp->mModelPreview->mPreviewLOD);
}
@@ -4157,6 +4165,8 @@ void LLFloaterModelPreview::onBrowseLOD(void* data)
//static
void LLFloaterModelPreview::onUpload(void* user_data)
{
+ assert_main_thread();
+
LLFloaterModelPreview* mp = (LLFloaterModelPreview*) user_data;
mp->mModelPreview->rebuildUploadData();
diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h
index 2c89927203..ae4cf18fee 100755
--- a/indra/newview/llfloatermodelpreview.h
+++ b/indra/newview/llfloatermodelpreview.h
@@ -279,7 +279,6 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex
friend class LLPhysicsDecomp;
LLFloater* mFMP;
- LLFloater* getFMP();
BOOL mNeedsUpdate;
bool mDirty;