Commit cd820f70 authored by Jan Möbius's avatar Jan Möbius

Merge branch 'fix_crash' into 'master'

Fix crash and only change draw mode of selected meshes

See merge request !15
parents ead5c31a 4ed43069
......@@ -70,8 +70,8 @@ OMPropertyModel<MeshT>::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<MeshT>::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<MeshT>::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<MeshT>* viz = dynamic_cast<OMPropertyVisualizer<MeshT>*>(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<MeshT>* viz = dynamic_cast<OMPropertyVisualizer<MeshT>*>(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));
}
}
}
}
......
......@@ -90,6 +90,8 @@ public:
virtual QString getPropertyText(unsigned int index);
void setDrawMode(const ACG::SceneGraph::DrawModes::DrawMode& _mode);
protected:
MeshT* mesh;
int mObjectID;
......
......@@ -87,7 +87,7 @@ void OMPropertyVisualizerBoolean<MeshT>::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<MeshT>::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 <typename MeshT>
......@@ -144,7 +144,7 @@ void OMPropertyVisualizerBoolean<MeshT>::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<MeshT>::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);
}
......
......@@ -132,7 +132,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeFaceProp(bool _setDrawMode)
}
if (_setDrawMode)
PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED);
this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED);
}
template <typename MeshT>
......@@ -211,7 +211,7 @@ void OMPropertyVisualizerDouble<MeshT>::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<MeshT>::visualizeHalfedgeProp(bool _setDrawMode)
}
}
if (_setDrawMode)
PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::HALFEDGES_COLORED);
this->setDrawMode(ACG::SceneGraph::DrawModes::HALFEDGES_COLORED);
}
template <typename MeshT>
......@@ -365,7 +365,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeVertexProp(bool _setDrawMode)
}
if (_setDrawMode)
PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED);
this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED);
}
template <typename MeshT>
......
......@@ -142,7 +142,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeFaceProp(bool _setDrawMode)
}
if (_setDrawMode)
PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED);
this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED);
}
template <typename MeshT, typename T>
......@@ -218,7 +218,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::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<MeshT, T>::visualizeHalfedgeProp(bool _setDrawM
}
if (_setDrawMode)
PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::HALFEDGES_COLORED);
this->setDrawMode(ACG::SceneGraph::DrawModes::HALFEDGES_COLORED);
}
template <typename MeshT, typename T>
......@@ -371,7 +371,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeVertexProp(bool _setDrawMod
}
if (_setDrawMode)
PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED);
this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED);
}
......
......@@ -113,7 +113,7 @@ void OMPropertyVisualizerSkinWeights<MeshT>::visualizeVertexProp(bool _setDrawMo
}
if (_setDrawMode)
PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED);
this->setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED);
}
template<typename MeshT>
......
......@@ -145,6 +145,16 @@ QString OMPropertyVisualizer<MeshT>::getPropertyText(unsigned int index)
}
template <typename MeshT>
void OMPropertyVisualizer<MeshT>::setDrawMode(const ACG::SceneGraph::DrawModes::DrawMode& _mode)
{
BaseObjectData* object;
if (PluginFunctions::getObject(mObjectID, object))
object->setObjectDrawMode(_mode);
}
template <typename MeshT>
void OMPropertyVisualizer<MeshT>::setPropertyFromText(unsigned int index, QString text)
{
......
......@@ -158,7 +158,7 @@ void OMPropertyVisualizerVector2<MeshT, VectorType>::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<MeshT, VectorType>::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<MeshT, VectorType>::visualizeHalfedgeProp(bool
}
if (_setDrawMode)
PluginFunctions::setDrawMode(
this->setDrawMode(
ACG::SceneGraph::DrawModes::HALFEDGES_COLORED);
}
else visualizeHalfedgePropAsStrokes();
......@@ -255,7 +255,7 @@ void OMPropertyVisualizerVector2<MeshT, VectorType>::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<MeshT, VectorType>::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 <typename MeshT, typename VectorType>
......
......@@ -140,7 +140,7 @@ void OMPropertyVisualizerVectorFieldDifference<MeshT>::visualizeFaceProp(bool _s
OMPVVFD::colorElements<MeshT, typename MeshT::FaceIter, OpenMesh::FPropHandleT<typename MeshT::Point>, OMPVVFD::scalarFn_norm_of_diff<MeshT> >(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 <typename MeshT>
......@@ -161,7 +161,7 @@ void OMPropertyVisualizerVectorFieldDifference<MeshT>::visualizeEdgeProp(bool _s
OMPVVFD::colorElements<MeshT, typename MeshT::EdgeIter, OpenMesh::EPropHandleT<typename MeshT::Point>, OMPVVFD::scalarFn_norm_of_diff<MeshT> >(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 <typename MeshT>
......@@ -182,7 +182,7 @@ void OMPropertyVisualizerVectorFieldDifference<MeshT>::visualizeHalfedgeProp(boo
OMPVVFD::colorElements<MeshT, typename MeshT::HalfedgeIter, OpenMesh::HPropHandleT<typename MeshT::Point>, OMPVVFD::scalarFn_norm_of_diff<MeshT> >(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 <typename MeshT>
......@@ -203,5 +203,5 @@ void OMPropertyVisualizerVectorFieldDifference<MeshT>::visualizeVertexProp(bool
OMPVVFD::colorElements<MeshT, typename MeshT::VertexIter, OpenMesh::VPropHandleT<typename MeshT::Point>, OMPVVFD::scalarFn_norm_of_diff<MeshT> >(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);
}
......@@ -154,7 +154,7 @@ void OMPropertyVisualizerVector<MeshT>::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<MeshT>::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<MeshT>::visualizeHalfedgeProp(bool _setDrawMode)
}
if (_setDrawMode)
PluginFunctions::setDrawMode(
this->setDrawMode(
ACG::SceneGraph::DrawModes::HALFEDGES_COLORED);
}
else visualizeHalfedgePropAsStrokes();
......@@ -254,7 +254,7 @@ void OMPropertyVisualizerVector<MeshT>::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<MeshT>::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 <typename MeshT>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment