diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-03-29 21:57:58 +0200 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-04-01 19:30:51 +0300 |
commit | e1e0b6fc5bb3eaa210fac24e2421fefbaeafe561 (patch) | |
tree | ca8eb824f1ab0e6f1439d76970650e341594dea8 /indra/newview/llmaterialeditor.cpp | |
parent | 18ef2e3b2ba5a6f0ac397fe6f0652c5b55bdaea8 (diff) |
viewer#1081 Account for 2K texture upload price in bulk upload
Diffstat (limited to 'indra/newview/llmaterialeditor.cpp')
-rw-r--r-- | indra/newview/llmaterialeditor.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index fc3c0bb022..1783621530 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -492,16 +492,16 @@ BOOL LLMaterialEditor::postBuild() S32 upload_cost_base = LLAgentBenefitsMgr::current().getTextureUploadCost(); S32 upload_cost_2k = LLAgentBenefitsMgr::current().get2KTextureUploadCost(); - bool large_texture = mBaseColorFetched && (mBaseColorFetched->getFullHeight() * mBaseColorFetched->getFullWidth() > LLAgentBenefits::MIN_2K_TEXTURE_AREA); + bool large_texture = mBaseColorFetched && (mBaseColorFetched->getFullHeight() * mBaseColorFetched->getFullWidth() >= LLAgentBenefits::MIN_2K_TEXTURE_AREA); getChild<LLUICtrl>("base_color_upload_fee")->setTextArg("[FEE]", llformat("%d", large_texture ? upload_cost_2k : upload_cost_base)); - large_texture = mMetallicRoughnessFetched && (mMetallicRoughnessFetched->getFullHeight() * mMetallicRoughnessFetched->getFullWidth() > LLAgentBenefits::MIN_2K_TEXTURE_AREA); + large_texture = mMetallicRoughnessFetched && (mMetallicRoughnessFetched->getFullHeight() * mMetallicRoughnessFetched->getFullWidth() >= LLAgentBenefits::MIN_2K_TEXTURE_AREA); getChild<LLUICtrl>("metallic_upload_fee")->setTextArg("[FEE]", llformat("%d", large_texture ? upload_cost_2k : upload_cost_base)); - large_texture = mEmissiveFetched && (mEmissiveFetched->getFullHeight() * mEmissiveFetched->getFullWidth() > LLAgentBenefits::MIN_2K_TEXTURE_AREA); + large_texture = mEmissiveFetched && (mEmissiveFetched->getFullHeight() * mEmissiveFetched->getFullWidth() >= LLAgentBenefits::MIN_2K_TEXTURE_AREA); getChild<LLUICtrl>("emissive_upload_fee")->setTextArg("[FEE]", llformat("%d", large_texture ? upload_cost_2k : upload_cost_base)); - large_texture = mNormalFetched && (mNormalFetched->getFullHeight() * mNormalFetched->getFullWidth() > LLAgentBenefits::MIN_2K_TEXTURE_AREA); + large_texture = mNormalFetched && (mNormalFetched->getFullHeight() * mNormalFetched->getFullWidth() >= LLAgentBenefits::MIN_2K_TEXTURE_AREA); getChild<LLUICtrl>("normal_upload_fee")->setTextArg("[FEE]", llformat("%d", large_texture ? upload_cost_2k : upload_cost_base)); } @@ -855,7 +855,7 @@ void LLMaterialEditor::markChangesUnsaved(U32 dirty_flag) S32 upload_2k_texture_count = 0; if (mBaseColorTextureUploadId.notNull() && mBaseColorTextureUploadId == getBaseColorId() && mBaseColorFetched) { - if (mBaseColorFetched->getFullHeight() * mBaseColorFetched->getFullWidth() > LLAgentBenefits::MIN_2K_TEXTURE_AREA) + if (mBaseColorFetched->getFullHeight() * mBaseColorFetched->getFullWidth() >= LLAgentBenefits::MIN_2K_TEXTURE_AREA) { upload_2k_texture_count++; } @@ -866,7 +866,7 @@ void LLMaterialEditor::markChangesUnsaved(U32 dirty_flag) } if (mMetallicTextureUploadId.notNull() && mMetallicTextureUploadId == getMetallicRoughnessId() && mMetallicRoughnessFetched) { - if (mMetallicRoughnessFetched->getFullHeight() * mMetallicRoughnessFetched->getFullWidth() > LLAgentBenefits::MIN_2K_TEXTURE_AREA) + if (mMetallicRoughnessFetched->getFullHeight() * mMetallicRoughnessFetched->getFullWidth() >= LLAgentBenefits::MIN_2K_TEXTURE_AREA) { upload_2k_texture_count++; } @@ -877,7 +877,7 @@ void LLMaterialEditor::markChangesUnsaved(U32 dirty_flag) } if (mEmissiveTextureUploadId.notNull() && mEmissiveTextureUploadId == getEmissiveId() && mEmissiveFetched) { - if (mEmissiveFetched->getFullHeight() * mEmissiveFetched->getFullWidth() > LLAgentBenefits::MIN_2K_TEXTURE_AREA) + if (mEmissiveFetched->getFullHeight() * mEmissiveFetched->getFullWidth() >= LLAgentBenefits::MIN_2K_TEXTURE_AREA) { upload_2k_texture_count++; } @@ -888,7 +888,7 @@ void LLMaterialEditor::markChangesUnsaved(U32 dirty_flag) } if (mNormalTextureUploadId.notNull() && mNormalTextureUploadId == getNormalId() && mNormalFetched) { - if (mNormalFetched->getFullHeight() * mNormalFetched->getFullWidth() > LLAgentBenefits::MIN_2K_TEXTURE_AREA) + if (mNormalFetched->getFullHeight() * mNormalFetched->getFullWidth() >= LLAgentBenefits::MIN_2K_TEXTURE_AREA) { upload_2k_texture_count++; } @@ -899,7 +899,12 @@ void LLMaterialEditor::markChangesUnsaved(U32 dirty_flag) } mExpectedUploadCost = upload_texture_count * LLAgentBenefitsMgr::current().getTextureUploadCost(); - mExpectedUploadCost += upload_2k_texture_count * LLAgentBenefitsMgr::current().get2KTextureUploadCost(); + S32 cost_2k = LLAgentBenefitsMgr::current().get2KTextureUploadCost(); + if (cost_2k < 0) + { + cost_2k = 0; + } + mExpectedUploadCost += upload_2k_texture_count * cost_2k; getChild<LLUICtrl>("total_upload_fee")->setTextArg("[FEE]", llformat("%d", mExpectedUploadCost)); } @@ -3535,7 +3540,7 @@ void LLMaterialEditor::saveTexture(LLImageJ2C* img, const std::string& name, con buffer.assign((const char*) img->getData(), img->getDataSize()); U32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); - if (img->getWidth() * img->getHeight() > LLAgentBenefits::MIN_2K_TEXTURE_AREA) + if (img->getWidth() * img->getHeight() >= LLAgentBenefits::MIN_2K_TEXTURE_AREA) { expected_upload_cost = LLAgentBenefitsMgr::current().get2KTextureUploadCost(); } |