Commit: d567785658349504dc98c693c8c46c30e9a60c44
Author: Jacques Lucke
Date:   Mon Jul 25 13:16:59 2022 +0200
Branches: master
https://developer.blender.org/rBd567785658349504dc98c693c8c46c30e9a60c44

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.

===================================================================

M       source/blender/blenkernel/intern/attribute.cc

===================================================================

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);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to