X3DImporter_Networking.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /// \file X3DImporter_Networking.cpp
  2. /// \brief Parsing data from nodes of "Networking" set of X3D.
  3. /// \date 2015-2016
  4. /// \author [email protected]
  5. #ifndef ASSIMP_BUILD_NO_X3D_IMPORTER
  6. #include "X3DImporter.hpp"
  7. #include "X3DImporter_Macro.hpp"
  8. // Header files, Assimp.
  9. #include "DefaultIOSystem.h"
  10. namespace Assimp
  11. {
  12. // <Inline
  13. // DEF="" ID
  14. // USE="" IDREF
  15. // bboxCenter="0 0 0" SFVec3f [initializeOnly]
  16. // bboxSize="-1 -1 -1" SFVec3f [initializeOnly]
  17. // load="true" SFBool [inputOutput]
  18. // url="" MFString [inputOutput]
  19. // />
  20. void X3DImporter::ParseNode_Networking_Inline()
  21. {
  22. std::string def, use;
  23. bool load = true;
  24. std::list<std::string> url;
  25. MACRO_ATTRREAD_LOOPBEG;
  26. MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
  27. MACRO_ATTRREAD_CHECK_RET("load", load, XML_ReadNode_GetAttrVal_AsBool);
  28. MACRO_ATTRREAD_CHECK_REF("url", url, XML_ReadNode_GetAttrVal_AsListS);
  29. MACRO_ATTRREAD_LOOPEND;
  30. // if "USE" defined then find already defined element.
  31. if(!use.empty())
  32. {
  33. CX3DImporter_NodeElement* ne;
  34. MACRO_USE_CHECKANDAPPLY(def, use, ENET_Group, ne);
  35. }
  36. else
  37. {
  38. ParseHelper_Group_Begin(true);// create new grouping element and go deeper if node has children.
  39. // at this place new group mode created and made current, so we can name it.
  40. if(!def.empty()) NodeElement_Cur->ID = def;
  41. if(load && (url.size() > 0))
  42. {
  43. DefaultIOSystem io_handler;
  44. std::string full_path;
  45. full_path = mFileDir + "/" + url.front();
  46. // Attribute "url" can contain list of strings. But we need only one - first.
  47. ParseFile(full_path, &io_handler);
  48. }
  49. // check for X3DMetadataObject childs.
  50. if(!mReader->isEmptyElement()) ParseNode_Metadata(NodeElement_Cur, "Inline");
  51. // exit from node in that place
  52. ParseHelper_Node_Exit();
  53. }// if(!use.empty()) else
  54. }
  55. }// namespace Assimp
  56. #endif // !ASSIMP_BUILD_NO_X3D_IMPORTER