summaryrefslogtreecommitdiff
path: root/indra/newview/llmaterialeditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llmaterialeditor.cpp')
-rw-r--r--indra/newview/llmaterialeditor.cpp84
1 files changed, 54 insertions, 30 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index 28160177f6..3cab060357 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -137,7 +137,8 @@ LLFloaterComboOptions* LLFloaterComboOptions::showUI(
{
combo_picker->mComboOptions->addSimpleElement(*iter);
}
- combo_picker->mComboOptions->selectFirstItem();
+ // select 'Bulk Upload All' option
+ combo_picker->mComboOptions->selectNthItem((S32)options.size() - 1);
combo_picker->openFloater(LLSD(title));
combo_picker->setFocus(true);
@@ -1332,15 +1333,6 @@ const std::string LLMaterialEditor::buildMaterialDescription()
desc << mNormalName;
}
- // trim last char if it's a ',' in case there is no normal texture
- // present and the code above inserts one
- // (no need to check for string length - always has initial string)
- std::string::iterator iter = desc.str().end() - 1;
- if (*iter == ',')
- {
- desc.str().erase(iter);
- }
-
// sanitize the material description so that it's compatible with the inventory
// note: split this up because clang doesn't like operating directly on the
// str() - error: lvalue reference to type 'basic_string<...>' cannot bind to a
@@ -1348,6 +1340,15 @@ const std::string LLMaterialEditor::buildMaterialDescription()
std::string inv_desc = desc.str();
LLInventoryObject::correctInventoryName(inv_desc);
+ // trim last char if it's a ',' in case there is no normal texture
+ // present and the code above inserts one
+ // (no need to check for string length - always has initial string)
+ std::string::iterator iter = inv_desc.end() - 1;
+ if (*iter == ',')
+ {
+ inv_desc.erase(iter);
+ }
+
return inv_desc;
}
@@ -2478,6 +2479,42 @@ void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std::
pack_textures(base_color_img, normal_img, mr_img, emissive_img, occlusion_img,
mBaseColorJ2C, mNormalJ2C, mMetallicRoughnessJ2C, mEmissiveJ2C);
+ if (open_floater)
+ {
+ bool textures_scaled = false;
+ if (mBaseColorFetched && mBaseColorJ2C
+ && (mBaseColorFetched->getWidth() != mBaseColorJ2C->getWidth()
+ || mBaseColorFetched->getHeight() != mBaseColorJ2C->getHeight()))
+ {
+ textures_scaled = true;
+ }
+ else if (mNormalFetched && mNormalJ2C
+ && (mNormalFetched->getWidth() != mNormalJ2C->getWidth()
+ || mNormalFetched->getHeight() != mNormalJ2C->getHeight()))
+ {
+ textures_scaled = true;
+ }
+ else if (mMetallicRoughnessFetched && mMetallicRoughnessJ2C
+ && (mMetallicRoughnessFetched->getWidth() != mMetallicRoughnessJ2C->getWidth()
+ || mMetallicRoughnessFetched->getHeight() != mMetallicRoughnessJ2C->getHeight()))
+ {
+ textures_scaled = true;
+ }
+ else if (mEmissiveFetched && mEmissiveJ2C
+ && (mEmissiveFetched->getWidth() != mEmissiveJ2C->getWidth()
+ || mEmissiveFetched->getHeight() != mEmissiveJ2C->getHeight()))
+ {
+ textures_scaled = true;
+ }
+
+ if (textures_scaled)
+ {
+ LLSD args;
+ args["MAX_SIZE"] = LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT;
+ LLNotificationsUtil::add("MaterialImagesWereScaled", args);
+ }
+ }
+
LLUUID base_color_id;
if (mBaseColorFetched.notNull())
{
@@ -2684,10 +2721,8 @@ const std::string LLMaterialEditor::getImageNameFromUri(std::string image_uri, c
// so we can include everything
if (stripped_uri.length() > 0)
{
- // example "DamagedHelmet: base layer"
+ // example "base layer"
return STRINGIZE(
- mMaterialNameShort <<
- ": " <<
stripped_uri <<
" (" <<
texture_type <<
@@ -2696,28 +2731,17 @@ const std::string LLMaterialEditor::getImageNameFromUri(std::string image_uri, c
}
else
// uri doesn't include the type (because the uri is empty)
- // so we must reorganize the string a bit to include the name
- // and an explicit name type
+ // include an explicit name type
{
- // example "DamagedHelmet: (Emissive)"
- return STRINGIZE(
- mMaterialNameShort <<
- " (" <<
- texture_type <<
- ")"
- );
+ // example "Emissive"
+ return texture_type;
}
}
else
- // uri includes the type so just use it directly with the
- // name of the material
+ // uri includes the type so just use it directly
{
- return STRINGIZE(
- // example: AlienBust: normal_layer
- mMaterialNameShort <<
- ": " <<
- stripped_uri
- );
+ // example: "normal_layer"
+ return stripped_uri;
}
}