From b06a99f7c76950484972e25d9dbbee8660a6a6c3 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Wed, 15 May 2024 12:47:27 +0300 Subject: Post-merge spaces fix --- indra/newview/llagentbenefits.cpp | 224 +++++++++++++++++++------------------- 1 file changed, 112 insertions(+), 112 deletions(-) (limited to 'indra/newview/llagentbenefits.cpp') diff --git a/indra/newview/llagentbenefits.cpp b/indra/newview/llagentbenefits.cpp index 0717d92ea7..4ac4d2136f 100644 --- a/indra/newview/llagentbenefits.cpp +++ b/indra/newview/llagentbenefits.cpp @@ -28,14 +28,14 @@ #include "llviewertexture.h" LLAgentBenefits::LLAgentBenefits(): - m_initalized(false), - m_animated_object_limit(-1), - m_animation_upload_cost(-1), - m_attachment_limit(-1), - m_group_membership_limit(-1), - m_picks_limit(-1), - m_sound_upload_cost(-1), - m_texture_upload_cost(-1) + m_initalized(false), + m_animated_object_limit(-1), + m_animation_upload_cost(-1), + m_attachment_limit(-1), + m_group_membership_limit(-1), + m_picks_limit(-1), + m_sound_upload_cost(-1), + m_texture_upload_cost(-1) { } @@ -48,53 +48,53 @@ LLAgentBenefits::~LLAgentBenefits() // the viewer cares about are integer. bool get_required_S32(const LLSD& sd, const LLSD::String& key, S32& value) { - value = -1; - if (sd.has(key)) - { - value = sd[key].asInteger(); - return true; - } - - LL_WARNS("Benefits") << "Missing required benefit field " << key << LL_ENDL; - return false; + value = -1; + if (sd.has(key)) + { + value = sd[key].asInteger(); + return true; + } + + LL_WARNS("Benefits") << "Missing required benefit field " << key << LL_ENDL; + return false; } bool LLAgentBenefits::init(const LLSD& benefits_sd) { - LL_DEBUGS("Benefits") << "initializing benefits from " << benefits_sd << LL_ENDL; - - if (!get_required_S32(benefits_sd, "animated_object_limit", m_animated_object_limit)) - { - return false; - } - if (!get_required_S32(benefits_sd, "animation_upload_cost", m_animation_upload_cost)) - { - return false; - } - if (!get_required_S32(benefits_sd, "attachment_limit", m_attachment_limit)) - { - return false; - } - if (!get_required_S32(benefits_sd, "create_group_cost", m_create_group_cost)) - { - return false; - } - if (!get_required_S32(benefits_sd, "group_membership_limit", m_group_membership_limit)) - { - return false; - } - if (!get_required_S32(benefits_sd, "picks_limit", m_picks_limit)) - { - return false; - } - if (!get_required_S32(benefits_sd, "sound_upload_cost", m_sound_upload_cost)) - { - return false; - } - if (!get_required_S32(benefits_sd, "texture_upload_cost", m_texture_upload_cost)) - { - return false; - } + LL_DEBUGS("Benefits") << "initializing benefits from " << benefits_sd << LL_ENDL; + + if (!get_required_S32(benefits_sd, "animated_object_limit", m_animated_object_limit)) + { + return false; + } + if (!get_required_S32(benefits_sd, "animation_upload_cost", m_animation_upload_cost)) + { + return false; + } + if (!get_required_S32(benefits_sd, "attachment_limit", m_attachment_limit)) + { + return false; + } + if (!get_required_S32(benefits_sd, "create_group_cost", m_create_group_cost)) + { + return false; + } + if (!get_required_S32(benefits_sd, "group_membership_limit", m_group_membership_limit)) + { + return false; + } + if (!get_required_S32(benefits_sd, "picks_limit", m_picks_limit)) + { + return false; + } + if (!get_required_S32(benefits_sd, "sound_upload_cost", m_sound_upload_cost)) + { + return false; + } + if (!get_required_S32(benefits_sd, "texture_upload_cost", m_texture_upload_cost)) + { + return false; + } if (benefits_sd.has("large_texture_upload_cost")) { @@ -116,49 +116,49 @@ bool LLAgentBenefits::init(const LLSD& benefits_sd) m_2k_texture_upload_cost.push_back(m_texture_upload_cost); } - // FIXME PREMIUM - either use this field or get rid of it - m_initalized = true; - return true; + // FIXME PREMIUM - either use this field or get rid of it + m_initalized = true; + return true; } S32 LLAgentBenefits::getAnimatedObjectLimit() const { - return m_animated_object_limit; + return m_animated_object_limit; } S32 LLAgentBenefits::getAnimationUploadCost() const { - return m_animation_upload_cost; + return m_animation_upload_cost; } S32 LLAgentBenefits::getAttachmentLimit() const { - return m_attachment_limit; + return m_attachment_limit; } S32 LLAgentBenefits::getCreateGroupCost() const { - return m_create_group_cost; + return m_create_group_cost; } S32 LLAgentBenefits::getGroupMembershipLimit() const { - return m_group_membership_limit; + return m_group_membership_limit; } S32 LLAgentBenefits::getPicksLimit() const { - return m_picks_limit; + return m_picks_limit; } S32 LLAgentBenefits::getSoundUploadCost() const { - return m_sound_upload_cost; + return m_sound_upload_cost; } S32 LLAgentBenefits::getTextureUploadCost() const { - return m_texture_upload_cost; + return m_texture_upload_cost; } S32 LLAgentBenefits::getTextureUploadCost(const LLViewerTexture* tex) const @@ -206,23 +206,23 @@ S32 LLAgentBenefits::get2KTextureUploadCost(S32 area) const bool LLAgentBenefits::findUploadCost(LLAssetType::EType& asset_type, S32& cost) const { - bool succ = false; - if (asset_type == LLAssetType::AT_TEXTURE) - { + bool succ = false; + if (asset_type == LLAssetType::AT_TEXTURE) + { cost = getTextureUploadCost(); - succ = true; - } - else if (asset_type == LLAssetType::AT_SOUND) - { - cost = getSoundUploadCost(); - succ = true; - } - else if (asset_type == LLAssetType::AT_ANIMATION) - { - cost = getAnimationUploadCost(); - succ = true; - } - return succ; + succ = true; + } + else if (asset_type == LLAssetType::AT_SOUND) + { + cost = getSoundUploadCost(); + succ = true; + } + else if (asset_type == LLAssetType::AT_ANIMATION) + { + cost = getAnimationUploadCost(); + succ = true; + } + return succ; } LLAgentBenefitsMgr::LLAgentBenefitsMgr() @@ -236,65 +236,65 @@ LLAgentBenefitsMgr::~LLAgentBenefitsMgr() // static const LLAgentBenefits& LLAgentBenefitsMgr::current() { - return instance().mCurrent; + return instance().mCurrent; } // static const LLAgentBenefits& LLAgentBenefitsMgr::get(const std::string& package) { - if (instance().mPackageMap.find(package) != instance().mPackageMap.end()) - { - return instance().mPackageMap[package]; - } - else - { - return instance().mDefault; - } + if (instance().mPackageMap.find(package) != instance().mPackageMap.end()) + { + return instance().mPackageMap[package]; + } + else + { + return instance().mDefault; + } } // static bool LLAgentBenefitsMgr::init(const std::string& package, const LLSD& benefits_sd) { - LLAgentBenefits benefits; - if (!benefits.init(benefits_sd)) - { - LL_WARNS("Benefits") << "Unable to initialize package " << package << " from sd " << benefits_sd << LL_ENDL; - return false; - } - else - { - instance().mPackageMap[package] = benefits; - } - return true; + LLAgentBenefits benefits; + if (!benefits.init(benefits_sd)) + { + LL_WARNS("Benefits") << "Unable to initialize package " << package << " from sd " << benefits_sd << LL_ENDL; + return false; + } + else + { + instance().mPackageMap[package] = benefits; + } + return true; } // static bool LLAgentBenefitsMgr::initCurrent(const std::string& package, const LLSD& benefits_sd) { - LLAgentBenefits benefits; - if (!benefits.init(benefits_sd)) - { - LL_WARNS("Benefits") << "Unable to initialize package " << package << " from sd " << benefits_sd << LL_ENDL; - return false; - } - else - { - instance().mCurrent = benefits; - instance().mCurrentName = package; - } - return true; + LLAgentBenefits benefits; + if (!benefits.init(benefits_sd)) + { + LL_WARNS("Benefits") << "Unable to initialize package " << package << " from sd " << benefits_sd << LL_ENDL; + return false; + } + else + { + instance().mCurrent = benefits; + instance().mCurrentName = package; + } + return true; } // static bool LLAgentBenefitsMgr::has(const std::string& package) { - return instance().mPackageMap.find(package) != instance().mPackageMap.end(); + return instance().mPackageMap.find(package) != instance().mPackageMap.end(); } //static bool LLAgentBenefitsMgr::isCurrent(const std::string& package) { - return instance().mCurrentName == package; + return instance().mCurrentName == package; } -- cgit v1.3 From 7ed053d9a257087b76937d750b9f2b0c96f6df38 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 20 May 2024 19:02:13 +0300 Subject: viewer#1520 Material upload floater displays wrong upload fee --- indra/llrender/llgltexture.cpp | 4 +++ indra/newview/llagentbenefits.cpp | 2 +- indra/newview/llmaterialeditor.cpp | 60 +++++++++++++++++++++++++------------- indra/newview/llmaterialeditor.h | 1 + 4 files changed, 45 insertions(+), 22 deletions(-) (limited to 'indra/newview/llagentbenefits.cpp') diff --git a/indra/llrender/llgltexture.cpp b/indra/llrender/llgltexture.cpp index be4fc85985..104976fcc6 100644 --- a/indra/llrender/llgltexture.cpp +++ b/indra/llrender/llgltexture.cpp @@ -49,6 +49,10 @@ LLGLTexture::LLGLTexture(const LLImageRaw* raw, BOOL usemipmaps) mUseMipMaps = usemipmaps ; // Create an empty image of the specified size and width mGLTexturep = new LLImageGL(raw, usemipmaps) ; + mFullWidth = mGLTexturep->getCurrentWidth(); + mFullHeight = mGLTexturep->getCurrentHeight(); + mComponents = mGLTexturep->getComponents(); + setTexelsPerImage(); } LLGLTexture::~LLGLTexture() diff --git a/indra/newview/llagentbenefits.cpp b/indra/newview/llagentbenefits.cpp index 4ac4d2136f..e9f00f6556 100644 --- a/indra/newview/llagentbenefits.cpp +++ b/indra/newview/llagentbenefits.cpp @@ -175,7 +175,7 @@ S32 LLAgentBenefits::getTextureUploadCost(const LLViewerTexture* tex) const return getTextureUploadCost(); } } - return getTextureUploadCost(); + return 0; } S32 LLAgentBenefits::getTextureUploadCost(const LLImageBase* tex) const diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 208b289ca9..36a0834845 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -489,10 +489,7 @@ BOOL LLMaterialEditor::postBuild() } else { - getChild("base_color_upload_fee")->setTextArg("[FEE]", llformat("%d", LLAgentBenefitsMgr::current().getTextureUploadCost(mBaseColorFetched))); - getChild("metallic_upload_fee")->setTextArg("[FEE]", llformat("%d", LLAgentBenefitsMgr::current().getTextureUploadCost(mMetallicRoughnessFetched))); - getChild("emissive_upload_fee")->setTextArg("[FEE]", llformat("%d", LLAgentBenefitsMgr::current().getTextureUploadCost(mEmissiveFetched))); - getChild("normal_upload_fee")->setTextArg("[FEE]", llformat("%d", LLAgentBenefitsMgr::current().getTextureUploadCost(mNormalFetched))); + refreshUploadCost(); } boost::function changes_callback = [this](LLUICtrl * ctrl, void* userData) @@ -811,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("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("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("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("normal_upload_fee")->setTextArg("[FEE]", llformat("%d", upload_cost)); + } + + getChild("total_upload_fee")->setTextArg("[FEE]", llformat("%d", mExpectedUploadCost)); +} + void LLMaterialEditor::markChangesUnsaved(U32 dirty_flag) { mUnsavedChanges |= dirty_flag; @@ -841,25 +869,15 @@ void LLMaterialEditor::markChangesUnsaved(U32 dirty_flag) setCanSave(false); } - mExpectedUploadCost = 0; - if (mBaseColorTextureUploadId.notNull() && mBaseColorTextureUploadId == getBaseColorId() && mBaseColorFetched) + 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)) { - mExpectedUploadCost += LLAgentBenefitsMgr::current().getTextureUploadCost(mBaseColorFetched); + refreshUploadCost(); } - if (mMetallicTextureUploadId.notNull() && mMetallicTextureUploadId == getMetallicRoughnessId() && mMetallicRoughnessFetched) - { - mExpectedUploadCost += LLAgentBenefitsMgr::current().getTextureUploadCost(mMetallicRoughnessFetched); - } - if (mEmissiveTextureUploadId.notNull() && mEmissiveTextureUploadId == getEmissiveId() && mEmissiveFetched) - { - mExpectedUploadCost += LLAgentBenefitsMgr::current().getTextureUploadCost(mEmissiveFetched); - } - if (mNormalTextureUploadId.notNull() && mNormalTextureUploadId == getNormalId() && mNormalFetched) - { - mExpectedUploadCost += LLAgentBenefitsMgr::current().getTextureUploadCost(mNormalFetched); - } - - getChild("total_upload_fee")->setTextArg("[FEE]", llformat("%d", mExpectedUploadCost)); } void LLMaterialEditor::setCanSaveAs(bool value) diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h index dda65476af..11809d26be 100644 --- a/indra/newview/llmaterialeditor.h +++ b/indra/newview/llmaterialeditor.h @@ -288,6 +288,7 @@ private: // utility function for building a description of the imported material // based on what we know about it. const std::string buildMaterialDescription(); + void refreshUploadCost(); void resetUnsavedChanges(); void markChangesUnsaved(U32 dirty_flag); -- cgit v1.3