update assimp to 5.2.3 Bugfix-Release

This commit is contained in:
AzaezelX 2022-04-26 11:56:24 -05:00
parent 3f796d2a06
commit f297476092
1150 changed files with 165834 additions and 112019 deletions

View file

@ -1,7 +1,7 @@
/*-----------------------------------------------------------------------------------------------
The MIT License (MIT)
Copyright (c) 2014-2015 Kim Kulling
Copyright (c) 2014-2020 Kim Kulling
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
@ -22,6 +22,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-----------------------------------------------------------------------------------------------*/
#include <openddlparser/DDLNode.h>
#include <openddlparser/OpenDDLParser.h>
#include <openddlparser/OpenDDLStream.h>
#include <algorithm>
@ -29,77 +30,76 @@ BEGIN_ODDLPARSER_NS
DDLNode::DllNodeList DDLNode::s_allocatedNodes;
template<class T>
inline
static void releaseDataType( T *ptr ) {
if( ddl_nullptr == ptr ) {
template <class T>
inline static void releaseDataType(T *ptr) {
if (nullptr == ptr) {
return;
}
T *current( ddl_nullptr );
while( ptr ) {
T *current(nullptr);
while (ptr) {
current = ptr;
ptr = ptr->m_next;
delete current;
}
}
static void releaseReferencedNames( Reference *ref ) {
if( ddl_nullptr == ref ) {
static void releaseReferencedNames(Reference *ref) {
if (nullptr == ref) {
return;
}
delete ref;
}
DDLNode::DDLNode( const std::string &type, const std::string &name, size_t idx, DDLNode *parent )
: m_type( type )
, m_name( name )
, m_parent( parent )
, m_children()
, m_properties( ddl_nullptr )
, m_value( ddl_nullptr )
, m_dtArrayList( ddl_nullptr )
, m_references( ddl_nullptr )
, m_idx( idx ) {
if( m_parent ) {
m_parent->m_children.push_back( this );
DDLNode::DDLNode(const std::string &type, const std::string &name, size_t idx, DDLNode *parent) :
m_type(type),
m_name(name),
m_parent(parent),
m_children(),
m_properties(nullptr),
m_value(nullptr),
m_dtArrayList(nullptr),
m_references(nullptr),
m_idx(idx) {
if (m_parent) {
m_parent->m_children.push_back(this);
}
}
DDLNode::~DDLNode() {
delete m_properties;
delete m_value;
releaseReferencedNames( m_references );
releaseReferencedNames(m_references);
delete m_dtArrayList;
m_dtArrayList = ddl_nullptr;
if( s_allocatedNodes[ m_idx ] == this ) {
s_allocatedNodes[ m_idx ] = ddl_nullptr;
m_dtArrayList = nullptr;
if (s_allocatedNodes[m_idx] == this) {
s_allocatedNodes[m_idx] = nullptr;
}
for ( size_t i = 0; i<m_children.size(); i++ ){
delete m_children[ i ];
for (size_t i = 0; i < m_children.size(); i++) {
delete m_children[i];
}
}
void DDLNode::attachParent( DDLNode *parent ) {
if( m_parent == parent ) {
void DDLNode::attachParent(DDLNode *parent) {
if (m_parent == parent) {
return;
}
m_parent = parent;
if( ddl_nullptr != m_parent ) {
m_parent->m_children.push_back( this );
if (nullptr != m_parent) {
m_parent->m_children.push_back(this);
}
}
void DDLNode::detachParent() {
if( ddl_nullptr != m_parent ) {
DDLNodeIt it = std::find( m_parent->m_children.begin(), m_parent->m_children.end(), this );
if( m_parent->m_children.end() != it ) {
m_parent->m_children.erase( it );
if (nullptr != m_parent) {
DDLNodeIt it = std::find(m_parent->m_children.begin(), m_parent->m_children.end(), this);
if (m_parent->m_children.end() != it) {
m_parent->m_children.erase(it);
}
m_parent = ddl_nullptr;
m_parent = nullptr;
}
}
@ -111,7 +111,7 @@ const DDLNode::DllNodeList &DDLNode::getChildNodeList() const {
return m_children;
}
void DDLNode::setType( const std::string &type ) {
void DDLNode::setType(const std::string &type) {
m_type = type;
}
@ -119,7 +119,7 @@ const std::string &DDLNode::getType() const {
return m_type;
}
void DDLNode::setName( const std::string &name ) {
void DDLNode::setName(const std::string &name) {
m_name = name;
}
@ -127,8 +127,8 @@ const std::string &DDLNode::getName() const {
return m_name;
}
void DDLNode::setProperties( Property *prop ) {
if(m_properties!=ddl_nullptr)
void DDLNode::setProperties(Property *prop) {
if (m_properties != nullptr)
delete m_properties;
m_properties = prop;
}
@ -137,37 +137,37 @@ Property *DDLNode::getProperties() const {
return m_properties;
}
bool DDLNode::hasProperty( const std::string &name ) {
const Property *prop( findPropertyByName( name ) );
return ( ddl_nullptr != prop );
bool DDLNode::hasProperty(const std::string &name) {
const Property *prop(findPropertyByName(name));
return (nullptr != prop);
}
bool DDLNode::hasProperties() const {
return( ddl_nullptr != m_properties );
return (nullptr != m_properties);
}
Property *DDLNode::findPropertyByName( const std::string &name ) {
if( name.empty() ) {
return ddl_nullptr;
Property *DDLNode::findPropertyByName(const std::string &name) {
if (name.empty()) {
return nullptr;
}
if( ddl_nullptr == m_properties ) {
return ddl_nullptr;
if (nullptr == m_properties) {
return nullptr;
}
Property *current( m_properties );
while( ddl_nullptr != current ) {
int res = strncmp( current->m_key->m_buffer, name.c_str(), name.size() );
if( 0 == res ) {
Property *current(m_properties);
while (nullptr != current) {
int res = strncmp(current->m_key->m_buffer, name.c_str(), name.size());
if (0 == res) {
return current;
}
current = current->m_next;
}
return ddl_nullptr;
return nullptr;
}
void DDLNode::setValue( Value *val ) {
void DDLNode::setValue(Value *val) {
m_value = val;
}
@ -175,7 +175,7 @@ Value *DDLNode::getValue() const {
return m_value;
}
void DDLNode::setDataArrayList( DataArrayList *dtArrayList ) {
void DDLNode::setDataArrayList(DataArrayList *dtArrayList) {
m_dtArrayList = dtArrayList;
}
@ -183,7 +183,7 @@ DataArrayList *DDLNode::getDataArrayList() const {
return m_dtArrayList;
}
void DDLNode::setReferences( Reference *refs ) {
void DDLNode::setReferences(Reference *refs) {
m_references = refs;
}
@ -191,22 +191,32 @@ Reference *DDLNode::getReferences() const {
return m_references;
}
void DDLNode::dump(IOStreamBase &/*stream*/) {
// Todo!
void DDLNode::dump(IOStreamBase &stream) {
if (!stream.isOpen()) {
return;
}
const std::string &type = this->getType();
stream.write("type = " + type);
Value::Iterator it(getValue());
while (it.hasNext()) {
Value *v = it.getNext();
v->dump(stream);
}
}
DDLNode *DDLNode::create( const std::string &type, const std::string &name, DDLNode *parent ) {
const size_t idx( s_allocatedNodes.size() );
DDLNode *node = new DDLNode( type, name, idx, parent );
s_allocatedNodes.push_back( node );
DDLNode *DDLNode::create(const std::string &type, const std::string &name, DDLNode *parent) {
const size_t idx(s_allocatedNodes.size());
DDLNode *node = new DDLNode(type, name, idx, parent);
s_allocatedNodes.push_back(node);
return node;
}
void DDLNode::releaseNodes() {
if( s_allocatedNodes.size() > 0 ) {
for( DDLNodeIt it = s_allocatedNodes.begin(); it != s_allocatedNodes.end(); it++ ) {
if( *it ) {
if (s_allocatedNodes.size() > 0) {
for (DDLNodeIt it = s_allocatedNodes.begin(); it != s_allocatedNodes.end(); it++) {
if (*it) {
delete *it;
}
}