diff options
author | Brad Kittenbrink (Brad Linden) <brad@lindenlab.com> | 2022-10-10 16:10:10 -0700 |
---|---|---|
committer | Brad Kittenbrink <brad@lindenlab.com> | 2022-10-14 14:44:05 -0700 |
commit | bda420662710e95de1b3f6ff954459b4bb6c3b01 (patch) | |
tree | 3633fdf38d03e103226cbd473c24dee0b04bb810 /indra/newview/llpanelface.cpp | |
parent | a2b09df2db69ba8a2e6b587d839d509fbe5abebb (diff) |
WIP for SL-18103 and SL-17697 live editing of materials using ModifyMaterialParams cap
Diffstat (limited to 'indra/newview/llpanelface.cpp')
-rw-r--r-- | indra/newview/llpanelface.cpp | 33 |
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; |