Skip to content
Snippets Groups Projects
Commit 4ffc9738 authored by Gerardo Tauriello's avatar Gerardo Tauriello
Browse files

Fixed LoadEntity to accept format string.

parent aad78004
No related branches found
No related tags found
No related merge requests found
...@@ -83,7 +83,8 @@ BOOST_PYTHON_MODULE(_ost_io) ...@@ -83,7 +83,8 @@ BOOST_PYTHON_MODULE(_ost_io)
def("Instance",IOManager::Instance, def("Instance",IOManager::Instance,
return_value_policy<reference_existing_object>() ); return_value_policy<reference_existing_object>() );
def("LoadEntity",LoadEntity,load_entity_ov()); def("LoadEntity", LoadEntity,
load_entity_ov(args("filename", "format")));
def("SaveEntity", &save_ent_view, def("SaveEntity", &save_ent_view,
save_entity_view_ov(args("entity", "filename", "format"))); save_entity_view_ov(args("entity", "filename", "format")));
def("SaveEntity", &save_ent_handle, def("SaveEntity", &save_ent_handle,
......
...@@ -30,13 +30,13 @@ namespace ost { namespace io { ...@@ -30,13 +30,13 @@ namespace ost { namespace io {
namespace { namespace {
void Import(mol::EntityHandle& eh, const String& filename, int flag) void Import(mol::EntityHandle& eh, const String& filename, const String& format)
{ {
Profile profile_import("import"); Profile profile_import("import");
LOG_DEBUG("creating EntityIOHandle for " << filename); LOG_DEBUG("creating EntityIOHandle for " << filename);
EntityIOHandlerP ent_io = IOManager::Instance().FindEntityImportHandler(filename); EntityIOHandlerP ent_io = IOManager::Instance().FindEntityImportHandler(filename, format);
// TODO: proper error handling // note: error handling done in FindEntityImportHandler
LOG_DEBUG("calling import on entity io handle"); LOG_DEBUG("calling import on entity io handle");
ent_io->Import(eh,filename); ent_io->Import(eh,filename);
...@@ -53,12 +53,12 @@ void Import(mol::EntityHandle& eh, const String& filename, int flag) ...@@ -53,12 +53,12 @@ void Import(mol::EntityHandle& eh, const String& filename, int flag)
} // anon ns } // anon ns
mol::EntityHandle LoadEntity(const String& filename, int flag) mol::EntityHandle LoadEntity(const String& filename, const String& format)
{ {
LOG_DEBUG("creating emtpy entity"); LOG_DEBUG("creating emtpy entity");
mol::EntityHandle eh=mol::CreateEntity(); mol::EntityHandle eh=mol::CreateEntity();
mol::XCSEditor xcs_lock=eh.EditXCS(mol::BUFFERED_EDIT); mol::XCSEditor xcs_lock=eh.EditXCS(mol::BUFFERED_EDIT);
Import(eh,filename,flag); Import(eh, filename, format);
return eh; return eh;
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
namespace ost { namespace io { namespace ost { namespace io {
// load unmanaged entity // load unmanaged entity
DLLEXPORT_OST_IO mol::EntityHandle LoadEntity(const String& filename, int flag=0); DLLEXPORT_OST_IO mol::EntityHandle LoadEntity(const String& filename, const String& format="auto");
}} // ns }} // ns
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment