diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-11-16 23:37:48 +0200 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-11-16 23:37:48 +0200 |
commit | d2b8d5b3687efb20f2d74bc7100282a5f3e8693d (patch) | |
tree | 27580a723e072b6e53505e8e53ea342aeb066554 /indra | |
parent | bfe5e3f289e4a260f10bcfffb8eca809c89f65d6 (diff) |
SL-17699 Fixed drag and drop into material picker
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/lltexturectrl.cpp | 56 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_texture_ctrl.xml | 10 |
2 files changed, 60 insertions, 6 deletions
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 7aa3639df7..3374af1c76 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -301,8 +301,24 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop( BOOL handled = FALSE; bool is_mesh = cargo_type == DAD_MESH; + bool is_texture = cargo_type == DAD_TEXTURE; + bool is_material = cargo_type == DAD_MATERIAL; - if ((cargo_type == DAD_TEXTURE) || is_mesh) + bool allow_dnd = false; + if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL) + { + allow_dnd = is_material; + } + else if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE) + { + allow_dnd = is_texture || is_mesh; + } + else + { + allow_dnd = is_texture || is_mesh || is_material; + } + + if (allow_dnd) { LLInventoryItem *item = (LLInventoryItem *)cargo_data; @@ -1246,6 +1262,21 @@ void LLFloaterTexturePicker::setInventoryPickType(LLTextureCtrl::EPickInventoryT S32 index = mModeSelector->getValue().asInteger(); getChild<LLButton>("Pipette")->setVisible(index == 0); } + + if (!mLabel.empty()) + { + std::string pick = getString("pick title"); + + setTitle(pick + mLabel); + } + else if(mInventoryPickType == LLTextureCtrl::PICK_MATERIAL) + { + setTitle(getString("pick_material")); + } + else + { + setTitle(getString("pick_texture")); + } } void LLFloaterTexturePicker::onPickerCallback(const std::vector<std::string>& filenames, LLHandle<LLFloater> handle) @@ -1770,11 +1801,26 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, // returns true, then the cast was valid, and we can perform // the third test without problems. LLInventoryItem* item = (LLInventoryItem*)cargo_data; - bool is_mesh = cargo_type == DAD_MESH; - if (getEnabled() && - ((cargo_type == DAD_TEXTURE) || is_mesh) && - allowDrop(item)) + bool is_mesh = cargo_type == DAD_MESH; + bool is_texture = cargo_type == DAD_TEXTURE; + bool is_material = cargo_type == DAD_MATERIAL; + + bool allow_dnd = false; + if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL) + { + allow_dnd = is_material; + } + else if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE) + { + allow_dnd = is_texture || is_mesh; + } + else + { + allow_dnd = is_texture || is_mesh || is_material; + } + + if (getEnabled() && allow_dnd && allowDrop(item)) { if (drop) { diff --git a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml index 18631c3ae7..47de3b7576 100644 --- a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml +++ b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml @@ -19,7 +19,15 @@ </floater.string> <floater.string name="pick title"> - Pick: +Pick: + </floater.string> + <floater.string + name="pick_material"> +PICK: MATERIAL + </floater.string> + <floater.string + name="pick_texture"> +PICK: TEXTURE </floater.string> <view |