You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

174 regels
5.3 KiB

  1. /*
  2. Open Asset Import Library (assimp)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2012, 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 FBXNoteAttribute.cpp
  34. * @brief Assimp::FBX::NodeAttribute (and subclasses) implementation
  35. */
  36. #include "AssimpPCH.h"
  37. #ifndef ASSIMP_BUILD_NO_FBX_IMPORTER
  38. #include "FBXParser.h"
  39. #include "FBXDocument.h"
  40. #include "FBXImporter.h"
  41. #include "FBXImportSettings.h"
  42. #include "FBXDocumentUtil.h"
  43. #include "FBXProperties.h"
  44. namespace Assimp {
  45. namespace FBX {
  46. using namespace Util;
  47. // ------------------------------------------------------------------------------------------------
  48. NodeAttribute::NodeAttribute(uint64_t id, const Element& element, const Document& doc, const std::string& name)
  49. : Object(id,element,name)
  50. {
  51. const Scope& sc = GetRequiredScope(element);
  52. const std::string& classname = ParseTokenAsString(GetRequiredToken(element,2));
  53. // hack on the deriving type but Null/LimbNode attributes are the only case in which
  54. // the property table is by design absent and no warning should be generated
  55. // for it.
  56. const bool is_null_or_limb = !strcmp(classname.c_str(), "Null") || !strcmp(classname.c_str(), "LimbNode");
  57. props = GetPropertyTable(doc,"NodeAttribute.Fbx" + classname,element,sc, is_null_or_limb);
  58. }
  59. // ------------------------------------------------------------------------------------------------
  60. NodeAttribute::~NodeAttribute()
  61. {
  62. }
  63. // ------------------------------------------------------------------------------------------------
  64. CameraSwitcher::CameraSwitcher(uint64_t id, const Element& element, const Document& doc, const std::string& name)
  65. : NodeAttribute(id,element,doc,name)
  66. {
  67. const Scope& sc = GetRequiredScope(element);
  68. const Element* const CameraId = sc["CameraId"];
  69. const Element* const CameraName = sc["CameraName"];
  70. const Element* const CameraIndexName = sc["CameraIndexName"];
  71. if(CameraId) {
  72. cameraId = ParseTokenAsInt(GetRequiredToken(*CameraId,0));
  73. }
  74. if(CameraName) {
  75. cameraName = GetRequiredToken(*CameraName,0).StringContents();
  76. }
  77. if(CameraIndexName && CameraIndexName->Tokens().size()) {
  78. cameraIndexName = GetRequiredToken(*CameraIndexName,0).StringContents();
  79. }
  80. }
  81. // ------------------------------------------------------------------------------------------------
  82. CameraSwitcher::~CameraSwitcher()
  83. {
  84. }
  85. // ------------------------------------------------------------------------------------------------
  86. Camera::Camera(uint64_t id, const Element& element, const Document& doc, const std::string& name)
  87. : NodeAttribute(id,element,doc,name)
  88. {
  89. }
  90. // ------------------------------------------------------------------------------------------------
  91. Camera::~Camera()
  92. {
  93. }
  94. // ------------------------------------------------------------------------------------------------
  95. Light::Light(uint64_t id, const Element& element, const Document& doc, const std::string& name)
  96. : NodeAttribute(id,element,doc,name)
  97. {
  98. }
  99. // ------------------------------------------------------------------------------------------------
  100. Light::~Light()
  101. {
  102. }
  103. // ------------------------------------------------------------------------------------------------
  104. Null::Null(uint64_t id, const Element& element, const Document& doc, const std::string& name)
  105. : NodeAttribute(id,element,doc,name)
  106. {
  107. }
  108. // ------------------------------------------------------------------------------------------------
  109. Null::~Null()
  110. {
  111. }
  112. // ------------------------------------------------------------------------------------------------
  113. LimbNode::LimbNode(uint64_t id, const Element& element, const Document& doc, const std::string& name)
  114. : NodeAttribute(id,element,doc,name)
  115. {
  116. }
  117. // ------------------------------------------------------------------------------------------------
  118. LimbNode::~LimbNode()
  119. {
  120. }
  121. }
  122. }
  123. #endif