summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2022-06-29 21:42:44 -0500
committerDave Parks <davep@lindenlab.com>2022-06-29 21:42:44 -0500
commit6f6df8ed71702f0ee8d21a2b583818ae360dd093 (patch)
tree70545286267ecc4419b7d1dfe463c6d08490775a /indra/newview
parent56ae3e0a083aefcbd6d7c955bb2c7e9e58000a4b (diff)
SL-17685 Drag and drop material support
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/llmaterialeditor.cpp2
-rw-r--r--indra/newview/lltooldraganddrop.cpp2
-rw-r--r--indra/newview/llviewerobject.cpp29
-rw-r--r--indra/newview/llviewerobject.h1
-rw-r--r--indra/newview/llvovolume.cpp2
-rw-r--r--indra/newview/llvovolume.h2
7 files changed, 36 insertions, 4 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index d4bd1c8b57..b67bc91277 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -344,6 +344,7 @@ set(viewer_SOURCE_FILES
llgesturemgr.cpp
llgiveinventory.cpp
llglsandbox.cpp
+ llgltfmateriallist.cpp
llgroupactions.cpp
llgroupiconctrl.cpp
llgrouplist.cpp
@@ -986,6 +987,7 @@ set(viewer_HEADER_FILES
llgesturelistener.h
llgesturemgr.h
llgiveinventory.h
+ llgltfmateriallist.h
llgroupactions.h
llgroupiconctrl.h
llgrouplist.h
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index 2455ad2926..9fb9f723cd 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -43,7 +43,6 @@
#include "llviewerregion.h"
#include "llvovolume.h"
#include "roles_constants.h"
-#include "tinygltf/tiny_gltf.h"
#include "llviewerobjectlist.h"
#include "llfloaterreg.h"
#include "llfilesystem.h"
@@ -52,6 +51,7 @@
#include "llviewertexturelist.h"
#include "llfloaterperms.h"
+#include "tinygltf/tiny_gltf.h"
#include <strstream>
///----------------------------------------------------------------------------
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index a4b34bb5b6..55e8a3b98b 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -1083,8 +1083,6 @@ void LLToolDragAndDrop::dropMaterialOneFace(LLViewerObject* hit_obj,
{
return;
}
-
- LLTextureEntry* tep = hit_obj ? (hit_obj->getTE(hit_face)) : NULL;
hit_obj->setRenderMaterialID(hit_face, asset_id);
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 232e51896e..753fb014c9 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -107,6 +107,7 @@
#include "llcleanup.h"
#include "llcallstack.h"
#include "llmeshrepository.h"
+#include "llgltfmateriallist.h"
#include "llgl.h"
//#define DEBUG_UPDATE_TYPE
@@ -4906,6 +4907,18 @@ void LLViewerObject::updateTEMaterialTextures(U8 te)
};
LLGLTFMaterial* mat = getTE(te)->getGLTFMaterial();
+ LLUUID mat_id = getRenderMaterialID(te);
+ if (mat == nullptr && mat_id.notNull())
+ {
+ mat = gGLTFMaterialList.getMaterial(mat_id);
+ getTE(te)->setGLTFMaterial(mat);
+ }
+ else if (mat_id.isNull() && mat != nullptr)
+ {
+ mat = nullptr;
+ getTE(te)->setGLTFMaterial(nullptr);
+ }
+
if (mat != nullptr)
{
mGLTFAlbedoMaps[te] = fetch_texture(mat->mAlbedoId);
@@ -4913,6 +4926,14 @@ void LLViewerObject::updateTEMaterialTextures(U8 te)
mGLTFMetallicRoughnessMaps[te] = fetch_texture(mat->mMetallicRoughnessId);
mGLTFEmissiveMaps[te] = fetch_texture(mat->mEmissiveId);
}
+ else
+ {
+ mGLTFAlbedoMaps[te] = nullptr;
+ mGLTFNormalMaps[te] = nullptr;
+ mGLTFMetallicRoughnessMaps[te] = nullptr;
+ mGLTFEmissiveMaps[te] = nullptr;
+ }
+
}
void LLViewerObject::refreshBakeTexture()
@@ -7028,8 +7049,16 @@ void LLViewerObject::setRenderMaterialID(U8 te, const LLUUID& id)
{
if (id.notNull())
{
+ getTE(te)->setGLTFMaterial(gGLTFMaterialList.getMaterial(id));
setHasRenderMaterialParams(true);
}
+ else
+ {
+ getTE(te)->setGLTFMaterial(nullptr);
+ }
+
+ faceMappingChanged();
+ gPipeline.markTextured(mDrawable);
LLRenderMaterialParams* param_block = (LLRenderMaterialParams*)getParameterEntry(LLNetworkData::PARAMS_RENDER_MATERIAL);
if (param_block)
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 1392caa855..109c96dc9c 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -207,6 +207,7 @@ public:
// Graphical stuff for objects - maybe broken out into render class later?
virtual void updateTextures();
+ virtual void faceMappingChanged() {}
virtual void boostTexturePriority(BOOL boost_children = TRUE); // When you just want to boost priority of this object
virtual LLDrawable* createDrawable(LLPipeline *pipeline);
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 685b24d5d6..4fa9f05c09 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -5861,6 +5861,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
continue;
}
+ // HACK -- brute force this check every time a drawable gets rebuilt
+ vobj->updateTEMaterialTextures(i);
#if 0
#if LL_RELEASE_WITH_DEBUG_INFO
const LLUUID pbr_id( "49c88210-7238-2a6b-70ac-92d4f35963cf" );
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index 79049851b4..db586fd741 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -172,7 +172,7 @@ public:
void markForUpdate(BOOL priority) override;
void markForUnload() { LLViewerObject::markForUnload(TRUE); mVolumeChanged = TRUE; }
- void faceMappingChanged() { mFaceMappingChanged=TRUE; };
+ void faceMappingChanged() override { mFaceMappingChanged=TRUE; }
/*virtual*/ void onShift(const LLVector4a &shift_vector) override; // Called when the drawable shifts