From 0bc7fee11fe43281d5d3c97e95249f9c26af0eb1 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 23 Jun 2022 19:51:11 +0300 Subject: SL-17640 Materials Upload UI #1 1. Allow 'none' textures 2. Disable 'apply now' buttons 3. Switch from loading dae files to just gltf glb --- indra/newview/llmaterialeditor.cpp | 20 ++++++++--- indra/newview/llmaterialeditor.h | 2 ++ indra/newview/lltexturectrl.cpp | 16 +++------ indra/newview/lltexturectrl.h | 2 +- .../default/xui/en/floater_material_editor.xml | 40 ++++++++++++---------- .../newview/skins/default/xui/en/notifications.xml | 8 +++++ 6 files changed, 54 insertions(+), 34 deletions(-) (limited to 'indra') diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 8b4d3b832b..f4bf400844 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -27,9 +27,12 @@ #include "llviewerprecompiledheaders.h" #include "llmaterialeditor.h" + +#include "llappviewer.h" #include "llcombobox.h" +#include "llnotificationsutil.h" +#include "lltrans.h" #include "llviewermenufile.h" -#include "llappviewer.h" #include "llviewertexture.h" #include "llselectmgr.h" #include "llvovolume.h" @@ -101,6 +104,11 @@ void LLMaterialEditor::setAlphaCutoff(F32 alpha_cutoff) childSetValue("alpha cutoff", alpha_cutoff); } +void LLMaterialEditor::setMaterialName(const std::string &name) +{ + setTitle(name); +} + LLUUID LLMaterialEditor::getMetallicRoughnessId() { return childGetValue("metallic-roughness texture").asUUID(); @@ -378,13 +386,14 @@ void LLMaterialFilePicker::loadMaterial(const std::string& filename) if (!loaded) { - // TODO: show error_msg to user + LLNotificationsUtil::add("CannotUploadMaterial"); return; } if (model_in.materials.empty()) { - // TODO: show error message that materials are missing + // materials are missing + LLNotificationsUtil::add("CannotUploadMaterial"); return; } @@ -446,9 +455,12 @@ void LLMaterialFilePicker::loadMaterial(const std::string& filename) mME->setMetalnessFactor(material_in.pbrMetallicRoughness.metallicFactor); mME->setRoughnessFactor(material_in.pbrMetallicRoughness.roughnessFactor); - + mME->setDoubleSided(material_in.doubleSided); + std::string new_material = LLTrans::getString("New Material"); + mME->setMaterialName(new_material); + mME->openFloater(); mME->applyToSelection(); diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h index e773ecd169..2af4ccf885 100644 --- a/indra/newview/llmaterialeditor.h +++ b/indra/newview/llmaterialeditor.h @@ -59,6 +59,8 @@ public: F32 getAlphaCutoff(); void setAlphaCutoff(F32 alpha_cutoff); + + void setMaterialName(const std::string &name); LLUUID getMetallicRoughnessId(); void setMetallicRoughnessId(const LLUUID& id); diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 1c4a56b549..b761f34790 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -193,10 +193,8 @@ void LLFloaterTexturePicker::setActive( BOOL active ) void LLFloaterTexturePicker::setCanApplyImmediately(BOOL b) { mCanApplyImmediately = b; - if (!mCanApplyImmediately) - { - getChild("apply_immediate_check")->setValue(FALSE); - } + + getChild("apply_immediate_check")->setValue(mCanApplyImmediately); updateFilterPermMask(); } @@ -413,11 +411,7 @@ BOOL LLFloaterTexturePicker::postBuild() getChild("apply_immediate_check")->setValue(gSavedSettings.getBOOL("TextureLivePreview")); childSetCommitCallback("apply_immediate_check", onApplyImmediateCheck, this); - - if (!mCanApplyImmediately) - { - getChildView("show_folders_check")->setEnabled(FALSE); - } + getChildView("apply_immediate_check")->setEnabled(mCanApplyImmediately); getChild("Pipette")->setCommitCallback( boost::bind(&LLFloaterTexturePicker::onBtnPipette, this)); childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this); @@ -483,7 +477,7 @@ void LLFloaterTexturePicker::draw() } getChildView("Default")->setEnabled(mImageAssetID != mDefaultImageAssetID || mTentative); - getChildView("Blank")->setEnabled(mImageAssetID != mBlankImageAssetID || mTentative); + getChildView("Blank")->setEnabled((mImageAssetID != mBlankImageAssetID && mBlankImageAssetID != mDefaultImageAssetID) || mTentative); getChildView("None")->setEnabled(mAllowNoTexture && (!mImageAssetID.isNull() || mTentative)); LLFloater::draw(); @@ -1146,7 +1140,7 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p) mOnCloseCallback(NULL), mOnSelectCallback(NULL), mBorderColor( p.border_color() ), - mAllowNoTexture( FALSE ), + mAllowNoTexture( p.allow_no_texture ), mAllowLocalTexture( TRUE ), mImmediateFilterPermMask( PERM_NONE ), mNonImmediateFilterPermMask( PERM_NONE ), diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index 92f6f89af6..1475c8c6fc 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -91,7 +91,7 @@ public: : image_id("image"), default_image_id("default_image_id"), default_image_name("default_image_name"), - allow_no_texture("allow_no_texture"), + allow_no_texture("allow_no_texture", false), can_apply_immediately("can_apply_immediately"), no_commit_on_selection("no_commit_on_selection", false), label_width("label_width", -1), diff --git a/indra/newview/skins/default/xui/en/floater_material_editor.xml b/indra/newview/skins/default/xui/en/floater_material_editor.xml index 5d72e6f79d..8482795f6f 100644 --- a/indra/newview/skins/default/xui/en/floater_material_editor.xml +++ b/indra/newview/skins/default/xui/en/floater_material_editor.xml @@ -7,8 +7,16 @@ layout="topleft" name="material editor" help_topic="material_editor" - title="Material: [MATERIAL_NAME]" + title="[MATERIAL_NAME]" width="256"> + Albedo: - Metallic-Roughness: - --> -