summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatermodelpreview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatermodelpreview.cpp')
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp307
1 files changed, 192 insertions, 115 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index ea839e6f5a..72c9170b06 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -113,8 +113,6 @@
#include "llviewernetwork.h"
#include "llviewershadermgr.h"
#include "glod/glod.h"
-#include <boost/algorithm/string.hpp>
-
const S32 SLM_SUPPORTED_VERSION = 3;
@@ -123,12 +121,6 @@ S32 LLFloaterModelPreview::sUploadAmount = 10;
LLFloaterModelPreview* LLFloaterModelPreview::sInstance = NULL;
std::list<LLModelLoader*> LLModelLoader::sActiveLoaderList;
-const S32 PREVIEW_BORDER_WIDTH = 2;
-const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PREVIEW_BORDER_WIDTH;
-const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE;
-const S32 PREF_BUTTON_HEIGHT = 16 + 7 + 16;
-const S32 PREVIEW_TEXTURE_HEIGHT = 300;
-
// "Retain%" decomp parameter has values from 0.0 to 1.0 by 0.01
// But according to the UI spec for upload model floater, this parameter
// should be represented by Retain spinner with values from 1 to 100 by 1.
@@ -290,23 +282,41 @@ bool ll_is_degenerate(const LLVector4a& a, const LLVector4a& b, const LLVector4a
bool validate_face(const LLVolumeFace& face)
{
+
+ for (U32 v = 0; v < face.mNumVertices; v++)
+ {
+ if(face.mPositions && !face.mPositions[v].isFinite3())
+ {
+ LL_WARNS() << "NaN position data in face found!" << LL_ENDL;
+ return false;
+ }
+
+ if(face.mNormals && !face.mNormals[v].isFinite3())
+ {
+ LL_WARNS() << "NaN normal data in face found!" << LL_ENDL;
+ return false;
+ }
+ }
+
for (U32 i = 0; i < face.mNumIndices; ++i)
{
if (face.mIndices[i] >= face.mNumVertices)
{
- llwarns << "Face has invalid index." << llendl;
+ LL_WARNS() << "Face has invalid index." << LL_ENDL;
return false;
}
}
if (face.mNumIndices % 3 != 0 || face.mNumIndices == 0)
{
- llwarns << "Face has invalid number of indices." << llendl;
+ LL_WARNS() << "Face has invalid number of indices." << LL_ENDL;
return false;
}
+
/*const LLVector4a scale(0.5f);
+
for (U32 i = 0; i < face.mNumIndices; i+=3)
{
U16 idx1 = face.mIndices[i];
@@ -319,11 +329,10 @@ bool validate_face(const LLVolumeFace& face)
if (ll_is_degenerate(v1,v2,v3))
{
- llwarns << "Degenerate face found!" << llendl;
+ LL_WARNS() << "Degenerate face found!" << LL_ENDL;
return false;
}
}*/
-
return true;
}
@@ -331,7 +340,7 @@ bool validate_model(const LLModel* mdl)
{
if (mdl->getNumVolumeFaces() == 0)
{
- llwarns << "Model has no faces!" << llendl;
+ LL_WARNS() << "Model has no faces!" << LL_ENDL;
return false;
}
@@ -339,13 +348,13 @@ bool validate_model(const LLModel* mdl)
{
if (mdl->getVolumeFace(i).mNumVertices == 0)
{
- llwarns << "Face has no vertices." << llendl;
+ LL_WARNS() << "Face has no vertices." << LL_ENDL;
return false;
}
if (mdl->getVolumeFace(i).mNumIndices == 0)
{
- llwarns << "Face has no indices." << llendl;
+ LL_WARNS() << "Face has no indices." << LL_ENDL;
return false;
}
@@ -364,7 +373,7 @@ BOOL stop_gloderror()
if (error != GLOD_NO_ERROR)
{
- llwarns << "GLOD error detected, cannot generate LOD: " << std::hex << error << llendl;
+ LL_WARNS() << "GLOD error detected, cannot generate LOD: " << std::hex << error << LL_ENDL;
return TRUE;
}
@@ -518,9 +527,16 @@ BOOL LLFloaterModelPreview::postBuild()
mUploadBtn = getChild<LLButton>("ok_btn");
mCalculateBtn = getChild<LLButton>("calculate_btn");
+ if (LLConvexDecomposition::getInstance() != NULL)
+ {
mCalculateBtn->setClickedCallback(boost::bind(&LLFloaterModelPreview::onClickCalculateBtn, this));
toggleCalculateButton(true);
+ }
+ else
+ {
+ mCalculateBtn->setEnabled(false);
+ }
return TRUE;
}
@@ -576,7 +592,7 @@ bool LLFloaterModelPreview::isViewOptionChecked(const LLSD& userdata)
bool LLFloaterModelPreview::isViewOptionEnabled(const LLSD& userdata)
{
- return childIsEnabled(userdata.asString());
+ return getChildView(userdata.asString())->getEnabled();
}
void LLFloaterModelPreview::setViewOptionEnabled(const std::string& option, bool enabled)
@@ -716,6 +732,11 @@ void LLFloaterModelPreview::toggleGenarateNormals()
{
bool enabled = childGetValue("gen_normals").asBoolean();
childSetEnabled("crease_angle", enabled);
+ if(enabled) {
+ mModelPreview->generateNormals();
+ } else {
+ mModelPreview->restoreNormals();
+ }
}
//static
@@ -760,7 +781,6 @@ void LLFloaterModelPreview::onLODParamCommit(S32 lod, bool enforce_tri_limit)
void LLFloaterModelPreview::draw()
{
LLFloater::draw();
- LLRect r = getRect();
mModelPreview->update();
@@ -933,7 +953,7 @@ void LLFloaterModelPreview::onPhysicsParamCommit(LLUICtrl* ctrl, void* data)
{
if (LLConvexDecomposition::getInstance() == NULL)
{
- llinfos << "convex decomposition tool is a stub on this platform. cannot get decomp." << llendl;
+ LL_INFOS() << "convex decomposition tool is a stub on this platform. cannot get decomp." << LL_ENDL;
return;
}
@@ -981,7 +1001,7 @@ void LLFloaterModelPreview::onPhysicsStageExecute(LLUICtrl* ctrl, void* data)
{
if (!sInstance->mCurRequest.empty())
{
- llinfos << "Decomposition request still pending." << llendl;
+ LL_INFOS() << "Decomposition request still pending." << LL_ENDL;
return;
}
@@ -1032,13 +1052,13 @@ void LLFloaterModelPreview::onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata)
}
else
{
- llwarns << "no iface" << llendl;
+ LL_WARNS() << "no iface" << LL_ENDL;
return;
}
if (which_mode <= 0)
{
- llwarns << "which_mode out of range, " << which_mode << llendl;
+ LL_WARNS() << "which_mode out of range, " << which_mode << LL_ENDL;
}
S32 file_mode = iface->getItemCount() - 1;
@@ -1123,8 +1143,8 @@ void LLFloaterModelPreview::initDecompControls()
// protected against stub by stage_count being 0 for stub above
LLConvexDecomposition::getInstance()->registerCallback(j, LLPhysicsDecomp::llcdCallback);
- //llinfos << "Physics decomp stage " << stage[j].mName << " (" << j << ") parameters:" << llendl;
- //llinfos << "------------------------------------" << llendl;
+ //LL_INFOS() << "Physics decomp stage " << stage[j].mName << " (" << j << ") parameters:" << LL_ENDL;
+ //LL_INFOS() << "------------------------------------" << LL_ENDL;
for (S32 i = 0; i < param_count; ++i)
{
@@ -1138,12 +1158,12 @@ void LLFloaterModelPreview::initDecompControls()
std::string type = "unknown";
- llinfos << name << " - " << description << llendl;
+ LL_INFOS() << name << " - " << description << LL_ENDL;
if (param[i].mType == LLCDParam::LLCD_FLOAT)
{
mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mFloat);
- //llinfos << "Type: float, Default: " << param[i].mDefault.mFloat << llendl;
+ //LL_INFOS() << "Type: float, Default: " << param[i].mDefault.mFloat << LL_ENDL;
LLUICtrl* ctrl = getChild<LLUICtrl>(name);
@@ -1193,7 +1213,7 @@ void LLFloaterModelPreview::initDecompControls()
else if (param[i].mType == LLCDParam::LLCD_INTEGER)
{
mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mIntOrEnumValue);
- //llinfos << "Type: integer, Default: " << param[i].mDefault.mIntOrEnumValue << llendl;
+ //LL_INFOS() << "Type: integer, Default: " << param[i].mDefault.mIntOrEnumValue << LL_ENDL;
LLUICtrl* ctrl = getChild<LLUICtrl>(name);
@@ -1219,7 +1239,7 @@ void LLFloaterModelPreview::initDecompControls()
else if (param[i].mType == LLCDParam::LLCD_BOOLEAN)
{
mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mBool);
- //llinfos << "Type: boolean, Default: " << (param[i].mDefault.mBool ? "True" : "False") << llendl;
+ //LL_INFOS() << "Type: boolean, Default: " << (param[i].mDefault.mBool ? "True" : "False") << LL_ENDL;
LLCheckBoxCtrl* check_box = getChild<LLCheckBoxCtrl>(name);
if (check_box)
@@ -1231,16 +1251,16 @@ void LLFloaterModelPreview::initDecompControls()
else if (param[i].mType == LLCDParam::LLCD_ENUM)
{
mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mIntOrEnumValue);
- //llinfos << "Type: enum, Default: " << param[i].mDefault.mIntOrEnumValue << llendl;
+ //LL_INFOS() << "Type: enum, Default: " << param[i].mDefault.mIntOrEnumValue << LL_ENDL;
{ //plug into combo box
- //llinfos << "Accepted values: " << llendl;
+ //LL_INFOS() << "Accepted values: " << LL_ENDL;
LLComboBox* combo_box = getChild<LLComboBox>(name);
for (S32 k = 0; k < param[i].mDetails.mEnumValues.mNumEnums; ++k)
{
- //llinfos << param[i].mDetails.mEnumValues.mEnumsArray[k].mValue
- // << " - " << param[i].mDetails.mEnumValues.mEnumsArray[k].mName << llendl;
+ //LL_INFOS() << param[i].mDetails.mEnumValues.mEnumsArray[k].mValue
+ // << " - " << param[i].mDetails.mEnumValues.mEnumsArray[k].mName << LL_ENDL;
std::string name(param[i].mDetails.mEnumValues.mEnumsArray[k].mName);
std::string localized_name;
@@ -1253,9 +1273,9 @@ void LLFloaterModelPreview::initDecompControls()
combo_box->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
}
- //llinfos << "----" << llendl;
+ //LL_INFOS() << "----" << LL_ENDL;
}
- //llinfos << "-----------------------------" << llendl;
+ //LL_INFOS() << "-----------------------------" << LL_ENDL;
}
}
@@ -1502,14 +1522,14 @@ bool LLModelLoader::doLoadModel()
if (!dom)
{
- llinfos<<" Error with dae - traditionally indicates a corrupt file."<<llendl;
+ LL_INFOS()<<" Error with dae - traditionally indicates a corrupt file."<<LL_ENDL;
setLoadState( ERROR_PARSING );
return false;
}
//Dom version
daeString domVersion = dae.getDomVersion();
std::string sldom(domVersion);
- llinfos<<"Collada Importer Version: "<<sldom<<llendl;
+ LL_INFOS()<<"Collada Importer Version: "<<sldom<<LL_ENDL;
//Dae version
domVersionType docVersion = dom->getVersion();
//0=1.4
@@ -1519,7 +1539,7 @@ bool LLModelLoader::doLoadModel()
{
docVersion = VERSIONTYPE_COUNT;
}
- llinfos<<"Dae version "<<colladaVersion[docVersion]<<llendl;
+ LL_INFOS()<<"Dae version "<<colladaVersion[docVersion]<<LL_ENDL;
daeDatabase* db = dae.getDatabase();
@@ -1529,14 +1549,14 @@ bool LLModelLoader::doLoadModel()
daeDocument* doc = dae.getDoc(mFilename);
if (!doc)
{
- llwarns << "can't find internal doc" << llendl;
+ LL_WARNS() << "can't find internal doc" << LL_ENDL;
return false;
}
daeElement* root = doc->getDomRoot();
if (!root)
{
- llwarns << "document has no root" << llendl;
+ LL_WARNS() << "document has no root" << LL_ENDL;
return false;
}
@@ -1684,7 +1704,6 @@ bool LLModelLoader::doLoadModel()
//If no skeleton, do a breadth-first search to get at specific joints
bool rootNode = false;
- bool skeletonWithNoRootNode = false;
//Need to test for a skeleton that does not have a root node
//This occurs when your instance controller does not have an associated scene
@@ -1695,10 +1714,6 @@ bool LLModelLoader::doLoadModel()
{
rootNode = true;
}
- else
- {
- skeletonWithNoRootNode = true;
- }
}
if ( !pSkeleton || !rootNode )
@@ -1706,7 +1721,7 @@ bool LLModelLoader::doLoadModel()
daeElement* pScene = root->getDescendant("visual_scene");
if ( !pScene )
{
- llwarns<<"No visual scene - unable to parse bone offsets "<<llendl;
+ LL_WARNS()<<"No visual scene - unable to parse bone offsets "<<LL_ENDL;
missingSkeletonOrScene = true;
}
else
@@ -1744,7 +1759,7 @@ bool LLModelLoader::doLoadModel()
//Build a joint for the resolver to work with
char str[64]={0};
sprintf(str,"./%s",(*jointIt).first.c_str() );
- //llwarns<<"Joint "<< str <<llendl;
+ //LL_WARNS()<<"Joint "<< str <<LL_ENDL;
//Setup the resolver
daeSIDResolver resolver( pSkeletonRootNode, str );
@@ -1777,7 +1792,7 @@ bool LLModelLoader::doLoadModel()
daeElement* pTranslateElement = getChildFromElement( pJoint, "translate" );
if ( pTranslateElement && pTranslateElement->typeID() != domTranslate::ID() )
{
- llwarns<< "The found element is not a translate node" <<llendl;
+ LL_WARNS()<< "The found element is not a translate node" <<LL_ENDL;
missingSkeletonOrScene = true;
}
else
@@ -1801,7 +1816,7 @@ bool LLModelLoader::doLoadModel()
//mention it
if ( missingSkeletonOrScene )
{
- llwarns<< "Partial jointmap found in asset - did you mean to just have a partial map?" << llendl;
+ LL_WARNS()<< "Partial jointmap found in asset - did you mean to just have a partial map?" << LL_ENDL;
}
}//got skeleton?
}
@@ -1914,17 +1929,19 @@ bool LLModelLoader::doLoadModel()
if ( mJointList.find( lookingForJoint ) != mJointList.end() )
{
- //llinfos<<"joint "<<lookingForJoint.c_str()<<llendl;
+ //LL_INFOS()<<"joint "<<lookingForJoint.c_str()<<LL_ENDL;
LLMatrix4 jointTransform = mJointList[lookingForJoint];
LLJoint* pJoint = mPreview->getPreviewAvatar()->getJoint( lookingForJoint );
if ( pJoint )
{
- pJoint->storeCurrentXform( jointTransform.getTranslation() );
+ LLUUID fake_mesh_id;
+ fake_mesh_id.generate();
+ pJoint->addAttachmentPosOverride( jointTransform.getTranslation(), fake_mesh_id, gAgentAvatarp->avString());
}
else
{
//Most likely an error in the asset.
- llwarns<<"Tried to apply joint position from .dae, but it did not exist in the avatar rig." << llendl;
+ LL_WARNS()<<"Tried to apply joint position from .dae, but it did not exist in the avatar rig." << LL_ENDL;
}
}
}
@@ -1952,7 +1969,7 @@ bool LLModelLoader::doLoadModel()
}
else
{
- llwarns<<"Possibly misnamed/missing joint [" <<lookingForJoint.c_str()<<" ] "<<llendl;
+ LL_WARNS()<<"Possibly misnamed/missing joint [" <<lookingForJoint.c_str()<<" ] "<<LL_ENDL;
}
}
@@ -1978,7 +1995,7 @@ bool LLModelLoader::doLoadModel()
{
if (pos.getCount() <= j+2)
{
- llerrs << "Invalid position array size." << llendl;
+ LL_ERRS() << "Invalid position array size." << LL_ENDL;
}
LLVector3 v(pos[j], pos[j+1], pos[j+2]);
@@ -2104,7 +2121,7 @@ bool LLModelLoader::doLoadModel()
if (!scene)
{
- llwarns << "document has no visual_scene" << llendl;
+ LL_WARNS() << "document has no visual_scene" << LL_ENDL;
setLoadState( ERROR_PARSING );
return true;
}
@@ -2143,7 +2160,7 @@ bool LLModelLoader::loadFromSLM(const std::string& filename)
S32 file_size = (S32) stat.st_size;
- llifstream ifstream(filename, std::ifstream::in | std::ifstream::binary);
+ llifstream ifstream(filename.c_str(), std::ifstream::in | std::ifstream::binary);
LLSD data;
LLSDSerialize::fromBinary(data, ifstream, file_size);
ifstream.close();
@@ -2319,7 +2336,7 @@ void LLModelLoader::processJointToNodeMapping( domNode* pNode )
}
else
{
- llinfos<<"Node is NULL"<<llendl;
+ LL_INFOS()<<"Node is NULL"<<LL_ENDL;
}
}
@@ -2390,7 +2407,7 @@ void LLModelPreview::critiqueJointToNodeMappingFromScene( void )
}
else
{
- llinfos<<"critiqueJointToNodeMappingFromScene is missing a: "<<name<<llendl;
+ LL_INFOS()<<"critiqueJointToNodeMappingFromScene is missing a: "<<name<<LL_ENDL;
result = false;
}
}
@@ -2442,7 +2459,7 @@ bool LLModelPreview::isRigLegacy( const std::vector<std::string> &jointListFromA
}
if ( !result )
{
- llinfos<<" Asset did not contain the joint (if you're u/l a fully rigged asset w/joint positions - it is required)." << *masterJointIt<< llendl;
+ LL_INFOS()<<" Asset did not contain the joint (if you're u/l a fully rigged asset w/joint positions - it is required)." << *masterJointIt<< LL_ENDL;
break;
}
}
@@ -2476,7 +2493,7 @@ bool LLModelPreview::isRigSuitableForJointPositionUpload( const std::vector<std:
}
if ( !result )
{
- llinfos<<" Asset did not contain the joint (if you're u/l a fully rigged asset w/joint positions - it is required)." << *masterJointIt<< llendl;
+ LL_INFOS()<<" Asset did not contain the joint (if you're u/l a fully rigged asset w/joint positions - it is required)." << *masterJointIt<< LL_ENDL;
break;
}
}
@@ -2502,7 +2519,7 @@ void LLModelLoader::loadTextures()
if(!material.mDiffuseMapFilename.empty())
{
material.mDiffuseMap =
- LLViewerTextureManager::getFetchedTextureFromUrl("file://" + material.mDiffuseMapFilename, TRUE, LLViewerTexture::BOOST_PREVIEW);
+ LLViewerTextureManager::getFetchedTextureFromUrl("file://" + material.mDiffuseMapFilename, FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_PREVIEW);
material.mDiffuseMap->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, TRUE, FALSE, mPreview, NULL, FALSE);
material.mDiffuseMap->forceToSaveRawImage(0, F32_MAX);
mNumOfFetchingTextures++ ;
@@ -2524,17 +2541,17 @@ bool LLModelLoader::isNodeAJoint( domNode* pNode )
{
if ( !pNode )
{
- llinfos<<"Created node is NULL"<<llendl;
+ LL_INFOS()<<"Created node is NULL"<<LL_ENDL;
return false;
}
if ( pNode->getName() == NULL )
{
- llinfos<<"Parsed node has no name "<<llendl;
+ LL_INFOS()<<"Parsed node has no name "<<LL_ENDL;
//Attempt to write the node id, if possible (aids in debugging the visual scene)
if ( pNode->getId() )
{
- llinfos<<"Parsed node ID: "<<pNode->getId()<<llendl;
+ LL_INFOS()<<"Parsed node ID: "<<pNode->getId()<<LL_ENDL;
}
return false;
}
@@ -2553,7 +2570,7 @@ bool LLModelPreview::verifyCount( int expected, int result )
{
if ( expected != result )
{
- llinfos<< "Error: (expected/got)"<<expected<<"/"<<result<<"verts"<<llendl;
+ LL_INFOS()<< "Error: (expected/got)"<<expected<<"/"<<result<<"verts"<<LL_ENDL;
return false;
}
return true;
@@ -2575,7 +2592,7 @@ bool LLModelPreview::verifyController( domController* pController )
if ( !pElement )
{
- llinfos<<"Can't resolve skin source"<<llendl;
+ LL_INFOS()<<"Can't resolve skin source"<<LL_ENDL;
return false;
}
@@ -2594,7 +2611,7 @@ bool LLModelPreview::verifyController( domController* pController )
domVertices* pVertices = pMesh->getVertices();
if ( !pVertices )
{
- llinfos<<"No vertices!"<<llendl;
+ LL_INFOS()<<"No vertices!"<<LL_ENDL;
return false;
}
@@ -2680,7 +2697,7 @@ void LLModelLoader::extractTranslationViaSID( daeElement* pElement, LLMatrix4& t
}
else
{
- llwarns<<"Element is nonexistent - empty/unsupported node."<<llendl;
+ LL_WARNS()<<"Element is nonexistent - empty/unsupported node."<<LL_ENDL;
}
}
//-----------------------------------------------------------------------------
@@ -2690,11 +2707,11 @@ void LLModelLoader::processJointNode( domNode* pNode, JointTransformMap& jointTr
{
if (pNode->getName() == NULL)
{
- llwarns << "nameless node, can't process" << llendl;
+ LL_WARNS() << "nameless node, can't process" << LL_ENDL;
return;
}
- //llwarns<<"ProcessJointNode# Node:" <<pNode->getName()<<llendl;
+ //LL_WARNS()<<"ProcessJointNode# Node:" <<pNode->getName()<<LL_ENDL;
//1. handle the incoming node - extract out translation via SID or element
@@ -2722,12 +2739,12 @@ void LLModelLoader::processJointNode( domNode* pNode, JointTransformMap& jointTr
daeElement* pTranslateElement = getChildFromElement( pNode, "translate" );
if ( !pTranslateElement || pTranslateElement->typeID() != domTranslate::ID() )
{
- //llwarns<< "The found element is not a translate node" <<llendl;
+ //LL_WARNS()<< "The found element is not a translate node" <<LL_ENDL;
daeSIDResolver jointResolver( pNode, "./matrix" );
domMatrix* pMatrix = daeSafeCast<domMatrix>( jointResolver.getElement() );
if ( pMatrix )
{
- //llinfos<<"A matrix SID was however found!"<<llendl;
+ //LL_INFOS()<<"A matrix SID was however found!"<<LL_ENDL;
domFloat4x4 domArray = pMatrix->getValue();
for ( int i = 0; i < 4; i++ )
{
@@ -2739,7 +2756,7 @@ void LLModelLoader::processJointNode( domNode* pNode, JointTransformMap& jointTr
}
else
{
- llwarns<< "The found element is not translate or matrix node - most likely a corrupt export!" <<llendl;
+ LL_WARNS()<< "The found element is not translate or matrix node - most likely a corrupt export!" <<LL_ENDL;
}
}
else
@@ -2776,7 +2793,7 @@ daeElement* LLModelLoader::getChildFromElement( daeElement* pElement, std::strin
{
return pChildOfElement;
}
- llwarns<< "Could not find a child [" << name << "] for the element: \"" << pElement->getAttribute("id") << "\"" << llendl;
+ LL_WARNS()<< "Could not find a child [" << name << "] for the element: \"" << pElement->getAttribute("id") << "\"" << LL_ENDL;
return NULL;
}
@@ -2858,7 +2875,7 @@ void LLModelLoader::processElement( daeElement* element, bool& badElement )
if (mTransform.determinant() < 0)
{ //negative scales are not supported
- llinfos << "Negative scale detected, unsupported transform. domInstance_geometry: " << LLModel::getElementLabel(instance_geo) << llendl;
+ LL_INFOS() << "Negative scale detected, unsupported transform. domInstance_geometry: " << LLModel::getElementLabel(instance_geo) << LL_ENDL;
badElement = true;
}
@@ -2888,7 +2905,7 @@ void LLModelLoader::processElement( daeElement* element, bool& badElement )
}
else
{
- llinfos<<"Unable to resolve geometry URL."<<llendl;
+ LL_INFOS()<<"Unable to resolve geometry URL."<<LL_ENDL;
badElement = true;
}
@@ -3226,7 +3243,11 @@ U32 LLModelPreview::calcResourceCost()
if ( mFMP && mFMP->childGetValue("upload_joints").asBoolean() )
{
- getPreviewAvatar()->setPelvisOffset( mPelvisZOffset );
+ // FIXME if preview avatar ever gets reused, this fake mesh ID stuff will fail.
+ // see also call to addAttachmentPosOverride.
+ LLUUID fake_mesh_id;
+ fake_mesh_id.generate();
+ getPreviewAvatar()->addPelvisFixup( mPelvisZOffset, fake_mesh_id );
}
F32 streaming_cost = 0.f;
@@ -3497,7 +3518,7 @@ void LLModelPreview::saveUploadData(const std::string& filename, bool save_skinw
data["instance"][i] = instance.asLLSD();
}
- llofstream out(filename, std::ios_base::out | std::ios_base::binary);
+ llofstream out(filename.c_str(), std::ios_base::out | std::ios_base::binary);
LLSDSerialize::toBinary(data, out);
out.flush();
out.close();
@@ -3523,7 +3544,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable
if (lod < LLModel::LOD_IMPOSTOR || lod > LLModel::NUM_LODS - 1)
{
- llwarns << "Invalid level of detail: " << lod << llendl;
+ LL_WARNS() << "Invalid level of detail: " << lod << LL_ENDL;
assert(lod >= LLModel::LOD_IMPOSTOR && lod < LLModel::NUM_LODS);
return;
}
@@ -3546,7 +3567,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable
if (mModelLoader)
{
- llwarns << "Incompleted model load operation pending." << llendl;
+ LL_WARNS() << "Incompleted model load operation pending." << LL_ENDL;
return;
}
@@ -3578,11 +3599,11 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable
if (lod == mPreviewLOD)
{
- mFMP->childSetText("lod_file_" + lod_name[lod], mLODFile[lod]);
+ mFMP->childSetValue("lod_file_" + lod_name[lod], mLODFile[lod]);
}
else if (lod == LLModel::LOD_PHYSICS)
{
- mFMP->childSetText("physics_file", mLODFile[lod]);
+ mFMP->childSetValue("physics_file", mLODFile[lod]);
}
mFMP->openFloater();
@@ -3597,7 +3618,7 @@ void LLModelPreview::setPhysicsFromLOD(S32 lod)
mModel[LLModel::LOD_PHYSICS] = mModel[lod];
mScene[LLModel::LOD_PHYSICS] = mScene[lod];
mLODFile[LLModel::LOD_PHYSICS].clear();
- mFMP->childSetText("physics_file", mLODFile[LLModel::LOD_PHYSICS]);
+ mFMP->childSetValue("physics_file", mLODFile[LLModel::LOD_PHYSICS]);
mVertexBuffer[LLModel::LOD_PHYSICS].clear();
rebuildUploadData();
refresh();
@@ -3818,7 +3839,6 @@ void LLModelPreview::generateNormals()
S32 which_lod = mPreviewLOD;
-
if (which_lod > 4 || which_lod < 0 ||
mModel[which_lod].empty())
{
@@ -3833,19 +3853,81 @@ void LLModelPreview::generateNormals()
if (which_lod == 3 && !mBaseModel.empty())
{
- for (LLModelLoader::model_list::iterator iter = mBaseModel.begin(); iter != mBaseModel.end(); ++iter)
+ if(mBaseModelFacesCopy.empty())
{
- (*iter)->generateNormals(angle_cutoff);
+ mBaseModelFacesCopy.reserve(mBaseModel.size());
+ for (LLModelLoader::model_list::iterator it = mBaseModel.begin(), itE = mBaseModel.end(); it != itE; ++it)
+ {
+ v_LLVolumeFace_t faces;
+ (*it)->copyFacesTo(faces);
+ mBaseModelFacesCopy.push_back(faces);
+ }
+ }
+
+ for (LLModelLoader::model_list::iterator it = mBaseModel.begin(), itE = mBaseModel.end(); it != itE; ++it)
+ {
+ (*it)->generateNormals(angle_cutoff);
}
mVertexBuffer[5].clear();
}
- for (LLModelLoader::model_list::iterator iter = mModel[which_lod].begin(); iter != mModel[which_lod].end(); ++iter)
+ bool perform_copy = mModelFacesCopy[which_lod].empty();
+ if(perform_copy) {
+ mModelFacesCopy[which_lod].reserve(mModel[which_lod].size());
+ }
+
+ for (LLModelLoader::model_list::iterator it = mModel[which_lod].begin(), itE = mModel[which_lod].end(); it != itE; ++it)
{
- (*iter)->generateNormals(angle_cutoff);
+ if(perform_copy)
+ {
+ v_LLVolumeFace_t faces;
+ (*it)->copyFacesTo(faces);
+ mModelFacesCopy[which_lod].push_back(faces);
+ }
+
+ (*it)->generateNormals(angle_cutoff);
+ }
+
+ mVertexBuffer[which_lod].clear();
+ refresh();
+ updateStatusMessages();
+}
+
+void LLModelPreview::restoreNormals()
+{
+ S32 which_lod = mPreviewLOD;
+
+ if (which_lod > 4 || which_lod < 0 ||
+ mModel[which_lod].empty())
+ {
+ return;
+ }
+
+ if(!mBaseModelFacesCopy.empty())
+ {
+ llassert(mBaseModelFacesCopy.size() == mBaseModel.size());
+
+ vv_LLVolumeFace_t::const_iterator itF = mBaseModelFacesCopy.begin();
+ for (LLModelLoader::model_list::iterator it = mBaseModel.begin(), itE = mBaseModel.end(); it != itE; ++it, ++itF)
+ {
+ (*it)->copyFacesFrom((*itF));
+ }
+
+ mBaseModelFacesCopy.clear();
}
+
+ if(!mModelFacesCopy[which_lod].empty())
+ {
+ vv_LLVolumeFace_t::const_iterator itF = mModelFacesCopy[which_lod].begin();
+ for (LLModelLoader::model_list::iterator it = mModel[which_lod].begin(), itE = mModel[which_lod].end(); it != itE; ++it, ++itF)
+ {
+ (*it)->copyFacesFrom((*itF));
+ }
+ mModelFacesCopy[which_lod].clear();
+ }
+
mVertexBuffer[which_lod].clear();
refresh();
updateStatusMessages();
@@ -3856,7 +3938,7 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
// Allow LoD from -1 to LLModel::LOD_PHYSICS
if (which_lod < -1 || which_lod > LLModel::NUM_LODS - 1)
{
- llwarns << "Invalid level of detail: " << which_lod << llendl;
+ LL_WARNS() << "Invalid level of detail: " << which_lod << LL_ENDL;
assert(which_lod >= -1 && which_lod < LLModel::NUM_LODS);
return;
}
@@ -4144,7 +4226,7 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
if (!validate_face(target_model->getVolumeFace(names[i])))
{
- llerrs << "Invalid face generated during LOD generation." << llendl;
+ LL_ERRS() << "Invalid face generated during LOD generation." << LL_ENDL;
}
}
@@ -4159,7 +4241,7 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
if (!validate_model(target_model))
{
- llerrs << "Invalid model generated when creating LODs" << llendl;
+ LL_ERRS() << "Invalid model generated when creating LODs" << LL_ENDL;
}
delete [] sizes;
@@ -4313,8 +4395,8 @@ void LLModelPreview::updateStatusMessages()
if (total_tris[lod] > 0)
{
- mFMP->childSetText(lod_triangles_name[lod], llformat("%d", total_tris[lod]));
- mFMP->childSetText(lod_vertices_name[lod], llformat("%d", total_verts[lod]));
+ mFMP->childSetValue(lod_triangles_name[lod], llformat("%d", total_tris[lod]));
+ mFMP->childSetValue(lod_vertices_name[lod], llformat("%d", total_verts[lod]));
}
else
{
@@ -4335,8 +4417,8 @@ void LLModelPreview::updateStatusMessages()
}
}
- mFMP->childSetText(lod_triangles_name[lod], mesh_status_na);
- mFMP->childSetText(lod_vertices_name[lod], mesh_status_na);
+ mFMP->childSetValue(lod_triangles_name[lod], mesh_status_na);
+ mFMP->childSetValue(lod_vertices_name[lod], mesh_status_na);
}
const U32 lod_high = LLModel::LOD_HIGH;
@@ -4385,7 +4467,7 @@ void LLModelPreview::updateStatusMessages()
if (lod == mPreviewLOD)
{
- mFMP->childSetText("lod_status_message_text", mFMP->getString(message));
+ mFMP->childSetValue("lod_status_message_text", mFMP->getString(message));
icon = mFMP->getChild<LLIconCtrl>("lod_status_message_icon");
icon->setImage(img);
}
@@ -4604,7 +4686,7 @@ void LLModelPreview::updateLodControls(S32 lod)
{
if (lod < LLModel::LOD_IMPOSTOR || lod > LLModel::LOD_HIGH)
{
- llwarns << "Invalid level of detail: " << lod << llendl;
+ LL_WARNS() << "Invalid level of detail: " << lod << LL_ENDL;
assert(lod >= LLModel::LOD_IMPOSTOR && lod <= LLModel::LOD_HIGH);
return;
}
@@ -4636,12 +4718,12 @@ void LLModelPreview::updateLodControls(S32 lod)
fmp->mLODMode[lod] = 0;
for (U32 i = 0; i < num_file_controls; ++i)
{
- mFMP->childShow(file_controls[i] + lod_name[lod]);
+ mFMP->childSetVisible(file_controls[i] + lod_name[lod], true);
}
for (U32 i = 0; i < num_lod_controls; ++i)
{
- mFMP->childHide(lod_controls[i] + lod_name[lod]);
+ mFMP->childSetVisible(lod_controls[i] + lod_name[lod], false);
}
}
else if (lod_mode == USE_LOD_ABOVE) // use LoD above
@@ -4649,12 +4731,12 @@ void LLModelPreview::updateLodControls(S32 lod)
fmp->mLODMode[lod] = 2;
for (U32 i = 0; i < num_file_controls; ++i)
{
- mFMP->childHide(file_controls[i] + lod_name[lod]);
+ mFMP->childSetVisible(file_controls[i] + lod_name[lod], false);
}
for (U32 i = 0; i < num_lod_controls; ++i)
{
- mFMP->childHide(lod_controls[i] + lod_name[lod]);
+ mFMP->childSetVisible(lod_controls[i] + lod_name[lod], false);
}
if (lod < LLModel::LOD_HIGH)
@@ -4679,12 +4761,12 @@ void LLModelPreview::updateLodControls(S32 lod)
for (U32 i = 0; i < num_file_controls; ++i)
{
- mFMP->childHide(file_controls[i] + lod_name[lod]);
+ mFMP->getChildView(file_controls[i] + lod_name[lod])->setVisible(false);
}
for (U32 i = 0; i < num_lod_controls; ++i)
{
- mFMP->childShow(lod_controls[i] + lod_name[lod]);
+ mFMP->getChildView(lod_controls[i] + lod_name[lod])->setVisible(true);
}
@@ -4917,7 +4999,7 @@ void LLModelPreview::createPreviewAvatar( void )
}
else
{
- llinfos<<"Failed to create preview avatar for upload model window"<<llendl;
+ LL_INFOS()<<"Failed to create preview avatar for upload model window"<<LL_ENDL;
}
}
@@ -5020,16 +5102,9 @@ BOOL LLModelPreview::render()
bool upload_skin = mFMP->childGetValue("upload_skin").asBoolean();
bool upload_joints = mFMP->childGetValue("upload_joints").asBoolean();
- bool resetJoints = false;
if ( upload_joints != mLastJointUpdate )
{
- if ( mLastJointUpdate )
- {
- resetJoints = true;
- }
-
mLastJointUpdate = upload_joints;
-
}
for (LLModelLoader::scene::iterator iter = mScene[mPreviewLOD].begin(); iter != mScene[mPreviewLOD].end(); ++iter)
@@ -5642,7 +5717,7 @@ void LLModelPreview::setPreviewLOD(S32 lod)
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
- mFMP->childSetText("lod_file_" + lod_name[mPreviewLOD], mLODFile[mPreviewLOD]);
+ mFMP->childSetValue("lod_file_" + lod_name[mPreviewLOD], mLODFile[mPreviewLOD]);
LLComboBox* combo_box2 = mFMP->getChild<LLComboBox>("preview_lod_combo2");
combo_box2->setCurrentByIndex((NUM_LOD-1)-mPreviewLOD); // combo box list of lods is in reverse order
@@ -5852,9 +5927,9 @@ void LLFloaterModelPreview::handleModelPhysicsFeeReceived()
mUploadBtn->setEnabled(mHasUploadPerm && !mUploadModelUrl.empty());
}
-void LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason)
+void LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(S32 status, const std::string& reason)
{
- llwarns << "LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(" << status << " : " << reason << ")" << llendl;
+ LL_WARNS() << "LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(" << status << " : " << reason << ")" << LL_ENDL;
doOnIdleOneTime(boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this, true));
}
@@ -5928,9 +6003,11 @@ void LLFloaterModelPreview::onPermissionsReceived(const LLSD& result)
getChild<LLTextBox>("warning_message")->setVisible(!mHasUploadPerm);
}
-void LLFloaterModelPreview::setPermissonsErrorStatus(U32 status, const std::string& reason)
+void LLFloaterModelPreview::setPermissonsErrorStatus(S32 status, const std::string& reason)
{
- llwarns << "LLFloaterModelPreview::setPermissonsErrorStatus(" << status << " : " << reason << ")" << llendl;
+ LL_WARNS() << "LLFloaterModelPreview::setPermissonsErrorStatus(" << status << " : " << reason << ")" << LL_ENDL;
LLNotificationsUtil::add("MeshUploadPermError");
}
+
+