diff --git a/code/OpenGEXImporter.cpp b/code/OpenGEXImporter.cpp index 673deb6f8..af9b550b5 100644 --- a/code/OpenGEXImporter.cpp +++ b/code/OpenGEXImporter.cpp @@ -60,6 +60,23 @@ static const aiImporterDesc desc = { "ogex" }; +namespace Grammar { + static const char *MetricType = "Metric"; + static const char *NameType = "Name"; + static const char *ObjectRefType = "ObjectRef"; + static const char *MaterialRefType = "MaterialRef"; + static const char *MetricKeyType = "key"; + static const char *GeometryNodeType = "GeometryNode"; + static const char *GeometryObjectType = "GeometryObject"; + static const char *TransformType = "Transform"; + static const char *MeshType = "Mesh"; + static const char *VertexArrayType = "VertexArray"; + static const char *IndexArrayType = "IndexArray"; + static const char *MaterialType = "Material"; + static const char *ColorType = "Color"; + static const char *TextureType = "Texture"; +} // Namespace Grammar + namespace Assimp { namespace OpenGEX { @@ -104,7 +121,7 @@ void OpenGEXImporter::InternReadFile( const std::string &filename, aiScene *pSce bool success( myParser.parse() ); if( success ) { Context *ctx = myParser.getContext(); - importMetric( ctx ); + handleNodes( ctx->m_root ); } } @@ -115,14 +132,44 @@ const aiImporterDesc *OpenGEXImporter::GetInfo() const { //------------------------------------------------------------------------------------------------ void OpenGEXImporter::SetupProperties( const Importer *pImp ) { - + if( NULL == pImp ) { + return; + } } //------------------------------------------------------------------------------------------------ -void OpenGEXImporter::importMetric( Context *ctx ) { - if( NULL == ctx ) { +void OpenGEXImporter::handleNodes( ODDLParser::DDLNode *node ) { + if( NULL == node ) { return; } + + DDLNode::DllNodeList childs = node->getChildNodeList(); + for( DDLNode::DllNodeList::iterator it = childs.begin(); it != childs.end(); it++ ) { + if( ( *it )->getType() == Grammar::MetricType ) { + importMetric( *it ); + } + } +} + +//------------------------------------------------------------------------------------------------ +void OpenGEXImporter::importMetric( DDLNode *node ) { + if( NULL == node ) { + return; + } + + Property *prop( node->getProperties() ); + while( NULL != prop ) { + if( NULL != prop->m_id ) { + if( Value::ddl_string == prop->m_primData->m_type ) { + std::string valName( (char*) prop->m_primData->m_data ); + Value *val( node->getValue() ); + if( NULL != val ) { + + } + } + } + prop = prop->m_next; + } } //------------------------------------------------------------------------------------------------ diff --git a/code/OpenGEXImporter.h b/code/OpenGEXImporter.h index 601721704..58641775e 100644 --- a/code/OpenGEXImporter.h +++ b/code/OpenGEXImporter.h @@ -46,6 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace ODDLParser { + class DDLNode; struct Context; } @@ -77,7 +78,8 @@ public: virtual void SetupProperties( const Importer *pImp ); protected: - void importMetric( ODDLParser::Context *ctx ); + void handleNodes( ODDLParser::DDLNode *node ); + void importMetric( ODDLParser::DDLNode *node ); void ParseGeoObject(); void ParseMaterial(); };