diff --git a/src/common/ml_shared_data_context.cpp b/src/common/ml_shared_data_context.cpp index 4979a5c20..d625efd78 100644 --- a/src/common/ml_shared_data_context.cpp +++ b/src/common/ml_shared_data_context.cpp @@ -518,7 +518,7 @@ void MLPoliciesStandAloneFunctions::computeRequestedRenderingDataCompatibleWithM } - MLPoliciesStandAloneFunctions::setPerViewGLOptionsPriorities(meshmodel,outputdt); + MLPoliciesStandAloneFunctions::setPerViewGLOptionsPriorities(outputdt); } void MLPoliciesStandAloneFunctions::fromMeshModelMaskToMLRenderingAtts( int meshmodelmask,MLRenderingData::RendAtts& atts) @@ -628,7 +628,7 @@ void MLPoliciesStandAloneFunctions::suggestedDefaultPerViewRenderingData(MeshMod } -void MLPoliciesStandAloneFunctions::disableRedundatRenderingDataAccordingToPriorities(MeshModel* meshmodel, MLRenderingData& dt) +void MLPoliciesStandAloneFunctions::disableRedundatRenderingDataAccordingToPriorities(MLRenderingData& dt) { for (MLRenderingData::PRIMITIVE_MODALITY pr = MLRenderingData::PRIMITIVE_MODALITY(0); pr < MLRenderingData::PR_ARITY; pr = MLRenderingData::next(pr)) { @@ -638,7 +638,7 @@ void MLPoliciesStandAloneFunctions::disableRedundatRenderingDataAccordingToPrior dt.set(pr, atts); } - setPerViewGLOptionsPriorities(meshmodel, dt); + setPerViewGLOptionsPriorities(dt); } @@ -699,16 +699,16 @@ void MLPoliciesStandAloneFunctions::setAttributePriorities(MLRenderingData::Rend // //} -void MLPoliciesStandAloneFunctions::setPerViewGLOptionsPriorities(MeshModel* mm,MLRenderingData& dt ) +void MLPoliciesStandAloneFunctions::setPerViewGLOptionsPriorities(MLRenderingData& dt ) { - if (mm == NULL) - return; - bool permeshcolor = mm->hasDataMask(MeshModel::MM_COLOR); + //if (mm == NULL) + // return; + //bool permeshcolor = mm->hasDataMask(MeshModel::MM_COLOR); MLPerViewGLOptions glopts; if (!dt.get(glopts)) return; - if (permeshcolor) - glopts._perpoint_mesh_color_enabled = true; + /*if (permeshcolor) + glopts._perpoint_mesh_color_enabled = true;*/ for(MLRenderingData::PRIMITIVE_MODALITY pm = MLRenderingData::PRIMITIVE_MODALITY(0);pm < MLRenderingData::PR_ARITY;pm = MLRenderingData::next(pm)) { @@ -720,23 +720,23 @@ void MLPoliciesStandAloneFunctions::setPerViewGLOptionsPriorities(MeshModel* mm, case (MLRenderingData::PR_POINTS): { glopts._perpoint_noshading = !atts[MLRenderingData::ATT_NAMES::ATT_VERTNORMAL]; - glopts._perpoint_mesh_color_enabled = !atts[MLRenderingData::ATT_NAMES::ATT_VERTCOLOR] && permeshcolor; - glopts._perpoint_fixed_color_enabled = !atts[MLRenderingData::ATT_NAMES::ATT_VERTCOLOR] && !permeshcolor; + glopts._perpoint_mesh_color_enabled &= !atts[MLRenderingData::ATT_NAMES::ATT_VERTCOLOR]; + glopts._perpoint_fixed_color_enabled = !atts[MLRenderingData::ATT_NAMES::ATT_VERTCOLOR] && !glopts._perpoint_mesh_color_enabled; break; } case (MLRenderingData::PR_WIREFRAME_EDGES): case (MLRenderingData::PR_WIREFRAME_TRIANGLES): { glopts._perwire_noshading = !atts[MLRenderingData::ATT_NAMES::ATT_VERTNORMAL]; - glopts._perwire_mesh_color_enabled = !atts[MLRenderingData::ATT_NAMES::ATT_VERTCOLOR] && permeshcolor; - glopts._perwire_fixed_color_enabled = !atts[MLRenderingData::ATT_NAMES::ATT_VERTCOLOR] && !atts[MLRenderingData::ATT_NAMES::ATT_FACECOLOR] && !permeshcolor; + glopts._perwire_mesh_color_enabled &= !atts[MLRenderingData::ATT_NAMES::ATT_VERTCOLOR]; + glopts._perwire_fixed_color_enabled = !atts[MLRenderingData::ATT_NAMES::ATT_VERTCOLOR] && !atts[MLRenderingData::ATT_NAMES::ATT_FACECOLOR] && !glopts._perwire_mesh_color_enabled; break; } case (MLRenderingData::PR_SOLID): { glopts._persolid_noshading = (!atts[MLRenderingData::ATT_NAMES::ATT_VERTNORMAL]) && (!atts[MLRenderingData::ATT_NAMES::ATT_FACENORMAL]); - glopts._persolid_mesh_color_enabled = !atts[MLRenderingData::ATT_NAMES::ATT_VERTCOLOR] && !atts[MLRenderingData::ATT_NAMES::ATT_FACECOLOR] && permeshcolor; - glopts._persolid_fixed_color_enabled = !atts[MLRenderingData::ATT_NAMES::ATT_VERTCOLOR] && !atts[MLRenderingData::ATT_NAMES::ATT_FACECOLOR] && !permeshcolor; + glopts._persolid_mesh_color_enabled &= !atts[MLRenderingData::ATT_NAMES::ATT_VERTCOLOR] && !atts[MLRenderingData::ATT_NAMES::ATT_FACECOLOR]; + glopts._persolid_fixed_color_enabled = !atts[MLRenderingData::ATT_NAMES::ATT_VERTCOLOR] && !atts[MLRenderingData::ATT_NAMES::ATT_FACECOLOR] && !glopts._persolid_mesh_color_enabled; break; } case (MLRenderingData::PR_ARITY): diff --git a/src/common/ml_shared_data_context.h b/src/common/ml_shared_data_context.h index 9da07aeb3..a43d2783f 100644 --- a/src/common/ml_shared_data_context.h +++ b/src/common/ml_shared_data_context.h @@ -190,7 +190,7 @@ struct MLPoliciesStandAloneFunctions static void setAttributePriorities(MLRenderingData::RendAtts& atts); - static void setPerViewGLOptionsPriorities(MeshModel* mm,MLRenderingData& dt ); + static void setPerViewGLOptionsPriorities(MLRenderingData& dt ); //static void setPerViewRenderingDataPriorities(MeshModel* mm,MLRenderingData& dt); @@ -198,7 +198,7 @@ struct MLPoliciesStandAloneFunctions static void suggestedDefaultPerViewRenderingData(MeshModel* meshmodel,MLRenderingData& dt); - static void disableRedundatRenderingDataAccordingToPriorities(MeshModel* meshmodel,MLRenderingData& dt); + static void disableRedundatRenderingDataAccordingToPriorities(MLRenderingData& dt); static bool isPrimitiveModalityCompatibleWithMesh(MeshModel* m,const MLRenderingData::PRIMITIVE_MODALITY pm); diff --git a/src/meshlab/glarea.cpp b/src/meshlab/glarea.cpp index a02e91765..7b065997d 100644 --- a/src/meshlab/glarea.cpp +++ b/src/meshlab/glarea.cpp @@ -1046,7 +1046,7 @@ void GLArea::setCurrentEditAction(QAction *editAction) { parentmultiview->sharedDataContext()->getRenderInfoPerMeshView(md()->mm()->id(), context(), dt); iEdit->suggestedRenderingData(*(md()->mm()), dt); - MLPoliciesStandAloneFunctions::disableRedundatRenderingDataAccordingToPriorities(md()->mm(), dt); + MLPoliciesStandAloneFunctions::disableRedundatRenderingDataAccordingToPriorities(dt); parentmultiview->sharedDataContext()->setRenderingDataPerMeshView(md()->mm()->id(), context(), dt); parentmultiview->sharedDataContext()->manageBuffers(md()->mm()->id()); } @@ -1059,7 +1059,7 @@ void GLArea::setCurrentEditAction(QAction *editAction) { parentmultiview->sharedDataContext()->getRenderInfoPerMeshView(mm->id(), context(), dt); iEdit->suggestedRenderingData(*(mm), dt); - MLPoliciesStandAloneFunctions::disableRedundatRenderingDataAccordingToPriorities(mm, dt); + MLPoliciesStandAloneFunctions::disableRedundatRenderingDataAccordingToPriorities(dt); parentmultiview->sharedDataContext()->setRenderingDataPerMeshView(mm->id(), context(), dt); parentmultiview->sharedDataContext()->manageBuffers(mm->id()); } diff --git a/src/meshlab/mainwindow_RunTime.cpp b/src/meshlab/mainwindow_RunTime.cpp index 2905e1d0e..faec79452 100644 --- a/src/meshlab/mainwindow_RunTime.cpp +++ b/src/meshlab/mainwindow_RunTime.cpp @@ -638,7 +638,6 @@ void MainWindow::setHandleMenu(QPoint point, Qt::Orientation orientation, QSplit unSplitMenu->addAction(unsplitRightAct); unSplitMenu->addAction(unsplitLeftAct); } - handleMenu->popup(point); } @@ -1067,7 +1066,8 @@ void MainWindow::startFilter() // In order to avoid that a filter changes something assumed by the current editing tool, // before actually starting the filter we close the current editing tool (if any). - endEdit(); + if (GLA()->getCurrentEditAction() != NULL) + endEdit(); updateMenus(); QStringList missingPreconditions; @@ -1306,7 +1306,28 @@ void MainWindow::updateSharedContextDataAfterFilterExecution(int postcondmask,in } curr.set(pm,rd); } - MLPoliciesStandAloneFunctions::setPerViewGLOptionsPriorities(mm,curr); + MLPerViewGLOptions opts; + curr.get(opts); + if (fclasses & MeshFilterInterface::MeshColoring) + { + bool hasmeshcolor = mm->hasDataMask(MeshModel::MM_COLOR); + opts._perpoint_mesh_color_enabled = hasmeshcolor; + opts._perwire_mesh_color_enabled = hasmeshcolor; + opts._persolid_mesh_color_enabled = hasmeshcolor; + + for (MLRenderingData::PRIMITIVE_MODALITY pm = MLRenderingData::PRIMITIVE_MODALITY(0); pm < MLRenderingData::PR_ARITY; pm = MLRenderingData::next(pm)) + { + MLRenderingData::RendAtts atts; + curr.get(pm, atts); + atts[MLRenderingData::ATT_NAMES::ATT_VERTCOLOR] = false; + atts[MLRenderingData::ATT_NAMES::ATT_FACECOLOR] = false; + curr.set(pm, atts); + } + } + curr.set(opts); + + + MLPoliciesStandAloneFunctions::setPerViewGLOptionsPriorities(curr); shared->setRenderingDataPerMeshView(mm->id(),GLA()->context(),curr); currentmeshnewlycreated = false; }