diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2011-01-04 16:22:38 -0700 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2011-01-04 16:22:38 -0700 |
commit | 961e50aab40fe09632e4f3f9aa385abd0fb42735 (patch) | |
tree | 82f77bd2f616315eb89632abe5815b40d5dad565 /indra/newview/llfloatermodelpreview.cpp | |
parent | 6262c4a427422ea82bbdafd7e701b700784663a6 (diff) |
clear some LLPointer issues for SH-694: check if there are any other LLPointer issues in the mesh model uploading flow and fix them if exist.
Diffstat (limited to 'indra/newview/llfloatermodelpreview.cpp')
-rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 68b9e5d23d..d63c8244df 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1590,6 +1590,35 @@ void LLModelLoader::run() }
}
+//called in the main thread
+void LLModelLoader::loadTextures()
+{
+ BOOL is_paused = isPaused() ;
+ pause() ; //pause the loader
+
+ for(scene::iterator iter = mScene.begin(); iter != mScene.end(); ++iter)
+ {
+ for(U32 i = 0 ; i < iter->second.size(); i++)
+ {
+ for(U32 j = 0 ; j < iter->second[i].mMaterial.size() ; j++)
+ {
+ if(!iter->second[i].mMaterial[j].mDiffuseMapFilename.empty())
+ {
+ iter->second[i].mMaterial[j].mDiffuseMap =
+ LLViewerTextureManager::getFetchedTextureFromUrl("file://" + iter->second[i].mMaterial[j].mDiffuseMapFilename, TRUE, LLViewerTexture::BOOST_PREVIEW);
+ iter->second[i].mMaterial[j].mDiffuseMap->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, TRUE, FALSE, mPreview, NULL, FALSE);
+ iter->second[i].mMaterial[j].mDiffuseMap->forceToSaveRawImage();
+ }
+ }
+ }
+ }
+
+ if(!is_paused)
+ {
+ unpause() ;
+ }
+}
+
bool LLModelLoader::isNodeAJoint( domNode* pNode )
{
if ( pNode->getName() == NULL)
@@ -1895,14 +1924,8 @@ LLImportMaterial LLModelLoader::profileToMaterial(domProfile_COMMON* material) // we only support init_from now - embedded data will come later
domImage::domInit_from* init = image->getInit_from();
if (init)
- {
- std::string filename = cdom::uriToNativePath(init->getValue().str());
-
- mat.mDiffuseMap = LLViewerTextureManager::getFetchedTextureFromUrl("file://" + filename, TRUE, LLViewerTexture::BOOST_PREVIEW);
- mat.mDiffuseMap->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, TRUE, FALSE, this->mPreview, NULL, FALSE);
-
- mat.mDiffuseMap->forceToSaveRawImage();
- mat.mDiffuseMapFilename = filename;
+ {
+ mat.mDiffuseMapFilename = cdom::uriToNativePath(init->getValue().str());
mat.mDiffuseMapLabel = getElementLabel(material);
}
}
@@ -2354,6 +2377,7 @@ void LLModelPreview::loadModelCallback(S32 lod) return;
}
+ mModelLoader->loadTextures() ;
mModel[lod] = mModelLoader->mModelList;
mScene[lod] = mModelLoader->mScene;
mVertexBuffer[lod].clear();
@@ -3803,7 +3827,7 @@ BOOL LLModelPreview::render() gGL.getTexUnit(0)->bind(instance.mMaterial[i].mDiffuseMap, true);
if (instance.mMaterial[i].mDiffuseMap->getDiscardLevel() > -1)
{
- mTextureSet.insert(instance.mMaterial[i].mDiffuseMap);
+ mTextureSet.insert(instance.mMaterial[i].mDiffuseMap.get());
}
}
}
|