diff --git a/OpenMesh/OMPropertyModelT_impl.hh b/OpenMesh/OMPropertyModelT_impl.hh index 0347cd56c7af7f702750ddff507dcb577e6bc750..9512fe548a7a4500b2c47de200165cc5c36e36f2 100644 --- a/OpenMesh/OMPropertyModelT_impl.hh +++ b/OpenMesh/OMPropertyModelT_impl.hh @@ -70,8 +70,8 @@ OMPropertyModel::OMPropertyModel(MeshT* mesh, int objectID, QObject *pare : OMPropertyModelSubclass(parent), mesh_(mesh), objectID_(objectID), - mCombineProperty1(0), - mCombineProperty2(0), + mCombineProperty1(nullptr), + mCombineProperty2(nullptr), pickModeActive(false) { gatherProperties(); @@ -263,7 +263,7 @@ bool OMPropertyModel::parseHeader(QString header, PropertyVisualizer*& pr TypeInfoWrapper typeInfo = getSupportedTypeInfoWrapper(friendlyName); - QString propName = QInputDialog::getText(0, "Property Name", "Please enter name.",QLineEdit::Normal,headerParts[4]); + QString propName = QInputDialog::getText(nullptr, "Property Name", "Please enter name.",QLineEdit::Normal,headerParts[4]); if (propName == "") return false; bool replace = false; @@ -383,15 +383,17 @@ void OMPropertyModel::mouseEvent(QMouseEvent* _event) ACG::Vec3d hit_point; if (PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_FACE, _event->pos(),node_idx, face_idx, &hit_point)) { - BaseObjectData* object; - PluginFunctions::getPickedObject(node_idx, object); + BaseObjectData* object = nullptr; - if (object->id() == objectID_ && !currentlySelectedIndices.empty()) + if (PluginFunctions::getPickedObject(node_idx, object)) { - OMPropertyVisualizer* viz = dynamic_cast*>(propertyVisualizers[currentlySelectedIndices.first().row()] ); - unsigned int primitiveId = viz->getClosestPrimitiveId(face_idx, hit_point); - mPickWidget.pickedHandle->setText(tr("%1").arg(primitiveId)); - mPickWidget.pickedValue->setText(viz->getPropertyText(primitiveId)); + if (object->id() == objectID_ && !currentlySelectedIndices.empty()) + { + OMPropertyVisualizer* viz = dynamic_cast*>(propertyVisualizers[currentlySelectedIndices.first().row()] ); + unsigned int primitiveId = viz->getClosestPrimitiveId(face_idx, hit_point); + mPickWidget.pickedHandle->setText(tr("%1").arg(primitiveId)); + mPickWidget.pickedValue->setText(viz->getPropertyText(primitiveId)); + } } } } diff --git a/OpenMesh/OMPropertyVisualizer.hh b/OpenMesh/OMPropertyVisualizer.hh index 8d7dd9b75a79c8cfa54c3b8df9c9ebcedc7569d8..40d6596c44169073cc42b53b6f67f2f63a7fe203 100644 --- a/OpenMesh/OMPropertyVisualizer.hh +++ b/OpenMesh/OMPropertyVisualizer.hh @@ -90,6 +90,8 @@ public: virtual QString getPropertyText(unsigned int index); + void setDrawMode(const ACG::SceneGraph::DrawModes::DrawMode& _mode); + protected: MeshT* mesh; int mObjectID; diff --git a/OpenMesh/OMPropertyVisualizerBooleanT_impl.hh b/OpenMesh/OMPropertyVisualizerBooleanT_impl.hh index 1b5d16b478a1d5ca52d62df78247b758cc7fb48c..299e254360c2caa192a2ff9a8bdbedf5e9ab4c66 100644 --- a/OpenMesh/OMPropertyVisualizerBooleanT_impl.hh +++ b/OpenMesh/OMPropertyVisualizerBooleanT_impl.hh @@ -87,7 +87,7 @@ void OMPropertyVisualizerBoolean::visualizeFaceProp(bool _setDrawMode) mesh->set_color(*f_it, colorFalse); if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED); } @@ -116,7 +116,7 @@ void OMPropertyVisualizerBoolean::visualizeEdgeProp(bool _setDrawMode) mesh->set_color(*e_it, colorFalse); if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::EDGES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::EDGES_COLORED); } template @@ -144,7 +144,7 @@ void OMPropertyVisualizerBoolean::visualizeHalfedgeProp(bool _setDrawMode mesh->set_color(*he_it, colorFalse); if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::HALFEDGES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::HALFEDGES_COLORED); } @@ -173,7 +173,7 @@ void OMPropertyVisualizerBoolean::visualizeVertexProp(bool _setDrawMode) mesh->set_color(*v_it, colorFalse); if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED); } diff --git a/OpenMesh/OMPropertyVisualizerDoubleT_impl.hh b/OpenMesh/OMPropertyVisualizerDoubleT_impl.hh index e5a612015fabe0d101cbb13de4ef358db13d6797..b4d01d09255b81e55f01bd919c3959ba226e8652 100644 --- a/OpenMesh/OMPropertyVisualizerDoubleT_impl.hh +++ b/OpenMesh/OMPropertyVisualizerDoubleT_impl.hh @@ -132,7 +132,7 @@ void OMPropertyVisualizerDouble::visualizeFaceProp(bool _setDrawMode) } if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED); } template @@ -211,7 +211,7 @@ void OMPropertyVisualizerDouble::visualizeEdgeProp(bool _setDrawMode) } if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::EDGES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::EDGES_COLORED); } @@ -288,7 +288,7 @@ void OMPropertyVisualizerDouble::visualizeHalfedgeProp(bool _setDrawMode) } } if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::HALFEDGES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::HALFEDGES_COLORED); } template @@ -365,7 +365,7 @@ void OMPropertyVisualizerDouble::visualizeVertexProp(bool _setDrawMode) } if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED); } template diff --git a/OpenMesh/OMPropertyVisualizerIntegerT_impl.hh b/OpenMesh/OMPropertyVisualizerIntegerT_impl.hh index 8852cd2f70ef4fc6d99dadb2142669f8c8fee9d3..4822634f194f039d833dcc54f809c1f311b180f9 100644 --- a/OpenMesh/OMPropertyVisualizerIntegerT_impl.hh +++ b/OpenMesh/OMPropertyVisualizerIntegerT_impl.hh @@ -142,7 +142,7 @@ void OMPropertyVisualizerInteger::visualizeFaceProp(bool _setDrawMode) } if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED); } template @@ -218,7 +218,7 @@ void OMPropertyVisualizerInteger::visualizeEdgeProp(bool _setDrawMode) } if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::EDGES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::EDGES_COLORED); } @@ -295,7 +295,7 @@ void OMPropertyVisualizerInteger::visualizeHalfedgeProp(bool _setDrawM } if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::HALFEDGES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::HALFEDGES_COLORED); } template @@ -371,7 +371,7 @@ void OMPropertyVisualizerInteger::visualizeVertexProp(bool _setDrawMod } if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED); } diff --git a/OpenMesh/OMPropertyVisualizerSkinWeightsT_impl.hh b/OpenMesh/OMPropertyVisualizerSkinWeightsT_impl.hh index d95d2e59cbe4526fdc1945d80d3c7cfb4fe6cf10..79e697e96bab6b90043491bd2ad41b5ffb490ad1 100644 --- a/OpenMesh/OMPropertyVisualizerSkinWeightsT_impl.hh +++ b/OpenMesh/OMPropertyVisualizerSkinWeightsT_impl.hh @@ -113,7 +113,7 @@ void OMPropertyVisualizerSkinWeights::visualizeVertexProp(bool _setDrawMo } if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED); } template diff --git a/OpenMesh/OMPropertyVisualizerT_impl.hh b/OpenMesh/OMPropertyVisualizerT_impl.hh index 1dc3b85e9a67ee9b9a0b1b4b987e5de9e81dd0d8..870616b953deafc64e46f975edab454e90d22877 100644 --- a/OpenMesh/OMPropertyVisualizerT_impl.hh +++ b/OpenMesh/OMPropertyVisualizerT_impl.hh @@ -145,6 +145,16 @@ QString OMPropertyVisualizer::getPropertyText(unsigned int index) } +template +void OMPropertyVisualizer::setDrawMode(const ACG::SceneGraph::DrawModes::DrawMode& _mode) +{ + BaseObjectData* object; + if (PluginFunctions::getObject(mObjectID, object)) + object->setObjectDrawMode(_mode); +} + + + template void OMPropertyVisualizer::setPropertyFromText(unsigned int index, QString text) { diff --git a/OpenMesh/OMPropertyVisualizerVector2T_impl.hh b/OpenMesh/OMPropertyVisualizerVector2T_impl.hh index c581f58e82e0a8c8487ba6a13d82fce41e851a4b..134266443deef9fb48da3eca690b36d7344a7106 100644 --- a/OpenMesh/OMPropertyVisualizerVector2T_impl.hh +++ b/OpenMesh/OMPropertyVisualizerVector2T_impl.hh @@ -158,7 +158,7 @@ void OMPropertyVisualizerVector2::visualizeFaceProp(bool _set PropertyVisualizer::propertyInfo); } if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED); } else visualizeFacePropAsStrokes(); } @@ -190,7 +190,7 @@ void OMPropertyVisualizerVector2::visualizeEdgeProp(bool _set PropertyVisualizer::propertyInfo); } if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::EDGES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::EDGES_COLORED); } else visualizeEdgePropAsStrokes(); } @@ -224,7 +224,7 @@ void OMPropertyVisualizerVector2::visualizeHalfedgeProp(bool } if (_setDrawMode) - PluginFunctions::setDrawMode( + this->setDrawMode( ACG::SceneGraph::DrawModes::HALFEDGES_COLORED); } else visualizeHalfedgePropAsStrokes(); @@ -255,7 +255,7 @@ void OMPropertyVisualizerVector2::visualizeVertexProp(bool _s PropertyVisualizer::propertyInfo); } if (_setDrawMode) - PluginFunctions::setDrawMode( + this->setDrawMode( ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED); } else visualizeVertexPropAsStrokes(); @@ -303,7 +303,7 @@ void OMPropertyVisualizerVector2::visualizeFacePropOnEdges() } _mesh->set_color(*e_it, color); } - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FLAT_SHADED | ACG::SceneGraph::DrawModes::EDGES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FLAT_SHADED | ACG::SceneGraph::DrawModes::EDGES_COLORED); } template diff --git a/OpenMesh/OMPropertyVisualizerVectorFieldDifferenceT_impl.hh b/OpenMesh/OMPropertyVisualizerVectorFieldDifferenceT_impl.hh index e73efbe94b4c1842465f721f1bc1648d560b7a5c..50cfc14ef12bc729f83ec90b2a7a8e0c7c0b99df 100644 --- a/OpenMesh/OMPropertyVisualizerVectorFieldDifferenceT_impl.hh +++ b/OpenMesh/OMPropertyVisualizerVectorFieldDifferenceT_impl.hh @@ -140,7 +140,7 @@ void OMPropertyVisualizerVectorFieldDifference::visualizeFaceProp(bool _s OMPVVFD::colorElements, OMPVVFD::scalarFn_norm_of_diff >(mesh, p1, p2, mesh->faces_begin(), mesh->faces_end()); if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED); } template @@ -161,7 +161,7 @@ void OMPropertyVisualizerVectorFieldDifference::visualizeEdgeProp(bool _s OMPVVFD::colorElements, OMPVVFD::scalarFn_norm_of_diff >(mesh, p1, p2, mesh->edges_begin(), mesh->edges_end()); if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::EDGES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::EDGES_COLORED); } template @@ -182,7 +182,7 @@ void OMPropertyVisualizerVectorFieldDifference::visualizeHalfedgeProp(boo OMPVVFD::colorElements, OMPVVFD::scalarFn_norm_of_diff >(mesh, p1, p2, mesh->halfedges_begin(), mesh->halfedges_end()); if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::HALFEDGES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::HALFEDGES_COLORED); } template @@ -203,5 +203,5 @@ void OMPropertyVisualizerVectorFieldDifference::visualizeVertexProp(bool OMPVVFD::colorElements, OMPVVFD::scalarFn_norm_of_diff >(mesh, p1, p2, mesh->vertices_begin(), mesh->vertices_end()); if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED); } diff --git a/OpenMesh/OMPropertyVisualizerVectorT_impl.hh b/OpenMesh/OMPropertyVisualizerVectorT_impl.hh index d744d220fc6f8add14e2fe328d8a570faaf9a80f..9d03da28013fd3a125661791c544dd06fd4e548f 100644 --- a/OpenMesh/OMPropertyVisualizerVectorT_impl.hh +++ b/OpenMesh/OMPropertyVisualizerVectorT_impl.hh @@ -154,7 +154,7 @@ void OMPropertyVisualizerVector::visualizeFaceProp(bool _setDrawMode) PropertyVisualizer::propertyInfo); } if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED); } else visualizeFacePropAsStrokes(); } @@ -187,7 +187,7 @@ void OMPropertyVisualizerVector::visualizeEdgeProp(bool _setDrawMode) PropertyVisualizer::propertyInfo); } if (_setDrawMode) - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::EDGES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::EDGES_COLORED); } else visualizeEdgePropAsStrokes(); } @@ -222,7 +222,7 @@ void OMPropertyVisualizerVector::visualizeHalfedgeProp(bool _setDrawMode) } if (_setDrawMode) - PluginFunctions::setDrawMode( + this->setDrawMode( ACG::SceneGraph::DrawModes::HALFEDGES_COLORED); } else visualizeHalfedgePropAsStrokes(); @@ -254,7 +254,7 @@ void OMPropertyVisualizerVector::visualizeVertexProp(bool _setDrawMode) PropertyVisualizer::propertyInfo); } if (_setDrawMode) - PluginFunctions::setDrawMode( + this->setDrawMode( ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED); } else visualizeVertexPropAsStrokes(); @@ -303,7 +303,7 @@ void OMPropertyVisualizerVector::visualizeFacePropOnEdges() { } _mesh->set_color(*e_it, color); } - PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FLAT_SHADED | ACG::SceneGraph::DrawModes::EDGES_COLORED); + this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FLAT_SHADED | ACG::SceneGraph::DrawModes::EDGES_COLORED); } template