diff options
author | Ayane <chanayane83@gmail.com> | 2024-07-17 01:47:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-17 02:47:22 +0300 |
commit | bd0baebb6eea478260880d04e34f6b3181d883a6 (patch) | |
tree | c282e22c3a2f709e878197c936b380c500608685 /indra | |
parent | b05ab692ba60438e3900b351d654bc0124a42f50 (diff) |
Raised the 512x512 limitation for uploading snapshots to inventory to 2048x2048 (#2025)
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llagentbenefits.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llagentbenefits.h | 1 | ||||
-rw-r--r-- | indra/newview/llfloatersnapshot.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llpanelsnapshot.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llpanelsnapshotinventory.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llpanelsnapshotoptions.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llsnapshotlivepreview.cpp | 4 |
7 files changed, 48 insertions, 7 deletions
diff --git a/indra/newview/llagentbenefits.cpp b/indra/newview/llagentbenefits.cpp index e9f00f6556..f651b42010 100644 --- a/indra/newview/llagentbenefits.cpp +++ b/indra/newview/llagentbenefits.cpp @@ -195,6 +195,19 @@ S32 LLAgentBenefits::getTextureUploadCost(const LLImageBase* tex) const return getTextureUploadCost(); } +S32 LLAgentBenefits::getTextureUploadCost(S32 w, S32 h) const +{ + if (w > 0 && h > 0) + { + S32 area = w * h; + if (area >= MIN_2K_TEXTURE_AREA) + { + return get2KTextureUploadCost(area); + } + } + return getTextureUploadCost(); +} + S32 LLAgentBenefits::get2KTextureUploadCost(S32 area) const { if (m_2k_texture_upload_cost.empty()) diff --git a/indra/newview/llagentbenefits.h b/indra/newview/llagentbenefits.h index ff23241aa9..c0aa6edd90 100644 --- a/indra/newview/llagentbenefits.h +++ b/indra/newview/llagentbenefits.h @@ -54,6 +54,7 @@ public: S32 getTextureUploadCost() const; S32 getTextureUploadCost(const LLViewerTexture* tex) const; S32 getTextureUploadCost(const LLImageBase* tex) const; + S32 getTextureUploadCost(S32 w, S32 h) const; S32 get2KTextureUploadCost(S32 area) const; bool findUploadCost(LLAssetType::EType& asset_type, S32& cost) const; diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 75b24a6bbc..700f532318 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -51,7 +51,7 @@ LLSnapshotFloaterView* gSnapshotFloaterView = NULL; const F32 AUTO_SNAPSHOT_TIME_DELAY = 1.f; const S32 MAX_POSTCARD_DATASIZE = 1572864; // 1.5 megabyte, similar to simulator limit -const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512 +const S32 MAX_TEXTURE_SIZE = 2048 ; //max upload texture size 2048 * 2048 static LLDefaultChildRegistry::Register<LLSnapshotFloaterView> r("snapshot_floater_view"); diff --git a/indra/newview/llpanelsnapshot.cpp b/indra/newview/llpanelsnapshot.cpp index 69047a30cd..2cb3db0cf5 100644 --- a/indra/newview/llpanelsnapshot.cpp +++ b/indra/newview/llpanelsnapshot.cpp @@ -41,7 +41,7 @@ #include "llagentbenefits.h" -constexpr S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512 +const S32 MAX_TEXTURE_SIZE = 2048 ; //max upload texture size 2048 * 2048 S32 power_of_two(S32 sz, S32 upper) { @@ -61,7 +61,9 @@ LLPanelSnapshot::LLPanelSnapshot() // virtual bool LLPanelSnapshot::postBuild() { - getChild<LLUICtrl>("save_btn")->setLabelArg("[UPLOAD_COST]", std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost())); + S32 w = getTypedPreviewWidth(); + S32 h = getTypedPreviewHeight(); + getChild<LLUICtrl>("save_btn")->setLabelArg("[UPLOAD_COST]", std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost(w, h))); getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onResolutionComboCommit, this, _1)); if (!getWidthSpinnerName().empty()) { diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp index 4abb89120b..96b17acc40 100644 --- a/indra/newview/llpanelsnapshotinventory.cpp +++ b/indra/newview/llpanelsnapshotinventory.cpp @@ -155,7 +155,19 @@ void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl) void LLPanelSnapshotInventoryBase::onSend() { - S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); + S32 w = 0; + S32 h = 0; + + if( mSnapshotFloater ) + { + LLSnapshotLivePreview* preview = mSnapshotFloater->getPreviewView(); + if( preview ) + { + preview->getSize(w, h); + } + } + + S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(w, h); if (can_afford_transaction(expected_upload_cost)) { if (mSnapshotFloater) diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 776de460a9..962d3bba16 100644 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -30,6 +30,7 @@ #include "llsidetraypanelcontainer.h" #include "llfloatersnapshot.h" // FIXME: create a snapshot model +#include "llsnapshotlivepreview.h" #include "llfloaterreg.h" #include "llagentbenefits.h" @@ -89,7 +90,19 @@ void LLPanelSnapshotOptions::onOpen(const LLSD& key) void LLPanelSnapshotOptions::updateUploadCost() { - S32 upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); + S32 w = 0; + S32 h = 0; + + if( mSnapshotFloater ) + { + LLSnapshotLivePreview* preview = mSnapshotFloater->getPreviewView(); + if( preview ) + { + preview->getSize(w, h); + } + } + + S32 upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(w, h); getChild<LLUICtrl>("save_to_inventory_btn")->setLabelArg("[AMOUNT]", llformat("%d", upload_cost)); } diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index 451f5bd607..ce12db740c 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -65,7 +65,7 @@ constexpr F32 FALL_TIME = 0.6f; constexpr S32 BORDER_WIDTH = 6; constexpr S32 TOP_PANEL_HEIGHT = 30; -constexpr S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512 +const S32 MAX_TEXTURE_SIZE = 2048 ; //max upload texture size 2048 * 2048 std::set<LLSnapshotLivePreview*> LLSnapshotLivePreview::sList; LLPointer<LLImageFormatted> LLSnapshotLivePreview::sSaveLocalImage = NULL; @@ -1024,7 +1024,7 @@ void LLSnapshotLivePreview::saveTexture(bool outfit_snapshot, std::string name) LLAgentUI::buildLocationString(pos_string, LLAgentUI::LOCATION_FORMAT_FULL); std::string who_took_it; LLAgentUI::buildFullname(who_took_it); - S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); + S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(scaled->getWidth(), scaled->getHeight()); std::string res_name = outfit_snapshot ? name : "Snapshot : " + pos_string; std::string res_desc = outfit_snapshot ? "" : "Taken by " + who_took_it + " at " + pos_string; LLFolderType::EType folder_type = outfit_snapshot ? LLFolderType::FT_NONE : LLFolderType::FT_SNAPSHOT_CATEGORY; |