Commit 02f2ecc6 authored by Max Lyon's avatar Max Lyon

fix crash when failed to getPickedObject

parent 83f680d1
......@@ -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));
}
}
}
}
......
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