MAINT-6647 - ignore previously created slm files on model upload. SL-442 - change coloring for show bones, to highlight joint positions and rigging
parent
9044a8b815
commit
72d5ff36f5
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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; };
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue