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