summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorCallum Prentice <callum@lindenlab.com>2022-08-19 14:51:03 -0700
committerCallum Prentice <callum@lindenlab.com>2022-08-19 14:51:03 -0700
commit15cd6c1cb757060754680bec6101df7c0675cb38 (patch)
treeb06a7911be74e881c5e0ce292220df18dc37972a /indra
parent664ba53e4ce8510345e490cedf4401f6655f38fc (diff)
parent59884327e29133afad7bb87852c83691f175922d (diff)
Merge branch 'DRTVWR-559-SL-17699' into DRTVWR-559
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/lltexturectrl.cpp124
-rw-r--r--indra/newview/lltexturectrl.h3
-rw-r--r--indra/newview/skins/default/xui/en/floater_texture_ctrl.xml32
3 files changed, 137 insertions, 22 deletions
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index e8ff14daac..1d3c61c21e 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -417,23 +417,29 @@ BOOL LLFloaterTexturePicker::postBuild()
childSetCommitCallback("show_folders_check", onShowFolders, this);
getChildView("show_folders_check")->setVisible( FALSE);
- mFilterEdit = getChild<LLFilterEditor>("inventory search editor");
- mFilterEdit->setCommitCallback(boost::bind(&LLFloaterTexturePicker::onFilterEdit, this, _2));
+ mFilterEdit = getChild<LLFilterEditor>("inventory search editor");
+ mFilterEdit->setCommitCallback(boost::bind(&LLFloaterTexturePicker::onFilterEdit, this, _2));
mInventoryPanel = getChild<LLInventoryPanel>("inventory panel");
+ mTextureMaterialsCombo = getChild<LLComboBox>("textures_material_combo");
+ mTextureMaterialsCombo->setCommitCallback(onSelectTextureMaterials, this);
+
+ // set the combo box to the first entry in the list (currently textures and materials)
+ mTextureMaterialsCombo->selectByValue(0);
+
mModeSelector = getChild<LLComboBox>("mode_selection");
mModeSelector->setCommitCallback(onModeSelect, this);
mModeSelector->selectByValue(0);
if(mInventoryPanel)
{
- U32 filter_types = 0x0;
- filter_types |= 0x1 << LLInventoryType::IT_TEXTURE;
- filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT;
+ // to avoid having to make an assumption about which option is
+ // selected at startup, we call the same function that is triggered
+ // when a texture/materials/both choice is made and let it take care
+ // of setting the filters
+ onSelectTextureMaterials(0, this);
- mInventoryPanel->setFilterTypes(filter_types);
- //mInventoryPanel->setFilterPermMask(getFilterPermMask()); //Commented out due to no-copy texture loss.
mInventoryPanel->setFilterPermMask(mImmediateFilterPermMask);
mInventoryPanel->setSelectCallback(boost::bind(&LLFloaterTexturePicker::onSelectionChange, this, _1, _2));
mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
@@ -817,6 +823,7 @@ void LLFloaterTexturePicker::onModeSelect(LLUICtrl* ctrl, void *userdata)
self->getChild<LLButton>("Blank")->setVisible(index == 0 ? TRUE : FALSE);
self->getChild<LLButton>("None")->setVisible(index == 0 ? TRUE : FALSE);
self->getChild<LLButton>("Pipette")->setVisible(index == 0 ? TRUE : FALSE);
+ self->getChild<LLComboBox>("textures_material_combo")->setVisible(index == 0 ? TRUE : FALSE);
self->getChild<LLFilterEditor>("inventory search editor")->setVisible(index == 0 ? TRUE : FALSE);
self->getChild<LLInventoryPanel>("inventory panel")->setVisible(index == 0 ? TRUE : FALSE);
@@ -1136,6 +1143,38 @@ void LLFloaterTexturePicker::onFilterEdit(const std::string& search_string )
mInventoryPanel->setFilterSubString(search_string);
}
+void LLFloaterTexturePicker::onSelectTextureMaterials(LLUICtrl* ctrl, void *userdata)
+{
+ LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)userdata;
+ int index = self->mTextureMaterialsCombo->getValue().asInteger();
+
+ // IMPORTANT: make sure these match the entries in floater_texture_ctrl.xml
+ // for the textures_material_combo combo box
+ const int textures_and_materials = 0;
+ const int textures_only = 1;
+ const int materials_only = 2;
+
+ U32 filter_types = 0x0;
+
+ if (index == textures_and_materials)
+ {
+ filter_types |= 0x1 << LLInventoryType::IT_TEXTURE;
+ filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT;
+ filter_types |= 0x1 << LLInventoryType::IT_MATERIAL;
+ }
+ else if (index == textures_only)
+ {
+ filter_types |= 0x1 << LLInventoryType::IT_TEXTURE;
+ filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT;
+ }
+ else if (index == materials_only)
+ {
+ filter_types |= 0x1 << LLInventoryType::IT_MATERIAL;
+ }
+
+ self->mInventoryPanel->setFilterTypes(filter_types);
+}
+
void LLFloaterTexturePicker::setLocalTextureEnabled(BOOL enabled)
{
mModeSelector->setEnabledByValue(1, enabled);
@@ -1494,9 +1533,9 @@ void LLTextureCtrl::onFloaterClose()
void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLUUID id)
{
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
- if( floaterp && getEnabled())
+ if( floaterp && getEnabled())
{
if (op == TEXTURE_CANCEL)
mViewModel->resetDirty();
@@ -1517,15 +1556,64 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLUUID id)
}
else
{
- mImageItemID = floaterp->findItemID(floaterp->getAssetID(), FALSE);
- LL_DEBUGS() << "mImageItemID: " << mImageItemID << LL_ENDL;
- mImageAssetID = floaterp->getAssetID();
- LL_DEBUGS() << "mImageAssetID: " << mImageAssetID << LL_ENDL;
+ mImageItemID = floaterp->findItemID(floaterp->getAssetID(), FALSE);
+ LL_DEBUGS() << "mImageItemID: " << mImageItemID << LL_ENDL;
+ mImageAssetID = floaterp->getAssetID();
+ LL_DEBUGS() << "mImageAssetID: " << mImageAssetID << LL_ENDL;
}
if (op == TEXTURE_SELECT && mOnSelectCallback)
{
- mOnSelectCallback( this, LLSD() );
+ // determine if the selected item in inventory is a material
+ // by finding the item in inventory and inspecting its (IT_) type
+ LLUUID item_id = floaterp->findItemID(floaterp->getAssetID(), FALSE);
+ LLInventoryItem* item = gInventory.getItem(item_id);
+ if (item)
+ {
+ if (item->getInventoryType() == LLInventoryType::IT_MATERIAL)
+ {
+ // ask the selection manager for the list of selected objects
+ // to which the material will be applied.
+ LLObjectSelectionHandle selectedObjectsHandle = LLSelectMgr::getInstance()->getSelection();
+ if (selectedObjectsHandle.notNull())
+ {
+ LLObjectSelection* selectedObjects = selectedObjectsHandle.get();
+ if (!selectedObjects->isEmpty())
+ {
+ // we have a selection - iterate over it
+ for (LLObjectSelection::valid_iterator obj_iter = selectedObjects->valid_begin();
+ obj_iter != selectedObjects->valid_end();
+ ++obj_iter)
+ {
+ LLSelectNode* object = *obj_iter;
+ LLViewerObject* viewer_object = object->getObject();
+ if (viewer_object)
+ {
+ // the asset ID of the material we want to apply
+ // the the selected objects
+ LLUUID asset_id = item->getAssetUUID();
+
+ // iterate over the faces in the object
+ // TODO: consider the case where user has
+ // selected only certain faces
+ S32 num_faces = viewer_object->getNumTEs();
+ for (S32 face = 0; face < num_faces; face++)
+ {
+ viewer_object->setRenderMaterialID(face, asset_id);
+ dialog_refresh_all();
+ }
+ viewer_object->sendTEUpdate();
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ // original behavior for textures, not materials
+ {
+ mOnSelectCallback(this, LLSD());
+ }
}
else if (op == TEXTURE_CANCEL && mOnCancelCallback)
{
@@ -1536,8 +1624,10 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLUUID id)
// If the "no_commit_on_selection" parameter is set
// we commit only when user presses OK in the picker
// (i.e. op == TEXTURE_SELECT) or texture changes via DnD.
- if (mCommitOnSelection || op == TEXTURE_SELECT)
- onCommit();
+ if (mCommitOnSelection || op == TEXTURE_SELECT)
+ {
+ onCommit();
+ }
}
}
}
@@ -1670,7 +1760,7 @@ void LLTextureCtrl::draw()
}
else//mImageAssetID == LLUUID::null
{
- mTexturep = NULL;
+ mTexturep = NULL;
}
// Border
diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h
index a234124c08..cfd5c4bd29 100644
--- a/indra/newview/lltexturectrl.h
+++ b/indra/newview/lltexturectrl.h
@@ -340,6 +340,8 @@ public:
static void onBakeTextureSelect(LLUICtrl* ctrl, void *userdata);
static void onHideBaseMeshRegionCheck(LLUICtrl* ctrl, void *userdata);
+ static void onSelectTextureMaterials(LLUICtrl* ctrl, void *userdata);
+
void setLocalTextureEnabled(BOOL enabled);
void setBakeTextureEnabled(BOOL enabled);
@@ -365,6 +367,7 @@ protected:
BOOL mActive;
LLFilterEditor* mFilterEdit;
+ LLComboBox* mTextureMaterialsCombo;
LLInventoryPanel* mInventoryPanel;
PermissionMask mImmediateFilterPermMask;
PermissionMask mDnDFilterPermMask;
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 1e42b97025..5ab31b404e 100644
--- a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml
+++ b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml
@@ -137,7 +137,29 @@
value="Preview Disabled"
word_wrap="true"
visible="false"
- width="87" />
+ width="87" />
+ <combo_box
+ follows="left|top|right"
+ height="23"
+ label="Choose Textures, Materials or LIFE!"
+ layout="topleft"
+ left="175"
+ name="textures_material_combo"
+ top="20"
+ width="231">
+ <combo_box.item
+ label="Materials &amp; Textures"
+ name="Materials_Textures"
+ value="0" />
+ <combo_box.item
+ label="Textures"
+ name="Textures"
+ value="1" />
+ <combo_box.item
+ label="Materials"
+ name="Materials"
+ value="2" />
+ </combo_box>
<filter_editor
follows="left|top|right"
height="23"
@@ -145,15 +167,15 @@
layout="topleft"
left="175"
name="inventory search editor"
- top="20"
+ top="48"
width="231" />
- <asset_filtered_inv_panel
- allow_multi_select="false"
+ <asset_filtered_inv_panel
+ allow_multi_select="false"
bg_visible="true"
bg_alpha_color="DkGray2"
border="false"
follows="all"
- height="233"
+ height="195"
layout="topleft"
left_delta="0"
name="inventory panel"