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-04-25 17:00:43 +0300
committerJacques Lucke <jacques@blender.org>2022-04-25 17:00:58 +0300
commit26afa23b3b81234e60a57c28ed447e5fb920e4b3 (patch)
tree64b85ca363d551870258d2aefc5b1c303a560a36 /source/blender/modifiers
parentc2751f8a11fa6bd37b2c092ce8f893bc843bfe1e (diff)
Fix: use natural string sorting for attribute names
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_nodes.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc
index 85b6cf6a2cd..ab33c27e213 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -1648,15 +1648,24 @@ static void used_attributes_panel_draw(const bContext *UNUSED(C), Panel *panel)
return;
}
- Vector<std::pair<StringRefNull, NamedAttributeUsage>> sorted_used_attribute;
+ struct NameWithUsage {
+ StringRefNull name;
+ NamedAttributeUsage usage;
+ };
+
+ Vector<NameWithUsage> sorted_used_attribute;
for (auto &&item : usage_by_attribute.items()) {
sorted_used_attribute.append({item.key, item.value});
}
- std::sort(sorted_used_attribute.begin(), sorted_used_attribute.end());
+ std::sort(sorted_used_attribute.begin(),
+ sorted_used_attribute.end(),
+ [](const NameWithUsage &a, const NameWithUsage &b) {
+ return BLI_strcasecmp_natural(a.name.c_str(), b.name.c_str()) <= 0;
+ });
- for (const auto &pair : sorted_used_attribute) {
- const StringRefNull attribute_name = pair.first;
- const NamedAttributeUsage usage = pair.second;
+ for (const NameWithUsage &attribute : sorted_used_attribute) {
+ const StringRefNull attribute_name = attribute.name;
+ const NamedAttributeUsage usage = attribute.usage;
/* #uiLayoutRowWithHeading doesn't seem to work in this case. */
uiLayout *split = uiLayoutSplit(layout, 0.4f, false);