Browse Source

[F] Fixed type in list.
[+] Added function to metadata class for conveniance.
[*] Enumeration AI_INT changed to AI_INT32.

Alexandr Arutjunov 9 years ago
parent
commit
9d40f36f87
3 changed files with 29 additions and 11 deletions
  1. 2 0
      code/CMakeLists.txt
  2. 2 2
      code/SceneCombiner.cpp
  3. 25 9
      include/assimp/metadata.h

+ 2 - 0
code/CMakeLists.txt

@@ -611,6 +611,8 @@ ADD_ASSIMP_IMPORTER( X
 )
 
 ADD_ASSIMP_IMPORTER(X3D
+  X3DExporter.cpp
+  X3DExporter.hpp
   X3DImporter.cpp
   X3DImporter.hpp
   X3DImporter_Geometry2D.cpp

+ 2 - 2
code/SceneCombiner.cpp

@@ -1237,8 +1237,8 @@ void SceneCombiner::Copy (aiMetadata** _dest, const aiMetadata* src)
         case AI_BOOL:
             out.mData = new bool(*static_cast<bool*>(in.mData));
             break;
-        case AI_INT:
-            out.mData = new int(*static_cast<int*>(in.mData));
+        case AI_INT32:
+            out.mData = new int32_t(*static_cast<int32_t*>(in.mData));
             break;
         case AI_UINT64:
             out.mData = new uint64_t(*static_cast<uint64_t*>(in.mData));

+ 25 - 9
include/assimp/metadata.h

@@ -64,12 +64,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  // -------------------------------------------------------------------------------
 typedef enum aiMetadataType
 {
-    AI_BOOL = 0,
-    AI_INT = 1,
-    AI_UINT64 = 2,
-    AI_FLOAT = 3,
-    AI_DOUBLE = 4,
-    AI_AISTRING = 5,
+    AI_BOOL       = 0,
+    AI_INT32      = 1,
+    AI_UINT64     = 2,
+    AI_FLOAT      = 3,
+    AI_DOUBLE     = 4,
+    AI_AISTRING   = 5,
     AI_AIVECTOR3D = 6,
 
 #ifndef SWIG
@@ -106,7 +106,7 @@ struct aiMetadataEntry
   */
  // -------------------------------------------------------------------------------
 inline aiMetadataType GetAiType( bool ) { return AI_BOOL; }
-inline aiMetadataType GetAiType( int ) { return AI_INT; }
+inline aiMetadataType GetAiType( int32_t ) { return AI_INT32; }
 inline aiMetadataType GetAiType( uint64_t ) { return AI_UINT64; }
 inline aiMetadataType GetAiType( float ) { return AI_FLOAT; }
 inline aiMetadataType GetAiType( double ) { return AI_DOUBLE; }
@@ -165,8 +165,8 @@ struct aiMetadata
                 case AI_BOOL:
                     delete static_cast<bool*>(data);
                     break;
-                case AI_INT:
-                    delete static_cast<int*>(data);
+                case AI_INT32:
+                    delete static_cast<int32_t*>(data);
                     break;
                 case AI_UINT64:
                     delete static_cast<uint64_t*>(data);
@@ -248,6 +248,22 @@ struct aiMetadata
         return Get(aiString(key), value);
     }
 
+	/// \fn inline bool Get(size_t pIndex, const aiString*& pKey, const aiMetadataEntry*& pEntry)
+	/// Return metadata entry for analyzing it by user.
+	/// \param [in] pIndex - index of the entry.
+	/// \param [out] pKey - pointer to the key value.
+	/// \param [out] pEntry - pointer to the entry: type and value.
+	/// \return false - if pIndex is out of range, else - true.
+	inline bool Get(size_t pIndex, const aiString*& pKey, const aiMetadataEntry*& pEntry)
+	{
+		if(pIndex >= mNumProperties) return false;
+
+		pKey = &mKeys[pIndex];
+		pEntry = &mValues[pIndex];
+
+		return true;
+	}
+
 #endif // __cplusplus
 
 };