diff options
-rw-r--r-- | indra/llrender/llgltexture.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llagentbenefits.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llmaterialeditor.cpp | 60 | ||||
-rw-r--r-- | indra/newview/llmaterialeditor.h | 1 |
4 files changed, 45 insertions, 22 deletions
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<LLUICtrl>("base_color_upload_fee")->setTextArg("[FEE]", llformat("%d", LLAgentBenefitsMgr::current().getTextureUploadCost(mBaseColorFetched))); - getChild<LLUICtrl>("metallic_upload_fee")->setTextArg("[FEE]", llformat("%d", LLAgentBenefitsMgr::current().getTextureUploadCost(mMetallicRoughnessFetched))); - getChild<LLUICtrl>("emissive_upload_fee")->setTextArg("[FEE]", llformat("%d", LLAgentBenefitsMgr::current().getTextureUploadCost(mEmissiveFetched))); - getChild<LLUICtrl>("normal_upload_fee")->setTextArg("[FEE]", llformat("%d", LLAgentBenefitsMgr::current().getTextureUploadCost(mNormalFetched))); + refreshUploadCost(); } boost::function<void(LLUICtrl*, void*)> 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<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; @@ -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<LLUICtrl>("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); |