diff --git a/src/common/ml_shared_data_context.h b/src/common/ml_shared_data_context.h index 063a26771..f0d3abc79 100644 --- a/src/common/ml_shared_data_context.h +++ b/src/common/ml_shared_data_context.h @@ -45,7 +45,8 @@ struct MLPerViewGLOptions : public vcg::RenderingModalityGLOptions bool _peredge_extra_enabled; bool _peredge_boundary_enabled; - bool _peredge_manifold_enabled; + bool _peredge_edgemanifold_enabled; + bool _peredge_vertmanifold_enabled; bool _peredge_text_boundary_enabled; bool _back_face_cull; @@ -71,7 +72,8 @@ struct MLPerViewGLOptions : public vcg::RenderingModalityGLOptions _visible = true; _peredge_extra_enabled = false; _peredge_boundary_enabled = true; - _peredge_manifold_enabled = true; + _peredge_edgemanifold_enabled = true; + _peredge_vertmanifold_enabled = true; _peredge_text_boundary_enabled = false; _back_face_cull = false; _double_side_lighting = false; @@ -111,7 +113,8 @@ private: _visible = opts._visible; _peredge_extra_enabled = opts._peredge_extra_enabled; _peredge_boundary_enabled = opts._peredge_boundary_enabled; - _peredge_manifold_enabled = opts._peredge_manifold_enabled; + _peredge_edgemanifold_enabled = opts._peredge_edgemanifold_enabled; + _peredge_vertmanifold_enabled = opts._peredge_vertmanifold_enabled; _peredge_text_boundary_enabled = opts._peredge_text_boundary_enabled; _back_face_cull = opts._back_face_cull; _double_side_lighting = opts._double_side_lighting; diff --git a/src/meshlab/ml_render_gui.cpp b/src/meshlab/ml_render_gui.cpp index d1c4c1156..d26f3b103 100644 --- a/src/meshlab/ml_render_gui.cpp +++ b/src/meshlab/ml_render_gui.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include MLRenderingToolbar::MLRenderingToolbar(QWidget* parent ) @@ -124,6 +125,7 @@ void MLRenderingToolbar::getCurrentRenderingDataAccordingToGUI( MLRenderingData& } } + MLRenderingSideToolbar::MLRenderingSideToolbar(QWidget* parent /*= NULL*/ ) :MLRenderingToolbar(parent) { @@ -147,6 +149,26 @@ void MLRenderingSideToolbar::initGui() addRenderingAction(new MLRenderingEdgeDecoratorAction(_meshid,this)); } +void MLRenderingSideToolbar::toggle( QAction* clickedact ) +{ + if ((clickedact != NULL) && (_actgroup != NULL)) + { + Qt::KeyboardModifiers mod = QApplication::keyboardModifiers(); + if (_actgroup != NULL) + { + if (mod == Qt::ControlModifier) + { + foreach(MLRenderingAction* act,_acts) + { + if (act != NULL) + act->setChecked(clickedact == act); + } + } + } + } + MLRenderingToolbar::toggle(clickedact); +} + MLRenderingParametersFrame::MLRenderingParametersFrame( int meshid,QWidget* parent ) :QFrame(parent),_meshid(meshid) { @@ -195,7 +217,6 @@ MLRenderingSolidParametersFrame::MLRenderingSolidParametersFrame( int meshid,QWi void MLRenderingSolidParametersFrame::initGui() { - setAutoFillBackground(true); QGridLayout* layout = new QGridLayout(); _shadingtool = new MLRenderingToolbar(_meshid,this); @@ -558,14 +579,16 @@ MLRenderingEdgeDecoratorParametersFrame::MLRenderingEdgeDecoratorParametersFrame MLRenderingEdgeDecoratorParametersFrame::~MLRenderingEdgeDecoratorParametersFrame() { delete _boundarytool; - delete _manifoldtool; + delete _edgemanifoldtool; + delete _vertmanifoldtool; delete _texturebordertool; } void MLRenderingEdgeDecoratorParametersFrame::getCurrentRenderingDataAccordingToGUI( MLRenderingData& dt ) const { _boundarytool->getRenderingDataAccordingToGUI(dt); - _manifoldtool->getRenderingDataAccordingToGUI(dt); + _edgemanifoldtool->getRenderingDataAccordingToGUI(dt); + _vertmanifoldtool->getRenderingDataAccordingToGUI(dt); _texturebordertool->getRenderingDataAccordingToGUI(dt); } @@ -573,14 +596,16 @@ void MLRenderingEdgeDecoratorParametersFrame::getCurrentRenderingDataAccordingTo void MLRenderingEdgeDecoratorParametersFrame::setPrimitiveButtonStatesAccordingToRenderingData( const MLRenderingData& dt ) { _boundarytool->setAccordingToRenderingData(dt); - _manifoldtool->setAccordingToRenderingData(dt); + _edgemanifoldtool->setAccordingToRenderingData(dt); + _vertmanifoldtool->setAccordingToRenderingData(dt); _texturebordertool->setAccordingToRenderingData(dt); } void MLRenderingEdgeDecoratorParametersFrame::setAssociatedMeshId( int meshid ) { _boundarytool->setAssociatedMeshId(meshid); - _manifoldtool->setAssociatedMeshId(meshid); + _edgemanifoldtool->setAssociatedMeshId(meshid); + _vertmanifoldtool->setAssociatedMeshId(meshid); _texturebordertool->setAssociatedMeshId(meshid); } @@ -598,20 +623,28 @@ void MLRenderingEdgeDecoratorParametersFrame::initGui() layout->addWidget(_boundarytool,0,1,Qt::AlignLeft); connect(_boundarytool,SIGNAL(updateRenderingDataAccordingToAction(int,MLRenderingAction*)),this,SIGNAL(updateRenderingDataAccordingToAction(int,MLRenderingAction*))); - QLabel* manifoldlab = new QLabel("Manifold",this); - manifoldlab->setFont(boldfont); - layout->addWidget(manifoldlab,1,0,Qt::AlignLeft); - _manifoldtool = new MLRenderingOnOffToolbar(_meshid,this); - _manifoldtool->setRenderingAction(new MLRenderingManifoldAction(_meshid,_manifoldtool)); - layout->addWidget(_manifoldtool,1,1,Qt::AlignLeft); - connect(_manifoldtool,SIGNAL(updateRenderingDataAccordingToAction(int,MLRenderingAction*)),this,SIGNAL(updateRenderingDataAccordingToAction(int,MLRenderingAction*))); + QLabel* vertmanifoldlab = new QLabel("No-Manif Verts",this); + vertmanifoldlab->setFont(boldfont); + layout->addWidget(vertmanifoldlab,1,0,Qt::AlignLeft); + _vertmanifoldtool = new MLRenderingOnOffToolbar(_meshid,this); + _vertmanifoldtool->setRenderingAction(new MLRenderingVertManifoldAction(_meshid,_vertmanifoldtool)); + layout->addWidget(_vertmanifoldtool,1,1,Qt::AlignLeft); + connect(_vertmanifoldtool,SIGNAL(updateRenderingDataAccordingToAction(int,MLRenderingAction*)),this,SIGNAL(updateRenderingDataAccordingToAction(int,MLRenderingAction*))); + + QLabel* edgemanifoldlab = new QLabel("No-Manif Edges",this); + edgemanifoldlab->setFont(boldfont); + layout->addWidget(edgemanifoldlab,2,0,Qt::AlignLeft); + _edgemanifoldtool = new MLRenderingOnOffToolbar(_meshid,this); + _edgemanifoldtool->setRenderingAction(new MLRenderingEdgeManifoldAction(_meshid,_edgemanifoldtool)); + layout->addWidget(_edgemanifoldtool,2,1,Qt::AlignLeft); + connect(_edgemanifoldtool,SIGNAL(updateRenderingDataAccordingToAction(int,MLRenderingAction*)),this,SIGNAL(updateRenderingDataAccordingToAction(int,MLRenderingAction*))); QLabel* textureborderlab = new QLabel("Texture Border",this); textureborderlab->setFont(boldfont); - layout->addWidget(textureborderlab,2,0,Qt::AlignLeft); + layout->addWidget(textureborderlab,3,0,Qt::AlignLeft); _texturebordertool = new MLRenderingOnOffToolbar(_meshid,this); - _texturebordertool->setRenderingAction(new MLRenderingTexBorderAction(_meshid,_manifoldtool)); - layout->addWidget(_texturebordertool,2,1,Qt::AlignLeft); + _texturebordertool->setRenderingAction(new MLRenderingTexBorderAction(_meshid,_texturebordertool)); + layout->addWidget(_texturebordertool,3,1,Qt::AlignLeft); connect(_texturebordertool,SIGNAL(updateRenderingDataAccordingToAction(int,MLRenderingAction*)),this,SIGNAL(updateRenderingDataAccordingToAction(int,MLRenderingAction*))); setMinimumSize(layout->sizeHint()); diff --git a/src/meshlab/ml_render_gui.h b/src/meshlab/ml_render_gui.h index fa2e63e43..6734d1249 100644 --- a/src/meshlab/ml_render_gui.h +++ b/src/meshlab/ml_render_gui.h @@ -125,15 +125,16 @@ protected: QList _acts; int _meshid; MLRenderingAction* _previoussel; - -private slots: - void toggle(QAction* act); +protected slots: + virtual void toggle(QAction* act); void extraUpdateRequired(int,MLRenderingAction*); signals: void updateRenderingDataAccordingToActions(int,const QList& acts); void activatedAction(MLRenderingAction*); + + protected: //if meshid is -1 it means that the actions are intended to be deployed to all the document and not to a specific mesh model QActionGroup* _actgroup; @@ -148,6 +149,9 @@ public: MLRenderingSideToolbar(int meshid,QWidget* parent = NULL); ~MLRenderingSideToolbar() {} +private slots: + void toggle(QAction* act); + private: void initGui(); }; @@ -292,7 +296,8 @@ public: private: void initGui(); MLRenderingOnOffToolbar* _boundarytool; - MLRenderingOnOffToolbar* _manifoldtool; + MLRenderingOnOffToolbar* _vertmanifoldtool; + MLRenderingOnOffToolbar* _edgemanifoldtool; MLRenderingOnOffToolbar* _texturebordertool; }; diff --git a/src/meshlab/ml_rendering_actions.cpp b/src/meshlab/ml_rendering_actions.cpp index 82638c278..2b7bb7112 100644 --- a/src/meshlab/ml_rendering_actions.cpp +++ b/src/meshlab/ml_rendering_actions.cpp @@ -934,35 +934,67 @@ bool MLRenderingBoundaryAction::isRenderingDataEnabled( const MLRenderingData& r return false; } -MLRenderingManifoldAction::MLRenderingManifoldAction( QObject* parent ) +MLRenderingEdgeManifoldAction::MLRenderingEdgeManifoldAction( QObject* parent ) :MLRenderingAction(-1,parent) { - setText("2-Manifold Decorator"); + setText("No 2-Manifold Edges Decorator"); } -MLRenderingManifoldAction::MLRenderingManifoldAction( int meshid,QObject* parent ) +MLRenderingEdgeManifoldAction::MLRenderingEdgeManifoldAction( int meshid,QObject* parent ) :MLRenderingAction(meshid,parent) { - setText("2-Manifold Decorator"); + setText("No 2-Manifold Edges Decorator"); } -void MLRenderingManifoldAction::updateRenderingData( MLRenderingData& rd ) +void MLRenderingEdgeManifoldAction::updateRenderingData( MLRenderingData& rd ) { MLPerViewGLOptions opts; bool valid = rd.get(opts); if (valid) { - opts._peredge_manifold_enabled = isChecked(); + opts._peredge_edgemanifold_enabled = isChecked(); rd.set(opts); } } -bool MLRenderingManifoldAction::isRenderingDataEnabled( const MLRenderingData& rd ) const +bool MLRenderingEdgeManifoldAction::isRenderingDataEnabled( const MLRenderingData& rd ) const { MLPerViewGLOptions opts; bool valid = rd.get(opts); if (valid) - return opts._peredge_manifold_enabled; + return opts._peredge_edgemanifold_enabled; + return false; +} + +MLRenderingVertManifoldAction::MLRenderingVertManifoldAction( QObject* parent ) + :MLRenderingAction(-1,parent) +{ + setText("No 2-Manifold Vertices Decorator"); +} + +MLRenderingVertManifoldAction::MLRenderingVertManifoldAction( int meshid,QObject* parent ) + :MLRenderingAction(meshid,parent) +{ + setText("No 2-Manifold Vertices Decorator"); +} + +void MLRenderingVertManifoldAction::updateRenderingData( MLRenderingData& rd ) +{ + MLPerViewGLOptions opts; + bool valid = rd.get(opts); + if (valid) + { + opts._peredge_vertmanifold_enabled = isChecked(); + rd.set(opts); + } +} + +bool MLRenderingVertManifoldAction::isRenderingDataEnabled( const MLRenderingData& rd ) const +{ + MLPerViewGLOptions opts; + bool valid = rd.get(opts); + if (valid) + return opts._peredge_vertmanifold_enabled; return false; } diff --git a/src/meshlab/ml_rendering_actions.h b/src/meshlab/ml_rendering_actions.h index 13094cd9e..05e758d3d 100644 --- a/src/meshlab/ml_rendering_actions.h +++ b/src/meshlab/ml_rendering_actions.h @@ -378,17 +378,29 @@ public: bool isRenderingDataEnabled(const MLRenderingData& rd) const; }; -class MLRenderingManifoldAction : public MLRenderingAction +class MLRenderingEdgeManifoldAction : public MLRenderingAction { Q_OBJECT public: - MLRenderingManifoldAction(QObject* parent); - MLRenderingManifoldAction(int meshid,QObject* parent); + MLRenderingEdgeManifoldAction(QObject* parent); + MLRenderingEdgeManifoldAction(int meshid,QObject* parent); void updateRenderingData(MLRenderingData& rd); bool isRenderingDataEnabled(const MLRenderingData& rd) const; }; +class MLRenderingVertManifoldAction : public MLRenderingAction +{ + Q_OBJECT +public: + MLRenderingVertManifoldAction(QObject* parent); + MLRenderingVertManifoldAction(int meshid,QObject* parent); + + void updateRenderingData(MLRenderingData& rd); + bool isRenderingDataEnabled(const MLRenderingData& rd) const; +}; + + class MLRenderingTexBorderAction : public MLRenderingAction { Q_OBJECT