Эх сурвалжийг харах

serialization fixes and more consisten API in the viewer

Former-commit-id: d04c28fd5d3caca5b5b47c5257b19862c641360d
Daniele Panozzo 7 жил өмнө
parent
commit
d743fdc5d3

+ 4 - 8
include/igl/opengl/glfw/Viewer.cpp

@@ -770,9 +770,7 @@ namespace glfw
   {
     std::string fname = igl::file_dialog_open();
     if(fname.length() == 0)
-    {
       return false;
-    }
     return load_scene(fname);
   }
 
@@ -780,10 +778,6 @@ namespace glfw
   {
     igl::deserialize(core,"Core",fname.c_str());
     igl::deserialize(data(),"Data",fname.c_str());
-    for(unsigned int i = 0; i <plugins.size(); ++i)
-    {
-      igl::deserialize(*plugins[i],plugins[i]->plugin_name,fname.c_str());
-    }
     return true;
   }
 
@@ -792,11 +786,13 @@ namespace glfw
     std::string fname = igl::file_dialog_save();
     if (fname.length() == 0)
       return false;
+    return save_scene(fname);
+  }
 
+  IGL_INLINE bool Viewer::save_scene(std::string fname)
+  {
     igl::serialize(core,"Core",fname.c_str(),true);
     igl::serialize(data(),"Data",fname.c_str());
-    for(unsigned int i = 0; i <plugins.size(); ++i)
-      igl::serialize(*plugins[i],plugins[i]->plugin_name,fname.c_str());
 
     return true;
   }

+ 1 - 0
include/igl/opengl/glfw/Viewer.h

@@ -69,6 +69,7 @@ namespace glfw
     IGL_INLINE bool load_scene();
     IGL_INLINE bool load_scene(std::string fname);
     IGL_INLINE bool save_scene();
+    IGL_INLINE bool save_scene(std::string fname);
     // Draw everything
     IGL_INLINE void draw();
     // OpenGL context resize

+ 1 - 1
include/igl/opengl/glfw/imgui/ImGuiMenu.cpp

@@ -375,4 +375,4 @@ IGL_INLINE float ImGuiMenu::hidpi_scaling()
 } // end namespace
 } // end namespace
 } // end namespace
-} // end namespace
+} // end namespace