From 72d5ff36f56c4afee85f5863f64f237980341014 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 17 Aug 2016 16:31:28 -0400 Subject: MAINT-6647 - ignore previously created slm files on model upload. SL-442 - change coloring for show bones, to highlight joint positions and rigging --- indra/llprimitive/llmodelloader.cpp | 30 ++++++++++++++++++++++-------- indra/llprimitive/llmodelloader.h | 4 +++- indra/newview/llface.cpp | 1 + indra/newview/llfloatermodelpreview.cpp | 17 +++++++++++------ indra/newview/llfloatermodelpreview.h | 4 ++-- indra/newview/llvoavatar.cpp | 31 ++++++++++++++++++------------- 6 files changed, 57 insertions(+), 30 deletions(-) diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp index 816ebc558a..4e468ff45f 100644 --- a/indra/llprimitive/llmodelloader.cpp +++ b/indra/llprimitive/llmodelloader.cpp @@ -150,6 +150,23 @@ void LLModelLoader::run() doOnIdleOneTime(boost::bind(&LLModelLoader::loadModelCallback,this)); } +// static +bool LLModelLoader::getSLMFilename(const std::string& model_filename, std::string& slm_filename) +{ + slm_filename = model_filename; + + std::string::size_type i = model_filename.rfind("."); + if (i != std::string::npos) + { + slm_filename.replace(i, model_filename.size()-1, ".slm"); + return true; + } + else + { + return false; + } +} + bool LLModelLoader::doLoadModel() { //first, look for a .slm file of the same name that was modified later @@ -157,20 +174,17 @@ bool LLModelLoader::doLoadModel() if (mTrySLM) { - std::string filename = mFilename; - - std::string::size_type i = filename.rfind("."); - if (i != std::string::npos) - { - filename.replace(i, filename.size()-1, ".slm"); + std::string slm_filename; + if (getSLMFilename(mFilename, slm_filename)) + { llstat slm_status; - if (LLFile::stat(filename, &slm_status) == 0) + if (LLFile::stat(slm_filename, &slm_status) == 0) { //slm file exists llstat dae_status; if (LLFile::stat(mFilename, &dae_status) != 0 || dae_status.st_mtime < slm_status.st_mtime) { - if (loadFromSLM(filename)) + if (loadFromSLM(slm_filename)) { //slm successfully loaded, if this fails, fall through and //try loading from dae diff --git a/indra/llprimitive/llmodelloader.h b/indra/llprimitive/llmodelloader.h index a902ca3404..d64e0a0773 100644 --- a/indra/llprimitive/llmodelloader.h +++ b/indra/llprimitive/llmodelloader.h @@ -137,7 +137,9 @@ public: virtual void setNoOptimize() { mNoOptimize = true; } virtual void run(); - + + static bool getSLMFilename(const std::string& model_filename, std::string& slm_filename); + // Will try SLM or derived class OpenFile as appropriate // virtual bool doLoadModel(); diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index de349a03d4..424bc0228c 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -573,6 +573,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) LLRiggedVolume* rigged = volume->getRiggedVolume(); if (rigged) { + // BENTO - called when selecting a face during edit of a mesh object LLGLEnable offset(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.f, -1.f); gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix); diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 0f0fafcce6..1fd2d429a7 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1656,12 +1656,11 @@ void LLModelPreview::saveUploadData(bool save_skinweights, bool save_joint_posit if (!mLODFile[LLModel::LOD_HIGH].empty()) { std::string filename = mLODFile[LLModel::LOD_HIGH]; - - std::string::size_type i = filename.rfind("."); - if (i != std::string::npos) - { - filename.replace(i, filename.size()-1, ".slm"); - saveUploadData(filename, save_skinweights, save_joint_positions); + std::string slm_filename; + + if (LLModelLoader::getSLMFilename(filename, slm_filename)) + { + saveUploadData(slm_filename, save_skinweights, save_joint_positions); } } } @@ -1818,6 +1817,12 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable } else { + // For MAINT-6647, we have set force_disable_slm to true, + // which means this code path will never be taken. Trying to + // re-use SLM files has never worked properly; in particular, + // it tends to force the UI into strange checkbox options + // which cannot be altered. + //only try to load from slm if viewer is configured to do so and this is the //initial model load (not an LoD or physics shape) mModelLoader->mTrySLM = gSavedSettings.getBOOL("MeshImportUseSLM") && mUploadData.empty(); diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 217ac35888..c4e42c76bd 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -106,7 +106,7 @@ public: void refresh(); void loadModel(S32 lod); - void loadModel(S32 lod, const std::string& file_name, bool force_disable_slm = false); + void loadModel(S32 lod, const std::string& file_name, bool force_disable_slm = true); void onViewOptionChecked(LLUICtrl* ctrl); bool isViewOptionChecked(const LLSD& userdata); @@ -261,7 +261,7 @@ public: void setPreviewLOD(S32 lod); void clearModel(S32 lod); void getJointAliases(JointMap& joint_map); - void loadModel(std::string filename, S32 lod, bool force_disable_slm = false); + void loadModel(std::string filename, S32 lod, bool force_disable_slm = true); void loadModelCallback(S32 lod); bool lodsReady() { return !mGenLOD && mLodsQuery.empty(); } void queryLODs() { mGenLOD = true; }; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index db0316ebcd..946db6713e 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1428,12 +1428,15 @@ void LLVOAvatar::renderBones() avatar_joint_list_t::iterator iter = mSkeleton.begin(); avatar_joint_list_t::iterator end = mSkeleton.end(); - static LLVector3 BASE_COLOR_OCCLUDED(1.0f, 0.0f, 0.0f); - static LLVector3 BASE_COLOR_VISIBLE(0.5f, 0.5f, 0.5f); - static LLVector3 EXTENDED_COLOR_OCCLUDED(0.0f, 1.0f, 0.0f); - static LLVector3 EXTENDED_COLOR_VISIBLE(0.5f, 0.5f, 0.5f); + // For bones with position overrides defined + static LLVector3 OVERRIDE_COLOR_OCCLUDED(1.0f, 0.0f, 0.0f); + static LLVector3 OVERRIDE_COLOR_VISIBLE(0.5f, 0.5f, 0.5f); + // For bones which are rigged to by at least one attachment static LLVector3 RIGGED_COLOR_OCCLUDED(0.0f, 1.0f, 1.0f); static LLVector3 RIGGED_COLOR_VISIBLE(0.5f, 0.5f, 0.5f); + // For bones not otherwise colored + static LLVector3 OTHER_COLOR_OCCLUDED(0.0f, 1.0f, 0.0f); + static LLVector3 OTHER_COLOR_VISIBLE(0.5f, 0.5f, 0.5f); static F32 SPHERE_SCALEF = 0.001f; @@ -1446,25 +1449,27 @@ void LLVOAvatar::renderBones() } jointp->updateWorldMatrix(); - LLJoint::SupportCategory sc = jointp->getSupport(); + LLVector3 occ_color, visible_color; - if (jointIsRiggedTo(jointp->getName())) + LLVector3 pos; + LLUUID mesh_id; + if (jointp->hasAttachmentPosOverride(pos,mesh_id)) { - occ_color = RIGGED_COLOR_OCCLUDED; - visible_color = RIGGED_COLOR_VISIBLE; + occ_color = OVERRIDE_COLOR_OCCLUDED; + visible_color = OVERRIDE_COLOR_VISIBLE; } else { - if (sc == LLJoint::SUPPORT_BASE) + if (jointIsRiggedTo(jointp->getName())) { - occ_color = BASE_COLOR_OCCLUDED; - visible_color = BASE_COLOR_VISIBLE; + occ_color = RIGGED_COLOR_OCCLUDED; + visible_color = RIGGED_COLOR_VISIBLE; } else { - occ_color = EXTENDED_COLOR_OCCLUDED; - visible_color = EXTENDED_COLOR_VISIBLE; + occ_color = OTHER_COLOR_OCCLUDED; + visible_color = OTHER_COLOR_VISIBLE; } } LLVector3 begin_pos(0,0,0); -- cgit v1.2.3