Skip to content

Commit

Permalink
IO_Assimp: add support for Blender file format
Browse files Browse the repository at this point in the history
Relates to GitHub #19
  • Loading branch information
HuguesDelorme committed Nov 15, 2023
1 parent 7dc56ba commit df7a7e8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/base/io_format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ std::string_view formatIdentifier(Format format)
case Format_COLLADA: return "COLLADA";
case Format_FBX: return "FBX";
case Format_X3D: return "X3D";
case Format_Blender: return "Blender";
}

return "";
Expand All @@ -58,6 +59,7 @@ std::string_view formatName(Format format)
case Format_COLLADA: return "COLLAborative Design Activity(ISO/PAS 17506)";
case Format_FBX: return "Filmbox";
case Format_X3D: return "Extensible 3D Graphics(ISO/IEC 19775/19776/19777)";
case Format_Blender: return "Blender File Format";
}

return "";
Expand All @@ -82,6 +84,7 @@ Span<std::string_view> formatFileSuffixes(Format format)
static std::string_view suffix_stl[] = { "stl" };
static std::string_view suffix_vrml[] = { "wrl", "wrz", "vrml" };
static std::string_view suffix_x3d[] = { "x3d", "x3dv", "x3db", "x3dz", "x3dbz", "x3dvz" };
static std::string_view suffix_blender[] = { "blend", "blender", "blend1", "blend2" };

switch (format) {
case Format_Unknown: return {};
Expand All @@ -102,6 +105,7 @@ Span<std::string_view> formatFileSuffixes(Format format)
case Format_STL: return suffix_stl;
case Format_VRML: return suffix_vrml;
case Format_X3D: return suffix_x3d;
case Format_Blender: return suffix_blender;
}

return {};
Expand All @@ -121,7 +125,8 @@ bool formatProvidesMesh(Format format)
{
return !formatProvidesBRep(format)
&& format != Format_Unknown
&& format != Format_Image;
&& format != Format_Image
;
}

} // namespace IO
Expand Down
3 changes: 2 additions & 1 deletion src/base/io_format.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ enum Format {
Format_STEP,
Format_STL,
Format_VRML,
Format_X3D
Format_X3D,
Format_Blender
};

// Returns identifier(unique short name) corresponding to 'format'
Expand Down
2 changes: 1 addition & 1 deletion src/io_assimp/io_assimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace IO {
Span<const Format> AssimpFactoryReader::formats() const
{
static const Format array[] = {
Format_AMF, Format_3DS, Format_3MF, Format_COLLADA, Format_FBX, Format_X3D
Format_AMF, Format_3DS, Format_3MF, Format_COLLADA, Format_FBX, Format_X3D, Format_Blender
};
return array;
}
Expand Down

0 comments on commit df7a7e8

Please sign in to comment.