From b6a35e36d71b421e8f74e5b5e3f0909c8fcda930 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 29 Oct 2022 01:27:35 +0300 Subject: SL-18448 Material Editor and Tools floater adjustments 1. Enable glow 2. Added buttons to texture->pbr --- indra/newview/llpanelface.cpp | 39 +++++++++++++--------- indra/newview/llpanelface.h | 3 +- .../skins/default/xui/en/panel_tools_texture.xml | 38 +++++++++++++++------ 3 files changed, 53 insertions(+), 27 deletions(-) diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 6d8d19c57c..f884cfe842 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -201,6 +201,8 @@ BOOL LLPanelFace::postBuild() childSetAction("button align",&LLPanelFace::onClickAutoFix,this); childSetAction("button align textures", &LLPanelFace::onAlignTexture, this); + childSetAction("pbr_from_inventory", &LLPanelFace::onClickBtnLoadInvPBR, this); + childSetAction("edit_selected_pbr", &LLPanelFace::onClickBtnEditPBR, this); LLTextureCtrl* mTextureCtrl; LLTextureCtrl* mShinyTextureCtrl; @@ -237,9 +239,6 @@ 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("texture control"); @@ -968,6 +967,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) pbr_ctrl->setImageAssetID(pbr_id); has_pbr_material = pbr_id.notNull(); } + getChildView("pbr_from_inventory")->setEnabled(editable); + getChildView("edit_selected_pbr")->setEnabled(editable && has_pbr_material); LLTextureCtrl* texture_ctrl = getChild("texture control"); LLTextureCtrl* shinytexture_ctrl = getChild("shinytexture control"); @@ -1469,8 +1470,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTE::getGlow(glow,identical_glow); getChild("glow")->setValue(glow); getChild("glow")->setTentative(!identical_glow); - getChildView("glow")->setEnabled(editable && !has_pbr_material); - getChildView("glow label")->setEnabled(editable && !has_pbr_material); + getChildView("glow")->setEnabled(editable); + getChildView("glow label")->setEnabled(editable); } { @@ -1746,6 +1747,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("label shininess")->setEnabled(FALSE); getChildView("label bumpiness")->setEnabled(FALSE); getChildView("button align")->setEnabled(FALSE); + getChildView("pbr_from_inventory")->setEnabled(FALSE); + getChildView("edit_selected_pbr")->setEnabled(FALSE); //getChildView("has media")->setEnabled(FALSE); //getChildView("media info set")->setEnabled(FALSE); @@ -2677,6 +2680,8 @@ void LLPanelFace::updateVisibility() // PBR controls getChildView("pbr_control")->setVisible(show_pbr); + getChildView("pbr_from_inventory")->setVisible(show_pbr); + getChildView("edit_selected_pbr")->setVisible(show_pbr); } // static @@ -3651,6 +3656,19 @@ void LLPanelFace::onAlignTexture(void* userdata) self->alignTestureLayer(); } +void LLPanelFace::onClickBtnLoadInvPBR(void* userdata) +{ + // Shouldn't this be "save to inventory?" + LLPanelFace* self = (LLPanelFace*)userdata; + LLTextureCtrl* pbr_ctrl = self->findChild("pbr_control"); + pbr_ctrl->showPicker(true); +} + +void LLPanelFace::onClickBtnEditPBR(void* userdata) +{ + LLMaterialEditor::loadLive(); +} + enum EPasteMode { PASTE_COLOR, @@ -4580,17 +4598,6 @@ void LLPanelFace::onPbrSelectionChanged(LLInventoryItem* itemp) } } -void LLPanelFace::onPbrStartEditing() -{ - bool identical; - LLUUID material_id; - LLSelectedTE::getPbrMaterialId(material_id, identical); - - LL_DEBUGS() << "loading material live editor with asset " << material_id << LL_ENDL; - - LLMaterialEditor::loadLive(); -} - bool LLPanelFace::isIdenticalPlanarTexgen() { LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT; diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index cc46116545..38d81e44ba 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -228,6 +228,8 @@ protected: static void onCommitRepeatsPerMeter( LLUICtrl* ctrl, void* userinfo); static void onClickAutoFix(void*); static void onAlignTexture(void*); + static void onClickBtnLoadInvPBR(void* userdata); + static void onClickBtnEditPBR(void* userdata); public: // needs to be accessible to selection manager void onCopyColor(); // records all selected faces @@ -438,7 +440,6 @@ private: */ void onTextureSelectionChanged(LLInventoryItem* itemp); void onPbrSelectionChanged(LLInventoryItem* itemp); - void onPbrStartEditing(); LLMenuButton* mMenuClipboardColor; LLMenuButton* mMenuClipboardTexture; diff --git a/indra/newview/skins/default/xui/en/panel_tools_texture.xml b/indra/newview/skins/default/xui/en/panel_tools_texture.xml index ff2323784c..e2d571324f 100644 --- a/indra/newview/skins/default/xui/en/panel_tools_texture.xml +++ b/indra/newview/skins/default/xui/en/panel_tools_texture.xml @@ -239,28 +239,46 @@ width="160" /> +