make xml parsing more verbose.
parent
484d305987
commit
c591f7de2f
|
@ -48,12 +48,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "AMFImporter.hpp"
|
||||
|
||||
// Header files, Assimp.
|
||||
#include <assimp/SceneCombiner.h>
|
||||
#include <assimp/StandardShapes.h>
|
||||
#include <assimp/StringUtils.h>
|
||||
|
||||
// Header files, stdlib.
|
||||
#include <iterator>
|
||||
|
||||
namespace Assimp {
|
||||
|
@ -379,7 +377,9 @@ void AMFImporter::Postprocess_BuildMeshSet(const AMFMesh &pNodeElement, const st
|
|||
|
||||
// check if volume use material
|
||||
if (!ne_volume->MaterialID.empty()) {
|
||||
if (!Find_ConvertedMaterial(ne_volume->MaterialID, &cur_mat)) Throw_ID_NotFound(ne_volume->MaterialID);
|
||||
if (!Find_ConvertedMaterial(ne_volume->MaterialID, &cur_mat)) {
|
||||
Throw_ID_NotFound(ne_volume->MaterialID);
|
||||
}
|
||||
}
|
||||
|
||||
// inside "volume" collect all data and place to arrays or create new objects
|
||||
|
|
|
@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef INCLUDED_AI_IRRXML_WRAPPER
|
||||
#define INCLUDED_AI_IRRXML_WRAPPER
|
||||
|
||||
// some long includes ....
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
#include "BaseImporter.h"
|
||||
#include "IOStream.hpp"
|
||||
#include <pugixml.hpp>
|
||||
|
@ -117,6 +117,7 @@ public:
|
|||
|
||||
bool parse(IOStream *stream) {
|
||||
if (nullptr == stream) {
|
||||
ASSIMP_LOG_DEBUG("Stream is nullptr.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -126,6 +127,7 @@ public:
|
|||
mDoc = new pugi::xml_document();
|
||||
pugi::xml_parse_result parse_result = mDoc->load_string(&mData[0], pugi::parse_full);
|
||||
if (parse_result.status == pugi::status_ok) {
|
||||
ASSIMP_LOG_DEBUG("Error while parse xml.");
|
||||
result = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <assimp/scene.h>
|
||||
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
class utScene : public ::testing::Test {
|
||||
|
|
|
@ -58,25 +58,20 @@ protected:
|
|||
TEST_F(utXmlParser, parse_xml_test) {
|
||||
XmlParser parser;
|
||||
std::string filename = ASSIMP_TEST_MODELS_DIR "/x3d/ComputerKeyboard.x3d";
|
||||
IOStream *stream = mIoSystem.Open(filename.c_str(), "rb");
|
||||
bool result = parser.parse(stream);
|
||||
std::unique_ptr<IOStream> stream(mIoSystem.Open(filename.c_str(), "rb"));
|
||||
EXPECT_NE(stream.get(), nullptr);
|
||||
bool result = parser.parse(stream.get());
|
||||
EXPECT_TRUE(result);
|
||||
mIoSystem.Close(stream);
|
||||
}
|
||||
|
||||
TEST_F(utXmlParser, parse_xml_and_traverse_test) {
|
||||
XmlParser parser;
|
||||
std::string filename = ASSIMP_TEST_MODELS_DIR "/x3d/ComputerKeyboard.x3d";
|
||||
|
||||
IOStream *stream = mIoSystem.Open(filename.c_str(), "rb");
|
||||
bool result = parser.parse(stream);
|
||||
std::unique_ptr<IOStream> stream(mIoSystem.Open(filename.c_str(), "rb"));
|
||||
EXPECT_NE(stream.get(), nullptr);
|
||||
bool result = parser.parse(stream.get());
|
||||
EXPECT_TRUE(result);
|
||||
XmlNode root = parser.getRootNode();
|
||||
std::string name = root.name();
|
||||
std::string name1 = root.name();
|
||||
EXPECT_NE(nullptr, root);
|
||||
mIoSystem.Close(stream);
|
||||
std::string name2 = root.name();
|
||||
|
||||
XmlNodeIterator nodeIt(root);
|
||||
EXPECT_TRUE(nodeIt.isEmpty());
|
||||
|
|
Loading…
Reference in New Issue