X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FPlugins%2FIO%2FMeshWriter.cxx;h=b0b7227ba7897b4b24b77bed685d409f81a40fad;hb=0d184ef7119178103610ad9e9fab83760cb89e06;hp=d865c577b9c64db44723f69d3f44545ea6d47407;hpb=e9143845b476fc8b86c1706fb140ebee770a650b;p=cpPlugins.git diff --git a/lib/cpPlugins/Plugins/IO/MeshWriter.cxx b/lib/cpPlugins/Plugins/IO/MeshWriter.cxx index d865c57..b0b7227 100644 --- a/lib/cpPlugins/Plugins/IO/MeshWriter.cxx +++ b/lib/cpPlugins/Plugins/IO/MeshWriter.cxx @@ -10,9 +10,12 @@ cpPlugins::IO::MeshWriter:: MeshWriter( ) : Superclass( ) { - this->SetNumberOfInputs( 1 ); - - this->m_Parameters->ConfigureAsString( "FileName", "" ); + this->_AddInput( "Input" ); + this->m_Parameters->ConfigureAsSaveFileName( "FileName" ); + this->m_Parameters->SetAcceptedFileExtensions( + "FileName", + "Mesh files (*.vtk *.stl *.obj)" + ); } // ------------------------------------------------------------------------- @@ -25,18 +28,18 @@ cpPlugins::IO::MeshWriter:: std::string cpPlugins::IO::MeshWriter:: _GenerateData( ) { - cpPlugins::Interface::Mesh* mesh = - this->GetInput< cpPlugins::Interface::Mesh >( 0 ); + auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "Input" ); if( mesh == NULL ) return( "MeshWriter: No input mesh." ); vtkPolyData* i = mesh->GetVTK< vtkPolyData >( ); if( i == NULL ) return( "MeshWriter: No suitable input." ); - std::string fname = this->m_Parameters->GetString( "FileName" ); + std::string fname = this->m_Parameters->GetSaveFileName( "FileName" ); vtkPolyDataWriter* pdw = this->_CreateVTK< vtkPolyDataWriter >( ); pdw->SetInputData( i ); pdw->SetFileName( fname.c_str( ) ); + pdw->SetFileTypeToBinary( ); pdw->Update( ); if( pdw->GetErrorCode( ) != 0 ) return( "MeshWriter: someting wrong happened." );