Change rendered model move button from left to middle
parent
700c606616
commit
f0e68d9f7a
|
@ -274,7 +274,10 @@ void MeshGenerator::process()
|
||||||
if (mergedMeshId > 0)
|
if (mergedMeshId > 0)
|
||||||
mergedMeshId = meshlite_combine_coplanar_faces(meshliteContext, mergedMeshId);
|
mergedMeshId = meshlite_combine_coplanar_faces(meshliteContext, mergedMeshId);
|
||||||
if (mergedMeshId > 0) {
|
if (mergedMeshId > 0) {
|
||||||
int subdivedMeshId = subdivMesh(meshliteContext, mergedMeshId);
|
int errorCount = 0;
|
||||||
|
int subdivedMeshId = subdivMesh(meshliteContext, mergedMeshId, &errorCount);
|
||||||
|
if (errorCount > 0)
|
||||||
|
broken = true;
|
||||||
if (subdivedMeshId > 0)
|
if (subdivedMeshId > 0)
|
||||||
mergedMeshId = subdivedMeshId;
|
mergedMeshId = subdivedMeshId;
|
||||||
else
|
else
|
||||||
|
|
|
@ -188,18 +188,26 @@ int mergeMeshs(void *meshliteContext, const std::vector<int> &meshIds)
|
||||||
return mergedMeshId;
|
return mergedMeshId;
|
||||||
}
|
}
|
||||||
|
|
||||||
int subdivMesh(void *meshliteContext, int meshId)
|
int subdivMesh(void *meshliteContext, int meshId, int *errorCount)
|
||||||
{
|
{
|
||||||
int triangulatedMeshId = meshlite_triangulate(meshliteContext, meshId);
|
int triangulatedMeshId = meshlite_triangulate(meshliteContext, meshId);
|
||||||
//#if USE_CGAL == 1
|
|
||||||
// CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
|
|
||||||
// SimpleMesh *simpleMesh = makeCgalMeshFromMeshlite<SimpleKernel>(meshliteContext, triangulatedMeshId);
|
|
||||||
// CGAL::Subdivision_method_3::CatmullClark_subdivision(*simpleMesh, CGAL::Polygon_mesh_processing::parameters::number_of_iterations(1));
|
|
||||||
// return makeMeshliteMeshFromCgal<SimpleKernel>(meshliteContext, simpleMesh);
|
|
||||||
//#else
|
|
||||||
if (0 == meshlite_is_triangulated_manifold(meshliteContext, triangulatedMeshId)) {
|
if (0 == meshlite_is_triangulated_manifold(meshliteContext, triangulatedMeshId)) {
|
||||||
return 0;
|
#if USE_CGAL == 1
|
||||||
|
CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
|
||||||
|
int subdiviedMeshId = 0;
|
||||||
|
SimpleMesh *simpleMesh = nullptr;
|
||||||
|
try {
|
||||||
|
simpleMesh = makeCgalMeshFromMeshlite<SimpleKernel>(meshliteContext, triangulatedMeshId);
|
||||||
|
CGAL::Subdivision_method_3::CatmullClark_subdivision(*simpleMesh, CGAL::Polygon_mesh_processing::parameters::number_of_iterations(1));
|
||||||
|
subdiviedMeshId = makeMeshliteMeshFromCgal<SimpleKernel>(meshliteContext, simpleMesh);
|
||||||
|
} catch (...) {
|
||||||
|
if (errorCount)
|
||||||
|
(*errorCount)++;
|
||||||
|
}
|
||||||
|
if (simpleMesh)
|
||||||
|
delete simpleMesh;
|
||||||
|
return subdiviedMeshId;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return meshlite_subdivide(meshliteContext, meshId);
|
return meshlite_subdivide(meshliteContext, meshId);
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
|
|
||||||
int mergeMeshs(void *meshliteContext, const std::vector<int> &meshIds);
|
int mergeMeshs(void *meshliteContext, const std::vector<int> &meshIds);
|
||||||
int unionMeshs(void *meshliteContext, const std::vector<int> &meshIds, int *errorCount=0);
|
int unionMeshs(void *meshliteContext, const std::vector<int> &meshIds, int *errorCount=0);
|
||||||
int subdivMesh(void *meshliteContext, int meshId);
|
int subdivMesh(void *meshliteContext, int meshId, int *errorCount=0);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -183,7 +183,7 @@ void ModelWidget::mousePressEvent(QMouseEvent *event)
|
||||||
if (!m_moveStarted && m_graphicsFunctions && m_graphicsFunctions->mousePress(event))
|
if (!m_moveStarted && m_graphicsFunctions && m_graphicsFunctions->mousePress(event))
|
||||||
return;
|
return;
|
||||||
m_lastPos = event->pos();
|
m_lastPos = event->pos();
|
||||||
if (event->button() == Qt::LeftButton) {
|
if (event->button() == Qt::MidButton) {
|
||||||
if (!m_moveStarted) {
|
if (!m_moveStarted) {
|
||||||
m_moveStartPos = mapToParent(event->pos());
|
m_moveStartPos = mapToParent(event->pos());
|
||||||
m_moveStartGeometry = geometry();
|
m_moveStartGeometry = geometry();
|
||||||
|
@ -209,7 +209,7 @@ void ModelWidget::mouseMoveEvent(QMouseEvent *event)
|
||||||
int dx = event->x() - m_lastPos.x();
|
int dx = event->x() - m_lastPos.x();
|
||||||
int dy = event->y() - m_lastPos.y();
|
int dy = event->y() - m_lastPos.y();
|
||||||
|
|
||||||
if (event->buttons() & Qt::LeftButton) {
|
if (event->buttons() & Qt::MidButton) {
|
||||||
if (m_moveStarted) {
|
if (m_moveStarted) {
|
||||||
QRect rect = m_moveStartGeometry;
|
QRect rect = m_moveStartGeometry;
|
||||||
QPoint pos = mapToParent(event->pos());
|
QPoint pos = mapToParent(event->pos());
|
||||||
|
|
|
@ -631,7 +631,7 @@ bool SkeletonGraphicsWidget::mousePress(QMouseEvent *event)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (SkeletonDocumentEditMode::Select == m_document->editMode) {
|
} else if (SkeletonDocumentEditMode::Select == m_document->editMode) {
|
||||||
if (m_mouseEventFromSelf) {
|
//if (m_mouseEventFromSelf) {
|
||||||
bool processed = false;
|
bool processed = false;
|
||||||
if ((nullptr == m_hoveredNodeItem || m_rangeSelectionSet.find(m_hoveredNodeItem) == m_rangeSelectionSet.end()) &&
|
if ((nullptr == m_hoveredNodeItem || m_rangeSelectionSet.find(m_hoveredNodeItem) == m_rangeSelectionSet.end()) &&
|
||||||
(nullptr == m_hoveredEdgeItem || m_rangeSelectionSet.find(m_hoveredEdgeItem) == m_rangeSelectionSet.end())) {
|
(nullptr == m_hoveredEdgeItem || m_rangeSelectionSet.find(m_hoveredEdgeItem) == m_rangeSelectionSet.end())) {
|
||||||
|
@ -657,7 +657,7 @@ bool SkeletonGraphicsWidget::mousePress(QMouseEvent *event)
|
||||||
if (processed) {
|
if (processed) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue