From 361571cdb330dea18ad5a3575d7b06c69371e11b Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 29 Nov 2022 13:51:23 -0800 Subject: SL-18732: Use override update callback for LLMaterialEditor::updateLive as well --- indra/newview/llmaterialeditor.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llmaterialeditor.cpp') diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index d5339777c4..f1fd276402 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -399,6 +399,9 @@ BOOL LLMaterialEditor::postBuild() if (mIsOverride) { + // Material override change success callback + LLGLTFMaterialList::addUpdateCallback(&LLMaterialEditor::updateLive); + // Live editing needs a recovery mechanism on cancel mBaseColorTextureCtrl->setOnCancelCallback(boost::bind(&LLMaterialEditor::onCancelCtrl, this, _1, _2, MATERIAL_BASE_COLOR_TEX_DIRTY)); mMetallicTextureCtrl->setOnCancelCallback(boost::bind(&LLMaterialEditor::onCancelCtrl, this, _1, _2, MATERIAL_METALLIC_ROUGHTNESS_TEX_DIRTY)); -- cgit v1.3 From bfcb07270ed7036c87a4ece7fa1f5416123fff85 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 29 Nov 2022 15:20:44 -0800 Subject: SL-18732: Review feedback --- indra/newview/llgltfmateriallist.cpp | 56 ++++++++++++++++-------------------- indra/newview/llgltfmateriallist.h | 2 +- indra/newview/llmaterialeditor.cpp | 2 +- indra/newview/llpanelface.cpp | 6 ++-- indra/newview/llpanelface.h | 2 +- 5 files changed, 30 insertions(+), 38 deletions(-) (limited to 'indra/newview/llmaterialeditor.cpp') diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 048085fb71..d04a674e91 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -148,7 +148,7 @@ public: void addCallback(void(*callback)(const LLUUID& object_id, S32 side)) { - mCallbacks.push_back(callback); + mSelectionCallbacks.push_back(callback); } bool operator()(const LLDispatcher* dispatcher, const std::string& key, const LLUUID& invoice, const sparam_t& strings) override @@ -214,6 +214,14 @@ public: return true; } + void doSelectionCallbacks(const LLUUID& object_id, S32 side) + { + for (auto& callback : mSelectionCallbacks) + { + callback(object_id, side); + } + } + void applyData(const LLGLTFOverrideCacheEntry &object_override) { // Parse the data @@ -289,41 +297,31 @@ public: // object not ready to receive override data, queue for later gGLTFMaterialList.queueOverrideUpdate(object_override.mObjectId, results[i].mSide, results[i].mMaterial); } - else if (obj && obj->isAnySelected()) + else if (obj && obj->getTE(i) && obj->getTE(i)->isSelected()) { - for (auto& override_update_callback : mCallbacks) - { - override_update_callback(object_override.mObjectId, results[i].mSide); - } + doSelectionCallbacks(object_override.mObjectId, results[i].mSide); } } else { // unblock material editor - if (obj && obj->isAnySelected()) + if (obj && obj->getTE(i) && obj->getTE(i)->isSelected()) { - for (auto& override_update_callback : mCallbacks) - { - override_update_callback(object_override.mObjectId, results[i].mSide); - } + doSelectionCallbacks(object_override.mObjectId, results[i].mSide); } } } if (obj && side_set.size() != obj->getNumTEs()) { // object exists and at least one texture entry needs to have its override data nulled out - bool object_has_selection = obj->isAnySelected(); for (int i = 0; i < obj->getNumTEs(); ++i) { if (side_set.find(i) == side_set.end()) { obj->setTEGLTFMaterialOverride(i, nullptr); - if (object_has_selection) + if (obj->getTE(i) && obj->getTE(i)->isSelected()) { - for (auto& override_update_callback : mCallbacks) - { - override_update_callback(object_override.mObjectId, i); - } + doSelectionCallbacks(object_override.mObjectId, i); } } } @@ -331,23 +329,21 @@ public: } else if (obj) { // override list was empty or an error occurred, null out all overrides for this object - bool object_has_selection = obj->isAnySelected(); for (int i = 0; i < obj->getNumTEs(); ++i) { obj->setTEGLTFMaterialOverride(i, nullptr); - if (object_has_selection) + if (obj->getTE(i) && obj->getTE(i)->isSelected()) { - for (auto& override_update_callback : mCallbacks) - { - override_update_callback(obj->getID(), i); - } + doSelectionCallbacks(obj->getID(), i); } } } }); } - std::vector mCallbacks; +private: + + std::vector mSelectionCallbacks; }; namespace @@ -375,23 +371,19 @@ void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj) if (iter != mQueuedOverrides.end()) { - bool object_has_selection = obj->isAnySelected(); override_list_t& overrides = iter->second; for (int i = 0; i < overrides.size(); ++i) { if (overrides[i].notNull()) { - if (!obj->getTE(i)->getGLTFMaterial()) + if (!obj->getTE(i) || !obj->getTE(i)->getGLTFMaterial()) { // object doesn't have its base GLTF material yet, don't apply override (yet) return; } obj->setTEGLTFMaterialOverride(i, overrides[i]); - if (object_has_selection) + if (obj->getTE(i)->isSelected()) { - for (auto& override_update_callback : handle_gltf_override_message.mCallbacks) - { - override_update_callback(id, i); - } + handle_gltf_override_message.doSelectionCallbacks(id, i); } } } @@ -480,7 +472,7 @@ void LLGLTFMaterialList::flushUpdates(void(*done_callback)(bool)) } } -void LLGLTFMaterialList::addUpdateCallback(void(*update_callback)(const LLUUID& object_id, S32 side)) +void LLGLTFMaterialList::addSelectionUpdateCallback(void(*update_callback)(const LLUUID& object_id, S32 side)) { handle_gltf_override_message.addCallback(update_callback); } diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 5a184f5e94..abbb755599 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -75,7 +75,7 @@ public: // for cases that care about the done_callback forwarded to LLCoros::instance().launch static void flushUpdates(void(*done_callback)(bool) = nullptr); - static void addUpdateCallback(void(*update_callback)(const LLUUID& object_id, S32 side)); + static void addSelectionUpdateCallback(void(*update_callback)(const LLUUID& object_id, S32 side)); // Queue an explicit LLSD ModifyMaterialParams update apply given override data // overrides -- LLSD map (or array of maps) in the format: diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index f1fd276402..8c8a07bc21 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -400,7 +400,7 @@ BOOL LLMaterialEditor::postBuild() if (mIsOverride) { // Material override change success callback - LLGLTFMaterialList::addUpdateCallback(&LLMaterialEditor::updateLive); + LLGLTFMaterialList::addSelectionUpdateCallback(&LLMaterialEditor::updateLive); // Live editing needs a recovery mechanism on cancel mBaseColorTextureCtrl->setOnCancelCallback(boost::bind(&LLMaterialEditor::onCancelCtrl, this, _1, _2, MATERIAL_BASE_COLOR_TEX_DIRTY)); diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 21c824ff5c..3d72865f69 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -276,7 +276,7 @@ BOOL LLPanelFace::postBuild() getChild("gltfTextureOffsetU")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetU, this, _1), nullptr); getChild("gltfTextureOffsetV")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetV, this, _1), nullptr); - LLGLTFMaterialList::addUpdateCallback(&LLPanelFace::onMaterialOverrideReceived); + LLGLTFMaterialList::addSelectionUpdateCallback(&LLPanelFace::onMaterialOverrideReceived); sMaterialOverrideSelection.connect(); childSetAction("button align",&LLPanelFace::onClickAutoFix,this); @@ -2056,7 +2056,7 @@ void LLPanelFace::unloadMedia() // static void LLPanelFace::onMaterialOverrideReceived(const LLUUID& object_id, S32 side) { - sMaterialOverrideSelection.onObjectUpdated(object_id, side); + sMaterialOverrideSelection.onSelectedObjectUpdated(object_id, side); } ////////////////////////////////////////////////////////////////////////////// @@ -4771,7 +4771,7 @@ void LLPanelFace::Selection::setObjectUpdatePending(const LLUUID &object_id, S32 mPendingSide = side; } -void LLPanelFace::Selection::onObjectUpdated(const LLUUID& object_id, S32 side) +void LLPanelFace::Selection::onSelectedObjectUpdated(const LLUUID& object_id, S32 side) { if (object_id == mSelectedObjectID && side == mSelectedSide) { diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 520b399d42..24bc973bde 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -487,7 +487,7 @@ private: // Callbacks void onSelectionChanged() { mNeedsSelectionCheck = true; } - void onObjectUpdated(const LLUUID &object_id, S32 side); + void onSelectedObjectUpdated(const LLUUID &object_id, S32 side); protected: void clearObjectUpdatePending(); -- cgit v1.3 From 7c489e0480221b9c85a919f02f2a1d45b936f6e7 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 30 Nov 2022 17:18:31 +0200 Subject: SL-18648 Clean up unused mNonImmediateFilterPermMask --- indra/newview/llfloaterland.cpp | 1 - indra/newview/llmaterialeditor.cpp | 4 ---- indra/newview/lloutfitgallery.cpp | 1 - indra/newview/llpaneleditwearable.cpp | 1 - indra/newview/llpanellandmedia.cpp | 1 - indra/newview/llpanelobject.cpp | 2 -- indra/newview/llpanelprofile.cpp | 2 -- indra/newview/lltexturectrl.cpp | 22 ---------------------- indra/newview/lltexturectrl.h | 8 -------- 9 files changed, 42 deletions(-) (limited to 'indra/newview/llmaterialeditor.cpp') diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 1a98ab9d76..9c4c9b3e59 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -2004,7 +2004,6 @@ BOOL LLPanelLandOptions::postBuild() mSnapshotCtrl->setAllowNoTexture ( TRUE ); mSnapshotCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); mSnapshotCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); - mSnapshotCtrl->setNonImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); } else { diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 07c283e9c2..4b9d870d18 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -391,13 +391,9 @@ BOOL LLMaterialEditor::postBuild() { // Only allow fully permissive textures mBaseColorTextureCtrl->setImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); - mBaseColorTextureCtrl->setNonImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); mMetallicTextureCtrl->setImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); - mMetallicTextureCtrl->setNonImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); mEmissiveTextureCtrl->setImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); - mEmissiveTextureCtrl->setNonImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); mNormalTextureCtrl->setImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); - mNormalTextureCtrl->setNonImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); } // Texture callback diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index d11b3b57f3..2d1cd43e94 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -1360,7 +1360,6 @@ void LLOutfitGallery::onSelectPhoto(LLUUID selected_outfit_id) "SELECT PHOTO", PERM_NONE, PERM_NONE, - PERM_NONE, FALSE, NULL); diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index ea10aa75ae..69998e8be4 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -574,7 +574,6 @@ static void init_texture_ctrl(LLPanelEditWearable* self, LLPanel* panel, const L // Don't allow (no copy) or (notransfer) textures to be selected. texture_ctrl->setImmediateFilterPermMask(PERM_NONE); texture_ctrl->setDnDFilterPermMask(PERM_NONE); - texture_ctrl->setNonImmediateFilterPermMask(PERM_NONE); } } diff --git a/indra/newview/llpanellandmedia.cpp b/indra/newview/llpanellandmedia.cpp index 26cd3ff1c1..213a66f005 100644 --- a/indra/newview/llpanellandmedia.cpp +++ b/indra/newview/llpanellandmedia.cpp @@ -86,7 +86,6 @@ BOOL LLPanelLandMedia::postBuild() mMediaTextureCtrl->setAllowNoTexture ( TRUE ); mMediaTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); mMediaTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); - mMediaTextureCtrl->setNonImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); mMediaAutoScaleCheck = getChild("media_auto_scale"); childSetCommitCallback("media_auto_scale", onCommitAny, this); diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 0bfc1297d3..0236b66b70 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -250,8 +250,6 @@ BOOL LLPanelObject::postBuild() // Don't allow (no copy) or (no transfer) textures to be selected during immediate mode mCtrlSculptTexture->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); mCtrlSculptTexture->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); - // Allow any texture to be used during non-immediate mode. - mCtrlSculptTexture->setNonImmediateFilterPermMask(PERM_NONE); LLAggregatePermissions texture_perms; if (LLSelectMgr::getInstance()->selectGetAggregateTexturePermissions(texture_perms)) { diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index f4eaa78f11..d9a8d496d1 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -1864,7 +1864,6 @@ void LLPanelProfileSecondLife::onShowTexturePicker() "SELECT PHOTO", PERM_NONE, PERM_NONE, - PERM_NONE, FALSE, NULL); @@ -2205,7 +2204,6 @@ void LLPanelProfileFirstLife::onChangePhoto() "SELECT PHOTO", PERM_NONE, PERM_NONE, - PERM_NONE, FALSE, NULL); diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 3374af1c76..9891d7b078 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -148,7 +148,6 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( const std::string& label, PermissionMask immediate_filter_perm_mask, PermissionMask dnd_filter_perm_mask, - PermissionMask non_immediate_filter_perm_mask, BOOL can_apply_immediately, LLUIImagePtr fallback_image) : LLFloater(LLSD()), @@ -167,7 +166,6 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( mFilterEdit(NULL), mImmediateFilterPermMask(immediate_filter_perm_mask), mDnDFilterPermMask(dnd_filter_perm_mask), - mNonImmediateFilterPermMask(non_immediate_filter_perm_mask), mContextConeOpacity(0.f), mSelectedItemPinned( FALSE ), mCanApply(true), @@ -254,7 +252,6 @@ void LLFloaterTexturePicker::setCanApplyImmediately(BOOL b) mCanApplyImmediately = b; getChild("apply_immediate_check")->setValue(mCanApplyImmediately); - updateFilterPermMask(); } void LLFloaterTexturePicker::stopUsingPipette() @@ -332,7 +329,6 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop( if (mod) item_perm_mask |= PERM_MODIFY; if (xfer) item_perm_mask |= PERM_TRANSFER; - //PermissionMask filter_perm_mask = getFilterPermMask(); Commented out due to no-copy texture loss. PermissionMask filter_perm_mask = mDnDFilterPermMask; if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask ) { @@ -488,8 +484,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)); @@ -667,12 +661,6 @@ const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, BOOL co return LLUUID::null; } -PermissionMask LLFloaterTexturePicker::getFilterPermMask() -{ - bool apply_immediate = getChild("apply_immediate_check")->getValue().asBoolean(); - return apply_immediate ? mImmediateFilterPermMask : mNonImmediateFilterPermMask; -} - void LLFloaterTexturePicker::commitIfImmediateSet() { if (!mNoCopyTextureSelected && mOnFloaterCommitCallback && mCanApply) @@ -1051,7 +1039,6 @@ void LLFloaterTexturePicker::onApplyImmediateCheck(LLUICtrl* ctrl, void *user_da LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl; gSavedSettings.setBOOL("TextureLivePreview", check_box->get()); - picker->updateFilterPermMask(); picker->commitIfImmediateSet(); } @@ -1128,11 +1115,6 @@ void LLFloaterTexturePicker::onBakeTextureSelect(LLUICtrl* ctrl, void *user_data } } -void LLFloaterTexturePicker::updateFilterPermMask() -{ - //mInventoryPanel->setFilterPermMask( getFilterPermMask() ); Commented out due to no-copy texture loss. -} - void LLFloaterTexturePicker::setCanApply(bool can_preview, bool can_apply) { getChildRef("Select").setEnabled(can_apply); @@ -1372,7 +1354,6 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p) mAllowNoTexture( p.allow_no_texture ), mAllowLocalTexture( TRUE ), mImmediateFilterPermMask( PERM_NONE ), - mNonImmediateFilterPermMask( PERM_NONE ), mCanApplyImmediately( FALSE ), mNeedsRawImageData( FALSE ), mValid( TRUE ), @@ -1552,7 +1533,6 @@ void LLTextureCtrl::showPicker(BOOL take_focus) mLabel, mImmediateFilterPermMask, mDnDFilterPermMask, - mNonImmediateFilterPermMask, mCanApplyImmediately, mFallbackImage); mFloaterHandle = floaterp->getHandle(); @@ -1984,8 +1964,6 @@ BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item) if (mod) item_perm_mask |= PERM_MODIFY; if (xfer) item_perm_mask |= PERM_TRANSFER; -// PermissionMask filter_perm_mask = mCanApplyImmediately ? commented out due to no-copy texture loss. -// mImmediateFilterPermMask : mNonImmediateFilterPermMask; PermissionMask filter_perm_mask = mImmediateFilterPermMask; if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask ) { diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index d06a82bbd5..8d6a520dfd 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -187,10 +187,7 @@ public: { mImmediateFilterPermMask = mask; } void setDnDFilterPermMask(PermissionMask mask) { mDnDFilterPermMask = mask; } - void setNonImmediateFilterPermMask(PermissionMask mask) - { mNonImmediateFilterPermMask = mask; } PermissionMask getImmediateFilterPermMask() { return mImmediateFilterPermMask; } - PermissionMask getNonImmediateFilterPermMask() { return mNonImmediateFilterPermMask; } void closeDependentFloater(); @@ -252,7 +249,6 @@ private: BOOL mAllowLocalTexture; PermissionMask mImmediateFilterPermMask; PermissionMask mDnDFilterPermMask; - PermissionMask mNonImmediateFilterPermMask; BOOL mCanApplyImmediately; BOOL mCommitOnSelection; BOOL mNeedsRawImageData; @@ -286,7 +282,6 @@ public: const std::string& label, PermissionMask immediate_filter_perm_mask, PermissionMask dnd_filter_perm_mask, - PermissionMask non_immediate_filter_perm_mask, BOOL can_apply_immediately, LLUIImagePtr fallback_image_name ); @@ -317,9 +312,7 @@ public: LLView* getOwner() const { return mOwner; } void setOwner(LLView* owner) { mOwner = owner; } void stopUsingPipette(); - PermissionMask getFilterPermMask(); - void updateFilterPermMask(); void commitIfImmediateSet(); void commitCancel(); @@ -388,7 +381,6 @@ protected: LLInventoryPanel* mInventoryPanel; PermissionMask mImmediateFilterPermMask; PermissionMask mDnDFilterPermMask; - PermissionMask mNonImmediateFilterPermMask; BOOL mCanApplyImmediately; BOOL mNoCopyTextureSelected; F32 mContextConeOpacity; -- cgit v1.3 From c0f598c10376f12310660a729f4a763dbf46368e Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 1 Dec 2022 06:42:10 +0200 Subject: SL-18725 Texture picker should explain why dropping texture isn't allowed Show a tooltip on drag&drop --- indra/newview/llmaterialeditor.cpp | 8 ++++---- indra/newview/lltexturectrl.cpp | 10 ++++++++-- indra/newview/lltexturectrl.h | 2 +- indra/newview/skins/default/xui/en/strings.xml | 5 +++++ 4 files changed, 18 insertions(+), 7 deletions(-) (limited to 'indra/newview/llmaterialeditor.cpp') diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 4b9d870d18..ea6b34c96e 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -390,10 +390,10 @@ BOOL LLMaterialEditor::postBuild() if (!gAgent.isGodlike()) { // Only allow fully permissive textures - mBaseColorTextureCtrl->setImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); - mMetallicTextureCtrl->setImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); - mEmissiveTextureCtrl->setImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); - mNormalTextureCtrl->setImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED); + mBaseColorTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + mMetallicTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + mEmissiveTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + mNormalTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); } // Texture callback diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 9891d7b078..6cf7e8850d 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -1800,7 +1800,7 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, allow_dnd = is_texture || is_mesh || is_material; } - if (getEnabled() && allow_dnd && allowDrop(item)) + if (getEnabled() && allow_dnd && allowDrop(item, cargo_type, tooltip_msg)) { if (drop) { @@ -1952,7 +1952,7 @@ void LLTextureCtrl::draw() LLUICtrl::draw(); } -BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item) +BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg) { BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID()); BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID()); @@ -1978,6 +1978,12 @@ BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item) } else { + PermissionMask mask = PERM_COPY | PERM_TRANSFER; + if ((filter_perm_mask & mask) == mask + && cargo_type == DAD_TEXTURE) + { + tooltip_msg.assign(LLTrans::getString("TooltipTextureRestrictedDrop")); + } return FALSE; } } diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index 8d6a520dfd..d898722006 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -223,7 +223,7 @@ public: EPickInventoryType getInventoryPickType() { return mInventoryPickType; }; private: - BOOL allowDrop(LLInventoryItem* item); + BOOL allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg); BOOL doDrop(LLInventoryItem* item); private: diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index e7e1a24f5e..255aff06be 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -319,6 +319,11 @@ Only items with unrestricted 'next owner' permissions can be attached to notecards. + +Only textures with unrestricted +copy and transfer permissions +are allowed. + Searching... -- cgit v1.3 From 321c7895d00b0b88675c06b8f1cef063632fd686 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 1 Dec 2022 21:54:49 +0200 Subject: SL-18741 Basic bulk upload for gltf materials #1 --- indra/newview/lldrawpoolwlsky.cpp | 5 +++ indra/newview/llfilepicker.cpp | 1 + indra/newview/lllocalgltfmaterials.cpp | 44 ++---------------- indra/newview/llmaterialeditor.cpp | 66 ++++++++++++++++++++++++--- indra/newview/llmaterialeditor.h | 3 +- indra/newview/lltinygltfhelper.cpp | 53 +++++++++++++++++++++- indra/newview/lltinygltfhelper.h | 4 +- indra/newview/llviewermenufile.cpp | 81 ++++++++++++++++++++++++++++------ 8 files changed, 192 insertions(+), 65 deletions(-) (limited to 'indra/newview/llmaterialeditor.cpp') diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 4bd7536964..f09d1abe2d 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -166,6 +166,11 @@ void LLDrawPoolWLSky::renderDome(const LLVector3& camPosLocal, F32 camHeightLoca void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 camHeightLocal) const { + if (!gSky.mVOSkyp) + { + return; + } + LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY)) diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 1dd9a43b72..1ec25ccaa1 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -179,6 +179,7 @@ BOOL LLFilePicker::setupFilter(ELoadFilter filter) SOUND_FILTER \ IMAGE_FILTER \ ANIM_FILTER \ + MATERIAL_FILTER \ L"\0"; break; case FFLOAD_WAV: diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp index 89f14c6cfa..a9099b1ce9 100644 --- a/indra/newview/lllocalgltfmaterials.cpp +++ b/indra/newview/lllocalgltfmaterials.cpp @@ -308,48 +308,10 @@ S32 LLLocalGLTFMaterialMgr::addUnit(const std::vector& filenames) S32 LLLocalGLTFMaterialMgr::addUnit(const std::string& filename) { - std::string exten = gDirUtilp->getExtension(filename); - S32 materials_in_file = 0; - - if (exten == "gltf" || exten == "glb") + S32 materials_in_file = LLTinyGLTFHelper::getMaterialCountFromFile(filename); + if (materials_in_file <= 0) { - tinygltf::TinyGLTF loader; - std::string error_msg; - std::string warn_msg; - - tinygltf::Model model_in; - - std::string filename_lc = filename; - LLStringUtil::toLower(filename_lc); - - // Load a tinygltf model fom a file. Assumes that the input filename has already been - // been sanitized to one of (.gltf , .glb) extensions, so does a simple find to distinguish. - bool decode_successful = false; - if (std::string::npos == filename_lc.rfind(".gltf")) - { // file is binary - decode_successful = loader.LoadBinaryFromFile(&model_in, &error_msg, &warn_msg, filename_lc); - } - else - { // file is ascii - decode_successful = loader.LoadASCIIFromFile(&model_in, &error_msg, &warn_msg, filename_lc); - } - - if (!decode_successful) - { - LL_WARNS("GLTF") << "Cannot load, error: Failed to decode" << error_msg - << ", warning:" << warn_msg - << " file: " << filename - << LL_ENDL; - return 0; - } - - if (model_in.materials.empty()) - { - // materials are missing - LL_WARNS("GLTF") << "Cannot load. File has no materials " << filename << LL_ENDL; - return 0; - } - materials_in_file = model_in.materials.size(); + return 0; } S32 loaded_materials = 0; diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index ea6b34c96e..660ad879ca 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -1400,8 +1400,6 @@ void LLMaterialEditor::createInventoryItem(const std::string &buffer, const std: LLNotificationsUtil::add("MaterialCreated", params); }); - // todo: apply permissions from textures here if server doesn't - // if any texture is 'no transfer', material should be 'no transfer' as well const LLViewerRegion* region = gAgent.getRegion(); if (region) { @@ -1684,6 +1682,59 @@ static void pack_textures( } } +void LLMaterialEditor::uploadMaterialFromFile(const std::string& filename, S32 index) +{ + if (index < 0) + { + return; + } + + tinygltf::TinyGLTF loader; + std::string error_msg; + std::string warn_msg; + + bool loaded = false; + tinygltf::Model model_in; + + std::string filename_lc = filename; + LLStringUtil::toLower(filename_lc); + + // Load a tinygltf model fom a file. Assumes that the input filename has already been + // been sanitized to one of (.gltf , .glb) extensions, so does a simple find to distinguish. + if (std::string::npos == filename_lc.rfind(".gltf")) + { // file is binary + loaded = loader.LoadBinaryFromFile(&model_in, &error_msg, &warn_msg, filename); + } + else + { // file is ascii + loaded = loader.LoadASCIIFromFile(&model_in, &error_msg, &warn_msg, filename); + } + + if (!loaded) + { + LLNotificationsUtil::add("CannotUploadMaterial"); + return; + } + + if (model_in.materials.empty()) + { + // materials are missing + return; + } + + if (index >= 0 && model_in.materials.size() <= index) + { + // material is missing + return; + } + + // Todo: no point in loading whole editor + LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor", LLSD().with("filename", filename).with("index", LLSD::Integer(index))); + me->loadMaterial(model_in, filename_lc, index, false); + me->saveIfNeeded(); +} + + void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 index) { tinygltf::TinyGLTF loader; @@ -1976,7 +2027,7 @@ void LLMaterialEditor::loadFromGLTFMaterial(LLUUID &asset_id) me->setFocus(TRUE); } -void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std::string &filename_lc, S32 index) +void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std::string &filename_lc, S32 index, bool open_floater) { if (model_in.materials.size() <= index) { @@ -2074,10 +2125,13 @@ void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std:: markChangesUnsaved(U32_MAX); - openFloater(); - setFocus(TRUE); + if (open_floater) + { + openFloater(getKey()); + setFocus(TRUE); - applyToSelection(); + applyToSelection(); + } } bool LLMaterialEditor::setFromGltfModel(const tinygltf::Model& model, S32 index, bool set_textures) diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h index 6deda5df50..d23a741e49 100644 --- a/indra/newview/llmaterialeditor.h +++ b/indra/newview/llmaterialeditor.h @@ -103,6 +103,7 @@ public: void loadAsset() override; // @index if -1 and file contains more than one material, // will promt to select specific one + static void uploadMaterialFromFile(const std::string& filename, S32 index); static void loadMaterialFromFile(const std::string& filename, S32 index = -1); void onSelectionChanged(); // live overrides selection changes @@ -242,7 +243,7 @@ private: void setFromGLTFMaterial(LLGLTFMaterial* mat); bool setFromSelection(); - void loadMaterial(const tinygltf::Model &model, const std::string &filename_lc, S32 index); + void loadMaterial(const tinygltf::Model &model, const std::string &filename_lc, S32 index, bool open_floater = true); friend class LLMaterialFilePicker; diff --git a/indra/newview/lltinygltfhelper.cpp b/indra/newview/lltinygltfhelper.cpp index 05587af9bc..838524e910 100644 --- a/indra/newview/lltinygltfhelper.cpp +++ b/indra/newview/lltinygltfhelper.cpp @@ -182,12 +182,62 @@ LLImageRaw * LLTinyGLTFHelper::getTexture(const std::string & folder, const tiny return rawImage; } +S32 LLTinyGLTFHelper::getMaterialCountFromFile(const std::string& filename) +{ + std::string exten = gDirUtilp->getExtension(filename); + S32 materials_in_file = 0; + + if (exten == "gltf" || exten == "glb") + { + tinygltf::TinyGLTF loader; + std::string error_msg; + std::string warn_msg; + + tinygltf::Model model_in; + + std::string filename_lc = filename; + LLStringUtil::toLower(filename_lc); + + // Load a tinygltf model fom a file. Assumes that the input filename has already been + // been sanitized to one of (.gltf , .glb) extensions, so does a simple find to distinguish. + bool decode_successful = false; + if (std::string::npos == filename_lc.rfind(".gltf")) + { // file is binary + decode_successful = loader.LoadBinaryFromFile(&model_in, &error_msg, &warn_msg, filename_lc); + } + else + { // file is ascii + decode_successful = loader.LoadASCIIFromFile(&model_in, &error_msg, &warn_msg, filename_lc); + } + + if (!decode_successful) + { + LL_WARNS("GLTF") << "Cannot load, error: Failed to decode" << error_msg + << ", warning:" << warn_msg + << " file: " << filename + << LL_ENDL; + return 0; + } + + if (model_in.materials.empty()) + { + // materials are missing + LL_WARNS("GLTF") << "Cannot load. File has no materials " << filename << LL_ENDL; + return 0; + } + materials_in_file = model_in.materials.size(); + } + return materials_in_file; +} + bool LLTinyGLTFHelper::getMaterialFromFile( const std::string& filename, S32 mat_index, - LLPointer < LLFetchedGLTFMaterial> material, + LLFetchedGLTFMaterial* material, std::string& material_name) { + llassert(material); + tinygltf::TinyGLTF loader; std::string error_msg; std::string warn_msg; @@ -304,5 +354,4 @@ bool LLTinyGLTFHelper::getMaterialFromFile( } return true; - } diff --git a/indra/newview/lltinygltfhelper.h b/indra/newview/lltinygltfhelper.h index 250a4b0b9a..92c9876aff 100644 --- a/indra/newview/lltinygltfhelper.h +++ b/indra/newview/lltinygltfhelper.h @@ -43,10 +43,12 @@ namespace LLTinyGLTFHelper LLImageRaw* getTexture(const std::string& folder, const tinygltf::Model& model, S32 texture_index); + S32 getMaterialCountFromFile(const std::string& filename); + bool getMaterialFromFile( const std::string& filename, S32 mat_index, - LLPointer < LLFetchedGLTFMaterial> material, + LLFetchedGLTFMaterial* material, std::string& material_name); void initFetchedTextures(tinygltf::Material& material, diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index c028a663ea..33c7240fe0 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -38,6 +38,7 @@ #include "llfloatermap.h" #include "llfloatermodelpreview.h" #include "llmaterialeditor.h" +#include "llfloaterperms.h" #include "llfloatersnapshot.h" #include "llfloateroutfitsnapshot.h" #include "llimage.h" @@ -49,9 +50,9 @@ #include "llinventorymodel.h" // gInventory #include "llpluginclassmedia.h" #include "llresourcedata.h" -#include "lltoast.h" -#include "llfloaterperms.h" #include "llstatusbar.h" +#include "lltinygltfhelper.h" +#include "lltoast.h" #include "llviewercontrol.h" // gSavedSettings #include "llviewertexturelist.h" #include "lluictrlfactory.h" @@ -471,19 +472,33 @@ void do_bulk_upload(std::vector filenames, const LLSD& notification if (LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(ext, asset_type, codec) && LLAgentBenefitsMgr::current().findUploadCost(asset_type, expected_upload_cost)) { - LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo( - filename, - asset_name, - asset_name, 0, - LLFolderType::FT_NONE, LLInventoryType::IT_NONE, - LLFloaterPerms::getNextOwnerPerms("Uploads"), - LLFloaterPerms::getGroupPerms("Uploads"), - LLFloaterPerms::getEveryonePerms("Uploads"), - expected_upload_cost)); + LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo( + filename, + asset_name, + asset_name, 0, + LLFolderType::FT_NONE, LLInventoryType::IT_NONE, + LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), + expected_upload_cost)); + + upload_new_resource(uploadInfo); + } - upload_new_resource(uploadInfo); - } -} + // gltf does not use normal upload procedure + if (ext == "gltf" || ext == "glb") + { + S32 materials_in_file = LLTinyGLTFHelper::getMaterialCountFromFile(filename); + + for (S32 i = 0; i < materials_in_file; i++) + { + // Todo: + // 1. Decouple bulk upload from material editor + // 2. Take into account possiblity of identical textures + LLMaterialEditor::uploadMaterialFromFile(filename, i); + } + } + } } bool get_bulk_upload_expected_cost(const std::vector& filenames, S32& total_cost, S32& file_count, S32& bvh_count) @@ -511,6 +526,44 @@ bool get_bulk_upload_expected_cost(const std::vector& filenames, S3 total_cost += cost; file_count++; } + + if (ext == "gltf" || ext == "glb") + { + S32 texture_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); + S32 materials_in_file = LLTinyGLTFHelper::getMaterialCountFromFile(filename); + + for (S32 i = 0; i < materials_in_file; i++) + { + LLPointer material = new LLFetchedGLTFMaterial(); + std::string material_name; + bool decode_successful = LLTinyGLTFHelper::getMaterialFromFile(filename, i, material.get(), material_name); + + if (decode_successful) + { + // Todo: make it account for possibility of same texture in different + // materials and even in scope of same material + S32 texture_count = 0; + if (material->mBaseColorId.notNull()) + { + texture_count++; + } + if (material->mMetallicRoughnessId.notNull()) + { + texture_count++; + } + if (material->mNormalId.notNull()) + { + texture_count++; + } + if (material->mEmissiveId.notNull()) + { + texture_count++; + } + total_cost += texture_count * texture_upload_cost; + file_count++; + } + } + } } return file_count > 0; -- cgit v1.3 From c033278ec2d16181b94d6433a3353765c8981850 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Wed, 7 Dec 2022 01:32:01 +0200 Subject: SL-18795 Overrides are not applied to one face --- indra/newview/llmaterialeditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llmaterialeditor.cpp') diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 660ad879ca..2d5f3df6a1 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -2506,7 +2506,7 @@ public: { // overrides are not supposed to work or apply if // there is no base material to work from - return false; + continue; } LLPointer material = tep->getGLTFMaterialOverride(); -- cgit v1.3 From c69c8aa347363bc51ed256523bc368d4584dbfd1 Mon Sep 17 00:00:00 2001 From: akleshchev <117672381+akleshchev@users.noreply.github.com> Date: Wed, 7 Dec 2022 02:16:12 +0200 Subject: SL-18777 PBR upload was stuck waiting for texture Handle obscure upload failure case - floater was waiting for a texture upload indefinetely. Unblock floater if upload fails. --- indra/newview/llcompilequeue.cpp | 2 +- indra/newview/llmaterialeditor.cpp | 201 +++++++++++++++++++++++++--------- indra/newview/llmaterialeditor.h | 4 +- indra/newview/llpreviewgesture.cpp | 8 +- indra/newview/llpreviewnotecard.cpp | 6 +- indra/newview/llpreviewscript.cpp | 32 +++++- indra/newview/llpreviewscript.h | 1 + indra/newview/llsettingsvo.cpp | 14 ++- indra/newview/llviewerassetupload.cpp | 55 +++++++--- indra/newview/llviewerassetupload.h | 20 +++- 10 files changed, 251 insertions(+), 92 deletions(-) (limited to 'indra/newview/llmaterialeditor.cpp') diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 9031ea5b1b..eb2c156ca5 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -124,7 +124,7 @@ public: LLQueuedScriptAssetUpload(LLUUID taskId, LLUUID itemId, LLUUID assetId, TargetType_t targetType, bool isRunning, std::string scriptName, LLUUID queueId, LLUUID exerienceId, taskUploadFinish_f finish) : LLScriptAssetUpload(taskId, itemId, targetType, isRunning, - exerienceId, std::string(), finish), + exerienceId, std::string(), finish, nullptr), mScriptName(scriptName), mQueueId(queueId) { diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 2d5f3df6a1..903ca60350 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -347,6 +347,7 @@ LLMaterialEditor::LLMaterialEditor(const LLSD& key) , mRevertedChanges(0) , mExpectedUploadCost(0) , mUploadingTexturesCount(0) + , mUploadingTexturesFailure(false) { const LLInventoryItem* item = getItem(); if (item) @@ -1251,9 +1252,9 @@ bool LLMaterialEditor::saveIfNeeded() { if (mUploadingTexturesCount > 0) { - // upload already in progress - // wait until textures upload - // will retry saving on callback + // Upload already in progress, wait until + // textures upload will retry saving on callback. + // Also should prevent some failure-callbacks return true; } @@ -1318,18 +1319,38 @@ bool LLMaterialEditor::updateInventoryItem(const std::string &buffer, const LLUU if (task_id.isNull() && !agent_url.empty()) { uploadInfo = std::make_shared(item_id, LLAssetType::AT_MATERIAL, buffer, - [](LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD) { - LLMaterialEditor::finishInventoryUpload(itemId, newAssetId, newItemId); - }); + [](LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD) + { + // done callback + LLMaterialEditor::finishInventoryUpload(itemId, newAssetId, newItemId); + }, + nullptr // failure callback + ); url = agent_url; } else if (!task_id.isNull() && !task_url.empty()) { LLUUID object_uuid(task_id); uploadInfo = std::make_shared(task_id, item_id, LLAssetType::AT_MATERIAL, buffer, - [object_uuid](LLUUID itemId, LLUUID, LLUUID newAssetId, LLSD) { - LLMaterialEditor::finishTaskUpload(itemId, newAssetId, object_uuid); - }); + [](LLUUID itemId, LLUUID task_id, LLUUID newAssetId, LLSD) + { + // done callback + LLMaterialEditor::finishTaskUpload(itemId, newAssetId, task_id); + }, + [](LLUUID itemId, LLUUID task_id, LLSD response, std::string reason) + { + // failure callback + LLSD floater_key; + floater_key["taskid"] = task_id; + floater_key["itemid"] = itemId; + LLMaterialEditor* me = LLFloaterReg::findTypedInstance("material_editor", floater_key); + if (me) + { + me->setEnabled(true); + } + return true; + } + ); url = task_url; } @@ -1394,11 +1415,15 @@ void LLMaterialEditor::createInventoryItem(const std::string &buffer, const std: inv_item_id, LLAssetType::AT_MATERIAL, output, - [](LLUUID item_id, LLUUID new_asset_id, LLUUID new_item_id, LLSD response) { - LL_INFOS("Material") << "inventory item uploaded. item: " << item_id << " asset: " << new_asset_id << " new_item_id: " << new_item_id << " response: " << response << LL_ENDL; - LLSD params = llsd::map("ASSET_ID", new_asset_id); - LLNotificationsUtil::add("MaterialCreated", params); - }); + [](LLUUID item_id, LLUUID new_asset_id, LLUUID new_item_id, LLSD response) + { + // done callback + LL_INFOS("Material") << "inventory item uploaded. item: " << item_id << " asset: " << new_asset_id << " new_item_id: " << new_item_id << " response: " << response << LL_ENDL; + LLSD params = llsd::map("ASSET_ID", new_asset_id); + LLNotificationsUtil::add("MaterialCreated", params); + }, + nullptr // failure callback, floater already closed + ); const LLViewerRegion* region = gAgent.getRegion(); if (region) @@ -1729,6 +1754,8 @@ void LLMaterialEditor::uploadMaterialFromFile(const std::string& filename, S32 i } // Todo: no point in loading whole editor + // This uses 'filename' to make sure multiple bulk uploads work + // instead of fighting for a single instance. LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor", LLSD().with("filename", filename).with("index", LLSD::Integer(index))); me->loadMaterial(model_in, filename_lc, index, false); me->saveIfNeeded(); @@ -2012,21 +2039,6 @@ void LLMaterialEditor::onSaveObjectsMaterialAsMsgCallback(const LLSD& notificati } } -void LLMaterialEditor::loadFromGLTFMaterial(LLUUID &asset_id) -{ - if (asset_id.isNull()) - { - LL_WARNS("MaterialEditor") << "Trying to open material with null id" << LL_ENDL; - return; - } - LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor"); - me->mMaterialName = LLTrans::getString("New Material"); - me->setTitle(me->mMaterialName); - me->setFromGLTFMaterial(gGLTFMaterialList.getMaterial(asset_id)); - me->openFloater(); - me->setFocus(TRUE); -} - void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std::string &filename_lc, S32 index, bool open_floater) { if (model_in.materials.size() <= index) @@ -3008,6 +3020,16 @@ void LLMaterialEditor::saveTexture(LLImageJ2C* img, const std::string& name, con U32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); + LLSD key = getKey(); + std::function failed_upload([key](LLUUID assetId, LLSD response, std::string reason) + { + LLMaterialEditor* me = LLFloaterReg::findTypedInstance("material_editor", key); + if (me) + { + me->setFailedToUploadTexture(); + } + return true; // handled + }); LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared( buffer, @@ -3023,13 +3045,26 @@ void LLMaterialEditor::saveTexture(LLImageJ2C* img, const std::string& name, con LLFloaterPerms::getEveryonePerms("Uploads"), expected_upload_cost, false, - cb)); + cb, + failed_upload)); upload_new_resource(uploadInfo); } +void LLMaterialEditor::setFailedToUploadTexture() +{ + mUploadingTexturesFailure = true; + mUploadingTexturesCount--; + if (mUploadingTexturesCount == 0) + { + setEnabled(true); + } +} + S32 LLMaterialEditor::saveTextures() { + mUploadingTexturesFailure = false; // not supposed to get here if already uploading + S32 work_count = 0; LLSD key = getKey(); // must be locally declared for lambda's capture to work if (mBaseColorTextureUploadId == getBaseColorId() && mBaseColorTextureUploadId.notNull()) @@ -3044,16 +3079,29 @@ S32 LLMaterialEditor::saveTextures() if (response["success"].asBoolean()) { me->setBaseColorId(newAssetId); + + // discard upload buffers once texture have been saved + me->mBaseColorJ2C = nullptr; + me->mBaseColorFetched = nullptr; + me->mBaseColorTextureUploadId.setNull(); + + me->mUploadingTexturesCount--; + + if (!me->mUploadingTexturesFailure) + { + // try saving + me->saveIfNeeded(); + } + else if (me->mUploadingTexturesCount == 0) + { + me->setEnabled(true); + } } else { - // To make sure that we won't retry (some failures can cb immediately) - me->setBaseColorId(LLUUID::null); + // stop upload if possible, unblock and let user decide + me->setFailedToUploadTexture(); } - me->mUploadingTexturesCount--; - - // try saving - me->saveIfNeeded(); } }); } @@ -3069,16 +3117,29 @@ S32 LLMaterialEditor::saveTextures() if (response["success"].asBoolean()) { me->setNormalId(newAssetId); + + // discard upload buffers once texture have been saved + me->mNormalJ2C = nullptr; + me->mNormalFetched = nullptr; + me->mNormalTextureUploadId.setNull(); + + me->mUploadingTexturesCount--; + + if (!me->mUploadingTexturesFailure) + { + // try saving + me->saveIfNeeded(); + } + else if (me->mUploadingTexturesCount == 0) + { + me->setEnabled(true); + } } else { - me->setNormalId(LLUUID::null); + // stop upload if possible, unblock and let user decide + me->setFailedToUploadTexture(); } - me->setNormalId(newAssetId); - me->mUploadingTexturesCount--; - - // try saving - me->saveIfNeeded(); } }); } @@ -3094,15 +3155,29 @@ S32 LLMaterialEditor::saveTextures() if (response["success"].asBoolean()) { me->setMetallicRoughnessId(newAssetId); + + // discard upload buffers once texture have been saved + me->mMetallicRoughnessJ2C = nullptr; + me->mMetallicRoughnessFetched = nullptr; + me->mMetallicTextureUploadId.setNull(); + + me->mUploadingTexturesCount--; + + if (!me->mUploadingTexturesFailure) + { + // try saving + me->saveIfNeeded(); + } + else if (me->mUploadingTexturesCount == 0) + { + me->setEnabled(true); + } } else { - me->setMetallicRoughnessId(LLUUID::null); + // stop upload if possible, unblock and let user decide + me->setFailedToUploadTexture(); } - me->mUploadingTexturesCount--; - - // try saving - me->saveIfNeeded(); } }); } @@ -3119,21 +3194,39 @@ S32 LLMaterialEditor::saveTextures() if (response["success"].asBoolean()) { me->setEmissiveId(newAssetId); + + // discard upload buffers once texture have been saved + me->mEmissiveJ2C = nullptr; + me->mEmissiveFetched = nullptr; + me->mEmissiveTextureUploadId.setNull(); + + me->mUploadingTexturesCount--; + + if (!me->mUploadingTexturesFailure) + { + // try saving + me->saveIfNeeded(); + } + else if (me->mUploadingTexturesCount == 0) + { + me->setEnabled(true); + } } else { - me->setEmissiveId(LLUUID::null); + // stop upload if possible, unblock and let user decide + me->setFailedToUploadTexture(); } - me->mUploadingTexturesCount--; - - // try saving - me->saveIfNeeded(); } }); } - // discard upload buffers once textures have been saved - clearTextures(); + if (!work_count) + { + // Discard upload buffers once textures have been confirmed as saved. + // Otherwise we keep buffers for potential upload failure recovery. + clearTextures(); + } // asset storage can callback immediately, causing a decrease // of mUploadingTexturesCount, report amount of work scheduled diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h index d23a741e49..74c776031e 100644 --- a/indra/newview/llmaterialeditor.h +++ b/indra/newview/llmaterialeditor.h @@ -116,14 +116,13 @@ public: static void savePickedMaterialAs(); static void onSaveObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response); - static void loadFromGLTFMaterial(LLUUID &asset_id); - static void onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status); void inventoryChanged(LLViewerObject* object, LLInventoryObject::object_list_t* inventory, S32 serial_num, void* user_data) override; typedef std::function upload_callback_f; void saveTexture(LLImageJ2C* img, const std::string& name, const LLUUID& asset_id, upload_callback_f cb); + void setFailedToUploadTexture(); // save textures to inventory if needed // returns amount of scheduled uploads @@ -295,6 +294,7 @@ private: U32 mRevertedChanges; // flags to indicate individual reverted parameters S32 mUploadingTexturesCount; S32 mExpectedUploadCost; + bool mUploadingTexturesFailure; std::string mMaterialNameShort; std::string mMaterialName; diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 759e7859f2..544ff8b5dc 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -1108,14 +1108,16 @@ void LLPreviewGesture::saveIfNeeded() item->setComplete(true); uploadInfo = std::make_shared(mItemUUID, LLAssetType::AT_GESTURE, buffer, - [](LLUUID itemId, LLUUID newAssetId, LLUUID, LLSD) { + [](LLUUID itemId, LLUUID newAssetId, LLUUID, LLSD) + { LLPreviewGesture::finishInventoryUpload(itemId, newAssetId); - }); + }, + nullptr); url = agent_url; } else if (!mObjectUUID.isNull() && !task_url.empty()) { - uploadInfo = std::make_shared(mObjectUUID, mItemUUID, LLAssetType::AT_GESTURE, buffer, nullptr); + uploadInfo = std::make_shared(mObjectUUID, mItemUUID, LLAssetType::AT_GESTURE, buffer, nullptr, nullptr); url = task_url; } diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index 3fd4f51559..2eccc0474f 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -552,7 +552,8 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem, bool sync) uploadInfo = std::make_shared(mItemUUID, LLAssetType::AT_NOTECARD, buffer, [](LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD) { LLPreviewNotecard::finishInventoryUpload(itemId, newAssetId, newItemId); - }); + }, + nullptr); url = agent_url; } else if (!mObjectUUID.isNull() && !task_url.empty()) @@ -561,7 +562,8 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem, bool sync) uploadInfo = std::make_shared(mObjectUUID, mItemUUID, LLAssetType::AT_NOTECARD, buffer, [object_uuid](LLUUID itemId, LLUUID, LLUUID newAssetId, LLSD) { LLPreviewNotecard::finishTaskUpload(itemId, newAssetId, object_uuid); - }); + }, + nullptr); url = task_url; } diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 5043250e08..8b93dd103d 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1686,6 +1686,32 @@ void LLPreviewLSL::finishedLSLUpload(LLUUID itemId, LLSD response) } } +bool LLPreviewLSL::failedLSLUpload(LLUUID itemId, LLUUID taskId, LLSD response, std::string reason) +{ + LLSD floater_key; + if (taskId.notNull()) + { + floater_key["taskid"] = taskId; + floater_key["itemid"] = itemId; + } + else + { + floater_key = LLSD(itemId); + } + + LLPreviewLSL* preview = LLFloaterReg::findTypedInstance("preview_script", floater_key); + if (preview) + { + // unfreeze floater + LLSD errors; + errors.append(LLTrans::getString("UploadFailed") + reason); + preview->callbackLSLCompileFailed(errors); + return true; + } + + return false; +} + // Save needs to compile the text in the buffer. If the compile // succeeds, then save both assets out to the database. If the compile // fails, go ahead and save the text anyway. @@ -1723,7 +1749,8 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/) [old_asset_id](LLUUID itemId, LLUUID, LLUUID, LLSD response) { LLFileSystem::removeFile(old_asset_id, LLAssetType::AT_LSL_TEXT); LLPreviewLSL::finishedLSLUpload(itemId, response); - })); + }, + LLPreviewLSL::failedLSLUpload)); LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); } @@ -2282,7 +2309,8 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) [isRunning, old_asset_id](LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response) { LLFileSystem::removeFile(old_asset_id, LLAssetType::AT_LSL_TEXT); LLLiveLSLEditor::finishLSLUpload(itemId, taskId, newAssetId, response, isRunning); - })); + }, + nullptr)); // needs failure handling? LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); } diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index f851ff6f3f..b01c7fd4ad 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -245,6 +245,7 @@ protected: static void* createScriptEdPanel(void* userdata); static void finishedLSLUpload(LLUUID itemId, LLSD response); + static bool failedLSLUpload(LLUUID itemId, LLUUID taskId, LLSD response, std::string reason); protected: // Can safely close only after both text and bytecode are uploaded diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index f9b7c749b3..59cfb4f0c4 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -234,9 +234,11 @@ void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings LLSDSerialize::serialize(settingdata, buffer, LLSDSerialize::LLSD_NOTATION); LLResourceUploadInfo::ptr_t uploadInfo = std::make_shared(inv_item_id, LLAssetType::AT_SETTINGS, buffer.str(), - [settings, callback](LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD response) { + [settings, callback](LLUUID itemId, LLUUID newAssetId, LLUUID newItemId, LLSD response) + { LLSettingsVOBase::onAgentAssetUploadComplete(itemId, newAssetId, newItemId, response, settings, callback); - }); + }, + nullptr); LLViewerAssetUpload::EnqueueInventoryUpload(agent_url, uploadInfo); } @@ -265,9 +267,11 @@ void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings LLSDSerialize::serialize(settingdata, buffer, LLSDSerialize::LLSD_NOTATION); LLResourceUploadInfo::ptr_t uploadInfo = std::make_shared(object_id, inv_item_id, LLAssetType::AT_SETTINGS, buffer.str(), - [settings, callback](LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response) { - LLSettingsVOBase::onTaskAssetUploadComplete(itemId, taskId, newAssetId, response, settings, callback); - }); + [settings, callback](LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response) + { + LLSettingsVOBase::onTaskAssetUploadComplete(itemId, taskId, newAssetId, response, settings, callback); + }, + nullptr); LLViewerAssetUpload::EnqueueInventoryUpload(agent_url, uploadInfo); } diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index 3eb9f9eda2..f86c1405a7 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -34,7 +34,6 @@ #include "lluuid.h" #include "llvorbisencode.h" #include "lluploaddialog.h" -#include "llpreviewscript.h" #include "llnotificationsutil.h" #include "llagent.h" #include "llfloaterreg.h" @@ -568,12 +567,14 @@ LLNewBufferedResourceUploadInfo::LLNewBufferedResourceUploadInfo( U32 everyonePerms, S32 expectedCost, bool show_inventory, - uploadFinish_f finish) + uploadFinish_f finish, + uploadFailure_f failure) : LLResourceUploadInfo(name, description, compressionInfo, destinationType, inventoryType, nextOWnerPerms, groupPerms, everyonePerms, expectedCost, show_inventory) , mBuffer(buffer) , mFinishFn(finish) + , mFailureFn(failure) { setAssetType(assetType); setAssetId(asset_id); @@ -614,8 +615,18 @@ LLUUID LLNewBufferedResourceUploadInfo::finishUpload(LLSD &result) return newItemId; } +bool LLNewBufferedResourceUploadInfo::failedUpload(LLSD &result, std::string &reason) +{ + if (mFailureFn) + { + return mFailureFn(getAssetId(), result, reason); + } + + return false; // Not handled +} + //========================================================================= -LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID itemId, LLAssetType::EType assetType, std::string buffer, invnUploadFinish_f finish) : +LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID itemId, LLAssetType::EType assetType, std::string buffer, invnUploadFinish_f finish, uploadFailed_f failed) : LLResourceUploadInfo(std::string(), std::string(), 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, 0, 0, 0, 0), mTaskUpload(false), @@ -623,6 +634,7 @@ LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID itemId, LLAssetType: mContents(buffer), mInvnFinishFn(finish), mTaskFinishFn(nullptr), + mFailureFn(failed), mStoredToCache(false) { setItemId(itemId); @@ -637,6 +649,7 @@ LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID itemId, LLPointergetData(), imageSize); } -LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID taskId, LLUUID itemId, LLAssetType::EType assetType, std::string buffer, taskUploadFinish_f finish) : +LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID taskId, LLUUID itemId, LLAssetType::EType assetType, std::string buffer, taskUploadFinish_f finish, uploadFailed_f failed) : LLResourceUploadInfo(std::string(), std::string(), 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, 0, 0, 0, 0), mTaskUpload(true), @@ -671,6 +684,7 @@ LLBufferedAssetUploadInfo::LLBufferedAssetUploadInfo(LLUUID taskId, LLUUID itemI mContents(buffer), mInvnFinishFn(nullptr), mTaskFinishFn(finish), + mFailureFn(failed), mStoredToCache(false) { setItemId(itemId); @@ -760,10 +774,19 @@ LLUUID LLBufferedAssetUploadInfo::finishUpload(LLSD &result) return newAssetId; } +bool LLBufferedAssetUploadInfo::failedUpload(LLSD &result, std::string &reason) +{ + if (mFailureFn) + { + return mFailureFn(getItemId(), getTaskId(), result, reason); + } + return false; +} + //========================================================================= -LLScriptAssetUpload::LLScriptAssetUpload(LLUUID itemId, std::string buffer, invnUploadFinish_f finish): - LLBufferedAssetUploadInfo(itemId, LLAssetType::AT_LSL_TEXT, buffer, finish), +LLScriptAssetUpload::LLScriptAssetUpload(LLUUID itemId, std::string buffer, invnUploadFinish_f finish, uploadFailed_f failed): + LLBufferedAssetUploadInfo(itemId, LLAssetType::AT_LSL_TEXT, buffer, finish, failed), mExerienceId(), mTargetType(LSL2), mIsRunning(false) @@ -771,8 +794,8 @@ LLScriptAssetUpload::LLScriptAssetUpload(LLUUID itemId, std::string buffer, invn } LLScriptAssetUpload::LLScriptAssetUpload(LLUUID taskId, LLUUID itemId, TargetType_t targetType, - bool isRunning, LLUUID exerienceId, std::string buffer, taskUploadFinish_f finish): - LLBufferedAssetUploadInfo(taskId, itemId, LLAssetType::AT_LSL_TEXT, buffer, finish), + bool isRunning, LLUUID exerienceId, std::string buffer, taskUploadFinish_f finish, uploadFailed_f failed): + LLBufferedAssetUploadInfo(taskId, itemId, LLAssetType::AT_LSL_TEXT, buffer, finish, failed), mExerienceId(exerienceId), mTargetType(targetType), mIsRunning(isRunning) @@ -986,19 +1009,15 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res LLNotificationsUtil::add(label, args); - // unfreeze script preview - if (uploadInfo->getAssetType() == LLAssetType::AT_LSL_TEXT) + if (uploadInfo->failedUpload(result, reason)) { - LLPreviewLSL* preview = LLFloaterReg::findTypedInstance("preview_script", - uploadInfo->getItemId()); - if (preview) - { - LLSD errors; - errors.append(LLTrans::getString("UploadFailed") + reason); - preview->callbackLSLCompileFailed(errors); - } + // no further action required, already handled by a callback + // ex: do not trigger snapshot floater when failing material texture + return; } + // Todo: move these floater specific actions into proper callbacks + // Let the Snapshot floater know we have failed uploading. LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance(); if (floater_snapshot && floater_snapshot->isWaitingState()) diff --git a/indra/newview/llviewerassetupload.h b/indra/newview/llviewerassetupload.h index 9eddcfbd0e..7f7707f5bb 100644 --- a/indra/newview/llviewerassetupload.h +++ b/indra/newview/llviewerassetupload.h @@ -64,6 +64,9 @@ public: virtual void logPreparedUpload(); virtual LLUUID finishUpload(LLSD &result); + // return true if no further action is need + virtual bool failedUpload(LLSD &result, std::string &reason) { return false; } + LLTransactionID getTransactionId() const { return mTransactionId; } LLAssetType::EType getAssetType() const { return mAssetType; } std::string getAssetTypeString() const; @@ -173,6 +176,7 @@ class LLNewBufferedResourceUploadInfo : public LLResourceUploadInfo { public: typedef std::function uploadFinish_f; + typedef std::function uploadFailure_f; LLNewBufferedResourceUploadInfo( const std::string& buffer, @@ -188,7 +192,8 @@ public: U32 everyonePerms, S32 expectedCost, bool show_inventory, - uploadFinish_f finish); + uploadFinish_f finish, + uploadFailure_f failure); virtual LLSD prepareUpload(); @@ -196,9 +201,11 @@ protected: virtual LLSD exportTempFile(); virtual LLUUID finishUpload(LLSD &result); + virtual bool failedUpload(LLSD &result, std::string &reason); private: uploadFinish_f mFinishFn; + uploadFailure_f mFailureFn; std::string mBuffer; }; @@ -208,14 +215,16 @@ class LLBufferedAssetUploadInfo : public LLResourceUploadInfo public: typedef std::function invnUploadFinish_f; typedef std::function taskUploadFinish_f; + typedef std::function uploadFailed_f; - LLBufferedAssetUploadInfo(LLUUID itemId, LLAssetType::EType assetType, std::string buffer, invnUploadFinish_f finish); + LLBufferedAssetUploadInfo(LLUUID itemId, LLAssetType::EType assetType, std::string buffer, invnUploadFinish_f finish, uploadFailed_f failed); LLBufferedAssetUploadInfo(LLUUID itemId, LLPointer image, invnUploadFinish_f finish); - LLBufferedAssetUploadInfo(LLUUID taskId, LLUUID itemId, LLAssetType::EType assetType, std::string buffer, taskUploadFinish_f finish); + LLBufferedAssetUploadInfo(LLUUID taskId, LLUUID itemId, LLAssetType::EType assetType, std::string buffer, taskUploadFinish_f finish, uploadFailed_f failed); virtual LLSD prepareUpload(); virtual LLSD generatePostBody(); virtual LLUUID finishUpload(LLSD &result); + virtual bool failedUpload(LLSD &result, std::string &reason); LLUUID getTaskId() const { return mTaskId; } const std::string & getContents() const { return mContents; } @@ -232,6 +241,7 @@ private: std::string mContents; invnUploadFinish_f mInvnFinishFn; taskUploadFinish_f mTaskFinishFn; + uploadFailed_f mFailureFn; bool mStoredToCache; }; @@ -245,9 +255,9 @@ public: MONO }; - LLScriptAssetUpload(LLUUID itemId, std::string buffer, invnUploadFinish_f finish); + LLScriptAssetUpload(LLUUID itemId, std::string buffer, invnUploadFinish_f finish, uploadFailed_f failed); LLScriptAssetUpload(LLUUID taskId, LLUUID itemId, TargetType_t targetType, - bool isRunning, LLUUID exerienceId, std::string buffer, taskUploadFinish_f finish); + bool isRunning, LLUUID exerienceId, std::string buffer, taskUploadFinish_f finish, uploadFailed_f failed); virtual LLSD generatePostBody(); -- cgit v1.3 From 76c6f3f002693459b77669df39d51fb4e456650d Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 7 Dec 2022 21:18:42 +0200 Subject: SL-18741 Don't allow bulk upload without caps --- indra/newview/lldrawpoolwlsky.cpp | 4 ++-- indra/newview/llmaterialeditor.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'indra/newview/llmaterialeditor.cpp') diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index c71d466830..9fe1b64d3d 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -354,7 +354,7 @@ void LLDrawPoolWLSky::renderStarsDeferred(const LLVector3& camPosLocal) const void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const { - if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp->getCloudNoiseTex()) + if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp && gSky.mVOSkyp->getCloudNoiseTex()) { LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); @@ -408,7 +408,7 @@ void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 void LLDrawPoolWLSky::renderSkyClouds(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const { - if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp->getCloudNoiseTex()) + if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp && gSky.mVOSkyp->getCloudNoiseTex()) { LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 903ca60350..2e57c35326 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -1559,6 +1559,12 @@ void LLMaterialEditor::refreshFromInventory(const LLUUID& new_item_id) void LLMaterialEditor::onClickSaveAs() { + if (!LLMaterialEditor::capabilitiesAvailable()) + { + LLNotificationsUtil::add("MissingMaterialCaps"); + return; + } + if (!can_afford_transaction(mExpectedUploadCost)) { LLSD args; @@ -1709,7 +1715,7 @@ static void pack_textures( void LLMaterialEditor::uploadMaterialFromFile(const std::string& filename, S32 index) { - if (index < 0) + if (index < 0 || !LLMaterialEditor::capabilitiesAvailable()) { return; } -- cgit v1.3