diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2011-09-06 00:41:58 +0400 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2011-09-06 00:41:58 +0400 |
commit | 6e9ff495eb082aeb49e6a1da23a7827d3fcd0fde (patch) | |
tree | 4f3c39b88d524edf516c232c9ee298d738dab87a /source/blender/collada/DocumentImporter.cpp | |
parent | 59a823c48aec80a48b39e27f8474302caf2dbf26 (diff) |
Add parser error handler.
OpenCOLLADA is a validating parser, so is pretty strict about document form. The added error handler will print out any errors the parser finds. A pop-up will be shown too, advising the user to check the console for the error log.
Diffstat (limited to 'source/blender/collada/DocumentImporter.cpp')
-rw-r--r-- | source/blender/collada/DocumentImporter.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 586c6ccfe82..366837421e3 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -76,6 +76,7 @@ #include "MEM_guardedalloc.h" #include "ExtraHandler.h" +#include "ErrorHandler.h" #include "DocumentImporter.h" #include "TransformReader.h" @@ -113,17 +114,19 @@ DocumentImporter::~DocumentImporter() bool DocumentImporter::import() { - /** TODO Add error handler (implement COLLADASaxFWL::IErrorHandler */ - COLLADASaxFWL::Loader loader; + ErrorHandler errorHandler; + COLLADASaxFWL::Loader loader(&errorHandler); COLLADAFW::Root root(&loader, this); ExtraHandler *ehandler = new ExtraHandler(this, &(this->anim_importer)); loader.registerExtraDataCallbackHandler(ehandler); - if (!root.loadDocument(mFilename)) return false; + if(errorHandler.hasError()) + return false; + /** TODO set up scene graph and such here */ mImportStage = Controller; |