Developer Documentation
FileOM.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 
43 #include <ACG/GL/GLState.hh>
44 
47 
48 #include <OpenMesh/Core/IO/IOManager.hh>
49 
50  #include <QtWidgets>
51 
52 #include "FileOM.hh"
53 
54 
55 // Defines for the type handling drop down box
56 #define TYPEAUTODETECT 0
57 #define TYPEASK 1
58 #define TYPEPOLY 2
59 #define TYPETRIANGLE 3
60 
63  loadOptions_(0),
64  saveOptions_(0),
65  saveBinary_(0),
66  saveVertexNormal_(0),
67  saveVertexTexCoord_(0),
68  saveVertexColor_(0),
69  saveFaceColor_(0),
70  saveFaceNormal_(0),
71  saveDefaultButton_(0),
72  triMeshHandling_(0),
73  loadVertexNormal_(0),
74  loadVertexTexCoord_(0),
75  loadVertexColor_(0),
76  loadFaceColor_(0),
77  loadFaceNormal_(0),
78  loadDefaultButton_(0),
79  trimeshOptions_(0)
80 
81 {
82 }
83 
84 //-----------------------------------------------------------------------------------------------------
85 
87 }
88 
89 //-----------------------------------------------------------------------------------------------------
90 
92  return QString( tr("OpenMesh Format files ( *.om )") );
93 };
94 
95 //-----------------------------------------------------------------------------------------------------
96 
98  return QString( tr("OpenMesh Format files ( *.om )") );
99 };
100 
101 //-----------------------------------------------------------------------------------------------------
102 
105  return type;
106 }
107 
108 //-----------------------------------------------------------------------------------------------------
109 
110 int FileOMPlugin::loadObject(QString _filename) {
111 
112  int triMeshControl = TYPEAUTODETECT; // 0 == Auto-Detect
113 
114  if ( OpenFlipper::Options::gui() ){
115  if ( triMeshHandling_ != 0 ){
116  triMeshControl = triMeshHandling_->currentIndex();
117  } else {
118  triMeshControl = TYPEAUTODETECT;
119  }
120  }
121 
122  int objectId = -1;
123 
124  if(triMeshControl == TYPEAUTODETECT) {
125  // If Auto-Detect is selected (triMeshControl == 0)
126  objectId = loadPolyMeshObject(_filename);
127 
128  PolyMeshObject *object = 0;
129  if(!PluginFunctions::getObject(objectId, object))
130  return -1;
131 
132  for ( PolyMesh::FaceIter f_it = object->mesh()->faces_begin(); f_it != object->mesh()->faces_end() ; ++f_it) {
133 
134  // Count number of vertices for the current face
135  uint count = 0;
136  for ( PolyMesh::FaceVertexIter fv_it( *(object->mesh()),*f_it); fv_it.is_valid(); ++fv_it )
137  ++count;
138 
139  // Check if it is a triangle. If not, this is really a poly mesh
140  if ( count != 3 ) {
141 
142  PolyMeshObject* object(0);
143  if(PluginFunctions::getObject( objectId, object )) {
144 
145  emit updatedObject(objectId, UPDATE_ALL);
146  emit openedFile( objectId );
147  }
148 
149  return objectId;
150  }
151  }
152 
153  } else if (triMeshControl == TYPEASK ) {
154 
155  // If Ask is selected -> show dialog
156  objectId = loadPolyMeshObject(_filename);
157 
158  bool triMesh = true;
159 
160  PolyMeshObject *object = 0;
161  if(!PluginFunctions::getObject(objectId, object))
162  return -1;
163 
164  for ( PolyMesh::FaceIter f_it = object->mesh()->faces_begin(); f_it != object->mesh()->faces_end() ; ++f_it) {
165 
166  // Count number of vertices for the current face
167  uint count = 0;
168  for ( PolyMesh::FaceVertexIter fv_it( *(object->mesh()),*f_it); fv_it.is_valid(); ++fv_it )
169  ++count;
170 
171  // Check if it is a triangle. If not, this is really a poly mesh
172  if ( count != 3 ) {
173  triMesh = false;
174  break;
175  }
176 
177  if(triMesh == false) break;
178  }
179 
180  // Note: If in non-gui mode, we will never enter this case branch
181 
182  QMetaObject::invokeMethod(this,"handleTrimeshDialog",Qt::BlockingQueuedConnection);
183  if ((trimeshOptions_ == TYPEPOLY) ||
184  (trimeshOptions_ == TYPEASK && !triMesh)) {
185 
186  PolyMeshObject* object(0);
187  if(PluginFunctions::getObject( objectId, object )) {
188 
189  emit updatedObject(objectId, UPDATE_ALL);
190  emit openedFile( objectId );
191  }
192  return objectId;
193  }
194 
195  } else if (triMeshControl == TYPEPOLY) {
196  // If always open as PolyMesh is selected
197 
198  objectId = loadPolyMeshObject(_filename);
199 
200  PolyMeshObject* object(0);
201  if(PluginFunctions::getObject( objectId, object )) {
202 
203  emit updatedObject(objectId, UPDATE_ALL);
204  emit openedFile( objectId );
205  }
206 
207  return objectId;
208  } else {
209  // If always open as TriMesh is selected
210 
211  objectId = loadTriMeshObject(_filename);
212 
213  TriMeshObject* object(0);
214  if(PluginFunctions::getObject( objectId, object )) {
215  emit updatedObject(objectId, UPDATE_ALL);
216  emit openedFile( objectId );
217  }
218 
219  return objectId;
220  }
221 
222  // Load object as triangle mesh
223  if(objectId != -1) emit deleteObject(objectId);
224 
225  objectId = loadTriMeshObject(_filename);
226 
227  TriMeshObject* object(0);
228  if(PluginFunctions::getObject( objectId, object )) {
229 
230  emit updatedObject(objectId, UPDATE_ALL);
231  emit openedFile( objectId );
232  }
233 
234  return objectId;
235 };
236 
238 {
239  QMessageBox msgBox;
240  QPushButton *detectButton = msgBox.addButton(tr("Auto-Detect"), QMessageBox::ActionRole);
241  QPushButton *triButton = msgBox.addButton(tr("Open as triangle mesh"), QMessageBox::ActionRole);
242  QPushButton *polyButton = msgBox.addButton(tr("Open as poly mesh"), QMessageBox::ActionRole);
243  msgBox.setWindowTitle( tr("Mesh types in file") );
244  msgBox.setText( tr("You are about to open a file containing one or more mesh types. \n\n Which mesh type should be used?") );
245  msgBox.setDefaultButton( detectButton );
246  msgBox.exec();
247 
248 
249  if (msgBox.clickedButton() == triButton)
250  trimeshOptions_ = TYPETRIANGLE ;
251  else if (msgBox.clickedButton() == polyButton)
252  trimeshOptions_ = TYPEPOLY ;
253  else
254  trimeshOptions_ = TYPEASK;
255 }
256 
257 //-----------------------------------------------------------------------------------------------------
258 
260 int FileOMPlugin::loadTriMeshObject(QString _filename){
261 
262  int id = -1;
263  emit addEmptyObject(DATA_TRIANGLE_MESH, id);
264 
265  TriMeshObject* object(0);
266  if(PluginFunctions::getObject( id, object)) {
267 
268  if ( PluginFunctions::objectCount() == 1 )
269  object->target(true);
270 
271  object->setFromFileName(_filename);
272  object->setName(object->filename());
273 
274  std::string filename = std::string( _filename.toUtf8() );
275 
276  //set options
278 
279  if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() &&
280  !OpenFlipper::Options::loadingRecentFile() && loadOptions_ != 0){
281 
282  if (loadVertexNormal_->isChecked())
284 
285  if (loadVertexTexCoord_->isChecked())
287 
288  if (loadVertexColor_->isChecked())
290 
291  if (loadFaceColor_->isChecked())
293 
294  if (loadFaceNormal_->isChecked())
296 
297  } else {
298 
299  // Let OpenMesh try to read everything it can
305 
306  }
307 
309  object->mesh()->request_vertex_texcoords2D();
310  object->mesh()->request_halfedge_texcoords2D();
311  object->mesh()->request_face_texture_index();
312 
313  // load file
314  bool ok = OpenMesh::IO::read_mesh( (*object->mesh()) , filename, opt );
315  if (!ok)
316  {
317  std::cerr << "Plugin FileOM : Read error for Triangle Mesh\n";
318  emit deleteObject( object->id() );
319  return -1;
320  }
321 
322  object->mesh()->update_normals();
323 
324  backupTextureCoordinates(*(object->mesh()));
325 
326  return object->id();
327 
328  } else {
329  emit log(LOGERR,"Error : Could not create new triangle mesh object.");
330  return -1;
331  }
332 }
333 
334 //-----------------------------------------------------------------------------------------------------
335 
337 int FileOMPlugin::loadPolyMeshObject(QString _filename){
338 
339  int id = -1;
340  emit addEmptyObject(DATA_POLY_MESH, id);
341 
342  PolyMeshObject* object(0);
343  if(PluginFunctions::getObject( id, object)) {
344 
345  if (PluginFunctions::objectCount() == 1 )
346  object->target(true);
347 
348  object->setFromFileName(_filename);
349  object->setName(object->filename());
350 
351  std::string filename = std::string( _filename.toUtf8() );
352 
353  //set options
355 
356  if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() &&
357  !OpenFlipper::Options::loadingRecentFile() && loadOptions_ != 0){
358 
359  if (loadVertexNormal_->isChecked())
361 
362  if (loadVertexTexCoord_->isChecked())
364 
365  if (loadVertexColor_->isChecked())
367 
368  if (loadFaceColor_->isChecked())
370 
371  if (loadFaceNormal_->isChecked())
373 
374  } else {
375 
376  // Let openmesh try to read everything it can
382 
383  }
384 
386  object->mesh()->request_vertex_texcoords2D();
387  object->mesh()->request_halfedge_texcoords2D();
388  object->mesh()->request_face_texture_index();
389 
390  // load file
391  bool ok = OpenMesh::IO::read_mesh( (*object->mesh()) , filename, opt );
392  if (!ok)
393  {
394  std::cerr << "Plugin FileOM : Read error for Poly Mesh\n";
395  emit deleteObject( object->id() );
396  return -1;
397 
398  }
399 
400 
401  if ( ! (opt & OpenMesh::IO::Options::VertexTexCoord) ) {
402  object->mesh()->release_vertex_texcoords2D();
403  }
404 
405 
406  if ( ! (opt & OpenMesh::IO::Options::FaceTexCoord) ) {
407  object->mesh()->release_halfedge_texcoords2D();
408  }
409 
410 
411  object->mesh()->update_normals();
412 
413  backupTextureCoordinates(*(object->mesh()));
414 
415  return object->id();
416 
417  } else {
418  emit log(LOGERR,"Error : Could not create new poly mesh object.");
419  return -1;
420  }
421 }
422 
423 //-----------------------------------------------------------------------------------------------------
424 
425 template <class MeshT>
427 
428  // Create a backup of the original per Vertex texture Coordinates
429  if (_mesh.has_vertex_texcoords2D()) {
430 
432  if (!_mesh.get_property_handle(oldVertexCoords, "Original Per Vertex Texture Coords"))
433  _mesh.add_property(oldVertexCoords, "Original Per Vertex Texture Coords");
434 
435  for (typename MeshT::VertexIter v_it = _mesh.vertices_begin(); v_it != _mesh.vertices_end(); ++v_it)
436  _mesh.property(oldVertexCoords, *v_it) = _mesh.texcoord2D(*v_it);
437 
438  }
439 
440  // Create a backup of the original per Face texture Coordinates
441  if (_mesh.has_halfedge_texcoords2D()) {
442 
444  if (!_mesh.get_property_handle(oldHalfedgeCoords,"Original Per Face Texture Coords"))
445  _mesh.add_property(oldHalfedgeCoords,"Original Per Face Texture Coords");
446 
447  for (typename MeshT::HalfedgeIter he_it = _mesh.halfedges_begin(); he_it != _mesh.halfedges_end(); ++he_it)
448  _mesh.property(oldHalfedgeCoords, *he_it) = _mesh.texcoord2D(*he_it);
449 
450  }
451 }
452 
453 //-----------------------------------------------------------------------------------------------------
454 
455 bool FileOMPlugin::saveObject(int _id, QString _filename)
456 {
457  BaseObjectData* object;
458  if ( !PluginFunctions::getObject(_id,object) ) {
459  emit log(LOGERR, tr("saveObject : cannot get object id %1 for save name %2").arg(_id).arg(_filename) );
460  return false;
461  }
462 
463  std::string filename = std::string( _filename.toUtf8() );
464 
465  if ( object->dataType( DATA_POLY_MESH ) ) {
466 
467  PolyMeshObject* polObj = dynamic_cast<PolyMeshObject* >( object );
468 
470 
471  if ( !OpenFlipper::Options::savingSettings() && saveOptions_ != 0){
472 
473  PolyMesh* mesh = polObj->mesh();
474 
475  if (saveBinary_->isChecked())
477 
478  if (saveVertexNormal_->isChecked() && mesh->has_vertex_normals())
480 
481  if (saveVertexTexCoord_->isChecked() && (mesh->has_vertex_texcoords1D() || mesh->has_vertex_texcoords2D() || mesh->has_vertex_texcoords3D())) {
482  std::cerr << "File OM texture write" << std::endl;
484  }
485 
486  if (saveVertexColor_->isChecked() && mesh->has_vertex_colors())
488 
489  if (saveFaceColor_->isChecked() && mesh->has_face_colors())
491 
492  if (saveFaceNormal_->isChecked() && mesh->has_face_normals())
494 
495  }
496 
497  object->setFromFileName(_filename);
498  object->setName(object->filename());
499 
500  PolyMeshObject* polyObj = dynamic_cast<PolyMeshObject* >( object );
501 
502  if (OpenMesh::IO::write_mesh(*polyObj->mesh(), filename.c_str(),opt) ){
503  emit log(LOGINFO, tr("Saved object to ") + _filename );
504  return true;
505  }else{
506  emit log(LOGERR, tr("Unable to save ") + _filename);
507  return false;
508  }
509  } else if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
510 
511  object->setFromFileName(_filename);
512  object->setName(object->filename());
513 
514  TriMeshObject* triObj = dynamic_cast<TriMeshObject* >( object );
515 
517 
518  if ( !OpenFlipper::Options::savingSettings() && saveOptions_ != 0){
519 
520  TriMesh* mesh = triObj->mesh();
521 
522  if (saveBinary_->isChecked())
524 
525  if (saveVertexNormal_->isChecked() && mesh->has_vertex_normals())
527 
528  if (saveVertexTexCoord_->isChecked() && (mesh->has_vertex_texcoords1D() || mesh->has_vertex_texcoords2D() || mesh->has_vertex_texcoords3D())) {
529  std::cerr << "File OM texture write" << std::endl;
531  }
532 
533  if (saveVertexColor_->isChecked() && mesh->has_vertex_colors())
535 
536  if (saveFaceColor_->isChecked() && mesh->has_face_colors())
538 
539  if (saveFaceNormal_->isChecked() && mesh->has_face_normals())
541 
542  }
543 
544  if (OpenMesh::IO::write_mesh(*triObj->mesh(), filename.c_str(),opt) ) {
545  emit log(LOGINFO, tr("Saved object to ") + _filename );
546  return true;
547  } else {
548  emit log(LOGERR, tr("Unable to save ") + _filename );
549  return false;
550  }
551  } else {
552  emit log(LOGERR, tr("Unable to save (object is not a compatible mesh type)"));
553  return false;
554  }
555 }
556 
557 //-----------------------------------------------------------------------------------------------------
558 
559 QWidget* FileOMPlugin::saveOptionsWidget(QString /*_currentFilter*/) {
560 
561  if (saveOptions_ == 0){
562  //generate widget
563  saveOptions_ = new QWidget();
564  QVBoxLayout* layout = new QVBoxLayout();
565  layout->setAlignment(Qt::AlignTop);
566 
567  saveBinary_ = new QCheckBox("Save Binary");
568  layout->addWidget(saveBinary_);
569 
570  saveVertexNormal_ = new QCheckBox("Save Vertex Normals");
571  layout->addWidget(saveVertexNormal_);
572 
573  saveVertexTexCoord_ = new QCheckBox("Save Vertex TexCoords");
574  layout->addWidget(saveVertexTexCoord_);
575 
576  saveVertexColor_ = new QCheckBox("Save Vertex Colors");
577  layout->addWidget(saveVertexColor_);
578 
579  saveFaceColor_ = new QCheckBox("Save Face Colors");
580  layout->addWidget(saveFaceColor_);
581 
582  saveFaceNormal_ = new QCheckBox("Save Face Normals");
583  layout->addWidget(saveFaceNormal_);
584 
585  saveDefaultButton_ = new QPushButton("Make Default");
586  layout->addWidget(saveDefaultButton_);
587 
588  saveOptions_->setLayout(layout);
589 
590  connect(saveDefaultButton_, SIGNAL(clicked()), this, SLOT(slotSaveDefault()));
591 
592  saveBinary_->setChecked( OpenFlipperSettings().value("FileOM/Save/Binary",true).toBool() );
593  saveVertexNormal_->setChecked( OpenFlipperSettings().value("FileOM/Save/Normals",true).toBool() );
594  saveVertexTexCoord_->setChecked( OpenFlipperSettings().value("FileOM/Save/TexCoords",true).toBool() );
595  saveVertexColor_->setChecked( OpenFlipperSettings().value("FileOM/Save/VertexColor",true).toBool() );
596  saveFaceColor_->setChecked( OpenFlipperSettings().value("FileOM/Save/FaceColor",true).toBool() );
597  saveFaceNormal_->setChecked( OpenFlipperSettings().value("FileOM/Save/FaceNormal",true).toBool() );
598 
599  }
600 
601  return saveOptions_;
602 }
603 
604 //-----------------------------------------------------------------------------------------------------
605 
606 QWidget* FileOMPlugin::loadOptionsWidget(QString /*_currentFilter*/) {
607 
608  if (loadOptions_ == 0){
609  //generate widget
610  loadOptions_ = new QWidget();
611  QVBoxLayout* layout = new QVBoxLayout();
612  layout->setAlignment(Qt::AlignTop);
613 
614  QLabel* label = new QLabel(tr("If PolyMesh is a Triangle Mesh:"));
615 
616  layout->addWidget(label);
617 
618  triMeshHandling_ = new QComboBox();
619  triMeshHandling_->addItem( tr("Auto-Detect") );
620  triMeshHandling_->addItem( tr("Ask") );
621  triMeshHandling_->addItem( tr("Always open as PolyMesh") );
622  triMeshHandling_->addItem( tr("Always open as TriangleMesh") );
623 
624  layout->addWidget(triMeshHandling_);
625 
626  loadVertexNormal_ = new QCheckBox("Load Vertex Normals");
627  layout->addWidget(loadVertexNormal_);
628 
629  loadVertexTexCoord_ = new QCheckBox("Load Vertex TexCoords");
630  layout->addWidget(loadVertexTexCoord_);
631 
632  loadVertexColor_ = new QCheckBox("Load Vertex Colors");
633  layout->addWidget(loadVertexColor_);
634 
635  loadFaceColor_ = new QCheckBox("Load Face Colors");
636  layout->addWidget(loadFaceColor_);
637 
638  loadFaceNormal_ = new QCheckBox("Load Face Normals");
639  layout->addWidget(loadFaceNormal_);
640 
641  loadDefaultButton_ = new QPushButton("Make Default");
642  layout->addWidget(loadDefaultButton_);
643 
644  loadOptions_->setLayout(layout);
645 
646  connect(loadDefaultButton_, SIGNAL(clicked()), this, SLOT(slotLoadDefault()));
647 
648 
649  triMeshHandling_->setCurrentIndex(OpenFlipperSettings().value("FileOM/Load/TriMeshHandling",TYPEAUTODETECT).toInt() );
650 
651  loadVertexNormal_->setChecked( OpenFlipperSettings().value("FileOM/Load/Normals",true).toBool() );
652  loadVertexTexCoord_->setChecked( OpenFlipperSettings().value("FileOM/Load/TexCoords",true).toBool() );
653  loadVertexColor_->setChecked( OpenFlipperSettings().value("FileOM/Load/VertexColor",true).toBool() );
654  loadFaceColor_->setChecked( OpenFlipperSettings().value("FileOM/Load/FaceColor",true).toBool() );
655  loadFaceColor_->setChecked( OpenFlipperSettings().value("FileOM/Load/FaceNormal",true).toBool() );
656 
657  }
658 
659  return loadOptions_;
660 }
661 
663 
664  OpenFlipperSettings().setValue( "FileOM/Load/Normals", loadVertexNormal_->isChecked() );
665  OpenFlipperSettings().setValue( "FileOM/Load/TexCoords", loadVertexTexCoord_->isChecked() );
666  OpenFlipperSettings().setValue( "FileOM/Load/VertexColor", loadVertexColor_->isChecked() );
667  OpenFlipperSettings().setValue( "FileOM/Load/FaceColor", loadFaceColor_->isChecked() );
668  OpenFlipperSettings().setValue( "FileOM/Load/FaceNormal", loadFaceNormal_->isChecked() );
669 
670  OpenFlipperSettings().setValue( "FileOM/Load/TriMeshHandling", triMeshHandling_->currentIndex() );
671 
672  OpenFlipperSettings().setValue( "Core/File/UseLoadDefaults", true );
673 }
674 
675 
677 
678  OpenFlipperSettings().setValue( "FileOM/Save/Binary", saveBinary_->isChecked() );
679  OpenFlipperSettings().setValue( "FileOM/Save/Normals", saveVertexNormal_->isChecked() );
680  OpenFlipperSettings().setValue( "FileOM/Save/TexCoords", saveVertexTexCoord_->isChecked() );
681  OpenFlipperSettings().setValue( "FileOM/Save/VertexColor", saveVertexColor_->isChecked() );
682  OpenFlipperSettings().setValue( "FileOM/Save/FaceColor", saveFaceColor_->isChecked() );
683  OpenFlipperSettings().setValue( "FileOM/Save/FaceNormal", saveFaceNormal_->isChecked() );
684 }
685 
686 
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
Has (r) / store (w) vertex colors.
Definition: Options.hh:105
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
#define DATA_POLY_MESH
Definition: PolyMesh.hh:59
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
Definition: FileOM.cc:103
int id() const
Definition: BaseObject.cc:190
Has (r) / store (w) face colors.
Definition: Options.hh:109
void slotLoadDefault()
Slot called when user wants to save the given Load options as default.
Definition: FileOM.cc:662
QWidget * saveOptionsWidget(QString)
Definition: FileOM.cc:559
void backupTextureCoordinates(MeshT &_mesh)
creates a backup of the original per vertex/face texture coordinates
Definition: FileOM.cc:426
bool write_mesh(const Mesh &_mesh, const std::string &_filename, Options _opt=Options::Default, std::streamsize _precision=6)
Write a mesh to the file _filename.
Definition: MeshIO.hh:207
QWidget * loadOptionsWidget(QString)
Definition: FileOM.cc:606
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
Has (r) / store (w) face normals.
Definition: Options.hh:108
Kernel::FaceVertexIter FaceVertexIter
Circulator.
Definition: PolyMeshT.hh:167
void initializePlugin()
Initialize Plugin.
Definition: FileOM.cc:86
bool dataType(DataType _type) const
Definition: BaseObject.cc:221
MeshT * mesh()
return a pointer to the mesh
int loadTriMeshObject(QString _filename)
Loads a triangle mesh.
Definition: FileOM.cc:260
int loadObject(QString _filename)
Loads Object and converts it to a triangle mesh if possible.
Definition: FileOM.cc:110
Has (r) / store (w) texture coordinates.
Definition: Options.hh:106
Has (r) / store (w) face texture coordinates.
Definition: Options.hh:110
void slotSaveDefault()
Slot called when user wants to save the given Save options as default.
Definition: FileOM.cc:676
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
Type for a MeshObject containing a triangle mesh.
Definition: TriangleMesh.hh:67
QString filename() const
return the filename of the object
Definition: BaseObject.cc:706
FileOMPlugin()
Constructor.
Definition: FileOM.cc:62
void handleTrimeshDialog()
Displays a dialog to ask how to load the mesh (triangle, polymesh , autodetect)
Definition: FileOM.cc:237
int loadPolyMeshObject(QString _filename)
Always loads mesh as polymesh.
Definition: FileOM.cc:337
Set options for reader/writer modules.
Definition: Options.hh:90
Predefined datatypes.
Definition: DataTypes.hh:83
Set binary mode for r/w.
Definition: Options.hh:100
Has (r) / store (w) vertex normals.
Definition: Options.hh:104
int objectCount()
Get the number of available objects.
#define DATA_TRIANGLE_MESH
Definition: TriangleMesh.hh:60
bool read_mesh(Mesh &_mesh, const std::string &_filename)
Read a mesh from file _filename.
Definition: MeshIO.hh:112
QString getLoadFilters()
Definition: FileOM.cc:91
Type for a Meshobject containing a poly mesh.
Definition: PolyMesh.hh:65
QString getSaveFilters()
Definition: FileOM.cc:97