2
0

X3DImporter.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. /*
  2. Open Asset Import Library (assimp)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2024, assimp team
  5. All rights reserved.
  6. Redistribution and use of this software in source and binary forms,
  7. with or without modification, are permitted provided that the
  8. following conditions are met:
  9. * Redistributions of source code must retain the above
  10. copyright notice, this list of conditions and the
  11. following disclaimer.
  12. * Redistributions in binary form must reproduce the above
  13. copyright notice, this list of conditions and the
  14. following disclaimer in the documentation and/or other
  15. materials provided with the distribution.
  16. * Neither the name of the assimp team, nor the names of its
  17. contributors may be used to endorse or promote products
  18. derived from this software without specific prior
  19. written permission of the assimp team.
  20. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. ----------------------------------------------------------------------
  32. */
  33. /// \file X3DImporter.cpp
  34. /// \brief X3D-format files importer for Assimp: main algorithm implementation.
  35. /// \date 2015-2016
  36. /// \author [email protected]
  37. #ifndef ASSIMP_BUILD_NO_X3D_IMPORTER
  38. #include "AssetLib/VRML/VrmlConverter.hpp"
  39. #include "X3DImporter.hpp"
  40. #include "X3DImporter_Macro.hpp"
  41. #include <assimp/DefaultIOSystem.h>
  42. // Header files, stdlib.
  43. #include <iterator>
  44. #include <memory>
  45. #if defined(ASSIMP_BUILD_NO_VRML_IMPORTER)
  46. #define X3D_FORMATS_DESCR_STR "Extensible 3D(X3D, X3DB) Importer"
  47. #define X3D_FORMATS_EXTENSIONS_STR "x3d x3db"
  48. #else
  49. #define X3D_FORMATS_DESCR_STR "VRML(WRL, X3DV) and Extensible 3D(X3D, X3DB) Importer"
  50. #define X3D_FORMATS_EXTENSIONS_STR "wrl x3d x3db x3dv"
  51. #endif // #if defined(ASSIMP_BUILD_NO_VRML_IMPORTER)
  52. namespace Assimp {
  53. /// Constant which holds the importer description
  54. const aiImporterDesc X3DImporter::Description = {
  55. X3D_FORMATS_DESCR_STR,
  56. "smalcom",
  57. "",
  58. "See documentation in source code. Chapter: Limitations.",
  59. aiImporterFlags_SupportTextFlavour | aiImporterFlags_SupportBinaryFlavour | aiImporterFlags_LimitedSupport | aiImporterFlags_Experimental,
  60. 0,
  61. 0,
  62. 0,
  63. 0,
  64. X3D_FORMATS_EXTENSIONS_STR
  65. };
  66. bool X3DImporter::isNodeEmpty(XmlNode &node) {
  67. return node.first_child().empty();
  68. }
  69. void X3DImporter::checkNodeMustBeEmpty(XmlNode &node) {
  70. if (!isNodeEmpty(node)) throw DeadlyImportError(std::string("Node <") + node.name() + "> must be empty.");
  71. }
  72. void X3DImporter::skipUnsupportedNode(const std::string &pParentNodeName, XmlNode &node) {
  73. static const size_t Uns_Skip_Len = 192;
  74. static const char *Uns_Skip[Uns_Skip_Len] = {
  75. // CAD geometry component
  76. "CADAssembly", "CADFace", "CADLayer", "CADPart", "IndexedQuadSet", "QuadSet",
  77. // Core
  78. "ROUTE", "ExternProtoDeclare", "ProtoDeclare", "ProtoInstance", "ProtoInterface", "WorldInfo",
  79. // Distributed interactive simulation (DIS) component
  80. "DISEntityManager", "DISEntityTypeMapping", "EspduTransform", "ReceiverPdu", "SignalPdu", "TransmitterPdu",
  81. // Cube map environmental texturing component
  82. "ComposedCubeMapTexture", "GeneratedCubeMapTexture", "ImageCubeMapTexture",
  83. // Environmental effects component
  84. "Background", "Fog", "FogCoordinate", "LocalFog", "TextureBackground",
  85. // Environmental sensor component
  86. "ProximitySensor", "TransformSensor", "VisibilitySensor",
  87. // Followers component
  88. "ColorChaser", "ColorDamper", "CoordinateChaser", "CoordinateDamper", "OrientationChaser", "OrientationDamper", "PositionChaser", "PositionChaser2D",
  89. "PositionDamper", "PositionDamper2D", "ScalarChaser", "ScalarDamper", "TexCoordChaser2D", "TexCoordDamper2D",
  90. // Geospatial component
  91. "GeoCoordinate", "GeoElevationGrid", "GeoLocation", "GeoLOD", "GeoMetadata", "GeoOrigin", "GeoPositionInterpolator", "GeoProximitySensor",
  92. "GeoTouchSensor", "GeoTransform", "GeoViewpoint",
  93. // Humanoid Animation (H-Anim) component
  94. "HAnimDisplacer", "HAnimHumanoid", "HAnimJoint", "HAnimSegment", "HAnimSite",
  95. // Interpolation component
  96. "ColorInterpolator", "CoordinateInterpolator", "CoordinateInterpolator2D", "EaseInEaseOut", "NormalInterpolator", "OrientationInterpolator",
  97. "PositionInterpolator", "PositionInterpolator2D", "ScalarInterpolator", "SplinePositionInterpolator", "SplinePositionInterpolator2D",
  98. "SplineScalarInterpolator", "SquadOrientationInterpolator",
  99. // Key device sensor component
  100. "KeySensor", "StringSensor",
  101. // Layering component
  102. "Layer", "LayerSet", "Viewport",
  103. // Layout component
  104. "Layout", "LayoutGroup", "LayoutLayer", "ScreenFontStyle", "ScreenGroup",
  105. // Navigation component
  106. "Billboard", "Collision", "LOD", "NavigationInfo", "OrthoViewpoint", "Viewpoint", "ViewpointGroup",
  107. // Networking component
  108. "EXPORT", "IMPORT", "Anchor", "LoadSensor",
  109. // NURBS component
  110. "Contour2D", "ContourPolyline2D", "CoordinateDouble", "NurbsCurve", "NurbsCurve2D", "NurbsOrientationInterpolator", "NurbsPatchSurface",
  111. "NurbsPositionInterpolator", "NurbsSet", "NurbsSurfaceInterpolator", "NurbsSweptSurface", "NurbsSwungSurface", "NurbsTextureCoordinate",
  112. "NurbsTrimmedSurface",
  113. // Particle systems component
  114. "BoundedPhysicsModel", "ConeEmitter", "ExplosionEmitter", "ForcePhysicsModel", "ParticleSystem", "PointEmitter", "PolylineEmitter", "SurfaceEmitter",
  115. "VolumeEmitter", "WindPhysicsModel",
  116. // Picking component
  117. "LinePickSensor", "PickableGroup", "PointPickSensor", "PrimitivePickSensor", "VolumePickSensor",
  118. // Pointing device sensor component
  119. "CylinderSensor", "PlaneSensor", "SphereSensor", "TouchSensor",
  120. // Rendering component
  121. "ClipPlane",
  122. // Rigid body physics
  123. "BallJoint", "CollidableOffset", "CollidableShape", "CollisionCollection", "CollisionSensor", "CollisionSpace", "Contact", "DoubleAxisHingeJoint",
  124. "MotorJoint", "RigidBody", "RigidBodyCollection", "SingleAxisHingeJoint", "SliderJoint", "UniversalJoint",
  125. // Scripting component
  126. "Script",
  127. // Programmable shaders component
  128. "ComposedShader", "FloatVertexAttribute", "Matrix3VertexAttribute", "Matrix4VertexAttribute", "PackagedShader", "ProgramShader", "ShaderPart",
  129. "ShaderProgram",
  130. // Shape component
  131. "FillProperties", "LineProperties", "TwoSidedMaterial",
  132. // Sound component
  133. "AudioClip", "Sound",
  134. // Text component
  135. "FontStyle", "Text",
  136. // Texturing3D Component
  137. "ComposedTexture3D", "ImageTexture3D", "PixelTexture3D", "TextureCoordinate3D", "TextureCoordinate4D", "TextureTransformMatrix3D", "TextureTransform3D",
  138. // Texturing component
  139. "MovieTexture", "MultiTexture", "MultiTextureCoordinate", "MultiTextureTransform", "PixelTexture", "TextureCoordinateGenerator", "TextureProperties",
  140. // Time component
  141. "TimeSensor",
  142. // Event Utilities component
  143. "BooleanFilter", "BooleanSequencer", "BooleanToggle", "BooleanTrigger", "IntegerSequencer", "IntegerTrigger", "TimeTrigger",
  144. // Volume rendering component
  145. "BlendedVolumeStyle", "BoundaryEnhancementVolumeStyle", "CartoonVolumeStyle", "ComposedVolumeStyle", "EdgeEnhancementVolumeStyle", "IsoSurfaceVolumeData",
  146. "OpacityMapVolumeStyle", "ProjectionVolumeStyle", "SegmentedVolumeData", "ShadedVolumeStyle", "SilhouetteEnhancementVolumeStyle", "ToneMappedVolumeStyle",
  147. "VolumeData"
  148. };
  149. const std::string nn = node.name();
  150. if (nn.empty()) {
  151. const std::string nv = node.value();
  152. if (!nv.empty()) {
  153. LogInfo("Ignoring comment \"" + nv + "\" in " + pParentNodeName + ".");
  154. return;
  155. }
  156. }
  157. bool found = false;
  158. for (size_t i = 0; i < Uns_Skip_Len; i++) {
  159. if (nn == Uns_Skip[i]) {
  160. found = true;
  161. }
  162. }
  163. if (!found) throw DeadlyImportError("Unknown node \"" + nn + "\" in " + pParentNodeName + ".");
  164. LogInfo("Skipping node \"" + nn + "\" in " + pParentNodeName + ".");
  165. }
  166. X3DImporter::X3DImporter() :
  167. mNodeElementCur(nullptr),
  168. mScene(nullptr),
  169. mpIOHandler(nullptr) {
  170. // empty
  171. }
  172. X3DImporter::~X3DImporter() {
  173. // Clear() is accounting if data already is deleted. So, just check again if all data is deleted.
  174. Clear();
  175. }
  176. void X3DImporter::Clear() {
  177. mNodeElementCur = nullptr;
  178. // Delete all elements
  179. if (!NodeElement_List.empty()) {
  180. for (std::list<X3DNodeElementBase *>::iterator it = NodeElement_List.begin(); it != NodeElement_List.end(); ++it) {
  181. delete *it;
  182. }
  183. NodeElement_List.clear();
  184. }
  185. }
  186. void X3DImporter::ParseFile(const std::string &file, IOSystem *pIOHandler) {
  187. ai_assert(nullptr != pIOHandler);
  188. static const std::string mode = "rb";
  189. std::unique_ptr<IOStream> fileStream(pIOHandler->Open(file, mode));
  190. if (!fileStream) {
  191. throw DeadlyImportError("Failed to open file " + file + ".");
  192. }
  193. XmlParser theParser;
  194. if (!theParser.parse(fileStream.get())) {
  195. return;
  196. }
  197. ParseFile(theParser);
  198. }
  199. void X3DImporter::ParseFile(std::istream &myIstream) {
  200. XmlParser theParser;
  201. if (!theParser.parse(myIstream)) {
  202. LogInfo("ParseFile(): ERROR: failed to convert VRML istream to xml");
  203. return;
  204. }
  205. ParseFile(theParser);
  206. }
  207. void X3DImporter::ParseFile(XmlParser &theParser) {
  208. XmlNode *node = theParser.findNode("X3D");
  209. if (nullptr == node) {
  210. return;
  211. }
  212. for (auto &currentNode : node->children()) {
  213. const std::string &currentName = currentNode.name();
  214. if (currentName == "head") {
  215. readHead(currentNode);
  216. } else if (currentName == "Scene") {
  217. readScene(currentNode);
  218. } else {
  219. skipUnsupportedNode("X3D", currentNode);
  220. }
  221. }
  222. }
  223. bool X3DImporter::CanRead(const std::string &pFile, IOSystem * /*pIOHandler*/, bool checkSig) const {
  224. if (checkSig) {
  225. if (GetExtension(pFile) == "x3d")
  226. return true;
  227. }
  228. return false;
  229. }
  230. void X3DImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
  231. mpIOHandler = pIOHandler;
  232. Clear();
  233. std::stringstream ss = ConvertVrmlFileToX3dXmlFile(pFile);
  234. const bool isReadFromMem{ ss.str().length() > 0 };
  235. if (!isReadFromMem) {
  236. std::shared_ptr<IOStream> stream(pIOHandler->Open(pFile, "rb"));
  237. if (!stream) {
  238. throw DeadlyImportError("Could not open file for reading");
  239. }
  240. }
  241. std::string::size_type slashPos = pFile.find_last_of("\\/");
  242. mScene = pScene;
  243. pScene->mRootNode = new aiNode(pFile);
  244. pScene->mRootNode->mParent = nullptr;
  245. pScene->mFlags |= AI_SCENE_FLAGS_ALLOW_SHARED;
  246. if (isReadFromMem) {
  247. ParseFile(ss);
  248. } else {
  249. pIOHandler->PushDirectory(slashPos == std::string::npos ? std::string() : pFile.substr(0, slashPos + 1));
  250. ParseFile(pFile, pIOHandler);
  251. pIOHandler->PopDirectory();
  252. }
  253. //search for root node element
  254. mNodeElementCur = NodeElement_List.front();
  255. if (mNodeElementCur == nullptr) {
  256. return;
  257. }
  258. while (mNodeElementCur->Parent != nullptr) {
  259. mNodeElementCur = mNodeElementCur->Parent;
  260. }
  261. { // fill aiScene with objects.
  262. std::list<aiMesh *> mesh_list;
  263. std::list<aiMaterial *> mat_list;
  264. std::list<aiLight *> light_list;
  265. // create nodes tree
  266. Postprocess_BuildNode(*mNodeElementCur, *pScene->mRootNode, mesh_list, mat_list, light_list);
  267. // copy needed data to scene
  268. if (!mesh_list.empty()) {
  269. std::list<aiMesh *>::const_iterator it = mesh_list.begin();
  270. pScene->mNumMeshes = static_cast<unsigned int>(mesh_list.size());
  271. pScene->mMeshes = new aiMesh *[pScene->mNumMeshes];
  272. for (size_t i = 0; i < pScene->mNumMeshes; i++)
  273. pScene->mMeshes[i] = *it++;
  274. }
  275. if (!mat_list.empty()) {
  276. std::list<aiMaterial *>::const_iterator it = mat_list.begin();
  277. pScene->mNumMaterials = static_cast<unsigned int>(mat_list.size());
  278. pScene->mMaterials = new aiMaterial *[pScene->mNumMaterials];
  279. for (size_t i = 0; i < pScene->mNumMaterials; i++)
  280. pScene->mMaterials[i] = *it++;
  281. }
  282. if (!light_list.empty()) {
  283. std::list<aiLight *>::const_iterator it = light_list.begin();
  284. pScene->mNumLights = static_cast<unsigned int>(light_list.size());
  285. pScene->mLights = new aiLight *[pScene->mNumLights];
  286. for (size_t i = 0; i < pScene->mNumLights; i++)
  287. pScene->mLights[i] = *it++;
  288. }
  289. }
  290. }
  291. const aiImporterDesc *X3DImporter::GetInfo() const {
  292. return &Description;
  293. }
  294. struct meta_entry {
  295. std::string name;
  296. std::string value;
  297. };
  298. void X3DImporter::readHead(XmlNode &node) {
  299. std::vector<meta_entry> metaArray;
  300. for (auto currentNode : node.children()) {
  301. const std::string &currentName = currentNode.name();
  302. if (currentName == "meta") {
  303. //checkNodeMustBeEmpty(node);
  304. meta_entry entry;
  305. if (XmlParser::getStdStrAttribute(currentNode, "name", entry.name)) {
  306. XmlParser::getStdStrAttribute(currentNode, "content", entry.value);
  307. metaArray.emplace_back(entry);
  308. }
  309. }
  310. // TODO: check if other node types in head should be supported
  311. }
  312. mScene->mMetaData = aiMetadata::Alloc(static_cast<unsigned int>(metaArray.size()));
  313. unsigned int i = 0;
  314. for (const auto& currentMeta : metaArray) {
  315. mScene->mMetaData->Set(i, currentMeta.name, aiString(currentMeta.value));
  316. ++i;
  317. }
  318. }
  319. void X3DImporter::readChildNodes(XmlNode &node, const std::string &pParentNodeName) {
  320. if (node.empty()) {
  321. return;
  322. }
  323. for (auto currentNode : node.children()) {
  324. const std::string &currentName = currentNode.name();
  325. if (currentName == "Shape")
  326. readShape(currentNode);
  327. else if (currentName == "Group") {
  328. startReadGroup(currentNode);
  329. readChildNodes(currentNode, "Group");
  330. endReadGroup();
  331. } else if (currentName == "StaticGroup") {
  332. startReadStaticGroup(currentNode);
  333. readChildNodes(currentNode, "StaticGroup");
  334. endReadStaticGroup();
  335. } else if (currentName == "Transform") {
  336. startReadTransform(currentNode);
  337. readChildNodes(currentNode, "Transform");
  338. endReadTransform();
  339. } else if (currentName == "Switch") {
  340. startReadSwitch(currentNode);
  341. readChildNodes(currentNode, "Switch");
  342. endReadSwitch();
  343. } else if (currentName == "DirectionalLight") {
  344. readDirectionalLight(currentNode);
  345. } else if (currentName == "PointLight") {
  346. readPointLight(currentNode);
  347. } else if (currentName == "SpotLight") {
  348. readSpotLight(currentNode);
  349. } else if (currentName == "Inline") {
  350. readInline(currentNode);
  351. } else if (!checkForMetadataNode(currentNode)) {
  352. skipUnsupportedNode(pParentNodeName, currentNode);
  353. }
  354. }
  355. }
  356. void X3DImporter::readScene(XmlNode &node) {
  357. ParseHelper_Group_Begin(true);
  358. readChildNodes(node, "Scene");
  359. ParseHelper_Node_Exit();
  360. }
  361. /*********************************************************************************************************************************************/
  362. /************************************************************ Functions: find set ************************************************************/
  363. /*********************************************************************************************************************************************/
  364. bool X3DImporter::FindNodeElement_FromRoot(const std::string &pID, const X3DElemType pType, X3DNodeElementBase **pElement) {
  365. for (std::list<X3DNodeElementBase *>::iterator it = NodeElement_List.begin(); it != NodeElement_List.end(); ++it) {
  366. if (((*it)->Type == pType) && ((*it)->ID == pID)) {
  367. if (pElement != nullptr) *pElement = *it;
  368. return true;
  369. }
  370. } // for(std::list<CX3DImporter_NodeElement*>::iterator it = NodeElement_List.begin(); it != NodeElement_List.end(); it++)
  371. return false;
  372. }
  373. bool X3DImporter::FindNodeElement_FromNode(X3DNodeElementBase *pStartNode, const std::string &pID,
  374. const X3DElemType pType, X3DNodeElementBase **pElement) {
  375. bool found = false; // flag: true - if requested element is found.
  376. // Check if pStartNode - this is the element, we are looking for.
  377. if ((pStartNode->Type == pType) && (pStartNode->ID == pID)) {
  378. found = true;
  379. if (pElement != nullptr) {
  380. *pElement = pStartNode;
  381. }
  382. goto fne_fn_end;
  383. } // if((pStartNode->Type() == pType) && (pStartNode->ID() == pID))
  384. // Check childs of pStartNode.
  385. for (std::list<X3DNodeElementBase *>::iterator ch_it = pStartNode->Children.begin(); ch_it != pStartNode->Children.end(); ++ch_it) {
  386. found = FindNodeElement_FromNode(*ch_it, pID, pType, pElement);
  387. if (found) {
  388. break;
  389. }
  390. } // for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = it->Children.begin(); ch_it != it->Children.end(); ch_it++)
  391. fne_fn_end:
  392. return found;
  393. }
  394. bool X3DImporter::FindNodeElement(const std::string &pID, const X3DElemType pType, X3DNodeElementBase **pElement) {
  395. X3DNodeElementBase *tnd = mNodeElementCur; // temporary pointer to node.
  396. bool static_search = false; // flag: true if searching in static node.
  397. // At first check if we have deal with static node. Go up through parent nodes and check flag.
  398. while (tnd != nullptr) {
  399. if (tnd->Type == X3DElemType::ENET_Group) {
  400. if (((X3DNodeElementGroup *)tnd)->Static) {
  401. static_search = true; // Flag found, stop walking up. Node with static flag will holded in tnd variable.
  402. break;
  403. }
  404. }
  405. tnd = tnd->Parent; // go up in graph.
  406. } // while (tnd != nullptr)
  407. // at now call appropriate search function.
  408. if (static_search) {
  409. return FindNodeElement_FromNode(tnd, pID, pType, pElement);
  410. } else {
  411. return FindNodeElement_FromRoot(pID, pType, pElement);
  412. }
  413. }
  414. /*********************************************************************************************************************************************/
  415. /************************************************************ Functions: parse set ***********************************************************/
  416. /*********************************************************************************************************************************************/
  417. void X3DImporter::ParseHelper_Group_Begin(const bool pStatic) {
  418. X3DNodeElementGroup *new_group = new X3DNodeElementGroup(mNodeElementCur, pStatic); // create new node with current node as parent.
  419. // if we are adding not the root element then add new element to current element child list.
  420. if (mNodeElementCur != nullptr) {
  421. mNodeElementCur->Children.push_back(new_group);
  422. }
  423. NodeElement_List.push_back(new_group); // it's a new element - add it to list.
  424. mNodeElementCur = new_group; // switch current element to new one.
  425. }
  426. void X3DImporter::ParseHelper_Node_Enter(X3DNodeElementBase *pNode) {
  427. ai_assert(nullptr != pNode);
  428. mNodeElementCur->Children.push_back(pNode); // add new element to current element child list.
  429. mNodeElementCur = pNode; // switch current element to new one.
  430. }
  431. void X3DImporter::ParseHelper_Node_Exit() {
  432. // check if we can walk up.
  433. if (mNodeElementCur != nullptr) {
  434. mNodeElementCur = mNodeElementCur->Parent;
  435. }
  436. }
  437. } // namespace Assimp
  438. #endif // !ASSIMP_BUILD_NO_X3D_IMPORTER