summaryrefslogtreecommitdiff
path: root/indra/newview/llmaterialeditor.cpp
diff options
context:
space:
mode:
authorBrad Linden <brad@lindenlab.com>2024-05-23 11:31:19 -0700
committerBrad Linden <brad@lindenlab.com>2024-05-23 11:31:19 -0700
commita1f49564d670a2c41bfa25c833bba2564b9b7f48 (patch)
tree1d205e51bc37621916a17d459ad83782fe41f975 /indra/newview/llmaterialeditor.cpp
parent6af5db09faf5ea33a2d4c47b64e76f42edae178a (diff)
parent6377610f6587989c126b00f490dfc8d527a1c2ce (diff)
Merge remote-tracking branch 'origin/DRTVWR-600-maint-A' into brad/merge-maint-a-to-dev
Diffstat (limited to 'indra/newview/llmaterialeditor.cpp')
-rw-r--r--indra/newview/llmaterialeditor.cpp82
1 files changed, 41 insertions, 41 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index ea295867cb..09b53dc801 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file llmaterialeditor.cpp
* @brief Implementation of the gltf material editor
*
* $LicenseInfo:firstyear=2022&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,7 +48,7 @@
#include "llviewertexture.h"
#include "llsdutil.h"
#include "llselectmgr.h"
-#include "llstatusbar.h" // can_afford_transaction()
+#include "llstatusbar.h" // can_afford_transaction()
#include "lltoolpie.h"
#include "llviewerinventory.h"
#include "llinventory.h"
@@ -502,7 +502,7 @@ bool LLMaterialEditor::postBuild()
// Apply changes to object live
applyToSelection();
};
-
+
childSetCommitCallback("double sided", changes_callback, (void*)&MATERIAL_DOUBLE_SIDED_DIRTY);
// BaseColor
@@ -550,7 +550,7 @@ bool LLMaterialEditor::postBuild()
// Disable/enable setCanApplyImmediately() based on
// working from inventory, upload or editing inworld
- return LLPreview::postBuild();
+ return LLPreview::postBuild();
}
void LLMaterialEditor::onClickCloseBtn(bool app_quitting)
@@ -1226,7 +1226,7 @@ std::string LLMaterialEditor::getEncodedAsset()
bool LLMaterialEditor::decodeAsset(const std::vector<char>& buffer)
{
LLSD asset;
-
+
std::istrstream str(&buffer[0], buffer.size());
if (LLSDSerialize::deserialize(asset, str, buffer.size()))
{
@@ -1290,7 +1290,7 @@ const std::string LLMaterialEditor::buildMaterialDescription()
desc << LLTrans::getString("Material Texture Name Header");
// add the texture names for each just so long as the material
- // we loaded has an entry for it (i think testing the texture
+ // we loaded has an entry for it (i think testing the texture
// control UUI for NULL is a valid metric for if it was loaded
// or not but I suspect this code will change a lot so may need
// to revisit
@@ -1372,7 +1372,7 @@ bool LLMaterialEditor::saveIfNeeded()
}
}
else
- {
+ {
// Make a new inventory item and set upload permissions
LLPermissions local_permissions;
local_permissions.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null);
@@ -1401,7 +1401,7 @@ bool LLMaterialEditor::saveIfNeeded()
// We do not update floater with uploaded asset yet, so just close it.
closeFloater();
}
-
+
return true;
}
@@ -1816,7 +1816,7 @@ void LLMaterialEditor::onSaveAsMsgCallback(const LLSD& notification, const LLSD&
}
else
{
- LLNotificationsUtil::add("InvalidMaterialName", LLSD(), LLSD(), [this](const LLSD& notification, const LLSD& response)
+ LLNotificationsUtil::add("InvalidMaterialName", LLSD(), LLSD(), [this](const LLSD& notification, const LLSD& response)
{
LLNotificationsUtil::add("SaveMaterialAs", LLSD().with("DESC", mMaterialName), LLSD(),
boost::bind(&LLMaterialEditor::onSaveAsMsgCallback, this, _1, _2));
@@ -1976,7 +1976,7 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind
std::list<std::string> material_list;
std::vector<tinygltf::Material>::const_iterator mat_iter = model_in.materials.begin();
std::vector<tinygltf::Material>::const_iterator mat_end = model_in.materials.end();
-
+
for (; mat_iter != mat_end; mat_iter++)
{
std::string mat_name = mat_iter->name;
@@ -2615,28 +2615,28 @@ bool LLMaterialEditor::setFromGltfModel(const tinygltf::Model& model, S32 index,
}
/**
- * Build a texture name from the contents of the (in tinyGLFT parlance)
+ * Build a texture name from the contents of the (in tinyGLFT parlance)
* Image URI. This often is filepath to the original image on the users'
* local file system.
*/
const std::string LLMaterialEditor::getImageNameFromUri(std::string image_uri, const std::string texture_type)
{
- // getBaseFileName() works differently on each platform and file patchs
- // can contain both types of delimiter so unify them then extract the
+ // getBaseFileName() works differently on each platform and file patchs
+ // can contain both types of delimiter so unify them then extract the
// base name (no path or extension)
std::replace(image_uri.begin(), image_uri.end(), '\\', gDirUtilp->getDirDelimiter()[0]);
std::replace(image_uri.begin(), image_uri.end(), '/', gDirUtilp->getDirDelimiter()[0]);
const bool strip_extension = true;
std::string stripped_uri = gDirUtilp->getBaseFileName(image_uri, strip_extension);
- // sometimes they can be really long and unwieldy - 64 chars is enough for anyone :)
+ // sometimes they can be really long and unwieldy - 64 chars is enough for anyone :)
const int max_texture_name_length = 64;
if (stripped_uri.length() > max_texture_name_length)
{
stripped_uri = stripped_uri.substr(0, max_texture_name_length - 1);
}
- // We intend to append the type of texture (base color, emissive etc.) to the
+ // We intend to append the type of texture (base color, emissive etc.) to the
// name of the texture but sometimes the creator already did that. To try
// to avoid repeats (not perfect), we look for the texture type in the name
// and if we find it, do not append the type, later on. One way this fails
@@ -2702,15 +2702,15 @@ const std::string LLMaterialEditor::getImageNameFromUri(std::string image_uri, c
/**
* Update the metadata for the material based on what we find in the loaded
* file (along with some assumptions and interpretations...). Fields include
- * the name of the material, a material description and the names of the
+ * the name of the material, a material description and the names of the
* composite textures.
*/
void LLMaterialEditor::setFromGltfMetaData(const std::string& filename, const tinygltf::Model& model, S32 index)
{
- // Use the name (without any path/extension) of the file that was
- // uploaded as the base of the material name. Then if the name of the
+ // Use the name (without any path/extension) of the file that was
+ // uploaded as the base of the material name. Then if the name of the
// scene is present and not blank, append that and use the result as
- // the name of the material. This is a first pass at creating a
+ // the name of the material. This is a first pass at creating a
// naming scheme that is useful to real content creators and hopefully
// avoid 500 materials in your inventory called "scene" or "Default"
const bool strip_extension = true;
@@ -2741,10 +2741,10 @@ void LLMaterialEditor::setFromGltfMetaData(const std::string& filename, const ti
// scene name isn't present so no point using it
}
- // If we have a valid material or scene name, use it to build the short and
- // long versions of the material name. The long version is used
+ // If we have a valid material or scene name, use it to build the short and
+ // long versions of the material name. The long version is used
// as you might expect, for the material name. The short version is
- // used as part of the image/texture name - the theory is that will
+ // used as part of the image/texture name - the theory is that will
// allow content creators to track the material and the corresponding
// textures
if (material_name.length())
@@ -2752,9 +2752,9 @@ void LLMaterialEditor::setFromGltfMetaData(const std::string& filename, const ti
mMaterialNameShort = base_filename;
mMaterialName = STRINGIZE(
- base_filename <<
- " " <<
- "(" <<
+ base_filename <<
+ " " <<
+ "(" <<
material_name <<
")"
);
@@ -2770,14 +2770,14 @@ void LLMaterialEditor::setFromGltfMetaData(const std::string& filename, const ti
LLInventoryObject::correctInventoryName(mMaterialName);
LLInventoryObject::correctInventoryName(mMaterialNameShort);
- // We also set the title of the floater to match the
+ // We also set the title of the floater to match the
// name of the material
setTitle(mMaterialName);
/**
- * Extract / derive the names of each composite texture. For each, the
+ * Extract / derive the names of each composite texture. For each, the
* index is used to to determine which of the "Images" is used. If the index
- * is -1 then that texture type is not present in the material (Seems to be
+ * is -1 then that texture type is not present in the material (Seems to be
* quite common that a material is missing 1 or more types of texture)
*/
if (model.materials.size() > index)
@@ -2785,8 +2785,8 @@ void LLMaterialEditor::setFromGltfMetaData(const std::string& filename, const ti
const tinygltf::Material& first_material = model.materials[index];
mBaseColorName = MATERIAL_BASE_COLOR_DEFAULT_NAME;
- // note: unlike the other textures, base color doesn't have its own entry
- // in the tinyGLTF Material struct. Rather, it is taken from a
+ // note: unlike the other textures, base color doesn't have its own entry
+ // in the tinyGLTF Material struct. Rather, it is taken from a
// sub-texture in the pbrMetallicRoughness member
int index = first_material.pbrMetallicRoughness.baseColorTexture.index;
if (index > -1 && index < model.images.size())
@@ -2940,7 +2940,7 @@ public:
else
{
// mSavedGLTFOverrideMaterials[te] being present but null
- // means we need to use a default value
+ // means we need to use a default value
revert_mat = new LLGLTFMaterial();
}
}
@@ -3281,7 +3281,7 @@ bool LLMaterialEditor::setFromSelection()
// Ovverdired might have been updated,
// refresh state of local textures in overrides
- //
+ //
// Todo: this probably shouldn't be here, but in localbitmap,
// subscried to all material overrides if we want copied
// objects to get properly updated as well
@@ -3304,7 +3304,7 @@ void LLMaterialEditor::loadAsset()
{
item = getItem();
}
-
+
bool fail = false;
if (item)
@@ -3510,16 +3510,16 @@ void LLMaterialEditor::saveTexture(LLImageJ2C* img, const std::string& name, con
LLResourceUploadInfo::ptr_t uploadInfo(std::make_shared<LLNewBufferedResourceUploadInfo>(
buffer,
asset_id,
- name,
- name,
+ name,
+ name,
0,
- LLFolderType::FT_TEXTURE,
+ LLFolderType::FT_TEXTURE,
LLInventoryType::IT_TEXTURE,
LLAssetType::AT_TEXTURE,
LLFloaterPerms::getNextOwnerPerms("Uploads"),
LLFloaterPerms::getGroupPerms("Uploads"),
LLFloaterPerms::getEveryonePerms("Uploads"),
- expected_upload_cost,
+ expected_upload_cost,
false,
cb,
failed_upload));