summaryrefslogtreecommitdiff
path: root/indra/newview/llmaterialeditor.cpp
diff options
context:
space:
mode:
authorAnsariel <ansariel.hiller@phoenixviewer.com>2024-06-11 13:38:43 +0200
committerAnsariel <ansariel.hiller@phoenixviewer.com>2024-06-11 13:38:43 +0200
commitd9789bfaf230e301873bd700f6f360d306dc2486 (patch)
tree4b2dd2680905ca9821e2b11b36aa63dfe7af4f84 /indra/newview/llmaterialeditor.cpp
parent9f6b8484dfb7dfa981d8a8ac3693d3f68e32bc12 (diff)
parenta73773bc1abdac6bc3beea36fd4ba58eba686e13 (diff)
Merge branch 'main' of https://github.com/secondlife/viewer into DRTVWR-600-maint-A
# Conflicts: # indra/llappearance/llavatarappearance.h # indra/llimage/llimage.cpp # indra/llmath/llvolume.cpp # indra/llmath/llvolume.h # indra/llprimitive/llgltfmaterial.h # indra/llrender/llrendertarget.cpp # indra/llrender/llshadermgr.cpp # indra/newview/lldynamictexture.cpp # indra/newview/llenvironment.cpp # indra/newview/llfetchedgltfmaterial.cpp # indra/newview/llfloaterimagepreview.cpp # indra/newview/llfloaterimagepreview.h # indra/newview/llfloaterregioninfo.cpp # indra/newview/llfloaterregioninfo.h # indra/newview/llmaniprotate.cpp # indra/newview/llmaniptranslate.cpp # indra/newview/llpanelvolume.cpp # indra/newview/llselectmgr.cpp # indra/newview/llselectmgr.h # indra/newview/llsurface.cpp # indra/newview/llsurface.h # indra/newview/llsurfacepatch.cpp # indra/newview/lltexturectrl.cpp # indra/newview/lltexturectrl.h # indra/newview/lltinygltfhelper.cpp # indra/newview/llviewertexture.cpp # indra/newview/llviewerwindow.cpp # indra/newview/llviewerwindow.h # indra/newview/llvlcomposition.cpp # indra/newview/llvlcomposition.h # indra/newview/llvocache.cpp # indra/newview/llvovolume.cpp # indra/newview/pipeline.cpp
Diffstat (limited to 'indra/newview/llmaterialeditor.cpp')
-rw-r--r--indra/newview/llmaterialeditor.cpp69
1 files changed, 42 insertions, 27 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index 6bf495d10f..92f8ed949e 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -489,11 +489,7 @@ bool LLMaterialEditor::postBuild()
}
else
{
- S32 upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
- getChild<LLUICtrl>("base_color_upload_fee")->setTextArg("[FEE]", llformat("%d", upload_cost));
- getChild<LLUICtrl>("metallic_upload_fee")->setTextArg("[FEE]", llformat("%d", upload_cost));
- getChild<LLUICtrl>("emissive_upload_fee")->setTextArg("[FEE]", llformat("%d", upload_cost));
- getChild<LLUICtrl>("normal_upload_fee")->setTextArg("[FEE]", llformat("%d", upload_cost));
+ refreshUploadCost();
}
boost::function<void(LLUICtrl*, void*)> changes_callback = [this](LLUICtrl * ctrl, void* userData)
@@ -812,6 +808,37 @@ void LLMaterialEditor::resetUnsavedChanges()
}
}
+void LLMaterialEditor::refreshUploadCost()
+{
+ mExpectedUploadCost = 0;
+ if (mBaseColorTextureUploadId.notNull() && mBaseColorTextureUploadId == getBaseColorId() && mBaseColorFetched)
+ {
+ S32 upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(mBaseColorFetched);
+ mExpectedUploadCost += upload_cost;
+ getChild<LLUICtrl>("base_color_upload_fee")->setTextArg("[FEE]", llformat("%d", upload_cost));
+ }
+ if (mMetallicTextureUploadId.notNull() && mMetallicTextureUploadId == getMetallicRoughnessId() && mMetallicRoughnessFetched)
+ {
+ S32 upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(mMetallicRoughnessFetched);
+ mExpectedUploadCost += upload_cost;
+ getChild<LLUICtrl>("metallic_upload_fee")->setTextArg("[FEE]", llformat("%d", upload_cost));
+ }
+ if (mEmissiveTextureUploadId.notNull() && mEmissiveTextureUploadId == getEmissiveId() && mEmissiveFetched)
+ {
+ S32 upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(mEmissiveFetched);
+ mExpectedUploadCost += upload_cost;
+ getChild<LLUICtrl>("emissive_upload_fee")->setTextArg("[FEE]", llformat("%d", upload_cost));
+ }
+ if (mNormalTextureUploadId.notNull() && mNormalTextureUploadId == getNormalId() && mNormalFetched)
+ {
+ S32 upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(mNormalFetched);
+ mExpectedUploadCost += upload_cost;
+ getChild<LLUICtrl>("normal_upload_fee")->setTextArg("[FEE]", llformat("%d", upload_cost));
+ }
+
+ getChild<LLUICtrl>("total_upload_fee")->setTextArg("[FEE]", llformat("%d", mExpectedUploadCost));
+}
+
void LLMaterialEditor::markChangesUnsaved(U32 dirty_flag)
{
mUnsavedChanges |= dirty_flag;
@@ -842,26 +869,15 @@ void LLMaterialEditor::markChangesUnsaved(U32 dirty_flag)
setCanSave(false);
}
- S32 upload_texture_count = 0;
- if (mBaseColorTextureUploadId.notNull() && mBaseColorTextureUploadId == getBaseColorId())
- {
- upload_texture_count++;
- }
- if (mMetallicTextureUploadId.notNull() && mMetallicTextureUploadId == getMetallicRoughnessId())
+ if ((dirty_flag & MATERIAL_BASE_COLOR_TEX_DIRTY)
+ || (dirty_flag & MATERIAL_NORMAL_TEX_DIRTY)
+ || (dirty_flag & MATERIAL_METALLIC_ROUGHTNESS_TEX_DIRTY)
+ || (dirty_flag & MATERIAL_EMISIVE_TEX_DIRTY)
+ || (dirty_flag == 0)
+ || (dirty_flag == U32_MAX))
{
- upload_texture_count++;
+ refreshUploadCost();
}
- if (mEmissiveTextureUploadId.notNull() && mEmissiveTextureUploadId == getEmissiveId())
- {
- upload_texture_count++;
- }
- if (mNormalTextureUploadId.notNull() && mNormalTextureUploadId == getNormalId())
- {
- upload_texture_count++;
- }
-
- mExpectedUploadCost = upload_texture_count * LLAgentBenefitsMgr::current().getTextureUploadCost();
- getChild<LLUICtrl>("total_upload_fee")->setTextArg("[FEE]", llformat("%d", mExpectedUploadCost));
}
void LLMaterialEditor::setCanSaveAs(bool value)
@@ -1870,7 +1886,7 @@ static void pack_textures(
if (normal_img)
{
// create a losslessly compressed version of the normal map
- normal_j2c = LLViewerTextureList::convertToUploadFile(normal_img, 1024, false, true);
+ normal_j2c = LLViewerTextureList::convertToUploadFile(normal_img, 2048, false, true);
LL_DEBUGS("MaterialEditor") << "Normal: " << normal_j2c->getDataSize() << LL_ENDL;
}
@@ -2124,7 +2140,7 @@ bool can_use_objects_material(LLSelectedTEGetMatData& func, const std::vector<Pe
// Look for the item to base permissions off of
item_out = nullptr;
- const bool blank_material = func.mMaterialId == LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID;
+ const bool blank_material = func.mMaterialId == BLANK_MATERIAL_ASSET_ID;
if (!blank_material)
{
LLAssetIDMatchesWithPerms item_has_perms(func.mMaterialId, ops);
@@ -3497,8 +3513,7 @@ void LLMaterialEditor::saveTexture(LLImageJ2C* img, const std::string& name, con
std::string buffer;
buffer.assign((const char*) img->getData(), img->getDataSize());
- U32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
-
+ U32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(img);
LLSD key = getKey();
std::function<bool(LLUUID itemId, LLSD response, std::string reason)> failed_upload([key](LLUUID assetId, LLSD response, std::string reason)
{