Skip to content
Snippets Groups Projects
Commit 00a04b87 authored by Andrey Kleshchev's avatar Andrey Kleshchev
Browse files

SL-17640 Fix name usage, fix "apply now"

This reverts commit 231c618a, instead color swatched get enabled 'apply now' in xml.
parent d9b3eef4
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "llviewerinventory.h" #include "llviewerinventory.h"
#include "llviewerregion.h" #include "llviewerregion.h"
#include "llvovolume.h" #include "llvovolume.h"
#include "llcolorswatch.h"
#include "tinygltf/tiny_gltf.h" #include "tinygltf/tiny_gltf.h"
...@@ -73,13 +72,17 @@ BOOL LLMaterialEditor::postBuild() ...@@ -73,13 +72,17 @@ BOOL LLMaterialEditor::postBuild()
childSetAction("save_as", boost::bind(&LLMaterialEditor::onClickSaveAs, this)); childSetAction("save_as", boost::bind(&LLMaterialEditor::onClickSaveAs, this));
childSetAction("cancel", boost::bind(&LLMaterialEditor::onClickCancel, this)); childSetAction("cancel", boost::bind(&LLMaterialEditor::onClickCancel, this));
boost::function<void(LLUICtrl*, void*)> changes_callback = [this](LLUICtrl * ctrl, void*) { setHasUnsavedChanges(true); }; boost::function<void(LLUICtrl*, void*)> changes_callback = [this](LLUICtrl * ctrl, void*)
{
setHasUnsavedChanges(true);
// Apply changes to object live
applyToSelection();
};
childSetCommitCallback("double sided", changes_callback, NULL); childSetCommitCallback("double sided", changes_callback, NULL);
// Albedo // Albedo
childSetCommitCallback("albedo color", changes_callback, NULL); childSetCommitCallback("albedo color", changes_callback, NULL);
getChild<LLColorSwatchCtrl>("albedo color")->setCanApplyImmediately(TRUE);
childSetCommitCallback("transparency", changes_callback, NULL); childSetCommitCallback("transparency", changes_callback, NULL);
childSetCommitCallback("alpha mode", changes_callback, NULL); childSetCommitCallback("alpha mode", changes_callback, NULL);
childSetCommitCallback("alpha cutoff", changes_callback, NULL); childSetCommitCallback("alpha cutoff", changes_callback, NULL);
...@@ -94,10 +97,13 @@ BOOL LLMaterialEditor::postBuild() ...@@ -94,10 +97,13 @@ BOOL LLMaterialEditor::postBuild()
// Emissive // Emissive
childSetCommitCallback("emissive color", changes_callback, NULL); childSetCommitCallback("emissive color", changes_callback, NULL);
getChild<LLColorSwatchCtrl>("emissive color")->setCanApplyImmediately(TRUE);
childSetVisible("unsaved_changes", mHasUnsavedChanges); childSetVisible("unsaved_changes", mHasUnsavedChanges);
// Todo:
// Disable/enable setCanApplyImmediately() based on
// working from inventory, upload or editing inworld
return LLFloater::postBuild(); return LLFloater::postBuild();
} }
...@@ -281,9 +287,6 @@ void LLMaterialEditor::setHasUnsavedChanges(bool value) ...@@ -281,9 +287,6 @@ void LLMaterialEditor::setHasUnsavedChanges(bool value)
mHasUnsavedChanges = value; mHasUnsavedChanges = value;
childSetVisible("unsaved_changes", value); childSetVisible("unsaved_changes", value);
} }
// HACK -- apply any changes to selection immediately
applyToSelection();
} }
void LLMaterialEditor::onCommitAlbedoTexture(LLUICtrl * ctrl, const LLSD & data) void LLMaterialEditor::onCommitAlbedoTexture(LLUICtrl * ctrl, const LLSD & data)
...@@ -300,6 +303,7 @@ void LLMaterialEditor::onCommitAlbedoTexture(LLUICtrl * ctrl, const LLSD & data) ...@@ -300,6 +303,7 @@ void LLMaterialEditor::onCommitAlbedoTexture(LLUICtrl * ctrl, const LLSD & data)
childSetValue("albedo_upload_fee", getString("no_upload_fee_string")); childSetValue("albedo_upload_fee", getString("no_upload_fee_string"));
} }
setHasUnsavedChanges(true); setHasUnsavedChanges(true);
applyToSelection();
} }
void LLMaterialEditor::onCommitMetallicTexture(LLUICtrl * ctrl, const LLSD & data) void LLMaterialEditor::onCommitMetallicTexture(LLUICtrl * ctrl, const LLSD & data)
...@@ -314,6 +318,7 @@ void LLMaterialEditor::onCommitMetallicTexture(LLUICtrl * ctrl, const LLSD & dat ...@@ -314,6 +318,7 @@ void LLMaterialEditor::onCommitMetallicTexture(LLUICtrl * ctrl, const LLSD & dat
childSetValue("metallic_upload_fee", getString("no_upload_fee_string")); childSetValue("metallic_upload_fee", getString("no_upload_fee_string"));
} }
setHasUnsavedChanges(true); setHasUnsavedChanges(true);
applyToSelection();
} }
void LLMaterialEditor::onCommitEmissiveTexture(LLUICtrl * ctrl, const LLSD & data) void LLMaterialEditor::onCommitEmissiveTexture(LLUICtrl * ctrl, const LLSD & data)
...@@ -328,6 +333,7 @@ void LLMaterialEditor::onCommitEmissiveTexture(LLUICtrl * ctrl, const LLSD & dat ...@@ -328,6 +333,7 @@ void LLMaterialEditor::onCommitEmissiveTexture(LLUICtrl * ctrl, const LLSD & dat
childSetValue("emissive_upload_fee", getString("no_upload_fee_string")); childSetValue("emissive_upload_fee", getString("no_upload_fee_string"));
} }
setHasUnsavedChanges(true); setHasUnsavedChanges(true);
applyToSelection();
} }
void LLMaterialEditor::onCommitNormalTexture(LLUICtrl * ctrl, const LLSD & data) void LLMaterialEditor::onCommitNormalTexture(LLUICtrl * ctrl, const LLSD & data)
...@@ -342,6 +348,7 @@ void LLMaterialEditor::onCommitNormalTexture(LLUICtrl * ctrl, const LLSD & data) ...@@ -342,6 +348,7 @@ void LLMaterialEditor::onCommitNormalTexture(LLUICtrl * ctrl, const LLSD & data)
childSetValue("normal_upload_fee", getString("no_upload_fee_string")); childSetValue("normal_upload_fee", getString("no_upload_fee_string"));
} }
setHasUnsavedChanges(true); setHasUnsavedChanges(true);
applyToSelection();
} }
...@@ -444,13 +451,12 @@ void LLMaterialEditor::onClickSave() ...@@ -444,13 +451,12 @@ void LLMaterialEditor::onClickSave()
LLTransactionID tid; LLTransactionID tid;
tid.generate(); // timestamp-based randomization + uniquification tid.generate(); // timestamp-based randomization + uniquification
LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
std::string res_name = "New Material";
std::string res_desc = "Saved Material"; std::string res_desc = "Saved Material";
U32 next_owner_perm = LLPermissions::DEFAULT.getMaskNextOwner(); U32 next_owner_perm = LLPermissions::DEFAULT.getMaskNextOwner();
LLUUID parent = gInventory.findCategoryUUIDForType(LLFolderType::FT_MATERIAL); LLUUID parent = gInventory.findCategoryUUIDForType(LLFolderType::FT_MATERIAL);
const U8 subtype = NO_INV_SUBTYPE; // TODO maybe use AT_SETTINGS and LLSettingsType::ST_MATERIAL ? const U8 subtype = NO_INV_SUBTYPE; // TODO maybe use AT_SETTINGS and LLSettingsType::ST_MATERIAL ?
create_inventory_item(gAgent.getID(), gAgent.getSessionID(), parent, tid, res_name, res_desc, create_inventory_item(gAgent.getID(), gAgent.getSessionID(), parent, tid, mMaterialName, res_desc,
LLAssetType::AT_MATERIAL, LLInventoryType::IT_MATERIAL, subtype, next_owner_perm, LLAssetType::AT_MATERIAL, LLInventoryType::IT_MATERIAL, subtype, next_owner_perm,
new LLBoostFuncInventoryCallback([output=dump](LLUUID const & inv_item_id){ new LLBoostFuncInventoryCallback([output=dump](LLUUID const & inv_item_id){
// from reference in LLSettingsVOBase::createInventoryItem()/updateInventoryItem() // from reference in LLSettingsVOBase::createInventoryItem()/updateInventoryItem()
...@@ -827,6 +833,10 @@ void LLMaterialEditor::importMaterial() ...@@ -827,6 +833,10 @@ void LLMaterialEditor::importMaterial()
void LLMaterialEditor::applyToSelection() void LLMaterialEditor::applyToSelection()
{ {
// Todo: associate with a specific 'selection' instead
// of modifying something that is selected
// This should be disabled when working from agent's
// inventory and for initial upload
LLViewerObject* objectp = LLSelectMgr::instance().getSelection()->getFirstObject(); LLViewerObject* objectp = LLSelectMgr::instance().getSelection()->getFirstObject();
if (objectp && objectp->getVolume()) if (objectp && objectp->getVolume())
{ {
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
Albedo: Albedo:
</text> </text>
<texture_picker <texture_picker
can_apply_immediately="false" can_apply_immediately="true"
default_image_name="Default" default_image_name="Default"
fallback_image="materials_ui_x_24.png" fallback_image="materials_ui_x_24.png"
allow_no_texture="true" allow_no_texture="true"
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
Tint Tint
</text> </text>
<color_swatch <color_swatch
can_apply_immediately="false" can_apply_immediately="true"
follows="left|top" follows="left|top"
height="40" height="40"
label_height="0" label_height="0"
...@@ -198,7 +198,7 @@ ...@@ -198,7 +198,7 @@
Metallic-Roughness: Metallic-Roughness:
</text> </text>
<texture_picker <texture_picker
can_apply_immediately="false" can_apply_immediately="true"
default_image_name="Default" default_image_name="Default"
fallback_image="materials_ui_x_24.png" fallback_image="materials_ui_x_24.png"
allow_no_texture="true" allow_no_texture="true"
...@@ -299,7 +299,7 @@ ...@@ -299,7 +299,7 @@
Emissive: Emissive:
</text> </text>
<texture_picker <texture_picker
can_apply_immediately="false" can_apply_immediately="true"
default_image_name="Default" default_image_name="Default"
fallback_image="materials_ui_x_24.png" fallback_image="materials_ui_x_24.png"
allow_no_texture="true" allow_no_texture="true"
...@@ -336,7 +336,7 @@ ...@@ -336,7 +336,7 @@
Tint Tint
</text> </text>
<color_swatch <color_swatch
can_apply_immediately="false" can_apply_immediately="true"
follows="left|top" follows="left|top"
height="40" height="40"
label_height="0" label_height="0"
...@@ -394,7 +394,7 @@ ...@@ -394,7 +394,7 @@
Normal: Normal:
</text> </text>
<texture_picker <texture_picker
can_apply_immediately="false" can_apply_immediately="true"
default_image_name="Default" default_image_name="Default"
fallback_image="materials_ui_x_24.png" fallback_image="materials_ui_x_24.png"
allow_no_texture="true" allow_no_texture="true"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment