Blender importer: always sort sets of objects by their name. Previously we accidentally ordered pointers to objects by their memory address, which was non-deterministic and caused regression tests to be flaky.
parent
e976cc2117
commit
1c64c590f2
|
@ -118,6 +118,16 @@ namespace Blender {
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# pragma warning(disable:4351)
|
# pragma warning(disable:4351)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct ObjectCompare {
|
||||||
|
bool operator() (const Object* left, const Object* right) const {
|
||||||
|
return strcmp(left->id.name, right->id.name) == -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// When keeping objects in sets, sort them by their name.
|
||||||
|
typedef std::set<const Object*, ObjectCompare> ObjectSet;
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
/** ConversionData acts as intermediate storage location for
|
/** ConversionData acts as intermediate storage location for
|
||||||
* the various ConvertXXX routines in BlenderImporter.*/
|
* the various ConvertXXX routines in BlenderImporter.*/
|
||||||
|
@ -130,7 +140,13 @@ namespace Blender {
|
||||||
, db(db)
|
, db(db)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::set<const Object*> objects;
|
struct ObjectCompare {
|
||||||
|
bool operator() (const Object* left, const Object* right) const {
|
||||||
|
return strcmp(left->id.name, right->id.name) == -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ObjectSet objects;
|
||||||
|
|
||||||
TempArray <std::vector, aiMesh> meshes;
|
TempArray <std::vector, aiMesh> meshes;
|
||||||
TempArray <std::vector, aiCamera> cameras;
|
TempArray <std::vector, aiCamera> cameras;
|
||||||
|
|
|
@ -1044,7 +1044,7 @@ aiLight* BlenderImporter::ConvertLight(const Scene& /*in*/, const Object* obj, c
|
||||||
aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, ConversionData& conv_data, const aiMatrix4x4& parentTransform)
|
aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, ConversionData& conv_data, const aiMatrix4x4& parentTransform)
|
||||||
{
|
{
|
||||||
std::deque<const Object*> children;
|
std::deque<const Object*> children;
|
||||||
for(std::set<const Object*>::iterator it = conv_data.objects.begin(); it != conv_data.objects.end() ;) {
|
for(ObjectSet::iterator it = conv_data.objects.begin(); it != conv_data.objects.end() ;) {
|
||||||
const Object* object = *it;
|
const Object* object = *it;
|
||||||
if (object->parent == obj) {
|
if (object->parent == obj) {
|
||||||
children.push_back(object);
|
children.push_back(object);
|
||||||
|
|
Loading…
Reference in New Issue