fix https://github.com/assimp/assimp/issues/946: use correct test for objectcompare in blender.
parent
23baecaff3
commit
5fc3ee9a21
|
@ -61,15 +61,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
// #define ASSIMP_BUILD_BLENDER_NO_STATS
|
// #define ASSIMP_BUILD_BLENDER_NO_STATS
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
template <bool,bool> class StreamReader;
|
|
||||||
typedef StreamReader<true,true> StreamReaderAny;
|
|
||||||
|
|
||||||
namespace Blender {
|
template <bool,bool> class StreamReader;
|
||||||
class FileDatabase;
|
typedef StreamReader<true,true> StreamReaderAny;
|
||||||
struct FileBlockHead;
|
|
||||||
|
|
||||||
template <template <typename> class TOUT>
|
namespace Blender {
|
||||||
class ObjectCache;
|
|
||||||
|
class FileDatabase;
|
||||||
|
struct FileBlockHead;
|
||||||
|
|
||||||
|
template <template <typename> class TOUT>
|
||||||
|
class ObjectCache;
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
/** Exception class used by the blender loader to selectively catch exceptions
|
/** Exception class used by the blender loader to selectively catch exceptions
|
||||||
|
@ -78,20 +80,21 @@ namespace Assimp {
|
||||||
* the loader itself, it will still be caught by Assimp due to its
|
* the loader itself, it will still be caught by Assimp due to its
|
||||||
* ancestry. */
|
* ancestry. */
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
struct Error : DeadlyImportError
|
struct Error : DeadlyImportError {
|
||||||
{
|
|
||||||
Error (const std::string& s)
|
Error (const std::string& s)
|
||||||
: DeadlyImportError(s)
|
: DeadlyImportError(s) {
|
||||||
{}
|
// empty
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
/** The only purpose of this structure is to feed a virtual dtor into its
|
/** The only purpose of this structure is to feed a virtual dtor into its
|
||||||
* descendents. It serves as base class for all data structure fields. */
|
* descendents. It serves as base class for all data structure fields. */
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
struct ElemBase
|
struct ElemBase {
|
||||||
{
|
virtual ~ElemBase() {
|
||||||
virtual ~ElemBase() {}
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
/** Type name of the element. The type
|
/** Type name of the element. The type
|
||||||
* string points is the `c_str` of the `name` attribute of the
|
* string points is the `c_str` of the `name` attribute of the
|
||||||
|
@ -103,25 +106,28 @@ struct ElemBase
|
||||||
const char* dna_type;
|
const char* dna_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
/** Represents a generic pointer to a memory location, which can be either 32
|
/** Represents a generic pointer to a memory location, which can be either 32
|
||||||
* or 64 bits. These pointers are loaded from the BLEND file and finally
|
* or 64 bits. These pointers are loaded from the BLEND file and finally
|
||||||
* fixed to point to the real, converted representation of the objects
|
* fixed to point to the real, converted representation of the objects
|
||||||
* they used to point to.*/
|
* they used to point to.*/
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
struct Pointer
|
struct Pointer {
|
||||||
{
|
Pointer()
|
||||||
Pointer() : val() {}
|
: val() {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
uint64_t val;
|
uint64_t val;
|
||||||
};
|
};
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
/** Represents a generic offset within a BLEND file */
|
/** Represents a generic offset within a BLEND file */
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
struct FileOffset
|
struct FileOffset {
|
||||||
{
|
FileOffset()
|
||||||
FileOffset() : val() {}
|
: val() {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
uint64_t val;
|
uint64_t val;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -132,8 +138,7 @@ struct FileOffset
|
||||||
* functions of shared_ptr */
|
* functions of shared_ptr */
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class vector : public std::vector<T>
|
class vector : public std::vector<T> {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
using std::vector<T>::resize;
|
using std::vector<T>::resize;
|
||||||
using std::vector<T>::empty;
|
using std::vector<T>::empty;
|
||||||
|
@ -150,8 +155,7 @@ public:
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
/** Mixed flags for use in #Field */
|
/** Mixed flags for use in #Field */
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
enum FieldFlags
|
enum FieldFlags {
|
||||||
{
|
|
||||||
FieldFlag_Pointer = 0x1,
|
FieldFlag_Pointer = 0x1,
|
||||||
FieldFlag_Array = 0x2
|
FieldFlag_Array = 0x2
|
||||||
};
|
};
|
||||||
|
@ -159,8 +163,7 @@ enum FieldFlags
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
/** Represents a single member of a data structure in a BLEND file */
|
/** Represents a single member of a data structure in a BLEND file */
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
struct Field
|
struct Field {
|
||||||
{
|
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string type;
|
std::string type;
|
||||||
|
|
||||||
|
@ -180,8 +183,7 @@ struct Field
|
||||||
* mission critical so we need them, while others can silently be default
|
* mission critical so we need them, while others can silently be default
|
||||||
* initialized and no animations are harmed. */
|
* initialized and no animations are harmed. */
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
enum ErrorPolicy
|
enum ErrorPolicy {
|
||||||
{
|
|
||||||
/** Substitute default value and ignore */
|
/** Substitute default value and ignore */
|
||||||
ErrorPolicy_Igno,
|
ErrorPolicy_Igno,
|
||||||
/** Substitute default value and write to log */
|
/** Substitute default value and write to log */
|
||||||
|
@ -202,15 +204,14 @@ enum ErrorPolicy
|
||||||
* binary `blob` read from the file to such a structure instance with
|
* binary `blob` read from the file to such a structure instance with
|
||||||
* meaningful contents. */
|
* meaningful contents. */
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
class Structure
|
class Structure {
|
||||||
{
|
|
||||||
template <template <typename> class> friend class ObjectCache;
|
template <template <typename> class> friend class ObjectCache;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Structure()
|
Structure()
|
||||||
: cache_idx(static_cast<size_t>(-1) )
|
: cache_idx(static_cast<size_t>(-1) ){
|
||||||
{}
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -709,8 +710,6 @@ class FileDatabase
|
||||||
template <template <typename> class TOUT> friend class ObjectCache;
|
template <template <typename> class TOUT> friend class ObjectCache;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
FileDatabase()
|
FileDatabase()
|
||||||
: _cacheArrays(*this)
|
: _cacheArrays(*this)
|
||||||
, _cache(*this)
|
, _cache(*this)
|
||||||
|
@ -718,7 +717,6 @@ public:
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// publicly accessible fields
|
// publicly accessible fields
|
||||||
bool i64bit;
|
bool i64bit;
|
||||||
bool little;
|
bool little;
|
||||||
|
|
|
@ -123,7 +123,8 @@ namespace Blender {
|
||||||
|
|
||||||
struct ObjectCompare {
|
struct ObjectCompare {
|
||||||
bool operator() (const Object* left, const Object* right) const {
|
bool operator() (const Object* left, const Object* right) const {
|
||||||
return strcmp(left->id.name, right->id.name) == -1;
|
printf( "left: %s, right: %s\n", left->id.name, right->id.name );
|
||||||
|
return ::strncmp(left->id.name, right->id.name, strlen( left->id.name ) ) == 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -144,7 +145,8 @@ namespace Blender {
|
||||||
|
|
||||||
struct ObjectCompare {
|
struct ObjectCompare {
|
||||||
bool operator() (const Object* left, const Object* right) const {
|
bool operator() (const Object* left, const Object* right) const {
|
||||||
return strcmp(left->id.name, right->id.name) == -1;
|
printf( "left: %s, right: %s\n", left->id.name, right->id.name );
|
||||||
|
return ::strncmp( left->id.name, right->id.name, strlen( left->id.name ) ) == 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ SOURCE_GROUP( unit FILES
|
||||||
|
|
||||||
SET( TEST_SRCS
|
SET( TEST_SRCS
|
||||||
unit/AssimpAPITest.cpp
|
unit/AssimpAPITest.cpp
|
||||||
|
unit/utBlenderIntermediate.cpp
|
||||||
unit/utBlendImportAreaLight.cpp
|
unit/utBlendImportAreaLight.cpp
|
||||||
unit/utBlendImportMaterials.cpp
|
unit/utBlendImportMaterials.cpp
|
||||||
unit/utColladaExportCamera.cpp
|
unit/utColladaExportCamera.cpp
|
||||||
|
|
Loading…
Reference in New Issue