From af30c8c95b81e99c76bd5e08dcaab4c31dfdcac1 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 11 Apr 2023 21:20:30 +0300 Subject: SL-19533 Don't try to restart fetchexcessively No real point restarting, but due to significant changes decided to keep this around and raise asserts instead of removing. --- indra/newview/lltexturectrl.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 0ce82a1297..6f29d45f6b 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -1478,8 +1478,11 @@ BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask) showPicker(FALSE); //grab textures first... LLInventoryModelBackgroundFetch::instance().start(gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE)); - //...then start full inventory fetch. - LLInventoryModelBackgroundFetch::instance().start(); + //...then start full inventory fetch (should have been done on startup, but just in case. + if (!LLInventoryModelBackgroundFetch::instance().inventoryFetchStarted()) + { + LLInventoryModelBackgroundFetch::instance().start(); + } handled = TRUE; } else -- cgit v1.2.3 From 7c100d54dda03db62a8d2c8be6a5e02ea9280f9b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 29 Jun 2023 02:33:58 +0300 Subject: SL-19928 Make thumbnail selection failures more user friendly --- indra/newview/lltexturectrl.cpp | 110 +++++++++++++++++++++++++++++----------- 1 file changed, 81 insertions(+), 29 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 6f29d45f6b..ec0ae39573 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -176,6 +176,8 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( mSelectedItemPinned( FALSE ), mCanApply(true), mCanPreview(true), + mMaxDim(S32_MAX), + mMinDim(0), mPreviewSettingChanged(false), mOnFloaterCommitCallback(NULL), mOnFloaterCloseCallback(NULL), @@ -270,19 +272,36 @@ void LLFloaterTexturePicker::stopUsingPipette() } } -void LLFloaterTexturePicker::updateImageStats() +bool LLFloaterTexturePicker::updateImageStats() { + bool result = true; if (mTexturep.notNull()) { //RN: have we received header data for this image? - if (mTexturep->getFullWidth() > 0 && mTexturep->getFullHeight() > 0) + S32 width = mTexturep->getFullWidth(); + S32 height = mTexturep->getFullHeight(); + if (width > 0 && height > 0) { - std::string formatted_dims = llformat("%d x %d", mTexturep->getFullWidth(),mTexturep->getFullHeight()); - mResolutionLabel->setTextArg("[DIMENSIONS]", formatted_dims); - if (mOnUpdateImageStatsCallback) - { - mOnUpdateImageStatsCallback(mTexturep); - } + if (width < mMinDim + || width > mMaxDim + || height < mMinDim + || height > mMaxDim + ) + { + std::string formatted_dims = llformat("%d x %d", width, height); + mResolutionWarning->setTextArg("[TEXDIM]", formatted_dims); + result = false; + } + else + { + std::string formatted_dims = llformat("%d x %d", width, height); + mResolutionLabel->setTextArg("[DIMENSIONS]", formatted_dims); + } + + if (mOnUpdateImageStatsCallback) + { + mOnUpdateImageStatsCallback(mTexturep); + } } else { @@ -293,6 +312,21 @@ void LLFloaterTexturePicker::updateImageStats() { mResolutionLabel->setTextArg("[DIMENSIONS]", std::string("")); } + mResolutionLabel->setVisible(result); + mResolutionWarning->setVisible(!result); + + // Hide buttons and pipete to make space for mResolutionWarning + // Hiding buttons is suboptimal, but at the moment limited to inventory thumbnails + // may be this should be an info/warning icon with a tooltip? + S32 index = mModeSelector->getValue().asInteger(); + if (index == 0) + { + mDefaultBtn->setVisible(result); + mNoneBtn->setVisible(result); + mBlankBtn->setVisible(result); + mPipetteBtn->setVisible(result); + } + return result; } // virtual @@ -410,11 +444,22 @@ BOOL LLFloaterTexturePicker::postBuild() mTentativeLabel = getChild("Multiple"); mResolutionLabel = getChild("size_lbl"); + mResolutionWarning = getChild("over_limit_lbl"); - childSetAction("Default",LLFloaterTexturePicker::onBtnSetToDefault,this); - childSetAction("None", LLFloaterTexturePicker::onBtnNone,this); - childSetAction("Blank", LLFloaterTexturePicker::onBtnBlank,this); + mDefaultBtn = getChild("Default"); + mNoneBtn = getChild("None"); + mBlankBtn = getChild("Blank"); + mPipetteBtn = getChild("Pipette"); + mSelectBtn = getChild("Select"); + mCancelBtn = getChild("Cancel"); + + mDefaultBtn->setClickedCallback(boost::bind(LLFloaterTexturePicker::onBtnSetToDefault,this)); + mNoneBtn->setClickedCallback(boost::bind(LLFloaterTexturePicker::onBtnNone, this)); + mBlankBtn->setClickedCallback(boost::bind(LLFloaterTexturePicker::onBtnBlank, this)); + mPipetteBtn->setCommitCallback(boost::bind(&LLFloaterTexturePicker::onBtnPipette, this)); + mSelectBtn->setClickedCallback(boost::bind(LLFloaterTexturePicker::onBtnSelect, this)); + mCancelBtn->setClickedCallback(boost::bind(LLFloaterTexturePicker::onBtnCancel, this)); childSetCommitCallback("show_folders_check", onShowFolders, this); @@ -481,10 +526,6 @@ BOOL LLFloaterTexturePicker::postBuild() getChildView("show_folders_check")->setEnabled(FALSE); } - getChild("Pipette")->setCommitCallback( boost::bind(&LLFloaterTexturePicker::onBtnPipette, this)); - childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this); - childSetAction("Select", LLFloaterTexturePicker::onBtnSelect,this); - // update permission filter once UI is fully initialized updateFilterPermMask(); mSavedFolderState.setApply(FALSE); @@ -504,13 +545,13 @@ void LLFloaterTexturePicker::draw() static LLCachedControl max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); drawConeToOwner(mContextConeOpacity, max_opacity, mOwner); - updateImageStats(); + bool valid_dims = updateImageStats(); // if we're inactive, gray out "apply immediate" checkbox getChildView("show_folders_check")->setEnabled(mActive && mCanApplyImmediately && !mNoCopyTextureSelected); - getChildView("Select")->setEnabled(mActive && mCanApply); - getChildView("Pipette")->setEnabled(mActive); - getChild("Pipette")->setValue(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); + mSelectBtn->setEnabled(mActive && mCanApply && valid_dims); + mPipetteBtn->setEnabled(mActive); + mPipetteBtn->setValue(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); //BOOL allow_copy = FALSE; if( mOwner ) @@ -544,9 +585,9 @@ void LLFloaterTexturePicker::draw() mTentativeLabel->setVisible( FALSE ); } - getChildView("Default")->setEnabled(mImageAssetID != mDefaultImageAssetID || mTentative); - getChildView("Blank")->setEnabled(mImageAssetID != mBlankImageAssetID || mTentative); - getChildView("None")->setEnabled(mAllowNoTexture && (!mImageAssetID.isNull() || mTentative)); + mDefaultBtn->setEnabled(mImageAssetID != mDefaultImageAssetID || mTentative); + mBlankBtn->setEnabled(mImageAssetID != mBlankImageAssetID || mTentative); + mNoneBtn->setEnabled(mAllowNoTexture && (!mImageAssetID.isNull() || mTentative)); LLFloater::draw(); @@ -820,10 +861,10 @@ void LLFloaterTexturePicker::onModeSelect(LLUICtrl* ctrl, void *userdata) LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; int index = self->mModeSelector->getValue().asInteger(); - self->getChild("Default")->setVisible(index == 0 ? TRUE : FALSE); - self->getChild("Blank")->setVisible(index == 0 ? TRUE : FALSE); - self->getChild("None")->setVisible(index == 0 ? TRUE : FALSE); - self->getChild("Pipette")->setVisible(index == 0 ? TRUE : FALSE); + self->mDefaultBtn->setVisible(index == 0 ? TRUE : FALSE); + self->mBlankBtn->setVisible(index == 0 ? TRUE : FALSE); + self->mNoneBtn->setVisible(index == 0 ? TRUE : FALSE); + self->mPipetteBtn->setVisible(index == 0 ? TRUE : FALSE); self->getChild("inventory search editor")->setVisible(index == 0 ? TRUE : FALSE); self->getChild("inventory panel")->setVisible(index == 0 ? TRUE : FALSE); @@ -1098,10 +1139,10 @@ void LLFloaterTexturePicker::updateFilterPermMask() //mInventoryPanel->setFilterPermMask( getFilterPermMask() ); Commented out due to no-copy texture loss. } -void LLFloaterTexturePicker::setCanApply(bool can_preview, bool can_apply) +void LLFloaterTexturePicker::setCanApply(bool can_preview, bool can_apply, bool inworld_image) { - getChildRef("Select").setEnabled(can_apply); - getChildRef("preview_disabled").setVisible(!can_preview); + mSelectBtn->setEnabled(can_apply); + getChildRef("preview_disabled").setVisible(!can_preview && inworld_image); getChildRef("apply_immediate_check").setVisible(can_preview); mCanApply = can_apply; @@ -1109,6 +1150,17 @@ void LLFloaterTexturePicker::setCanApply(bool can_preview, bool can_apply) mPreviewSettingChanged = true; } +void LLFloaterTexturePicker::setDimentionsLimits(S32 max_dim, S32 min_dim) +{ + mMaxDim = max_dim; + mMinDim = min_dim; + + std::string formatted_dims = llformat("%d x %d", mMinDim, mMinDim); + mResolutionWarning->setTextArg("[MINTEXDIM]", formatted_dims); + formatted_dims = llformat("%d x %d", mMaxDim, mMaxDim); + mResolutionWarning->setTextArg("[MAXTEXDIM]", formatted_dims); +} + void LLFloaterTexturePicker::onFilterEdit(const std::string& search_string ) { std::string upper_case_search_string = search_string; -- cgit v1.2.3 From ab18293d35c4ce391f65efaa65be53cdbe84f550 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 30 Jun 2023 00:42:55 +0300 Subject: SL-19929 Picker's warning small adjustment --- indra/newview/lltexturectrl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index ec0ae39573..21bb855704 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -288,7 +288,7 @@ bool LLFloaterTexturePicker::updateImageStats() || height > mMaxDim ) { - std::string formatted_dims = llformat("%d x %d", width, height); + std::string formatted_dims = llformat("%dx%d", width, height); mResolutionWarning->setTextArg("[TEXDIM]", formatted_dims); result = false; } @@ -1155,9 +1155,9 @@ void LLFloaterTexturePicker::setDimentionsLimits(S32 max_dim, S32 min_dim) mMaxDim = max_dim; mMinDim = min_dim; - std::string formatted_dims = llformat("%d x %d", mMinDim, mMinDim); + std::string formatted_dims = llformat("%dx%d", mMinDim, mMinDim); mResolutionWarning->setTextArg("[MINTEXDIM]", formatted_dims); - formatted_dims = llformat("%d x %d", mMaxDim, mMaxDim); + formatted_dims = llformat("%dx%d", mMaxDim, mMaxDim); mResolutionWarning->setTextArg("[MAXTEXDIM]", formatted_dims); } -- cgit v1.2.3 From 7b9206dfd15ee90fde421525254b0a29d94f1ef2 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 22 Jul 2023 00:22:35 +0300 Subject: SL-20045 Texture picker should apply the exact texture inventory item --- indra/newview/lltexturectrl.cpp | 145 +++++++++++++++++++++++++++------------- 1 file changed, 99 insertions(+), 46 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 21bb855704..36fa4e9a37 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -713,17 +713,76 @@ PermissionMask LLFloaterTexturePicker::getFilterPermMask() void LLFloaterTexturePicker::commitIfImmediateSet() { - if (!mNoCopyTextureSelected && mOnFloaterCommitCallback && mCanApply) + if (!mNoCopyTextureSelected && mCanApply) { - mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CHANGE, LLUUID::null); + commitCallback(); } } +void LLFloaterTexturePicker::commitCallback() +{ + if (!mOnFloaterCommitCallback) + { + return; + } + LLUUID asset_id = mImageAssetID; + LLUUID inventory_id; + LLPickerSource mode = (LLPickerSource)mModeSelector->getValue().asInteger(); + + switch (mode) + { + case PICKER_INVENTORY: + { + LLFolderView* root_folder = mInventoryPanel->getRootFolder(); + if (root_folder && root_folder->getCurSelectedItem()) + { + LLFolderViewItem* last_selected = root_folder->getCurSelectedItem(); + LLFolderViewModelItemInventory* inv_view = static_cast(last_selected->getViewModelItem()); + + LLInventoryItem* itemp = gInventory.getItem(inv_view->getUUID()); + if (itemp && itemp->getAssetUUID() == mImageAssetID) + { + inventory_id = inv_view->getUUID(); + } + else + { + mode = PICKER_UNKNOWN; // source of id unknown + } + } + else + { + mode = PICKER_UNKNOWN; // source of id unknown + } + break; + } + case PICKER_LOCAL: + { + if (!mLocalScrollCtrl->getAllSelected().empty()) + { + LLUUID temp_id = mLocalScrollCtrl->getFirstSelected()->getColumn(LOCAL_TRACKING_ID_COLUMN)->getValue().asUUID(); + asset_id = LLLocalBitmapMgr::getInstance()->getWorldID(temp_id); + } + else + { + asset_id = mImageAssetID; + mode = PICKER_UNKNOWN; // source of id unknown + } + break; + } + case PICKER_BAKE: + break; + default: + mode = PICKER_UNKNOWN; // source of id unknown + break; + } + + mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CHANGE, mode, asset_id, inventory_id); +} void LLFloaterTexturePicker::commitCancel() { if (!mNoCopyTextureSelected && mOnFloaterCommitCallback && mCanApply) { - mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CANCEL, LLUUID::null); + mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CANCEL, PICKER_UNKNOWN, mOriginalImageAssetID, LLUUID::null); } } @@ -776,7 +835,7 @@ void LLFloaterTexturePicker::onBtnCancel(void* userdata) self->setImageID( self->mOriginalImageAssetID ); if (self->mOnFloaterCommitCallback) { - self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CANCEL, LLUUID::null); + self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CANCEL, PICKER_UNKNOWN, self->mOriginalImageAssetID, LLUUID::null); } self->mViewModel->resetDirty(); self->closeFloater(); @@ -786,20 +845,7 @@ void LLFloaterTexturePicker::onBtnCancel(void* userdata) void LLFloaterTexturePicker::onBtnSelect(void* userdata) { LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; - LLUUID local_id = LLUUID::null; - if (self->mOwner) - { - if (self->mLocalScrollCtrl->getVisible() && !self->mLocalScrollCtrl->getAllSelected().empty()) - { - LLUUID temp_id = self->mLocalScrollCtrl->getFirstSelected()->getColumn(LOCAL_TRACKING_ID_COLUMN)->getValue().asUUID(); - local_id = LLLocalBitmapMgr::getInstance()->getWorldID(temp_id); - } - } - - if (self->mOnFloaterCommitCallback) - { - self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_SELECT, local_id); - } + self->commitCallback(); self->closeFloater(); } @@ -861,25 +907,25 @@ void LLFloaterTexturePicker::onModeSelect(LLUICtrl* ctrl, void *userdata) LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; int index = self->mModeSelector->getValue().asInteger(); - self->mDefaultBtn->setVisible(index == 0 ? TRUE : FALSE); - self->mBlankBtn->setVisible(index == 0 ? TRUE : FALSE); - self->mNoneBtn->setVisible(index == 0 ? TRUE : FALSE); - self->mPipetteBtn->setVisible(index == 0 ? TRUE : FALSE); - self->getChild("inventory search editor")->setVisible(index == 0 ? TRUE : FALSE); - self->getChild("inventory panel")->setVisible(index == 0 ? TRUE : FALSE); + self->mDefaultBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); + self->mBlankBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); + self->mNoneBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); + self->mPipetteBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); + self->getChild("inventory search editor")->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); + self->getChild("inventory panel")->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); /*self->getChild("show_folders_check")->setVisible(mode); no idea under which conditions the above is even shown, needs testing. */ - self->getChild("l_add_btn")->setVisible(index == 1 ? TRUE : FALSE); - self->getChild("l_rem_btn")->setVisible(index == 1 ? TRUE : FALSE); - self->getChild("l_upl_btn")->setVisible(index == 1 ? TRUE : FALSE); - self->getChild("l_name_list")->setVisible(index == 1 ? TRUE : FALSE); + self->getChild("l_add_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE); + self->getChild("l_rem_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE); + self->getChild("l_upl_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE); + self->getChild("l_name_list")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE); - self->getChild("l_bake_use_texture_combo_box")->setVisible(index == 2 ? TRUE : FALSE); + self->getChild("l_bake_use_texture_combo_box")->setVisible(index == PICKER_BAKE ? TRUE : FALSE); self->getChild("hide_base_mesh_region")->setVisible(FALSE);// index == 2 ? TRUE : FALSE); - if (index == 2) + if (index == PICKER_BAKE) { self->stopUsingPipette(); @@ -1020,7 +1066,7 @@ void LLFloaterTexturePicker::onLocalScrollCommit(LLUICtrl* ctrl, void* userdata) { if (self->mOnFloaterCommitCallback) { - self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CHANGE, inworld_id); + self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CHANGE, PICKER_LOCAL, inworld_id, LLUUID::null); } } } @@ -1457,7 +1503,7 @@ void LLTextureCtrl::showPicker(BOOL take_focus) } if (texture_floaterp) { - texture_floaterp->setOnFloaterCommitCallback(boost::bind(&LLTextureCtrl::onFloaterCommit, this, _1, _2)); + texture_floaterp->setOnFloaterCommitCallback(boost::bind(&LLTextureCtrl::onFloaterCommit, this, _1, _2, _3, _4)); } if (texture_floaterp) { @@ -1574,7 +1620,7 @@ void LLTextureCtrl::onFloaterClose() mFloaterHandle.markDead(); } -void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLUUID id) +void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLPickerSource source, const LLUUID& asset_id, const LLUUID& inv_id) { LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); @@ -1588,22 +1634,29 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLUUID id) else if (mCommitOnSelection || op == TEXTURE_SELECT) mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here? - if(floaterp->isDirty() || id.notNull()) // mModelView->setDirty does not work. + if(floaterp->isDirty() || asset_id.notNull()) // mModelView->setDirty does not work. { setTentative( FALSE ); - if (id.notNull()) - { - mImageItemID = id; - mImageAssetID = id; - } - else - { - mImageItemID = floaterp->findItemID(floaterp->getAssetID(), FALSE); - LL_DEBUGS() << "mImageItemID: " << mImageItemID << LL_ENDL; - mImageAssetID = floaterp->getAssetID(); - LL_DEBUGS() << "mImageAssetID: " << mImageAssetID << LL_ENDL; - } + switch(source) + { + case PICKER_INVENTORY: + mImageItemID = inv_id; + mImageAssetID = asset_id; + break; + case PICKER_BAKE: + case PICKER_LOCAL: + mImageItemID = LLUUID::null; + mImageAssetID = asset_id; + break; + case PICKER_UNKNOWN: + default: + mImageItemID = floaterp->findItemID(asset_id, FALSE); + mImageAssetID = asset_id; + break; + } + + LL_DEBUGS() << "mImageAssetID: " << mImageAssetID << ", mImageItemID: " << mImageItemID << LL_ENDL; if (op == TEXTURE_SELECT && mOnSelectCallback) { -- cgit v1.2.3 From b267515922f6bca9034810ab7f18626f39cec356 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 25 Jul 2023 22:06:23 +0300 Subject: SL-20068 Selecting from texture picker for thumbnail does not assign thumbnail --- indra/newview/lltexturectrl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 36fa4e9a37..29891ba235 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -715,11 +715,11 @@ void LLFloaterTexturePicker::commitIfImmediateSet() { if (!mNoCopyTextureSelected && mCanApply) { - commitCallback(); + commitCallback(LLTextureCtrl::TEXTURE_CHANGE); } } -void LLFloaterTexturePicker::commitCallback() +void LLFloaterTexturePicker::commitCallback(LLTextureCtrl::ETexturePickOp op) { if (!mOnFloaterCommitCallback) { @@ -776,7 +776,7 @@ void LLFloaterTexturePicker::commitCallback() break; } - mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CHANGE, mode, asset_id, inventory_id); + mOnFloaterCommitCallback(op, mode, asset_id, inventory_id); } void LLFloaterTexturePicker::commitCancel() { @@ -845,7 +845,7 @@ void LLFloaterTexturePicker::onBtnCancel(void* userdata) void LLFloaterTexturePicker::onBtnSelect(void* userdata) { LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; - self->commitCallback(); + self->commitCallback(LLTextureCtrl::TEXTURE_SELECT); self->closeFloater(); } -- cgit v1.2.3 From 1cf4a2c95210ba94c330710e0a98f762bf54c605 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 27 Jul 2023 13:30:09 +0300 Subject: SL-20080 Show warning message when selecting a non square texture for thumbnails --- indra/newview/lltexturectrl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 29891ba235..a746744e53 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -282,7 +282,8 @@ bool LLFloaterTexturePicker::updateImageStats() S32 height = mTexturep->getFullHeight(); if (width > 0 && height > 0) { - if (width < mMinDim + if (width != height + || width < mMinDim || width > mMaxDim || height < mMinDim || height > mMaxDim -- cgit v1.2.3 From 119b02937ed42502549ba3dab2db48c6edef9425 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 27 Jul 2023 23:20:17 +0300 Subject: SL-19958 An inventory material without asset should default to a blank material #2 --- indra/newview/lltexturectrl.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 0dd1ff5483..b3310a1f9a 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -232,12 +232,20 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id, bool set_selecti mInventoryPanel->setSelection(item_id, TAKE_FOCUS_NO); } } - - - } } +void LLFloaterTexturePicker::setImageIDFromItem(const LLInventoryItem* itemp, bool set_selection) +{ + LLUUID asset_id = itemp->getAssetUUID(); + if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL && asset_id.isNull()) + { + // If an inventory item has a null asset, consider it a valid blank material(gltf) + asset_id = LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID; + } + setImageID(asset_id, set_selection); +} + void LLFloaterTexturePicker::setActive( BOOL active ) { if (!active && getChild("Pipette")->getValue().asBoolean()) @@ -388,7 +396,7 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop( { if (drop) { - setImageID( item->getAssetUUID() ); + setImageIDFromItem(item); commitIfImmediateSet(); } @@ -860,7 +868,7 @@ void LLFloaterTexturePicker::onSelectionChange(const std::dequegetAssetUUID(),false); + setImageIDFromItem(itemp, false); mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here? if(!mPreviewSettingChanged) -- cgit v1.2.3 From 5a706086fefa6058389dc35707fc6b0c8ccece2d Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Fri, 21 Jul 2023 17:32:08 -0700 Subject: SL-20053: Fix sometimes unable to unset a PBR material on a prim. Caused by inventory item asset IDs being null. Seems suspicious. But working around it for now seems best. --- indra/newview/lltexturectrl.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index b3310a1f9a..c13376d0a6 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -693,6 +693,11 @@ void LLFloaterTexturePicker::draw() const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, BOOL copyable_only, BOOL ignore_library) { + if (asset_id.isNull()) + { + return LLUUID::null; + } + LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLAssetIDMatches asset_id_matches(asset_id); -- cgit v1.2.3 From cfb69846f1e8309ed86d4a18eb26a889f6dbaccc Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 9 Sep 2023 00:00:22 +0300 Subject: SL-20261 Allow and resize existing textures as necessary for thumbnails --- indra/newview/lltexturectrl.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index a746744e53..0c3730d084 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -1197,15 +1197,12 @@ void LLFloaterTexturePicker::setCanApply(bool can_preview, bool can_apply, bool mPreviewSettingChanged = true; } -void LLFloaterTexturePicker::setDimentionsLimits(S32 max_dim, S32 min_dim) +void LLFloaterTexturePicker::setMinDimentionsLimits(S32 min_dim) { - mMaxDim = max_dim; mMinDim = min_dim; std::string formatted_dims = llformat("%dx%d", mMinDim, mMinDim); mResolutionWarning->setTextArg("[MINTEXDIM]", formatted_dims); - formatted_dims = llformat("%dx%d", mMaxDim, mMaxDim); - mResolutionWarning->setTextArg("[MAXTEXDIM]", formatted_dims); } void LLFloaterTexturePicker::onFilterEdit(const std::string& search_string ) -- cgit v1.2.3 From 97ee8b207bf43a8acb3f2702d26eb5f3b7471e45 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 19 Sep 2023 00:54:14 +0300 Subject: SL-5522 Fix applying textuers and materials with limited restrictions to attachments 1. Texture picker now updates filter's permissions based on selection 2. Various panels now properly check permissions --- indra/newview/lltexturectrl.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index c13376d0a6..7e399a6808 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -1339,6 +1339,12 @@ void LLFloaterTexturePicker::setInventoryPickType(LLTextureCtrl::EPickInventoryT } } +void LLFloaterTexturePicker::setImmediateFilterPermMask(PermissionMask mask) +{ + mImmediateFilterPermMask = mask; + mInventoryPanel->setFilterPermMask(mask); +} + void LLFloaterTexturePicker::onPickerCallback(const std::vector& filenames, LLHandle handle) { std::vector::const_iterator iter = filenames.begin(); @@ -1526,6 +1532,17 @@ void LLTextureCtrl::setCanApply(bool can_preview, bool can_apply) } } +void LLTextureCtrl::setImmediateFilterPermMask(PermissionMask mask) +{ + mImmediateFilterPermMask = mask; + + LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); + if (floaterp) + { + floaterp->setImmediateFilterPermMask(mask); + } +} + void LLTextureCtrl::setVisible( BOOL visible ) { if( !visible ) -- cgit v1.2.3 From 226081b27511ad45fbeaa16b9226265dc446976b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 25 Sep 2023 20:24:57 +0300 Subject: SL-20334 Unable to use non-square textures from inventory --- indra/newview/lltexturectrl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 0c3730d084..2e137a8e12 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -176,6 +176,7 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( mSelectedItemPinned( FALSE ), mCanApply(true), mCanPreview(true), + mLimitsSet(false), mMaxDim(S32_MAX), mMinDim(0), mPreviewSettingChanged(false), @@ -282,7 +283,7 @@ bool LLFloaterTexturePicker::updateImageStats() S32 height = mTexturep->getFullHeight(); if (width > 0 && height > 0) { - if (width != height + if ((mLimitsSet && (width != height)) || width < mMinDim || width > mMaxDim || height < mMinDim @@ -1200,6 +1201,7 @@ void LLFloaterTexturePicker::setCanApply(bool can_preview, bool can_apply, bool void LLFloaterTexturePicker::setMinDimentionsLimits(S32 min_dim) { mMinDim = min_dim; + mLimitsSet = true; std::string formatted_dims = llformat("%dx%d", mMinDim, mMinDim); mResolutionWarning->setTextArg("[MINTEXDIM]", formatted_dims); -- cgit v1.2.3 From b894570e9af5eafd5de06f401fdc782599c063a2 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 27 Sep 2023 20:59:07 +0300 Subject: SL-19958 Fix default material not droping into texture ctrl --- indra/newview/lltexturectrl.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 7e399a6808..bbacec843b 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -2101,8 +2101,16 @@ BOOL LLTextureCtrl::doDrop(LLInventoryItem* item) return mDropCallback(this, item); } - // no callback installed, so just set the image ids and carry on. - setImageAssetID( item->getAssetUUID() ); + // no callback installed, so just set the image ids and carry on. + LLUUID asset_id = item->getAssetUUID(); + + if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL && asset_id.isNull()) + { + // If an inventory material has a null asset, consider it a valid blank material(gltf) + asset_id = LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID; + } + + setImageAssetID(asset_id); mImageItemID = item->getUUID(); return TRUE; } -- cgit v1.2.3 From 5566f28b039e2f3999e397a26243707affc80991 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 3 Oct 2023 19:27:26 +0300 Subject: D559 Post merge fixes --- indra/newview/lltexturectrl.cpp | 54 ++++++++++++----------------------------- 1 file changed, 15 insertions(+), 39 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 796753955b..8a8abc222f 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -593,8 +593,6 @@ BOOL LLFloaterTexturePicker::postBuild() childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this); childSetAction("Select", LLFloaterTexturePicker::onBtnSelect,this); - // update permission filter once UI is fully initialized - updateFilterPermMask(); mSavedFolderState.setApply(FALSE); LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterTexturePicker::onTextureSelect, this, _1)); @@ -837,8 +835,18 @@ void LLFloaterTexturePicker::commitCallback(LLTextureCtrl::ETexturePickOp op) { if (!mLocalScrollCtrl->getAllSelected().empty()) { - LLUUID temp_id = mLocalScrollCtrl->getFirstSelected()->getColumn(LOCAL_TRACKING_ID_COLUMN)->getValue().asUUID(); - asset_id = LLLocalBitmapMgr::getInstance()->getWorldID(temp_id); + LLSD data = mLocalScrollCtrl->getFirstSelected()->getValue(); + LLUUID temp_id = data["id"]; + S32 asset_type = data["type"].asInteger(); + + if (LLAssetType::AT_MATERIAL == asset_type) + { + asset_id = LLLocalGLTFMaterialMgr::getInstance()->getWorldID(temp_id); + } + else + { + asset_id = LLLocalBitmapMgr::getInstance()->getWorldID(temp_id); + } } else { @@ -923,30 +931,10 @@ void LLFloaterTexturePicker::onBtnCancel(void* userdata) // static void LLFloaterTexturePicker::onBtnSelect(void* userdata) { - LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; - LLUUID local_id = LLUUID::null; - if (self->mOwner) - { - if (self->mLocalScrollCtrl->getVisible() && !self->mLocalScrollCtrl->getAllSelected().empty()) - { - LLSD data = self->mLocalScrollCtrl->getFirstSelected()->getValue(); - LLUUID temp_id = data["id"]; - S32 asset_type = data["type"].asInteger(); - - if (LLAssetType::AT_MATERIAL == asset_type) - { - local_id = LLLocalGLTFMaterialMgr::getInstance()->getWorldID(temp_id); - } - else - { - local_id = LLLocalBitmapMgr::getInstance()->getWorldID(temp_id); - } - } - } - + LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; if (self->mOnFloaterCommitCallback) { - self->commitCallback(LLTextureCtrl::TEXTURE_SELECT, local_id); + self->commitCallback(LLTextureCtrl::TEXTURE_SELECT); } self->closeFloater(); } @@ -1306,19 +1294,7 @@ void LLFloaterTexturePicker::onBakeTextureSelect(LLUICtrl* ctrl, void *user_data } } -//static -void LLFloaterTexturePicker::onHideBaseMeshRegionCheck(LLUICtrl* ctrl, void *user_data) -{ - //LLFloaterTexturePicker* picker = (LLFloaterTexturePicker*)user_data; - //LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl; -} - -void LLFloaterTexturePicker::updateFilterPermMask() -{ - //mInventoryPanel->setFilterPermMask( getFilterPermMask() ); Commented out due to no-copy texture loss. -} - -void LLFloaterTexturePicker::setCanApply(bool can_preview, bool can_apply) +void LLFloaterTexturePicker::setCanApply(bool can_preview, bool can_apply, bool inworld_image) { mSelectBtn->setEnabled(can_apply); getChildRef("preview_disabled").setVisible(!can_preview && inworld_image); -- cgit v1.2.3 From eab9396579842ae0202bfa3318ffc527e7ee6d1a Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 7 Oct 2023 00:06:34 +0300 Subject: SL-20386 Fix default material recognition in picker's inventory --- indra/newview/lltexturectrl.cpp | 52 +++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 7 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 8a8abc222f..4e5dcf5fca 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -213,15 +213,38 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id, bool set_selecti mModeSelector->selectByValue(0); onModeSelect(0,this); } - - LLUUID item_id = findItemID(mImageAssetID, FALSE); + + LLUUID item_id; + LLFolderView* root_folder = mInventoryPanel->getRootFolder(); + if (root_folder && root_folder->getCurSelectedItem()) + { + LLFolderViewItem* last_selected = root_folder->getCurSelectedItem(); + LLFolderViewModelItemInventory* inv_view = static_cast(last_selected->getViewModelItem()); + + LLInventoryItem* itemp = gInventory.getItem(inv_view->getUUID()); + + if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL + && mImageAssetID == LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID + && itemp && itemp->getAssetUUID().isNull()) + { + item_id = inv_view->getUUID(); + } + else if (itemp && itemp->getAssetUUID() == mImageAssetID) + { + item_id = inv_view->getUUID(); + } + } + if (item_id.isNull()) + { + item_id = findItemID(mImageAssetID, FALSE); + } if (item_id.isNull()) { mInventoryPanel->getRootFolder()->clearSelection(); } else { - LLInventoryItem* itemp = gInventory.getItem(image_id); + LLInventoryItem* itemp = gInventory.getItem(item_id); if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID())) { // no copy texture @@ -741,14 +764,22 @@ void LLFloaterTexturePicker::draw() const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, BOOL copyable_only, BOOL ignore_library) { - if (asset_id.isNull()) + LLUUID loockup_id = asset_id; + if (loockup_id.isNull()) { - return LLUUID::null; + if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL) + { + loockup_id = LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID; + } + else + { + return LLUUID::null; + } } LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; - LLAssetIDMatches asset_id_matches(asset_id); + LLAssetIDMatches asset_id_matches(loockup_id); gInventory.collectDescendentsIf(LLUUID::null, cats, items, @@ -816,7 +847,14 @@ void LLFloaterTexturePicker::commitCallback(LLTextureCtrl::ETexturePickOp op) LLFolderViewModelItemInventory* inv_view = static_cast(last_selected->getViewModelItem()); LLInventoryItem* itemp = gInventory.getItem(inv_view->getUUID()); - if (itemp && itemp->getAssetUUID() == mImageAssetID) + + if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL + && mImageAssetID == LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID + && itemp && itemp->getAssetUUID().isNull()) + { + inventory_id = inv_view->getUUID(); + } + else if (itemp && itemp->getAssetUUID() == mImageAssetID) { inventory_id = inv_view->getUUID(); } -- cgit v1.2.3 From fa368f8bcdbf991064cf3350f29c733fec7d21c8 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 9 Oct 2023 22:25:52 +0300 Subject: SL-20372 Picker should remember choice of texture source --- indra/newview/lltexturectrl.cpp | 171 +++++++++++++++++++++------------------- 1 file changed, 92 insertions(+), 79 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 4e5dcf5fca..10667b02d9 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -138,6 +138,8 @@ bool get_can_copy_texture(LLUUID asset_id) return get_is_predefined_texture(asset_id) || get_copy_free_item_by_asset_id(asset_id).notNull(); } +S32 LLFloaterTexturePicker::sLastPickerMode = 0; + LLFloaterTexturePicker::LLFloaterTexturePicker( LLView* owner, LLUUID image_asset_id, @@ -515,6 +517,15 @@ BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask) return LLFloater::handleKeyHere(key, mask); } +void LLFloaterTexturePicker::onOpen(const LLSD& key) +{ + if (sLastPickerMode != 0 + && mModeSelector->selectByValue(sLastPickerMode)) + { + changeMode(); + } +} + void LLFloaterTexturePicker::onClose(bool app_quitting) { if (mOwner && mOnFloaterCloseCallback) @@ -522,6 +533,7 @@ void LLFloaterTexturePicker::onClose(bool app_quitting) mOnFloaterCloseCallback(); } stopUsingPipette(); + sLastPickerMode = mModeSelector->getValue().asInteger(); } // virtual @@ -1032,85 +1044,8 @@ void LLFloaterTexturePicker::onSelectionChange(const std::dequemModeSelector->getValue().asInteger(); - - self->mDefaultBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); - self->mBlankBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); - self->mNoneBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); - self->getChild("inventory search editor")->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); - self->getChild("inventory panel")->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); - - /*self->getChild("show_folders_check")->setVisible(mode); - no idea under which conditions the above is even shown, needs testing. */ - - self->getChild("l_add_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE); - self->getChild("l_rem_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE); - self->getChild("l_upl_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE); - self->getChild("l_name_list")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE); - - self->getChild("l_bake_use_texture_combo_box")->setVisible(index == PICKER_BAKE ? TRUE : FALSE); - self->getChild("hide_base_mesh_region")->setVisible(FALSE);// index == 2 ? TRUE : FALSE); - - bool pipette_visible = (index == PICKER_INVENTORY) - && (self->mInventoryPickType != LLTextureCtrl::PICK_MATERIAL); - self->mPipetteBtn->setVisible(pipette_visible); - - if (index == PICKER_BAKE) - { - self->stopUsingPipette(); - - S8 val = -1; - - LLUUID imageID = self->mImageAssetID; - if (imageID == IMG_USE_BAKED_HEAD) - { - val = 0; - } - else if (imageID == IMG_USE_BAKED_UPPER) - { - val = 1; - } - else if (imageID == IMG_USE_BAKED_LOWER) - { - val = 2; - } - else if (imageID == IMG_USE_BAKED_EYES) - { - val = 3; - } - else if (imageID == IMG_USE_BAKED_SKIRT) - { - val = 4; - } - else if (imageID == IMG_USE_BAKED_HAIR) - { - val = 5; - } - else if (imageID == IMG_USE_BAKED_LEFTARM) - { - val = 6; - } - else if (imageID == IMG_USE_BAKED_LEFTLEG) - { - val = 7; - } - else if (imageID == IMG_USE_BAKED_AUX1) - { - val = 8; - } - else if (imageID == IMG_USE_BAKED_AUX2) - { - val = 9; - } - else if (imageID == IMG_USE_BAKED_AUX3) - { - val = 10; - } - - - self->getChild("l_bake_use_texture_combo_box")->setSelectedByValue(val, TRUE); - } + LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; + self->changeMode(); } // static @@ -1386,6 +1321,84 @@ void LLFloaterTexturePicker::onFilterEdit(const std::string& search_string ) mInventoryPanel->setFilterSubString(search_string); } +void LLFloaterTexturePicker::changeMode() +{ + int index = mModeSelector->getValue().asInteger(); + + mDefaultBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); + mBlankBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); + mNoneBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); + mFilterEdit->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); + mInventoryPanel->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE); + + getChild("l_add_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE); + getChild("l_rem_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE); + getChild("l_upl_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE); + getChild("l_name_list")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE); + + getChild("l_bake_use_texture_combo_box")->setVisible(index == PICKER_BAKE ? TRUE : FALSE); + getChild("hide_base_mesh_region")->setVisible(FALSE);// index == 2 ? TRUE : FALSE); + + bool pipette_visible = (index == PICKER_INVENTORY) + && (mInventoryPickType != LLTextureCtrl::PICK_MATERIAL); + mPipetteBtn->setVisible(pipette_visible); + + if (index == PICKER_BAKE) + { + stopUsingPipette(); + + S8 val = -1; + + LLUUID imageID = mImageAssetID; + if (imageID == IMG_USE_BAKED_HEAD) + { + val = 0; + } + else if (imageID == IMG_USE_BAKED_UPPER) + { + val = 1; + } + else if (imageID == IMG_USE_BAKED_LOWER) + { + val = 2; + } + else if (imageID == IMG_USE_BAKED_EYES) + { + val = 3; + } + else if (imageID == IMG_USE_BAKED_SKIRT) + { + val = 4; + } + else if (imageID == IMG_USE_BAKED_HAIR) + { + val = 5; + } + else if (imageID == IMG_USE_BAKED_LEFTARM) + { + val = 6; + } + else if (imageID == IMG_USE_BAKED_LEFTLEG) + { + val = 7; + } + else if (imageID == IMG_USE_BAKED_AUX1) + { + val = 8; + } + else if (imageID == IMG_USE_BAKED_AUX2) + { + val = 9; + } + else if (imageID == IMG_USE_BAKED_AUX3) + { + val = 10; + } + + getChild("l_bake_use_texture_combo_box")->setSelectedByValue(val, TRUE); + } +} + void LLFloaterTexturePicker::refreshLocalList() { mLocalScrollCtrl->clearRows(); -- cgit v1.2.3