summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelface.cpp')
-rw-r--r--indra/newview/llpanelface.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index aaee64485a..ff5128e0c2 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -46,6 +46,7 @@
#include "llcombobox.h"
#include "lldrawpoolbump.h"
#include "llface.h"
+#include "llgltfmateriallist.h"
#include "llinventoryfunctions.h"
#include "llinventorymodel.h" // gInventory
#include "llinventorymodelbackgroundfetch.h"
@@ -53,6 +54,7 @@
#include "llfloaterreg.h"
#include "lllineeditor.h"
#include "llmaterialmgr.h"
+#include "llmaterialeditor.h"
#include "llmediactrl.h"
#include "llmediaentry.h"
#include "llmenubutton.h"
@@ -91,6 +93,7 @@
#include "llsdserialize.h"
#include "llinventorymodel.h"
+using namespace std::literals;
//
// Constant definitions for comboboxes
@@ -234,6 +237,9 @@ BOOL LLPanelFace::postBuild()
pbr_ctrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
pbr_ctrl->setBakeTextureEnabled(false);
pbr_ctrl->setInventoryPickType(LLTextureCtrl::PICK_MATERIAL);
+
+ // TODO - design real UI for activating live editing
+ pbr_ctrl->setRightMouseUpCallback(boost::bind(&LLPanelFace::onPbrStartEditing, this));
}
mTextureCtrl = getChild<LLTextureCtrl>("texture control");
@@ -4574,6 +4580,33 @@ void LLPanelFace::onPbrSelectionChanged(LLInventoryItem* itemp)
}
}
+void LLPanelFace::onPbrStartEditing() {
+ LL_DEBUGS() << "begin live editing material" << LL_ENDL;
+
+ LLMaterialEditor *editor =
+ dynamic_cast<LLMaterialEditor *>(LLFloaterReg::showInstance("material_editor", LLSD(LLUUID::null), TAKE_FOCUS_YES));
+ if (editor)
+ {
+ LLObjectSelection *select = LLSelectMgr::getInstance()->getSelection();
+ LLViewerObject * objectp = select->getFirstObject();
+ LLUUID object_id = objectp->getID();
+
+ bool identical;
+ LLUUID material_id;
+ LLSelectedTE::getPbrMaterialId(material_id, identical);
+
+ S32 face = 0;
+
+ LL_DEBUGS() << "loading material live editor with asset " << material_id << " on object " << object_id << LL_ENDL;
+
+ LLGLTFMaterial* material = gGLTFMaterialList.getMaterial(material_id);
+ editor->setTitle("Editing material on "s + object_id.asString());
+ editor->setAssetId(material_id);
+ editor->setFromGLTFMaterial(material);
+ editor->setOverrideTarget(object_id, face);
+ }
+}
+
bool LLPanelFace::isIdenticalPlanarTexgen()
{
LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT;