[Bf-blender-cvs] [f3d5114c413] master: Fix T93285: Wrong instance order when instancing a collection

Germano Cavalcante noreply at git.blender.org
Wed Apr 27 16:19:57 CEST 2022


Commit: f3d5114c41352161d0dad7f30ef6b7dd1f28df85
Author: Germano Cavalcante
Date:   Wed Apr 27 11:18:23 2022 -0300
Branches: master
https://developer.blender.org/rBf3d5114c41352161d0dad7f30ef6b7dd1f28df85

Fix T93285: Wrong instance order when instancing a collection

At least on the Mac, `std::sort` sometimes passes the same value in the
`a` and `b` parameters.

The `true` return is only for cases where `a` is less than `b`.

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

M	source/blender/nodes/geometry/nodes/node_geo_collection_info.cc

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

diff --git a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
index 68d42444afd..54a061993a3 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
@@ -120,7 +120,7 @@ static void node_geo_exec(GeoNodeExecParams params)
     std::sort(entries.begin(),
               entries.end(),
               [](const InstanceListEntry &a, const InstanceListEntry &b) {
-                return BLI_strcasecmp_natural(a.name, b.name) <= 0;
+                return BLI_strcasecmp_natural(a.name, b.name) < 0;
               });
     for (const InstanceListEntry &entry : entries) {
       instances.add_instance(entry.handle, entry.transform);



More information about the Bf-blender-cvs mailing list