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  QStringList headerParts = header.split(tr(", "), QString::SkipEmptyParts );
224  int headerVersion = headerParts[0].toUInt();
225  if (headerVersion == 1)
226  {
227  n = headerParts[1].toUInt();
228  unsigned int nExpected = 0;
229 
230  PropertyInfo::ENTITY_FILTER filter = (PropertyInfo::ENTITY_FILTER)headerParts[2].toInt();
231  switch (filter)
232  {
233  case PropertyInfo::EF_FACE:
234  nExpected = mesh_->n_faces();
235  break;
236  case PropertyInfo::EF_EDGE:
237  nExpected = mesh_->n_edges();
238  break;
239  case PropertyInfo::EF_HALFEDGE:
240  nExpected = mesh_->n_halfedges();
241  break;
242  case PropertyInfo::EF_VERTEX:
243  nExpected = mesh_->n_vertices();
244  break;
245  default:
246  nExpected = -1;
247  break;
248  }
249 
250  if (n != nExpected)
251  {
252  emit log(LOGERR, "Could not load property: unexpected number of entities");
253  return false;
254  }
255 
256  QString friendlyName = headerParts[3];
257 
258  if (!isSupported(friendlyName))
259  {
260  emit log(LOGERR, tr("Could not load property: unsupported property type %1").arg(friendlyName));
261  return false;
262  }
263 
264  TypeInfoWrapper typeInfo = getSupportedTypeInfoWrapper(friendlyName);
265 
266  QString propName = QInputDialog::getText(nullptr, "Property Name", "Please enter name.",QLineEdit::Normal,headerParts[4]);
267  if (propName == "") return false;
268 
269  bool replace = false;
270  if (!(isPropertyFree(propName, filter, typeInfo) || replace))
271  {
272  NewNameMessageBox* msgBox = new NewNameMessageBox(propName);
273  msgBox->exec();
274 
275  if (msgBox->rename)
276  propName = QInputDialog::getText(0, "New Property Name", "Please enter new name.");
277  else if (msgBox->cancel)
278  return false;
279  else if (msgBox->replace)
280  replace = true;
281 
282  delete msgBox;
283  }
284 
285  if (!replace)
286  {
287  addProperty(propName, friendlyName, filter);
289  }
290 
291  propVis = getPropertyVisualizer(propName, filter, typeInfo);
292 
293  return true;
294 
295  }
296  else
297  {
298  emit log(LOGERR, "Could not load property: unsupported header format");
299  return false;
300  }
301 }
302 
303 
304 template<typename MeshT>
305 void OMPropertyModel<MeshT>::setPropertyFromFile(QTextStream& file_stream, unsigned int n, PropertyVisualizer* propVis)
306 {
307 #ifdef ENABLE_SKELETON_SUPPORT
308  if (propVis->getPropertyInfo().typeinfo() == proptype_SkinWeights)
309  {
310  for (unsigned int i = 0; i < n; ++i)
311  {
312  QString propertyText = "";
313  QString tmp;
314  while ((tmp = file_stream.readLine()) != "")
315  propertyText = propertyText + tmp;
316  propVis->setPropertyFromText(i, propertyText);
317  }
318  }
319  else
320 #endif
321  {
322  SingleObjectPropertyModel::setPropertyFromFile(file_stream, n, propVis);
323  }
324 }
325 
326 template<typename MeshT>
328 {
329  PluginFunctions::pickMode(lastPickMode);
330  PluginFunctions::actionMode(lastActionMode);
331 }
332 
333 
339 template<typename MeshT>
341 {
342  if ( mPickWidget.pickButton->isChecked() ){
343 
344  lastPickMode = PluginFunctions::pickMode();
345  lastActionMode = PluginFunctions::actionMode();
346 
347  PluginFunctions::pickMode(PROP_VIS);
348  PluginFunctions::actionMode(Viewer::PickingMode);
349 
350  } else {
351  resetPicking();
352  }
353 }
354 
355 
356 template<typename MeshT>
357 void OMPropertyModel<MeshT>::pickModeChanged(const std::string& _mode)
358 {
359  pickModeActive = (_mode == PROP_VIS);
360 
361  if (!pickModeActive)
362  {
363  lastPickMode = _mode;
364  }
365 
366  mPickWidget.pickButton->setChecked(pickModeActive);
367 }
368 
375 template<typename MeshT>
376 void OMPropertyModel<MeshT>::mouseEvent(QMouseEvent* _event)
377 {
378  if (!pickModeActive) return;
379 
380  if (_event->type() == QEvent::MouseButtonPress)
381  {
382  size_t node_idx, face_idx;
383  ACG::Vec3d hit_point;
384 
385  if (PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_FACE, _event->pos(),node_idx, face_idx, &hit_point)) {
386  BaseObjectData* object = nullptr;
387 
388  if (PluginFunctions::getPickedObject(node_idx, object))
389  {
390  if (object->id() == objectID_ && !currentlySelectedIndices.empty())
391  {
392  OMPropertyVisualizer<MeshT>* viz = dynamic_cast<OMPropertyVisualizer<MeshT>*>(propertyVisualizers[currentlySelectedIndices.first().row()] );
393  unsigned int primitiveId = viz->getClosestPrimitiveId(face_idx, hit_point);
394  mPickWidget.pickedHandle->setText(tr("%1").arg(primitiveId));
395  mPickWidget.pickedValue->setText(viz->getPropertyText(primitiveId));
396  }
397  }
398  }
399  }
400 }
401 
402 template<typename MeshT>
403 bool OMPropertyModel<MeshT>::isVectorType(const TypeInfoWrapper& typeInfo) const
404 {
405  return (typeInfo == proptype_Vec3f) || (typeInfo == proptype_Vec3d);
406 }
407 
408 template<typename MeshT>
410  typename MeshT::prop_iterator props_first,
411  typename MeshT::prop_iterator props_last,
412  PropertyInfo::ENTITY_FILTER filter)
413 {
414  for (typename MeshT::prop_iterator pit = props_first; pit != props_last; ++pit) {
415  OpenMesh::BaseProperty*const baseProp = *pit;
416  if (baseProp && isSupported(baseProp) && isNew(baseProp, filter))
417  addPropertyVisualizer(baseProp, mesh, filter);
418  }
419 }
420 
421 template<typename MeshT>
423 {
424  beginResetModel();
425  if (mesh_) {
426  gatherProperties(mesh_, mesh_->fprops_begin(), mesh_->fprops_end(), PropertyInfo::EF_FACE);
427  gatherProperties(mesh_, mesh_->eprops_begin(), mesh_->eprops_end(), PropertyInfo::EF_EDGE);
428  gatherProperties(mesh_, mesh_->hprops_begin(), mesh_->hprops_end(), PropertyInfo::EF_HALFEDGE);
429  gatherProperties(mesh_, mesh_->vprops_begin(), mesh_->vprops_end(), PropertyInfo::EF_VERTEX);
430  }
431  endResetModel();
432 }
433 
434 
442 template<typename MeshT>
444 {
445  TypeInfoWrapper bp_type = typeid(*baseProp);
446  TypeInfoWrapperSet::const_iterator propIt = supportedPropertyTypes.find(bp_type);
447  return propIt != supportedPropertyTypes.end();
448 }
449 
460 template<typename MeshT>
461 bool OMPropertyModel<MeshT>::isSupported(QString friendlyName) const
462 {
463  for (TypeInfoWrapperSet::const_iterator it = supportedPropertyTypes.begin();
464  it != supportedPropertyTypes.end();
465  ++it )
466  {
467  if (friendlyName.toStdString().compare(it->getName()) == 0)
468  return true;
469  }
470  return false;
471 }
472 
481 template<typename MeshT>
482 bool OMPropertyModel<MeshT>::isNew(OpenMesh::BaseProperty* const baseProp, PropertyInfo::ENTITY_FILTER filter)
483 {
484  for (unsigned int i = 0; i < propertyVisualizers.size(); ++i)
485  {
486  const PropertyInfo& propInfo = propertyVisualizers[i]->getPropertyInfo();
487  if (propInfo == PropertyInfo(baseProp->name(), getSupportedTypeInfoWrapper(baseProp) , filter))
488  return false;
489  }
490  return true;
491 }
492 
500 template<typename MeshT>
502 {
503  TypeInfoWrapper bp_type = typeid(*baseProp);
504  TypeInfoWrapperSet::const_iterator propIt = supportedPropertyTypes.find(bp_type);
505  return *propIt;
506 }
507 
515 template<typename MeshT>
517 {
518  for (TypeInfoWrapperSet::const_iterator it = supportedPropertyTypes.begin();
519  it != supportedPropertyTypes.end();
520  ++it )
521  {
522  if (friendlyName.toStdString().compare(it->getName()) == 0)
523  return *it;
524  }
525  throw std::exception();
526 }
527 
528 
539 template<typename MeshT>
540 void OMPropertyModel<MeshT>::addPropertyVisualizer(OpenMesh::BaseProperty* const baseProp, MeshT* mesh, PropertyInfo::ENTITY_FILTER filter)
541 {
542  PropertyInfo propInfo = PropertyInfo(baseProp->name(), getSupportedTypeInfoWrapper(baseProp) , filter);
543  if (propInfo.typeinfo() == proptype_bool)
544  propertyVisualizers.push_back(new OMPropertyVisualizerBoolean<MeshT>(mesh, objectID_, propInfo));
545  else if (propInfo.typeinfo() == proptype_int)
546  propertyVisualizers.push_back(new OMPropertyVisualizerInteger<MeshT, int>(mesh, objectID_, propInfo, false));
547  else if (propInfo.typeinfo() == proptype_uint)
548  propertyVisualizers.push_back(new OMPropertyVisualizerInteger<MeshT, unsigned int>(mesh, objectID_, propInfo, true));
549  else if (propInfo.typeinfo() == proptype_uint8_t)
550  propertyVisualizers.push_back(new OMPropertyVisualizerInteger<MeshT, uint8_t>(mesh, objectID_, propInfo, true));
551  else if (propInfo.typeinfo() == proptype_double)
552  propertyVisualizers.push_back(new OMPropertyVisualizerDouble<MeshT>(mesh, objectID_, propInfo));
553  else if ((propInfo.typeinfo() == proptype_Vec3d) || (propInfo.typeinfo() == proptype_Vec3f))
554  propertyVisualizers.push_back(new OMPropertyVisualizerVector<MeshT>(mesh, objectID_, propInfo));
555  else if ((propInfo.typeinfo() == proptype_Vec2d))
556  propertyVisualizers.push_back(new OMPropertyVisualizerVector2<MeshT, ACG::Vec2d>(mesh, objectID_, propInfo));
557  else if ((propInfo.typeinfo() == proptype_Vec2f))
558  propertyVisualizers.push_back(new OMPropertyVisualizerVector2<MeshT, ACG::Vec2f>(mesh, objectID_, propInfo));
559 #ifdef ENABLE_SKELETON_SUPPORT
560  else if (propInfo.typeinfo() == proptype_SkinWeights)
561  propertyVisualizers.push_back(new OMPropertyVisualizerSkinWeights<MeshT>(mesh, objectID_, propInfo));
562 #endif
563  connectLogs(propertyVisualizers.back());
564 }
565 
576 template<typename MeshT>
577 void OMPropertyModel<MeshT>:: addProperty(QString propName, QString friendlyTypeName, PropertyInfo::ENTITY_FILTER filter)
578 {
579 
580  QString dtype = friendlyTypeName;
581  QString pname = propName;
582 
583  MeshT* mesh = mesh_;
584 
585  if ( filter == PropertyInfo::EF_VERTEX )
586  {
587  if ( (dtype == tr("Vec3d")) || (dtype == tr("Vec3f")) )
588  {
590  mesh->add_property(prop, pname.toStdString());
591  }
592  else if (dtype == tr("Vec2d"))
593  {
595  mesh->add_property(prop, pname.toStdString());
596  }
597  else if (dtype == tr("Vec2f"))
598  {
600  mesh->add_property(prop, pname.toStdString());
601  }
602  else if ( dtype == tr("double") )
603  {
605  mesh->add_property(prop, pname.toStdString());
606  }
607  else if ( dtype == tr("unsigned int") )
608  {
610  mesh->add_property(prop, pname.toStdString());
611  }
612  else if ( dtype == tr("uint8_t") )
613  {
615  mesh->add_property(prop, pname.toStdString());
616  }
617  else if ( dtype == tr("int") )
618  {
620  mesh->add_property(prop, pname.toStdString());
621  }
622  else if ( dtype == tr("bool") )
623  {
625  mesh->add_property(prop, pname.toStdString());
626  }
627  //please update the doc if you write "skin weights"-property support
628 
629 #ifdef ENABLE_SKELETON_SUPPORT
630  else if ( dtype == tr("SkinWeights") )
631  {
633  mesh->add_property(prop, pname.toStdString());
634  }
635 #endif
636  }
637  else if ( filter == PropertyInfo::EF_EDGE )
638  {
639  if ( (dtype == tr("Vec3d")) || (dtype == tr("Vec3f")) )
640  {
642  mesh->add_property(prop, pname.toStdString());
643  }
644  else if ( dtype == tr("Vec2d") )
645  {
647  mesh->add_property(prop, pname.toStdString());
648  }
649  else if ( dtype == tr("Vec2f") )
650  {
652  mesh->add_property(prop, pname.toStdString());
653  }
654  else if ( dtype == tr("double") )
655  {
657  mesh->add_property(prop, pname.toStdString());
658  }
659  else if ( dtype == tr("unsgined int") )
660  {
662  mesh->add_property(prop, pname.toStdString());
663  }
664  else if ( dtype == tr("uint8_t") )
665  {
667  mesh->add_property(prop, pname.toStdString());
668  }
669  else if ( dtype == tr("int") )
670  {
672  mesh->add_property(prop, pname.toStdString());
673  }
674  else if ( dtype == tr("bool") )
675  {
677  mesh->add_property(prop, pname.toStdString());
678  }
679  }
680  else if ( filter == PropertyInfo::EF_FACE )
681  {
682  if ( (dtype == tr("Vec3d")) || (dtype == tr("Vec3f")) )
683  {
685  mesh->add_property(prop, pname.toStdString());
686  }
687  else if ( dtype == tr("Vec2d") )
688  {
690  mesh->add_property(prop, pname.toStdString());
691  }
692  else if ( dtype == tr("Vec2f") )
693  {
695  mesh->add_property(prop, pname.toStdString());
696  }
697  else if ( dtype == tr("double") )
698  {
700  mesh->add_property(prop, pname.toStdString());
701  }
702  else if ( dtype == tr("unsigned int") )
703  {
705  mesh->add_property(prop, pname.toStdString());
706  }
707  else if ( dtype == tr("uint8_t") )
708  {
710  mesh->add_property(prop, pname.toStdString());
711  }
712  else if ( dtype == tr("int") )
713  {
715  mesh->add_property(prop, pname.toStdString());
716  }
717  else if ( dtype == tr("bool") )
718  {
720  mesh->add_property(prop, pname.toStdString());
721  }
722  }
723  else if ( filter == PropertyInfo::EF_HALFEDGE )
724  {
725  if ( (dtype == tr("Vec3d")) || (dtype == tr("Vec3f")) )
726  {
728  mesh->add_property(prop, pname.toStdString());
729  }
730  else if ( dtype == tr("double") )
731  {
733  mesh->add_property(prop, pname.toStdString());
734  }
735  else if ( dtype == tr("unsigned int") )
736  {
738  mesh->add_property(prop, pname.toStdString());
739  }
740  else if ( dtype == tr("uint8_t") )
741  {
743  mesh->add_property(prop, pname.toStdString());
744  }
745  else if ( dtype == tr("int") )
746  {
748  mesh->add_property(prop, pname.toStdString());
749  }
750  else if ( dtype == tr("bool") )
751  {
753  mesh->add_property(prop, pname.toStdString());
754  }
755  }
756 
757 }
758 
759 
760 template<typename MeshT>
762 {
763 
764 
765  supportedPropertyTypes.insert(proptype_bool);
766  supportedPropertyTypes.insert(proptype_int);
767  supportedPropertyTypes.insert(proptype_uint);
768  supportedPropertyTypes.insert(proptype_uint8_t);
769  supportedPropertyTypes.insert(proptype_double);
770  supportedPropertyTypes.insert(proptype_Vec3d);
771  supportedPropertyTypes.insert(proptype_Vec3f);
772  supportedPropertyTypes.insert(proptype_Vec2d);
773  supportedPropertyTypes.insert(proptype_Vec2f);
774 
775 #ifdef ENABLE_SKELETON_SUPPORT
776  supportedPropertyTypes.insert(proptype_SkinWeights);
777 #endif
778 
779 //#ifdef ENABLE_SKELETON_SUPPORT
780 // //template <typename MeshT>
781 // //const typename OMPropertyModel<MeshT>::TypeInfoWrapperSet OMPropertyModel<MeshT>::supportedPropertyTypes =
782 // // (OpenFlipper::Options::nogui() ? typename OMPropertyModel<MeshT>::TypeInfoWrapperSet() : typename OMPropertyModel<MeshT>::TypeInfoWrapperSet(propertyTypes, propertyTypes + 7));
783 // supportedPropertyTypes = typename OMPropertyModel<MeshT>::TypeInfoWrapperSet();
784 //#else
785 // //const typename OMPropertyModel<MeshT>::TypeInfoWrapperSet OMPropertyModel<MeshT>::supportedPropertyTypes =
786 // // (OpenFlipper::Options::nogui() ? typename OMPropertyModel<MeshT>::TypeInfoWrapperSet() : typename OMPropertyModel<MeshT>::TypeInfoWrapperSet(propertyTypes, propertyTypes + 6));
787 // supportedPropertyTypes = typename OMPropertyModel<MeshT>::TypeInfoWrapperSet();
788 //#endif
789 
790 }
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.