summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llpanelface.cpp1
-rw-r--r--indra/newview/lltexturectrl.cpp126
-rw-r--r--indra/newview/lltexturectrl.h19
-rw-r--r--indra/newview/skins/default/xui/en/floater_texture_ctrl.xml118
4 files changed, 194 insertions, 70 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 795a93c3fe..9300b161f4 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -213,6 +213,7 @@ BOOL LLPanelFace::postBuild()
pbr_ctrl->setImmediateFilterPermMask(PERM_NONE);
pbr_ctrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
pbr_ctrl->setBakeTextureEnabled(false);
+ pbr_ctrl->setInventoryPickType(LLTextureCtrl::PICK_MATERIAL);
}
mTextureCtrl = getChild<LLTextureCtrl>("texture control");
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 580fd7936e..87c05c162a 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -177,7 +177,8 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
mOnFloaterCloseCallback(NULL),
mSetImageAssetIDCallback(NULL),
mOnUpdateImageStatsCallback(NULL),
- mBakeTextureEnabled(FALSE)
+ mBakeTextureEnabled(FALSE),
+ mInventoryPickType(LLTextureCtrl::PICK_TEXTURE)
{
mCanApplyImmediately = can_apply_immediately;
buildFromFile("floater_texture_ctrl.xml");
@@ -466,8 +467,20 @@ BOOL LLFloaterTexturePicker::postBuild()
mLocalScrollCtrl = getChild<LLScrollListCtrl>("l_name_list");
mLocalScrollCtrl->setCommitCallback(onLocalScrollCommit, this);
mLocalScrollCtrl->clearRows();
- LLLocalBitmapMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
- LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
+
+ if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE_MATERIAL)
+ {
+ LLLocalBitmapMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
+ LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
+ }
+ else if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE)
+ {
+ LLLocalBitmapMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
+ }
+ else if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ {
+ LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
+ }
mNoCopyTextureSelected = FALSE;
@@ -901,11 +914,18 @@ void LLFloaterTexturePicker::onBtnAdd(void* userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)userdata;
- // todo: there will be changes to texture picker to forbid
- // selection of materials in some cases, like landmarks, once
- // it gets implemented, update code to select FLOAD_* filter
- // based on picker's material/texture mode.
- LLFilePickerReplyThread::startPicker(boost::bind(&onPickerCallback, _1, self->getHandle()), LLFilePicker::FFLOAD_MATERIAL_TEXTURE, true);
+ if (self->mInventoryPickType == LLTextureCtrl::PICK_TEXTURE_MATERIAL)
+ {
+ LLFilePickerReplyThread::startPicker(boost::bind(&onPickerCallback, _1, self->getHandle()), LLFilePicker::FFLOAD_MATERIAL_TEXTURE, true);
+ }
+ else if (self->mInventoryPickType == LLTextureCtrl::PICK_TEXTURE)
+ {
+ LLFilePickerReplyThread::startPicker(boost::bind(&onPickerCallback, _1, self->getHandle()), LLFilePicker::FFLOAD_IMAGE, true);
+ }
+ else if (self->mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ {
+ LLFilePickerReplyThread::startPicker(boost::bind(&onPickerCallback, _1, self->getHandle()), LLFilePicker::FFLOAD_MATERIAL, true);
+ }
}
// static
@@ -941,8 +961,20 @@ void LLFloaterTexturePicker::onBtnRemove(void* userdata)
self->getChild<LLButton>("l_rem_btn")->setEnabled(false);
self->getChild<LLButton>("l_upl_btn")->setEnabled(false);
self->mLocalScrollCtrl->clearRows();
- LLLocalBitmapMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
- LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
+
+ if (self->mInventoryPickType == LLTextureCtrl::PICK_TEXTURE_MATERIAL)
+ {
+ LLLocalBitmapMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
+ LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
+ }
+ else if (self->mInventoryPickType == LLTextureCtrl::PICK_TEXTURE)
+ {
+ LLLocalBitmapMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
+ }
+ else if (self->mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ {
+ LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
+ }
}
}
@@ -1183,18 +1215,23 @@ void LLFloaterTexturePicker::onSelectTextureMaterials(LLUICtrl* ctrl, void *user
U32 filter_types = 0x0;
- if (index == textures_and_materials)
+ if (self->mInventoryPickType != LLTextureCtrl::PICK_TEXTURE_MATERIAL)
+ {
+ index = self->mInventoryPickType;
+ }
+
+ if (index == LLTextureCtrl::PICK_TEXTURE_MATERIAL)
{
filter_types |= 0x1 << LLInventoryType::IT_TEXTURE;
filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT;
filter_types |= 0x1 << LLInventoryType::IT_MATERIAL;
}
- else if (index == textures_only)
+ else if (index == LLTextureCtrl::PICK_TEXTURE)
{
filter_types |= 0x1 << LLInventoryType::IT_TEXTURE;
filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT;
}
- else if (index == materials_only)
+ else if (index == LLTextureCtrl::PICK_MATERIAL)
{
filter_types |= 0x1 << LLInventoryType::IT_MATERIAL;
}
@@ -1229,6 +1266,28 @@ void LLFloaterTexturePicker::setBakeTextureEnabled(BOOL enabled)
onModeSelect(0, this);
}
+void LLFloaterTexturePicker::setInventoryPickType(LLTextureCtrl::EPickInventoryType type)
+{
+ mInventoryPickType = type;
+
+ mLocalScrollCtrl->clearRows();
+ if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE_MATERIAL)
+ {
+ LLLocalBitmapMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
+ LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
+ }
+ else if (mInventoryPickType == LLTextureCtrl::PICK_TEXTURE)
+ {
+ LLLocalBitmapMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
+ }
+ else if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ {
+ LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(mLocalScrollCtrl);
+ }
+
+ onSelectTextureMaterials(0, this);
+}
+
void LLFloaterTexturePicker::onPickerCallback(const std::vector<std::string>& filenames, LLHandle<LLFloater> handle)
{
std::vector<std::string>::const_iterator iter = filenames.begin();
@@ -1254,8 +1313,20 @@ void LLFloaterTexturePicker::onPickerCallback(const std::vector<std::string>& fi
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)handle.get();
self->mLocalScrollCtrl->clearRows();
- LLLocalBitmapMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
- LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
+
+ if (self->mInventoryPickType == LLTextureCtrl::PICK_TEXTURE_MATERIAL)
+ {
+ LLLocalBitmapMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
+ LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
+ }
+ else if (self->mInventoryPickType == LLTextureCtrl::PICK_TEXTURE)
+ {
+ LLLocalBitmapMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
+ }
+ else if (self->mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ {
+ LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl);
+ }
}
}
@@ -1306,6 +1377,8 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
mValid( TRUE ),
mShowLoadingPlaceholder( TRUE ),
mOpenTexPreview(false),
+ mBakeTextureEnabled(true),
+ mInventoryPickType(PICK_TEXTURE),
mImageAssetID(p.image_id),
mDefaultImageAssetID(p.default_image_id),
mDefaultImageName(p.default_image_name),
@@ -1495,14 +1568,10 @@ void LLTextureCtrl::showPicker(BOOL take_focus)
if (texture_floaterp)
{
texture_floaterp->setOnFloaterCommitCallback(boost::bind(&LLTextureCtrl::onFloaterCommit, this, _1, _2));
- }
- if (texture_floaterp)
- {
texture_floaterp->setSetImageAssetIDCallback(boost::bind(&LLTextureCtrl::setImageAssetID, this, _1));
- }
- if (texture_floaterp)
- {
- texture_floaterp->setBakeTextureEnabled(TRUE);
+
+ texture_floaterp->setBakeTextureEnabled(mBakeTextureEnabled);
+ texture_floaterp->setInventoryPickType(mInventoryPickType);
}
LLFloater* root_floater = gFloaterView->getParentFloater(this);
@@ -1749,8 +1818,9 @@ void LLTextureCtrl::setImageAssetID( const LLUUID& asset_id )
}
}
-void LLTextureCtrl::setBakeTextureEnabled(BOOL enabled)
+void LLTextureCtrl::setBakeTextureEnabled(bool enabled)
{
+ mBakeTextureEnabled = enabled;
LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
if (floaterp)
{
@@ -1758,6 +1828,16 @@ void LLTextureCtrl::setBakeTextureEnabled(BOOL enabled)
}
}
+void LLTextureCtrl::setInventoryPickType(EPickInventoryType type)
+{
+ mInventoryPickType = type;
+ LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
+ if (floaterp)
+ {
+ floaterp->setInventoryPickType(type);
+ }
+}
+
BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask,
BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
EAcceptance *accept,
diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h
index 0325e09aa7..fb409af42b 100644
--- a/indra/newview/lltexturectrl.h
+++ b/indra/newview/lltexturectrl.h
@@ -78,6 +78,13 @@ public:
TEXTURE_CANCEL
} ETexturePickOp;
+ typedef enum e_pick_inventory_type
+ {
+ PICK_TEXTURE_MATERIAL = 0,
+ PICK_TEXTURE = 1,
+ PICK_MATERIAL = 2,
+ } EPickInventoryType;
+
public:
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
{
@@ -212,7 +219,11 @@ public:
LLViewerFetchedTexture* getTexture() { return mTexturep; }
- void setBakeTextureEnabled(BOOL enabled);
+ void setBakeTextureEnabled(bool enabled);
+ bool getBakeTextureEnabled() const { return mBakeTextureEnabled; }
+
+ void setInventoryPickType(EPickInventoryType type);
+ EPickInventoryType getInventoryPickType() { return mInventoryPickType; };
private:
BOOL allowDrop(LLInventoryItem* item);
@@ -251,7 +262,8 @@ private:
std::string mLoadingPlaceholderString;
S32 mLabelWidth;
bool mOpenTexPreview;
- BOOL mBakeTextureEnabled;
+ bool mBakeTextureEnabled;
+ LLTextureCtrl::EPickInventoryType mInventoryPickType;
};
//////////////////////////////////////////////////////////////////////////////////////////
@@ -347,6 +359,8 @@ public:
void setLocalTextureEnabled(BOOL enabled);
void setBakeTextureEnabled(BOOL enabled);
+ void setInventoryPickType(LLTextureCtrl::EPickInventoryType type);
+
static void onPickerCallback(const std::vector<std::string>& filenames, LLHandle<LLFloater> handle);
protected:
@@ -389,6 +403,7 @@ private:
bool mCanApply;
bool mCanPreview;
bool mPreviewSettingChanged;
+ LLTextureCtrl::EPickInventoryType mInventoryPickType;
texture_selected_callback mTextureSelectedCallback;
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 2a84fece03..b6a2aaf31b 100644
--- a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml
+++ b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml
@@ -137,51 +137,79 @@
value="Preview Disabled"
word_wrap="true"
visible="false"
- 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"
- label="Filter Textures"
- layout="topleft"
- left="175"
- name="inventory search editor"
- top="48"
- width="231" />
- <asset_filtered_inv_panel
- allow_multi_select="false"
- bg_visible="true"
- bg_alpha_color="DkGray2"
- border="false"
- follows="all"
- height="200"
- layout="topleft"
- left_delta="0"
- name="inventory panel"
- top_pad="4"
- width="231"
- filter_asset_types="texture|material"/>
+ width="87" />
+
+ <layout_stack name="inventory_stack"
+ width="231"
+ height="276"
+ top="20"
+ left="175"
+ follows="all"
+ animate="false"
+ orientation="vertical">
+ <layout_panel name="combo_layout"
+ border="false"
+ bevel_style="in"
+ auto_resize="false"
+ user_resize="false"
+ visible="false"
+ width="231"
+ height="24">
+ <combo_box
+ follows="left|top|right"
+ height="23"
+ label="Choose Textures, Materials or LIFE!"
+ layout="topleft"
+ left="0"
+ name="textures_material_combo"
+ top="0"
+ 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>
+ </layout_panel>
+ <layout_panel name="inventory_layout"
+ border="false"
+ bevel_style="in"
+ auto_resize="true"
+ user_resize="false"
+ visible="true"
+ width="231"
+ height="252">
+ <filter_editor
+ follows="left|top|right"
+ height="23"
+ label="Filter Textures"
+ layout="topleft"
+ left="0"
+ name="inventory search editor"
+ top="4"
+ width="231" />
+ <asset_filtered_inv_panel
+ allow_multi_select="false"
+ bg_visible="true"
+ bg_alpha_color="DkGray2"
+ border="false"
+ follows="all"
+ height="221"
+ layout="topleft"
+ left_delta="0"
+ name="inventory panel"
+ top_pad="4"
+ width="231"
+ filter_asset_types="texture|material"/>
+ </layout_panel>
+ </layout_stack>
<!-- middle: local mode -->
<button