summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lldrawpoolsky.cpp2
-rw-r--r--indra/newview/llface.cpp28
-rw-r--r--indra/newview/llface.h3
-rw-r--r--indra/newview/lllocalgltfmaterials.cpp10
-rw-r--r--indra/newview/lllocalgltfmaterials.h10
-rw-r--r--indra/newview/llmaterialeditor.cpp106
-rw-r--r--indra/newview/llmaterialeditor.h4
-rw-r--r--indra/newview/llviewermenu.cpp2
-rw-r--r--indra/newview/llviewermenu.h1
-rw-r--r--indra/newview/llviewertexture.cpp30
-rw-r--r--indra/newview/llviewertexture.h5
-rw-r--r--indra/newview/llvovolume.cpp236
-rw-r--r--indra/newview/llvovolume.h20
13 files changed, 95 insertions, 362 deletions
diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp
index 55ebf03adc..5b614a2ce0 100644
--- a/indra/newview/lldrawpoolsky.cpp
+++ b/indra/newview/lldrawpoolsky.cpp
@@ -51,7 +51,7 @@ LLDrawPoolSky::LLDrawPoolSky()
void LLDrawPoolSky::prerender()
{
mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT);
- if (gSky.mVOSkyp->mDrawable)
+ if (gSky.mVOSkyp && gSky.mVOSkyp->mDrawable)
{
gSky.mVOSkyp->updateGeometry(gSky.mVOSkyp->mDrawable);
}
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 6557bcb81d..878022a2c8 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -342,34 +342,6 @@ void LLFace::dirtyTexture()
gPipeline.markTextured(drawablep);
}
-void LLFace::notifyAboutCreatingTexture(LLViewerTexture *texture)
-{
- LLDrawable* drawablep = getDrawable();
- if(mVObjp.notNull() && mVObjp->getVolume())
- {
- LLVOVolume *vobj = drawablep->getVOVolume();
- if(vobj && vobj->notifyAboutCreatingTexture(texture))
- {
- gPipeline.markTextured(drawablep);
- gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_VOLUME);
- }
- }
-}
-
-void LLFace::notifyAboutMissingAsset(LLViewerTexture *texture)
-{
- LLDrawable* drawablep = getDrawable();
- if(mVObjp.notNull() && mVObjp->getVolume())
- {
- LLVOVolume *vobj = drawablep->getVOVolume();
- if(vobj && vobj->notifyAboutMissingAsset(texture))
- {
- gPipeline.markTextured(drawablep);
- gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_VOLUME);
- }
- }
-}
-
void LLFace::switchTexture(U32 ch, LLViewerTexture* new_texture)
{
llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
diff --git a/indra/newview/llface.h b/indra/newview/llface.h
index a5ea460061..0cb986b8ed 100644
--- a/indra/newview/llface.h
+++ b/indra/newview/llface.h
@@ -228,9 +228,6 @@ public:
LLVertexBuffer* getVertexBuffer() const { return mVertexBuffer; }
S32 getRiggedIndex(U32 type) const;
- void notifyAboutCreatingTexture(LLViewerTexture *texture);
- void notifyAboutMissingAsset(LLViewerTexture *texture);
-
// used to preserve draw order of faces that are batched together.
// Allows content creators to manipulate linked sets and face ordering
// for consistent alpha sorting results, particularly for rigged attachments
diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp
index b07efff827..89f14c6cfa 100644
--- a/indra/newview/lllocalgltfmaterials.cpp
+++ b/indra/newview/lllocalgltfmaterials.cpp
@@ -93,27 +93,27 @@ LLLocalGLTFMaterial::~LLLocalGLTFMaterial()
}
/* accessors */
-std::string LLLocalGLTFMaterial::getFilename()
+std::string LLLocalGLTFMaterial::getFilename() const
{
return mFilename;
}
-std::string LLLocalGLTFMaterial::getShortName()
+std::string LLLocalGLTFMaterial::getShortName() const
{
return mShortName;
}
-LLUUID LLLocalGLTFMaterial::getTrackingID()
+LLUUID LLLocalGLTFMaterial::getTrackingID() const
{
return mTrackingID;
}
-LLUUID LLLocalGLTFMaterial::getWorldID()
+LLUUID LLLocalGLTFMaterial::getWorldID() const
{
return mWorldID;
}
-S32 LLLocalGLTFMaterial::getIndexInFile()
+S32 LLLocalGLTFMaterial::getIndexInFile() const
{
return mMaterialIndex;
}
diff --git a/indra/newview/lllocalgltfmaterials.h b/indra/newview/lllocalgltfmaterials.h
index 3bdccbbf3d..6919b9b4b2 100644
--- a/indra/newview/lllocalgltfmaterials.h
+++ b/indra/newview/lllocalgltfmaterials.h
@@ -42,11 +42,11 @@ public: /* main */
virtual ~LLLocalGLTFMaterial();
public: /* accessors */
- std::string getFilename();
- std::string getShortName();
- LLUUID getTrackingID();
- LLUUID getWorldID();
- S32 getIndexInFile();
+ std::string getFilename() const;
+ std::string getShortName() const;
+ LLUUID getTrackingID() const;
+ LLUUID getWorldID() const;
+ S32 getIndexInFile() const;
public:
bool updateSelf();
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index 8c8a07bc21..07c283e9c2 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -46,6 +46,7 @@
#include "llsdutil.h"
#include "llselectmgr.h"
#include "llstatusbar.h" // can_afford_transaction()
+#include "lltoolpie.h"
#include "llviewerinventory.h"
#include "llinventory.h"
#include "llviewerregion.h"
@@ -322,9 +323,17 @@ bool LLSelectedTEGetMatData::apply(LLViewerObject* objectp, S32 te_index)
mLocalMaterial = local_mat;
}
mMaterial = tep->getGLTFRenderMaterial();
+
+ if (mMaterial.isNull())
+ {
+ // Shouldn't be possible?
+ LL_WARNS("MaterialEditor") << "Object has material id, but no material" << LL_ENDL;
+ mMaterial = gGLTFMaterialList.getMaterial(mat_id);
+ }
}
+ return true;
}
- return true;
+ return false;
}
///----------------------------------------------------------------------------
@@ -1819,58 +1828,95 @@ void LLMaterialEditor::loadLive()
void LLMaterialEditor::saveObjectsMaterialAs()
{
-
- // Find an applicable material.
- // Do this before showing message, because
- // message is going to drop selection.
LLSelectedTEGetMatData func(false);
LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, true /*first applicable*/);
+ saveMaterialAs(func.mMaterial, func.mLocalMaterial);
+}
+void LLMaterialEditor::savePickedMaterialAs()
+{
+ LLPickInfo pick = LLToolPie::getInstance()->getPick();
+ if (pick.mPickType != LLPickInfo::PICK_OBJECT || !pick.getObject())
+ {
+ return;
+ }
+
+ LLPointer<LLGLTFMaterial> render_material;
+ LLPointer<LLLocalGLTFMaterial> local_material;
- if (func.mLocalMaterial.notNull())
+ LLViewerObject *objectp = pick.getObject();
+ LLUUID mat_id = objectp->getRenderMaterialID(pick.mObjectFace);
+ if (mat_id.notNull() && objectp->permCopy())
+ {
+ // Try a face user picked first
+ // (likely the only method we need, but in such case
+ // enable_object_save_gltf_material will need to check this)
+ LLTextureEntry *tep = objectp->getTE(pick.mObjectFace);
+ LLGLTFMaterial *mat = tep->getGLTFMaterial();
+ LLLocalGLTFMaterial *local_mat = dynamic_cast<LLLocalGLTFMaterial*>(mat);
+
+ if (local_mat)
+ {
+ local_material = local_mat;
+ }
+ render_material = tep->getGLTFRenderMaterial();
+ }
+ else
+ {
+ // Find an applicable material.
+ // Do this before showing message, because
+ // message is going to drop selection.
+ LLSelectedTEGetMatData func(false);
+ LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, true /*first applicable*/);
+ local_material = func.mLocalMaterial;
+ render_material = func.mMaterial;
+ }
+
+ saveMaterialAs(render_material, local_material);
+}
+
+void LLMaterialEditor::saveMaterialAs(const LLGLTFMaterial* render_material, const LLLocalGLTFMaterial *local_material)
+{
+ if (local_material)
{
// This is a local material, reload it from file
// so that user won't end up with grey textures
// on next login.
- LLMaterialEditor::loadMaterialFromFile(func.mLocalMaterial->getFilename(), func.mLocalMaterial->getIndexInFile());
+ LLMaterialEditor::loadMaterialFromFile(local_material->getFilename(), local_material->getIndexInFile());
LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor");
if (me)
{
- // apply differences on top
- LLGLTFMaterial* local_mat = func.mLocalMaterial.get();
- // don't use override mat here, it has 'hacked ids'
- // and values, use end result.
- LLGLTFMaterial* cmp_mat = func.mMaterial.get();
-
- me->setBaseColor(cmp_mat->mBaseColor);
- me->setMetalnessFactor(cmp_mat->mMetallicFactor);
- me->setRoughnessFactor(cmp_mat->mRoughnessFactor);
- me->setEmissiveColor(cmp_mat->mEmissiveColor);
- me->setDoubleSided(cmp_mat->mDoubleSided);
- me->setAlphaMode(cmp_mat->getAlphaMode());
- me->setAlphaCutoff(cmp_mat->mAlphaCutoff);
+ // don't use override material here, it has 'hacked ids'
+ // and values, use end result, apply it on top of local.
+ me->setBaseColor(render_material->mBaseColor);
+ me->setMetalnessFactor(render_material->mMetallicFactor);
+ me->setRoughnessFactor(render_material->mRoughnessFactor);
+ me->setEmissiveColor(render_material->mEmissiveColor);
+ me->setDoubleSided(render_material->mDoubleSided);
+ me->setAlphaMode(render_material->getAlphaMode());
+ me->setAlphaCutoff(render_material->mAlphaCutoff);
// most things like colors we can apply without verifying
// but texture ids are going to be different from both, base and override
// so only apply override id if there is actually a difference
- if (local_mat->mBaseColorId != cmp_mat->mBaseColorId)
+ if (local_material->mBaseColorId != render_material->mBaseColorId)
{
- me->setBaseColorId(cmp_mat->mBaseColorId);
+ me->setBaseColorId(render_material->mBaseColorId);
me->childSetValue("base_color_upload_fee", me->getString("no_upload_fee_string"));
}
- if (local_mat->mNormalId != cmp_mat->mNormalId)
+ if (local_material->mNormalId != render_material->mNormalId)
{
- me->setNormalId(cmp_mat->mNormalId);
+ me->setNormalId(render_material->mNormalId);
me->childSetValue("normal_upload_fee", me->getString("no_upload_fee_string"));
}
- if (local_mat->mMetallicRoughnessId != cmp_mat->mMetallicRoughnessId)
+ if (local_material->mMetallicRoughnessId != render_material->mMetallicRoughnessId)
{
- me->setMetallicRoughnessId(cmp_mat->mMetallicRoughnessId);
+ me->setMetallicRoughnessId(render_material->mMetallicRoughnessId);
me->childSetValue("metallic_upload_fee", me->getString("no_upload_fee_string"));
}
- if (local_mat->mEmissiveId != cmp_mat->mEmissiveId)
+ if (local_material->mEmissiveId != render_material->mEmissiveId)
{
- me->setEmissiveId(cmp_mat->mEmissiveId);
+ me->setEmissiveId(render_material->mEmissiveId);
me->childSetValue("emissive_upload_fee", me->getString("no_upload_fee_string"));
}
@@ -1882,9 +1928,9 @@ void LLMaterialEditor::saveObjectsMaterialAs()
}
LLSD payload;
- if (func.mMaterial.notNull())
+ if (render_material)
{
- payload["data"] = func.mMaterial->asJSON();
+ payload["data"] = render_material->asJSON();
}
else
{
diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h
index 23d5434ff7..6deda5df50 100644
--- a/indra/newview/llmaterialeditor.h
+++ b/indra/newview/llmaterialeditor.h
@@ -35,6 +35,7 @@ class LLButton;
class LLColorSwatchCtrl;
class LLComboBox;
class LLGLTFMaterial;
+class LLLocalGLTFMaterial;
class LLTextureCtrl;
class LLTextBox;
@@ -111,6 +112,7 @@ public:
static void loadLive();
static void saveObjectsMaterialAs();
+ static void savePickedMaterialAs();
static void onSaveObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response);
static void loadFromGLTFMaterial(LLUUID &asset_id);
@@ -232,6 +234,8 @@ public:
static bool capabilitiesAvailable();
private:
+ static void saveMaterialAs(const LLGLTFMaterial *render_material, const LLLocalGLTFMaterial *local_material);
+
static bool updateInventoryItem(const std::string &buffer, const LLUUID &item_id, const LLUUID &task_id);
static void createInventoryItem(const std::string &buffer, const std::string &name, const std::string &desc);
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index c67d76100a..8d0dd505bf 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -2962,7 +2962,7 @@ void handle_object_edit_gltf_material()
void handle_object_save_gltf_material()
{
- LLMaterialEditor::saveObjectsMaterialAs();
+ LLMaterialEditor::savePickedMaterialAs();
}
void handle_attachment_edit(const LLUUID& inv_item_id)
diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h
index 0673652e61..7142763451 100644
--- a/indra/newview/llviewermenu.h
+++ b/indra/newview/llviewermenu.h
@@ -135,7 +135,6 @@ bool anyone_copy_selection(LLSelectNode* nodep);
// *TODO: Move to separate file
bool for_sale_selection(LLSelectNode* nodep);
-void handle_save_snapshot(void *);
void handle_toggle_flycam();
void handle_object_sit_or_stand();
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index c2e09b2882..0fd796afba 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -659,8 +659,6 @@ S8 LLViewerTexture::getType() const
void LLViewerTexture::cleanup()
{
- notifyAboutMissingAsset();
-
if (LLAppViewer::getTextureFetch())
{
LLAppViewer::getTextureFetch()->updateRequestPriority(mID, 0.f);
@@ -673,30 +671,6 @@ void LLViewerTexture::cleanup()
mVolumeList[LLRender::SCULPT_TEX].clear();
}
-void LLViewerTexture::notifyAboutCreatingTexture()
-{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- for(U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
- {
- for(U32 f = 0; f < mNumFaces[ch]; f++)
- {
- mFaceList[ch][f]->notifyAboutCreatingTexture(this);
- }
- }
-}
-
-void LLViewerTexture::notifyAboutMissingAsset()
-{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
- for(U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
- {
- for(U32 f = 0; f < mNumFaces[ch]; f++)
- {
- mFaceList[ch][f]->notifyAboutMissingAsset(this);
- }
- }
-}
-
// virtual
void LLViewerTexture::dump()
{
@@ -1579,8 +1553,6 @@ void LLViewerFetchedTexture::postCreateTexture()
mGLTexturep->checkActiveThread();
#endif
- notifyAboutCreatingTexture();
-
setActive();
if (!needsToSaveRawImage())
@@ -2221,8 +2193,6 @@ void LLViewerFetchedTexture::setIsMissingAsset(BOOL is_missing)
}
if (is_missing)
{
- notifyAboutMissingAsset();
-
if (mUrl.empty())
{
LL_WARNS() << mID << ": Marking image as missing" << LL_ENDL;
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index 312e2ca365..5fa5d893e7 100644
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -177,10 +177,7 @@ protected:
void cleanup() ;
void init(bool firstinit) ;
void reorganizeFaceList() ;
- void reorganizeVolumeList() ;
-
- void notifyAboutMissingAsset();
- void notifyAboutCreatingTexture();
+ void reorganizeVolumeList();
private:
friend class LLBumpImageList;
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 038935963d..f06719634e 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -2367,243 +2367,11 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID)
return res;
}
-bool LLVOVolume::notifyAboutCreatingTexture(LLViewerTexture *texture)
-{ //Ok, here we have confirmation about texture creation, check our wait-list
- //and make changes, or return false
-
- std::pair<mmap_UUID_MAP_t::iterator, mmap_UUID_MAP_t::iterator> range = mWaitingTextureInfo.equal_range(texture->getID());
-
- typedef std::map<U8, LLMaterialPtr> map_te_material;
- map_te_material new_material;
-
- for(mmap_UUID_MAP_t::iterator range_it = range.first; range_it != range.second; ++range_it)
- {
- LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te);
-
- //here we just interesting in DIFFUSE_MAP only!
- if(NULL != cur_material.get() && LLRender::DIFFUSE_MAP == range_it->second.map && GL_RGBA != texture->getPrimaryFormat())
- { //ok let's check the diffuse mode
- switch(cur_material->getDiffuseAlphaMode())
- {
- case LLMaterial::DIFFUSE_ALPHA_MODE_BLEND:
- case LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE:
- case LLMaterial::DIFFUSE_ALPHA_MODE_MASK:
- { //uups... we have non 32 bit texture with LLMaterial::DIFFUSE_ALPHA_MODE_* => LLMaterial::DIFFUSE_ALPHA_MODE_NONE
-
- LLMaterialPtr mat = NULL;
- map_te_material::iterator it = new_material.find(range_it->second.te);
- if(new_material.end() == it) {
- mat = new LLMaterial(cur_material->asLLSD());
- new_material.insert(map_te_material::value_type(range_it->second.te, mat));
- } else {
- mat = it->second;
- }
-
- mat->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE);
-
- } break;
- } //switch
- } //if
- } //for
-
- //setup new materials
- for(map_te_material::const_iterator it = new_material.begin(), end = new_material.end(); it != end; ++it)
- {
- LLMaterialMgr::getInstance()->put(getID(), it->first, *it->second);
- LLViewerObject::setTEMaterialParams(it->first, it->second);
- }
-
- //clear wait-list
- mWaitingTextureInfo.erase(range.first, range.second);
-
- return 0 != new_material.size();
-}
-
-bool LLVOVolume::notifyAboutMissingAsset(LLViewerTexture *texture)
-{ //Ok, here if we wait information about texture and it's missing
- //then depending from the texture map (diffuse, normal, or specular)
- //make changes in material and confirm it. If not return false.
- std::pair<mmap_UUID_MAP_t::iterator, mmap_UUID_MAP_t::iterator> range = mWaitingTextureInfo.equal_range(texture->getID());
- if(range.first == range.second) return false;
-
- typedef std::map<U8, LLMaterialPtr> map_te_material;
- map_te_material new_material;
-
- for(mmap_UUID_MAP_t::iterator range_it = range.first; range_it != range.second; ++range_it)
- {
- LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te);
- if (cur_material.isNull())
- continue;
-
- switch(range_it->second.map)
- {
- case LLRender::DIFFUSE_MAP:
- {
- if(LLMaterial::DIFFUSE_ALPHA_MODE_NONE != cur_material->getDiffuseAlphaMode())
- { //missing texture + !LLMaterial::DIFFUSE_ALPHA_MODE_NONE => LLMaterial::DIFFUSE_ALPHA_MODE_NONE
- LLMaterialPtr mat = NULL;
- map_te_material::iterator it = new_material.find(range_it->second.te);
- if(new_material.end() == it) {
- mat = new LLMaterial(cur_material->asLLSD());
- new_material.insert(map_te_material::value_type(range_it->second.te, mat));
- } else {
- mat = it->second;
- }
-
- mat->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE);
- }
- } break;
- case LLRender::NORMAL_MAP:
- { //missing texture => reset material texture id
- LLMaterialPtr mat = NULL;
- map_te_material::iterator it = new_material.find(range_it->second.te);
- if(new_material.end() == it) {
- mat = new LLMaterial(cur_material->asLLSD());
- new_material.insert(map_te_material::value_type(range_it->second.te, mat));
- } else {
- mat = it->second;
- }
-
- mat->setNormalID(LLUUID::null);
- } break;
- case LLRender::SPECULAR_MAP:
- { //missing texture => reset material texture id
- LLMaterialPtr mat = NULL;
- map_te_material::iterator it = new_material.find(range_it->second.te);
- if(new_material.end() == it) {
- mat = new LLMaterial(cur_material->asLLSD());
- new_material.insert(map_te_material::value_type(range_it->second.te, mat));
- } else {
- mat = it->second;
- }
-
- mat->setSpecularID(LLUUID::null);
- } break;
- case LLRender::NUM_TEXTURE_CHANNELS:
- //nothing to do, make compiler happy
- break;
- } //switch
- } //for
-
- //setup new materials
- for(map_te_material::const_iterator it = new_material.begin(), end = new_material.end(); it != end; ++it)
- {
- LLMaterialMgr::getInstance()->setLocalMaterial(getRegion()->getRegionID(), it->second);
- LLViewerObject::setTEMaterialParams(it->first, it->second);
- }
-
- //clear wait-list
- mWaitingTextureInfo.erase(range.first, range.second);
-
- return 0 != new_material.size();
-}
-
S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams)
{
- LLMaterialPtr pMaterial = const_cast<LLMaterialPtr&>(pMaterialParams);
-
- if(pMaterialParams)
- { //check all of them according to material settings
-
- LLViewerTexture *img_diffuse = getTEImage(te);
- LLViewerTexture *img_normal = getTENormalMap(te);
- LLViewerTexture *img_specular = getTESpecularMap(te);
-
- llassert(NULL != img_diffuse);
-
- LLMaterialPtr new_material = NULL;
-
- //diffuse
- if(NULL != img_diffuse)
- { //guard
- if(0 == img_diffuse->getPrimaryFormat() && !img_diffuse->isMissingAsset())
- { //ok here we don't have information about texture, let's belief and leave material settings
- //but we remember this case
- mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(img_diffuse->getID(), material_info(LLRender::DIFFUSE_MAP, te)));
- }
- else
- {
- bool bSetDiffuseNone = false;
- if(img_diffuse->isMissingAsset())
- {
- bSetDiffuseNone = true;
- }
- else
- {
- switch(pMaterialParams->getDiffuseAlphaMode())
- {
- case LLMaterial::DIFFUSE_ALPHA_MODE_BLEND:
- case LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE:
- case LLMaterial::DIFFUSE_ALPHA_MODE_MASK:
- { //all of them modes available only for 32 bit textures
- LLTextureEntry* tex_entry = getTE(te);
- bool bIsBakedImageId = false;
- if (tex_entry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(tex_entry->getID()))
- {
- bIsBakedImageId = true;
- }
- if (GL_RGBA != img_diffuse->getPrimaryFormat() && !bIsBakedImageId)
- {
- bSetDiffuseNone = true;
- }
- } break;
- }
- } //else
-
-
- if(bSetDiffuseNone)
- { //upps... we should substitute this material with LLMaterial::DIFFUSE_ALPHA_MODE_NONE
- new_material = new LLMaterial(pMaterialParams->asLLSD());
- new_material->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE);
- }
- }
- }
-
- //normal
- if(LLUUID::null != pMaterialParams->getNormalID())
- {
- if(img_normal && img_normal->isMissingAsset() && img_normal->getID() == pMaterialParams->getNormalID())
- {
- if(!new_material) {
- new_material = new LLMaterial(pMaterialParams->asLLSD());
- }
- new_material->setNormalID(LLUUID::null);
- }
- else if(NULL == img_normal || 0 == img_normal->getPrimaryFormat())
- { //ok here we don't have information about texture, let's belief and leave material settings
- //but we remember this case
- mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(pMaterialParams->getNormalID(), material_info(LLRender::NORMAL_MAP,te)));
- }
-
- }
-
-
- //specular
- if(LLUUID::null != pMaterialParams->getSpecularID())
- {
- if(img_specular && img_specular->isMissingAsset() && img_specular->getID() == pMaterialParams->getSpecularID())
- {
- if(!new_material) {
- new_material = new LLMaterial(pMaterialParams->asLLSD());
- }
- new_material->setSpecularID(LLUUID::null);
- }
- else if(NULL == img_specular || 0 == img_specular->getPrimaryFormat())
- { //ok here we don't have information about texture, let's belief and leave material settings
- //but we remember this case
- mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(pMaterialParams->getSpecularID(), material_info(LLRender::SPECULAR_MAP, te)));
- }
- }
-
- if(new_material) {
- pMaterial = new_material;
- LLMaterialMgr::getInstance()->setLocalMaterial(getRegion()->getRegionID(), pMaterial);
- }
- }
-
- S32 res = LLViewerObject::setTEMaterialParams(te, pMaterial);
+ S32 res = LLViewerObject::setTEMaterialParams(te, pMaterialParams);
- LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterial) ? pMaterial->asLLSD() : LLSD("null")) << " res " << res
+ LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterialParams) ? pMaterialParams->asLLSD() : LLSD("null")) << " res " << res
<< ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast<LLVOVolume*>(this), te) ? " selected" : " not selected" )
<< LL_ENDL;
setChanged(ALL_CHANGED);
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index 003ab38d64..2c269d745d 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -476,26 +476,6 @@ protected:
static S32 sNumLODChanges;
friend class LLVolumeImplFlexible;
-
-public:
- bool notifyAboutCreatingTexture(LLViewerTexture *texture);
- bool notifyAboutMissingAsset(LLViewerTexture *texture);
-
-private:
- struct material_info
- {
- LLRender::eTexIndex map;
- U8 te;
-
- material_info(LLRender::eTexIndex map_, U8 te_)
- : map(map_)
- , te(te_)
- {}
- };
-
- typedef std::multimap<LLUUID, material_info> mmap_UUID_MAP_t;
- mmap_UUID_MAP_t mWaitingTextureInfo;
-
};
#endif // LL_LLVOVOLUME_H