summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatermodelpreview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatermodelpreview.cpp')
-rw-r--r--indra/newview/llfloatermodelpreview.cpp53
1 files changed, 37 insertions, 16 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 85cc205dab..1e0624f8c4 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -102,11 +102,12 @@ const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PRE
const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE;
const S32 PREF_BUTTON_HEIGHT = 16 + 7 + 16;
const S32 PREVIEW_TEXTURE_HEIGHT = 300;
+const S32 NUM_LOD = 4;
void drawBoxOutline(const LLVector3& pos, const LLVector3& size);
-std::string lod_name[] =
+std::string lod_name[NUM_LOD+1] =
{
"lowest",
"low",
@@ -115,7 +116,7 @@ std::string lod_name[] =
"I went off the end of the lod_name array. Me so smart."
};
-std::string lod_triangles_name[] =
+std::string lod_triangles_name[NUM_LOD+1] =
{
"lowest_triangles",
"low_triangles",
@@ -124,7 +125,7 @@ std::string lod_triangles_name[] =
"I went off the end of the lod_triangles_name array. Me so smart."
};
-std::string lod_vertices_name[] =
+std::string lod_vertices_name[NUM_LOD+1] =
{
"lowest_vertices",
"low_vertices",
@@ -133,7 +134,7 @@ std::string lod_vertices_name[] =
"I went off the end of the lod_vertices_name array. Me so smart."
};
-std::string lod_status_name[] =
+std::string lod_status_name[NUM_LOD+1] =
{
"lowest_status",
"low_status",
@@ -142,7 +143,7 @@ std::string lod_status_name[] =
"I went off the end of the lod_status_name array. Me so smart."
};
-std::string lod_label_name[] =
+std::string lod_label_name[NUM_LOD+1] =
{
"lowest_label",
"low_label",
@@ -283,6 +284,7 @@ BOOL LLFloaterModelPreview::postBuild()
childDisable("upload_skin");
childDisable("upload_joints");
+ childDisable("ok_btn");
initDecompControls();
@@ -420,6 +422,7 @@ void LLFloaterModelPreview::onPreviewLODCommit(LLUICtrl* ctrl, void* userdata)
{
which_mode = iface->getFirstSelectedIndex();
}
+ which_mode = (NUM_LOD-1)-which_mode; // combo box list of lods is in reverse order
fp->mModelPreview->setPreviewLOD(which_mode);
}
@@ -1302,12 +1305,12 @@ void LLModelLoader::run()
llwarns<<"Tried to apply joint position from .dae, but it did not exist in the avatar rig." << llendl;
}
//Reposition the avatars pelvis (avPos+offset)
- if ( lookingForJoint == "mPelvis" )
- {
- const LLVector3& pos = gAgentAvatarp->getCharacterPosition();
- gAgentAvatarp->setPelvisOffset( true, jointTransform.getTranslation() );
- gAgentAvatarp->setPosition( pos + jointTransform.getTranslation() );
- }
+ //if ( lookingForJoint == "mPelvis" )
+ //{
+ // const LLVector3& pos = gAgentAvatarp->getCharacterPosition();
+ // gAgentAvatarp->setPelvisOffset( true, jointTransform.getTranslation() );
+ // gAgentAvatarp->setPosition( pos + jointTransform.getTranslation() );
+ //}
}
}
} //missingSkeletonOrScene
@@ -1552,9 +1555,11 @@ void LLModelLoader::run()
}
daeElement* scene = root->getDescendant("visual_scene");
+
if (!scene)
{
llwarns << "document has no visual_scene" << llendl;
+ setLoadState( ERROR_PARSING );
return;
}
@@ -1999,6 +2004,11 @@ LLModelPreview::~LLModelPreview()
U32 LLModelPreview::calcResourceCost()
{
rebuildUploadData();
+
+ if ( mModelLoader->getLoadState() != LLModelLoader::ERROR_PARSING )
+ {
+ mFMP->childEnable("ok_btn");
+ }
U32 cost = 0;
std::set<LLModel*> accounted;
@@ -2093,6 +2103,11 @@ void LLModelPreview::rebuildUploadData()
F32 max_scale = 0.f;
+ if ( mBaseScene.size() > 0 )
+ {
+ mFMP->childEnable("ok_btn");
+ }
+
for (LLModelLoader::scene::iterator iter = mBaseScene.begin(); iter != mBaseScene.end(); ++iter)
{ //for each transform in scene
LLMatrix4 mat = iter->first;
@@ -2233,6 +2248,11 @@ void LLModelPreview::loadModel(std::string filename, S32 lod)
setPreviewLOD(lod);
+ if ( mModelLoader->getLoadState() == LLModelLoader::ERROR_PARSING )
+ {
+ mFMP->childDisable("ok_btn");
+ }
+
if (lod == mPreviewLOD)
{
mFMP->childSetText("lod_file", mLODFile[mPreviewLOD]);
@@ -2999,7 +3019,9 @@ void LLModelPreview::updateStatusMessages()
mFMP->childSetText(lod_status_name[lod], message);
}
- if (upload_ok)
+ bool errorStateFromLoader = mModelLoader->getLoadState() == LLModelLoader::ERROR_PARSING ? true : false;
+
+ if ( upload_ok && !errorStateFromLoader )
{
mFMP->childEnable("ok_btn");
}
@@ -3369,6 +3391,8 @@ BOOL LLModelPreview::render()
refresh();
}
+ gPipeline.enableLightsPreview();
+
LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) *
LLQuaternion(mCameraYaw, LLVector3::z_axis);
@@ -3383,8 +3407,6 @@ BOOL LLModelPreview::render()
stop_glerror();
- gPipeline.enableLightsAvatar();
-
gGL.pushMatrix();
const F32 BRIGHTNESS = 0.9f;
gGL.color3f(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS);
@@ -3752,7 +3774,7 @@ void LLModelPreview::setPreviewLOD(S32 lod)
mPreviewLOD = lod;
LLComboBox* combo_box = mFMP->getChild<LLComboBox>("preview_lod_combo");
- combo_box->setCurrentByIndex(mPreviewLOD);
+ combo_box->setCurrentByIndex((NUM_LOD-1)-mPreviewLOD); // combo box list of lods is in reverse order
mFMP->childSetTextArg("lod_table_footer", "[DETAIL]", mFMP->getString(lod_name[mPreviewLOD]));
mFMP->childSetText("lod_file", mLODFile[mPreviewLOD]);
@@ -3886,4 +3908,3 @@ void LLFloaterModelPreview::DecompRequest::completed()
sInstance->mCurRequest = NULL;
}
}
-