Developer Documentation
OMPropertyModelT_impl.hh
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 
44 #define OM_PROPERTY_MODEL_CC
45 
46 #include "OMPropertyModel.hh"
47 
48 #include "OMPropertyVisualizerBoolean.hh"
49 #include "OMPropertyVisualizerDouble.hh"
50 #include "OMPropertyVisualizerInteger.hh"
51 #include "OMPropertyVisualizerVector.hh"
52 #include "OMPropertyVisualizerVector2.hh"
53 #include "OMPropertyVisualizerVectorFieldDifference.hh"
54 
55 #ifdef ENABLE_SKELETON_SUPPORT
56 #include "OMPropertyVisualizerSkinWeights.hh"
57 #endif
58 
59 #include "../Utils.hh"
60 
61 #include <vector>
62 
63 #include <QInputDialog>
64 #include <QTextStream>
65 
66 #define PROP_VIS "PropertyVisualization"
67 
68 template<typename MeshT>
69 OMPropertyModel<MeshT>::OMPropertyModel(MeshT* mesh, int objectID, QObject *parent)
70  : OMPropertyModelSubclass(parent),
71  mesh_(mesh),
72  objectID_(objectID),
73  mCombineProperty1(nullptr),
74  mCombineProperty2(nullptr),
75  pickModeActive(false)
76 {
78  bCombine.setText(tr("Combine"));
79  bCombine.hide();
80  connect(&bCombine, SIGNAL(clicked()),
81  this, SLOT(slotCombine()));
82  widgets->layout()->addWidget(&bCombine);
83  widgets->layout()->addWidget(&mLoadSaveWidget);
84 
85  connect(mLoadSaveWidget.save_property , SIGNAL(clicked()),
86  this, SLOT(slotSaveProperty()));
87 
88  connect(mLoadSaveWidget.load_property , SIGNAL(clicked()),
89  this, SLOT(slotLoadProperty()));
90 
91  widgets->layout()->addWidget(&mPickWidget);
92  connect(mPickWidget.pickButton, SIGNAL(clicked()),
93  this, SLOT(slotPickProperty()));
94  mPickWidget.hide();
95  QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
96  mPickWidget.pickButton->setIcon( QIcon(iconPath + "color-picker.png") );
97 
98 
99  lastPickMode = PluginFunctions::pickMode();
100  lastActionMode = PluginFunctions::actionMode();
101 
102  initializeSupportedPropertyTypes();
103 
104 }
105 
106 template<typename MeshT>
107 void OMPropertyModel<MeshT>::updateWidget(const QModelIndexList& selectedIndices)
108 {
110 
111  if (selectedIndices.size() == 2)
112  {
113  if (combinable(propertyVisualizers[selectedIndices[0].row()], propertyVisualizers[selectedIndices[1].row()]))
114  {
115 
116  bCombine.show();
117  mCombineProperty1 = &propertyVisualizers[selectedIndices[0].row()]->getPropertyInfo();
118  mCombineProperty2 = &propertyVisualizers[selectedIndices[1].row()]->getPropertyInfo();
119  }
120  else
121  bCombine.hide();
122  }
123  else
124  bCombine.hide();
125 
126  if (selectedIndices.size() == 1)
127  mPickWidget.show();
128  else
129  {
130  mPickWidget.hide();
131  //reset Picking, just if picking was enabled
132  if (mPickWidget.pickButton->isChecked())
133  resetPicking();
134  }
135 }
136 
137 template<typename MeshT>
139 {
140  QString filter;
141  filter = tr("Vertex Property (*.vprop)");
142  filter += tr(";; HalfEdge Property (*.hprop)");
143  filter += tr(";; Edge Property (*.eprop)");
144  filter += tr(";; Face Property (*.fprop)");
145  filter += tr(";; All Files (*)");
146  return filter;
147 }
148 
149 template<typename MeshT>
151 {
152  PropertyVisualizer* propViz = propertyVisualizers[propId];
153 
154  QString filter;
155 
156  if (propViz->getPropertyInfo().isVertexProp())
157  filter = tr("Vertex Property (*.vprop)");
158  else if (propViz->getPropertyInfo().isHalfedgeProp())
159  filter = tr("HalfEdge Property (*.hprop)");
160  else if (propViz->getPropertyInfo().isEdgeProp())
161  filter = tr("Edge Property (*.eprop)");
162  else if (propViz->getPropertyInfo().isFaceProp())
163  filter = tr("Face Property (*.fprop)");
164 
165  filter += tr(";; All Files (*)");
166 
167  return filter;
168 }
169 
178 template<typename MeshT>
180 {
181  beginResetModel();
182  if (isVectorType(mCombineProperty1->typeinfo()))
183  propertyVisualizers.push_back(new OMPropertyVisualizerVectorFieldDifference<MeshT>(mesh_, objectID_, *mCombineProperty1, *mCombineProperty2));
184  endResetModel();
185 }
186 
200 template<typename MeshT>
201 bool OMPropertyModel<MeshT>::combinable(PropertyVisualizer* propertyVisualizer1, PropertyVisualizer* propertyVisualizer2)
202 {
203  const PropertyInfo& propInfo1 = propertyVisualizer1->getPropertyInfo();
204  const PropertyInfo& propInfo2 = propertyVisualizer2->getPropertyInfo();
205  TypeInfoWrapper typeInfo1 = propInfo1.typeinfo();
206  TypeInfoWrapper typeInfo2 = propInfo2.typeinfo();
207 
208  return (isVectorType(typeInfo1) && isVectorType(typeInfo2)) && (propInfo1.entityType() == propInfo2.entityType());
209 }
210 
211 template<typename MeshT>
213 {
214  for (QModelIndexList::const_iterator it = currentlySelectedIndices.begin(), it_end = currentlySelectedIndices.end();
215  it != it_end; ++it) {
217  }
218 }
219 
220 template<typename MeshT>
221 bool OMPropertyModel<MeshT>::parseHeader(QString header, PropertyVisualizer*& propVis, unsigned int &n)
222 {
223 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
224  QStringList headerParts = header.split(tr(", "), QString::SkipEmptyParts );
225 #else
226  QStringList headerParts = header.split(tr(", "), Qt::SkipEmptyParts );
227 #endif
228 
229  int headerVersion = headerParts[0].toUInt();
230  if (headerVersion == 1)
231  {
232  n = headerParts[1].toUInt();
233  unsigned int nExpected = 0;
234 
235  PropertyInfo::ENTITY_FILTER filter = (PropertyInfo::ENTITY_FILTER)headerParts[2].toInt();
236  switch (filter)
237  {
238  case PropertyInfo::EF_FACE:
239  nExpected = mesh_->n_faces();
240  break;
241  case PropertyInfo::EF_EDGE:
242  nExpected = mesh_->n_edges();
243  break;
244  case PropertyInfo::EF_HALFEDGE:
245  nExpected = mesh_->n_halfedges();
246  break;
247  case PropertyInfo::EF_VERTEX:
248  nExpected = mesh_->n_vertices();
249  break;
250  default:
251  nExpected = -1;
252  break;
253  }
254 
255  if (n != nExpected)
256  {
257  emit log(LOGERR, "Could not load property: unexpected number of entities");
258  return false;
259  }
260 
261  QString friendlyName = headerParts[3];
262 
263  if (!isSupported(friendlyName))
264  {
265  emit log(LOGERR, tr("Could not load property: unsupported property type %1").arg(friendlyName));
266  return false;
267  }
268 
269  TypeInfoWrapper typeInfo = getSupportedTypeInfoWrapper(friendlyName);
270 
271  QString propName = QInputDialog::getText(nullptr, "Property Name", "Please enter name.",QLineEdit::Normal,headerParts[4]);
272  if (propName == "") return false;
273 
274  bool replace = false;
275  if (!(isPropertyFree(propName, filter, typeInfo) || replace))
276  {
277  NewNameMessageBox* msgBox = new NewNameMessageBox(propName);
278  msgBox->exec();
279 
280  if (msgBox->rename)
281  propName = QInputDialog::getText(0, "New Property Name", "Please enter new name.");
282  else if (msgBox->cancel)
283  return false;
284  else if (msgBox->replace)
285  replace = true;
286 
287  delete msgBox;
288  }
289 
290  if (!replace)
291  {
292  addProperty(propName, friendlyName, filter);
294  }
295 
296  propVis = getPropertyVisualizer(propName, filter, typeInfo);
297 
298  return true;
299 
300  }
301  else
302  {
303  emit log(LOGERR, "Could not load property: unsupported header format");
304  return false;
305  }
306 }
307 
308 
309 template<typename MeshT>
310 void OMPropertyModel<MeshT>::setPropertyFromFile(QTextStream& file_stream, unsigned int n, PropertyVisualizer* propVis)
311 {
312 #ifdef ENABLE_SKELETON_SUPPORT
313  if (propVis->getPropertyInfo().typeinfo() == proptype_SkinWeights)
314  {
315  for (unsigned int i = 0; i < n; ++i)
316  {
317  QString propertyText = "";
318  QString tmp;
319  while ((tmp = file_stream.readLine()) != "")
320  propertyText = propertyText + tmp;
321  propVis->setPropertyFromText(i, propertyText);
322  }
323  }
324  else
325 #endif
326  {
327  SingleObjectPropertyModel::setPropertyFromFile(file_stream, n, propVis);
328  }
329 }
330 
331 template<typename MeshT>
333 {
334  PluginFunctions::pickMode(lastPickMode);
335  PluginFunctions::actionMode(lastActionMode);
336 }
337 
338 
344 template<typename MeshT>
346 {
347  if ( mPickWidget.pickButton->isChecked() ){
348 
349  lastPickMode = PluginFunctions::pickMode();
350  lastActionMode = PluginFunctions::actionMode();
351 
352  PluginFunctions::pickMode(PROP_VIS);
353  PluginFunctions::actionMode(Viewer::PickingMode);
354 
355  } else {
356  resetPicking();
357  }
358 }
359 
360 
361 template<typename MeshT>
362 void OMPropertyModel<MeshT>::pickModeChanged(const std::string& _mode)
363 {
364  pickModeActive = (_mode == PROP_VIS);
365 
366  if (!pickModeActive)
367  {
368  lastPickMode = _mode;
369  }
370 
371  mPickWidget.pickButton->setChecked(pickModeActive);
372 }
373 
380 template<typename MeshT>
381 void OMPropertyModel<MeshT>::mouseEvent(QMouseEvent* _event)
382 {
383  if (!pickModeActive) return;
384 
385  if (_event->type() == QEvent::MouseButtonPress)
386  {
387  size_t node_idx, face_idx;
388  ACG::Vec3d hit_point;
389 
390  if (PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_FACE, _event->pos(),node_idx, face_idx, &hit_point)) {
391  BaseObjectData* object = nullptr;
392 
393  if (PluginFunctions::getPickedObject(node_idx, object))
394  {
395  if (object->id() == objectID_ && !currentlySelectedIndices.empty())
396  {
397  OMPropertyVisualizer<MeshT>* viz = dynamic_cast<OMPropertyVisualizer<MeshT>*>(propertyVisualizers[currentlySelectedIndices.first().row()] );
398  unsigned int primitiveId = viz->getClosestPrimitiveId(face_idx, hit_point);
399  mPickWidget.pickedHandle->setText(tr("%1").arg(primitiveId));
400  mPickWidget.pickedValue->setText(viz->getPropertyText(primitiveId));
401  }
402  }
403  }
404  }
405 }
406 
407 template<typename MeshT>
408 bool OMPropertyModel<MeshT>::isVectorType(const TypeInfoWrapper& typeInfo) const
409 {
410  return (typeInfo == proptype_Vec3f) || (typeInfo == proptype_Vec3d);
411 }
412 
413 template<typename MeshT>
415  typename MeshT::prop_iterator props_first,
416  typename MeshT::prop_iterator props_last,
417  PropertyInfo::ENTITY_FILTER filter)
418 {
419  for (typename MeshT::prop_iterator pit = props_first; pit != props_last; ++pit) {
420  OpenMesh::BaseProperty*const baseProp = *pit;
421  if (baseProp && isSupported(baseProp) && isNew(baseProp, filter))
422  addPropertyVisualizer(baseProp, mesh, filter);
423  }
424 }
425 
426 template<typename MeshT>
428 {
429  beginResetModel();
430  if (mesh_) {
431  gatherProperties(mesh_, mesh_->fprops_begin(), mesh_->fprops_end(), PropertyInfo::EF_FACE);
432  gatherProperties(mesh_, mesh_->eprops_begin(), mesh_->eprops_end(), PropertyInfo::EF_EDGE);
433  gatherProperties(mesh_, mesh_->hprops_begin(), mesh_->hprops_end(), PropertyInfo::EF_HALFEDGE);
434  gatherProperties(mesh_, mesh_->vprops_begin(), mesh_->vprops_end(), PropertyInfo::EF_VERTEX);
435  }
436  endResetModel();
437 }
438 
439 
447 template<typename MeshT>
449 {
450  TypeInfoWrapper bp_type = typeid(*baseProp);
451  TypeInfoWrapperSet::const_iterator propIt = supportedPropertyTypes.find(bp_type);
452  return propIt != supportedPropertyTypes.end();
453 }
454 
465 template<typename MeshT>
466 bool OMPropertyModel<MeshT>::isSupported(QString friendlyName) const
467 {
468  for (TypeInfoWrapperSet::const_iterator it = supportedPropertyTypes.begin();
469  it != supportedPropertyTypes.end();
470  ++it )
471  {
472  if (friendlyName.toStdString().compare(it->getName()) == 0)
473  return true;
474  }
475  return false;
476 }
477 
486 template<typename MeshT>
487 bool OMPropertyModel<MeshT>::isNew(OpenMesh::BaseProperty* const baseProp, PropertyInfo::ENTITY_FILTER filter)
488 {
489  for (unsigned int i = 0; i < propertyVisualizers.size(); ++i)
490  {
491  const PropertyInfo& propInfo = propertyVisualizers[i]->getPropertyInfo();
492  if (propInfo == PropertyInfo(baseProp->name(), getSupportedTypeInfoWrapper(baseProp) , filter))
493  return false;
494  }
495  return true;
496 }
497 
505 template<typename MeshT>
507 {
508  TypeInfoWrapper bp_type = typeid(*baseProp);
509  TypeInfoWrapperSet::const_iterator propIt = supportedPropertyTypes.find(bp_type);
510  return *propIt;
511 }
512 
520 template<typename MeshT>
522 {
523  for (TypeInfoWrapperSet::const_iterator it = supportedPropertyTypes.begin();
524  it != supportedPropertyTypes.end();
525  ++it )
526  {
527  if (friendlyName.toStdString().compare(it->getName()) == 0)
528  return *it;
529  }
530  throw std::exception();
531 }
532 
533 
544 template<typename MeshT>
545 void OMPropertyModel<MeshT>::addPropertyVisualizer(OpenMesh::BaseProperty* const baseProp, MeshT* mesh, PropertyInfo::ENTITY_FILTER filter)
546 {
547  PropertyInfo propInfo = PropertyInfo(baseProp->name(), getSupportedTypeInfoWrapper(baseProp) , filter);
548  if (propInfo.typeinfo() == proptype_bool)
549  propertyVisualizers.push_back(new OMPropertyVisualizerBoolean<MeshT>(mesh, objectID_, propInfo));
550  else if (propInfo.typeinfo() == proptype_int)
551  propertyVisualizers.push_back(new OMPropertyVisualizerInteger<MeshT, int>(mesh, objectID_, propInfo, false));
552  else if (propInfo.typeinfo() == proptype_uint)
553  propertyVisualizers.push_back(new OMPropertyVisualizerInteger<MeshT, unsigned int>(mesh, objectID_, propInfo, true));
554  else if (propInfo.typeinfo() == proptype_uint8_t)
555  propertyVisualizers.push_back(new OMPropertyVisualizerInteger<MeshT, uint8_t>(mesh, objectID_, propInfo, true));
556  else if (propInfo.typeinfo() == proptype_double)
557  propertyVisualizers.push_back(new OMPropertyVisualizerDouble<MeshT>(mesh, objectID_, propInfo));
558  else if ((propInfo.typeinfo() == proptype_Vec3d) || (propInfo.typeinfo() == proptype_Vec3f))
559  propertyVisualizers.push_back(new OMPropertyVisualizerVector<MeshT>(mesh, objectID_, propInfo));
560  else if ((propInfo.typeinfo() == proptype_Vec2d))
561  propertyVisualizers.push_back(new OMPropertyVisualizerVector2<MeshT, ACG::Vec2d>(mesh, objectID_, propInfo));
562  else if ((propInfo.typeinfo() == proptype_Vec2f))
563  propertyVisualizers.push_back(new OMPropertyVisualizerVector2<MeshT, ACG::Vec2f>(mesh, objectID_, propInfo));
564 #ifdef ENABLE_SKELETON_SUPPORT
565  else if (propInfo.typeinfo() == proptype_SkinWeights)
566  propertyVisualizers.push_back(new OMPropertyVisualizerSkinWeights<MeshT>(mesh, objectID_, propInfo));
567 #endif
568  connectLogs(propertyVisualizers.back());
569 }
570 
581 template<typename MeshT>
582 void OMPropertyModel<MeshT>:: addProperty(QString propName, QString friendlyTypeName, PropertyInfo::ENTITY_FILTER filter)
583 {
584 
585  QString dtype = friendlyTypeName;
586  QString pname = propName;
587 
588  MeshT* mesh = mesh_;
589 
590  if ( filter == PropertyInfo::EF_VERTEX )
591  {
592  if ( (dtype == tr("Vec3d")) || (dtype == tr("Vec3f")) )
593  {
595  mesh->add_property(prop, pname.toStdString());
596  }
597  else if (dtype == tr("Vec2d"))
598  {
600  mesh->add_property(prop, pname.toStdString());
601  }
602  else if (dtype == tr("Vec2f"))
603  {
605  mesh->add_property(prop, pname.toStdString());
606  }
607  else if ( dtype == tr("double") )
608  {
610  mesh->add_property(prop, pname.toStdString());
611  }
612  else if ( dtype == tr("unsigned int") )
613  {
615  mesh->add_property(prop, pname.toStdString());
616  }
617  else if ( dtype == tr("uint8_t") )
618  {
620  mesh->add_property(prop, pname.toStdString());
621  }
622  else if ( dtype == tr("int") )
623  {
625  mesh->add_property(prop, pname.toStdString());
626  }
627  else if ( dtype == tr("bool") )
628  {
630  mesh->add_property(prop, pname.toStdString());
631  }
632  //please update the doc if you write "skin weights"-property support
633 
634 #ifdef ENABLE_SKELETON_SUPPORT
635  else if ( dtype == tr("SkinWeights") )
636  {
638  mesh->add_property(prop, pname.toStdString());
639  }
640 #endif
641  }
642  else if ( filter == PropertyInfo::EF_EDGE )
643  {
644  if ( (dtype == tr("Vec3d")) || (dtype == tr("Vec3f")) )
645  {
647  mesh->add_property(prop, pname.toStdString());
648  }
649  else if ( dtype == tr("Vec2d") )
650  {
652  mesh->add_property(prop, pname.toStdString());
653  }
654  else if ( dtype == tr("Vec2f") )
655  {
657  mesh->add_property(prop, pname.toStdString());
658  }
659  else if ( dtype == tr("double") )
660  {
662  mesh->add_property(prop, pname.toStdString());
663  }
664  else if ( dtype == tr("unsgined int") )
665  {
667  mesh->add_property(prop, pname.toStdString());
668  }
669  else if ( dtype == tr("uint8_t") )
670  {
672  mesh->add_property(prop, pname.toStdString());
673  }
674  else if ( dtype == tr("int") )
675  {
677  mesh->add_property(prop, pname.toStdString());
678  }
679  else if ( dtype == tr("bool") )
680  {
682  mesh->add_property(prop, pname.toStdString());
683  }
684  }
685  else if ( filter == PropertyInfo::EF_FACE )
686  {
687  if ( (dtype == tr("Vec3d")) || (dtype == tr("Vec3f")) )
688  {
690  mesh->add_property(prop, pname.toStdString());
691  }
692  else if ( dtype == tr("Vec2d") )
693  {
695  mesh->add_property(prop, pname.toStdString());
696  }
697  else if ( dtype == tr("Vec2f") )
698  {
700  mesh->add_property(prop, pname.toStdString());
701  }
702  else if ( dtype == tr("double") )
703  {
705  mesh->add_property(prop, pname.toStdString());
706  }
707  else if ( dtype == tr("unsigned int") )
708  {
710  mesh->add_property(prop, pname.toStdString());
711  }
712  else if ( dtype == tr("uint8_t") )
713  {
715  mesh->add_property(prop, pname.toStdString());
716  }
717  else if ( dtype == tr("int") )
718  {
720  mesh->add_property(prop, pname.toStdString());
721  }
722  else if ( dtype == tr("bool") )
723  {
725  mesh->add_property(prop, pname.toStdString());
726  }
727  }
728  else if ( filter == PropertyInfo::EF_HALFEDGE )
729  {
730  if ( (dtype == tr("Vec3d")) || (dtype == tr("Vec3f")) )
731  {
733  mesh->add_property(prop, pname.toStdString());
734  }
735  else if ( dtype == tr("double") )
736  {
738  mesh->add_property(prop, pname.toStdString());
739  }
740  else if ( dtype == tr("unsigned int") )
741  {
743  mesh->add_property(prop, pname.toStdString());
744  }
745  else if ( dtype == tr("uint8_t") )
746  {
748  mesh->add_property(prop, pname.toStdString());
749  }
750  else if ( dtype == tr("int") )
751  {
753  mesh->add_property(prop, pname.toStdString());
754  }
755  else if ( dtype == tr("bool") )
756  {
758  mesh->add_property(prop, pname.toStdString());
759  }
760  }
761 
762 }
763 
764 
765 template<typename MeshT>
767 {
768 
769 
770  supportedPropertyTypes.insert(proptype_bool);
771  supportedPropertyTypes.insert(proptype_int);
772  supportedPropertyTypes.insert(proptype_uint);
773  supportedPropertyTypes.insert(proptype_uint8_t);
774  supportedPropertyTypes.insert(proptype_double);
775  supportedPropertyTypes.insert(proptype_Vec3d);
776  supportedPropertyTypes.insert(proptype_Vec3f);
777  supportedPropertyTypes.insert(proptype_Vec2d);
778  supportedPropertyTypes.insert(proptype_Vec2f);
779 
780 #ifdef ENABLE_SKELETON_SUPPORT
781  supportedPropertyTypes.insert(proptype_SkinWeights);
782 #endif
783 
784 //#ifdef ENABLE_SKELETON_SUPPORT
785 // //template <typename MeshT>
786 // //const typename OMPropertyModel<MeshT>::TypeInfoWrapperSet OMPropertyModel<MeshT>::supportedPropertyTypes =
787 // // (OpenFlipper::Options::nogui() ? typename OMPropertyModel<MeshT>::TypeInfoWrapperSet() : typename OMPropertyModel<MeshT>::TypeInfoWrapperSet(propertyTypes, propertyTypes + 7));
788 // supportedPropertyTypes = typename OMPropertyModel<MeshT>::TypeInfoWrapperSet();
789 //#else
790 // //const typename OMPropertyModel<MeshT>::TypeInfoWrapperSet OMPropertyModel<MeshT>::supportedPropertyTypes =
791 // // (OpenFlipper::Options::nogui() ? typename OMPropertyModel<MeshT>::TypeInfoWrapperSet() : typename OMPropertyModel<MeshT>::TypeInfoWrapperSet(propertyTypes, propertyTypes + 6));
792 // supportedPropertyTypes = typename OMPropertyModel<MeshT>::TypeInfoWrapperSet();
793 //#endif
794 
795 }
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
bool isSupported(OpenMesh::BaseProperty *const baseProp) const
Checks if visualizing this property is supported.
virtual void setPropertyFromFile(QTextStream &file_stream, unsigned int n, PropertyVisualizer *propVis)
Sets the property values from a given file.
unsigned int getClosestPrimitiveId(unsigned int _face, ACG::Vec3d &_hitPoint)
Returns the ID of the closest primitive.
Wraps the information of a type.
Definition: Utils.hh:73
picks faces (should be implemented for all nodes)
Definition: PickTarget.hh:78
virtual void saveProperty()
Saves the currently slected properties.
virtual QString getLoadFilenameFilter()
Returns the filename filter for loading.
bool isPropertyFree(QString propName, PropertyInfo::ENTITY_FILTER filter, TypeInfoWrapper typeInfo)
Checks if the property name is still available.
bool isNew(OpenMesh::BaseProperty *const baseProp, PropertyInfo::ENTITY_FILTER filter)
Checks if we already created a PropertyVisualizer for this property.
Added for signal/slot support.
void connectLogs(PropertyVisualizer *propViz) override
Connects the PropertyVisualizer log signals with the log slot.
int id() const
Definition: BaseObject.cc:190
virtual bool parseHeader(QString header, PropertyVisualizer *&propVis, unsigned int &n)
Parses the property file header.
virtual void pickModeChanged(const std::string &_mode)
Handles changing of pick mode.
void saveProperty(unsigned int propId)
Saves property.
virtual void gatherProperties() override
Searches for properties and creates PropertyVisualizers.
Asks the user how to proceed after a name clash.
Definition: Utils.hh:170
Viewer::ActionMode actionMode()
Get the current Action mode.
void resetPicking()
Disables picking.
virtual QString getSaveFilenameFilter(unsigned int propId)
Returns the filename filter for saving.
void addPropertyVisualizer(OpenMesh::BaseProperty *const baseProp, MeshT *mesh, PropertyInfo::ENTITY_FILTER filter)
Adds a new PropertyVisualizer.
const PropertyInfo & getPropertyInfo() const
Returns the PropertyInfo.
TypeInfoWrapper getSupportedTypeInfoWrapper(OpenMesh::BaseProperty *const baseProp)
Returns the TypeInfoWrapper for the property if it is supported.
Cellection of information about a property.
Definition: Utils.hh:109
const std::string & name() const
Return the name of the property.
void addProperty(QString propName, QString friendlyTypeName, PropertyInfo::ENTITY_FILTER filter)
Adds a new property to the mesh.
const std::string pickMode()
Get the current Picking mode.
This class vizualizes a property.
PropertyVisualizer * getPropertyVisualizer(QString propName, PropertyInfo::ENTITY_FILTER filter, TypeInfoWrapper typeInfo)
Returns a PropertyVisualizer.
virtual void updateWidget(const QModelIndexList &selectedIndices)
Updates the widget.
void gatherProperties()
Searches for all properties and creates the visualizers.
virtual void pickProperty()
Toggle picking on and off.
virtual void updateWidget(const QModelIndexList &selectedIndices) override
Updates the widget.
virtual void setPropertyFromFile(QTextStream &file_stream, unsigned int n, PropertyVisualizer *propVis)
Sets the property values from a given file.
virtual void combine()
Combines two properties.
virtual void mouseEvent(QMouseEvent *_event)
Handles mouse events for picking.
bool combinable(PropertyVisualizer *propertyVisualizer1, PropertyVisualizer *propertyVisualizer2)
Checks if two properties are combinable.
virtual void setPropertyFromText(unsigned int index, QString text)=0
Returns the value of a property in text form.
bool getPickedObject(const size_t _node_idx, BaseObjectData *&_object)
Get the picked mesh.
virtual QString getPropertyText(unsigned int index)
Returns the value of a property in text form.