Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-07-25 14:16:59 +0300
committerJacques Lucke <jacques@blender.org>2022-07-25 14:16:59 +0300
commitd567785658349504dc98c693c8c46c30e9a60c44 (patch)
tree5158b02d8ac69ae3fe9422123aceb466af7582a7 /source/blender/blenkernel/intern/attribute.cc
parent332d547ab7bc99604b31f20cb300a38277629787 (diff)
Fix T99816: renaming attribute works incorrectly
This fixes two issues: * There was a crash when the new attribute name was empty. * The attribute name was incremented (e.g. "Attribute.001") when the old and new name were the same.
Diffstat (limited to 'source/blender/blenkernel/intern/attribute.cc')
-rw-r--r--source/blender/blenkernel/intern/attribute.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/attribute.cc b/source/blender/blenkernel/intern/attribute.cc
index ff40f842349..639e190a2c6 100644
--- a/source/blender/blenkernel/intern/attribute.cc
+++ b/source/blender/blenkernel/intern/attribute.cc
@@ -146,6 +146,13 @@ bool BKE_id_attribute_rename(ID *id,
BLI_assert_msg(0, "Required attribute name is not editable");
return false;
}
+ if (STREQ(new_name, "")) {
+ BKE_report(reports, RPT_ERROR, "Attribute name can not be empty");
+ return false;
+ }
+ if (STREQ(old_name, new_name)) {
+ return false;
+ }
CustomDataLayer *layer = BKE_id_attribute_search(
id, old_name, CD_MASK_PROP_ALL, ATTR_DOMAIN_MASK_ALL);