Commit 3517aeda authored by Jan Möbius's avatar Jan Möbius

Moved currentDrawMOde to viewerProperties

Removed old action triggered by drawModeMenu

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5230 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 6d569a5c
...@@ -288,18 +288,13 @@ QPoint mapToLocal( const QPoint _point ) { ...@@ -288,18 +288,13 @@ QPoint mapToLocal( const QPoint _point ) {
void setDrawMode( const unsigned int _mode , int _viewer) { void setDrawMode( const unsigned int _mode , int _viewer) {
if ( _viewer == ACTIVE_VIEWER ) { if ( _viewer == ACTIVE_VIEWER )
examiner_widgets_[activeExaminer_]->drawMode(_mode); viewerProperties(activeExaminer()).drawMode(_mode);
examiner_widgets_[activeExaminer_]->updateGL(); else if ( _viewer == ALL_VIEWERS )
} else if ( _viewer == ALL_VIEWERS ) for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
for ( uint i = 0 ; i < examiner_widgets_.size(); ++i ) { viewerProperties(i).drawMode(_mode);
examiner_widgets_[i]->drawMode(_mode); else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
examiner_widgets_[i]->updateGL(); viewerProperties(_viewer).drawMode(_mode);
}
else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() ) {
examiner_widgets_[_viewer]->drawMode(_mode);
examiner_widgets_[_viewer]->updateGL();
}
else else
std::cerr << "Requested illegal viewer for setting DrawMode!!" << std::endl; std::cerr << "Requested illegal viewer for setting DrawMode!!" << std::endl;
...@@ -312,15 +307,15 @@ void setDrawMode( const unsigned int _mode , int _viewer) { ...@@ -312,15 +307,15 @@ void setDrawMode( const unsigned int _mode , int _viewer) {
*/ */
unsigned int drawMode( int _viewer ) { unsigned int drawMode( int _viewer ) {
if ( _viewer == ACTIVE_VIEWER ) { if ( _viewer == ACTIVE_VIEWER ) {
return examiner_widgets_[activeExaminer_]->drawMode(); return viewerProperties(activeExaminer()).drawMode();
} else if ( _viewer == ALL_VIEWERS ) } else if ( _viewer == ALL_VIEWERS )
std::cerr << "Please select viewer to get viewing direction!" << std::endl; std::cerr << "Please select viewer to get viewing direction!" << std::endl;
else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() ) else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
return examiner_widgets_[_viewer]->drawMode(); return viewerProperties(_viewer).drawMode();
else else
std::cerr << "Requested illegal viewer for viewingDirection!!" << std::endl; std::cerr << "Requested illegal viewer for viewingDirection!!" << std::endl;
return examiner_widgets_[activeExaminer_]->drawMode(); return viewerProperties(activeExaminer()).drawMode();
} }
bool scenegraphPick( ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0 ) { bool scenegraphPick( ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0 ) {
......
...@@ -589,7 +589,7 @@ void Core::openIniFile( QString _filename, ...@@ -589,7 +589,7 @@ void Core::openIniFile( QString _filename,
resetScenegraph(); resetScenegraph();
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) { for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
coreWidget_->examiner_widgets_[i]->drawMode( OpenFlipper::Options::standardDrawMode() ); PluginFunctions::viewerProperties(i).drawMode( OpenFlipper::Options::standardDrawMode() );
coreWidget_->examiner_widgets_[i]->viewAll(); coreWidget_->examiner_widgets_[i]->viewAll();
} }
......
...@@ -234,7 +234,7 @@ void Core::slotLoad(QString _filename, DataType _type, int& _id) { ...@@ -234,7 +234,7 @@ void Core::slotLoad(QString _filename, DataType _type, int& _id) {
// if this is the first object opend, reset the global draw mode of all examiners to standard draw mode // if this is the first object opend, reset the global draw mode of all examiners to standard draw mode
if ( PluginFunctions::objectCount() == 1 && OpenFlipper::Options::gui() && !OpenFlipper::Options::loadingSettings() ) if ( PluginFunctions::objectCount() == 1 && OpenFlipper::Options::gui() && !OpenFlipper::Options::loadingSettings() )
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) { for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
coreWidget_->examiner_widgets_[i]->drawMode( OpenFlipper::Options::standardDrawMode() ); PluginFunctions::viewerProperties(i).drawMode( OpenFlipper::Options::standardDrawMode() );
coreWidget_->examiner_widgets_[i]->viewAll(); coreWidget_->examiner_widgets_[i]->viewAll();
} }
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
//============================================================================= //=============================================================================
#include <OpenFlipper/common/GlobalDefines.hh> #include <OpenFlipper/common/GlobalDefines.hh>
#include <ACG/Scenegraph/DrawModes.hh>
#include "ViewerProperties.hh" #include "ViewerProperties.hh"
#include <iostream> #include <iostream>
...@@ -47,6 +48,7 @@ namespace Viewer { ...@@ -47,6 +48,7 @@ namespace Viewer {
ViewerProperties::ViewerProperties(): ViewerProperties::ViewerProperties():
actionMode_(Viewer::PickingMode), actionMode_(Viewer::PickingMode),
lastActionMode_(Viewer::PickingMode), lastActionMode_(Viewer::PickingMode),
currentDrawMode_(ACG::SceneGraph::DrawModes::NONE),
snapshotName_("snap.png"), snapshotName_("snap.png"),
snapshotCounter_(0), snapshotCounter_(0),
wZoomFactor_(1.0), wZoomFactor_(1.0),
......
...@@ -108,8 +108,26 @@ namespace Viewer { ...@@ -108,8 +108,26 @@ namespace Viewer {
Viewer::ActionMode actionMode_, lastActionMode_; Viewer::ActionMode actionMode_, lastActionMode_;
/** @} */ /** @} */
//===========================================================================
/** @name Draw Mode States
* @{ */
//===========================================================================
public:
/// set draw mode (No test if this mode is available!)
void drawMode(unsigned int _mode) { currentDrawMode_ = _mode; emit updated(); };
/// get current draw mode
unsigned int drawMode() { return currentDrawMode_; };
private:
unsigned int currentDrawMode_;
/** @} */
//=========================================================================== //===========================================================================
/** @name Snapshot settings /** @name Snapshot settings
* @{ */ * @{ */
......
...@@ -115,7 +115,7 @@ static const char VIEW_MAGIC[] = ...@@ -115,7 +115,7 @@ static const char VIEW_MAGIC[] =
glViewer::glViewer( QtGLGraphicsScene* _scene, glViewer::glViewer( QtGLGraphicsScene* _scene,
QGLWidget* _glWidget, QGLWidget* _glWidget,
Viewer::ViewerProperties& _properties, Viewer::ViewerProperties& _properties,
QGraphicsWidget* _parent, QGraphicsWidget* _parent,
const char* /* _name */ , const char* /* _name */ ,
QStatusBar *_statusBar) : QStatusBar *_statusBar) :
...@@ -150,7 +150,6 @@ glViewer::glViewer( QtGLGraphicsScene* _scene, ...@@ -150,7 +150,6 @@ glViewer::glViewer( QtGLGraphicsScene* _scene,
eyeDist_ = 0.01; eyeDist_ = 0.01;
sceneGraphRoot_ = 0; sceneGraphRoot_ = 0;
curDrawMode_ = ACG::SceneGraph::DrawModes::NONE;
normalsMode_ = DONT_TOUCH_NORMALS; normalsMode_ = DONT_TOUCH_NORMALS;
projectionMode_ = PERSPECTIVE_PROJECTION; projectionMode_ = PERSPECTIVE_PROJECTION;
...@@ -544,13 +543,13 @@ void glViewer::drawScene_mono() ...@@ -544,13 +543,13 @@ void glViewer::drawScene_mono()
if (sceneGraphRoot_) if (sceneGraphRoot_)
{ {
if (! properties_.renderPicking() ) { if (! properties_.renderPicking() ) {
ACG::SceneGraph::DrawAction action(curDrawMode_, false); ACG::SceneGraph::DrawAction action( properties_.drawMode() , false);
ACG::SceneGraph::traverse(sceneGraphRoot_, action, *glstate_, curDrawMode_); ACG::SceneGraph::traverse(sceneGraphRoot_, action, *glstate_, properties_.drawMode() );
if( blending_ ) if( blending_ )
{ {
ACG::SceneGraph::DrawAction action(curDrawMode_, true); ACG::SceneGraph::DrawAction action(properties_.drawMode(), true);
ACG::SceneGraph::traverse(sceneGraphRoot_, action, *glstate_, curDrawMode_); ACG::SceneGraph::traverse(sceneGraphRoot_, action, *glstate_, properties_.drawMode());
} }
} else { } else {
...@@ -1155,45 +1154,6 @@ void glViewer::actionPasteView() ...@@ -1155,45 +1154,6 @@ void glViewer::actionPasteView()
} }
//-----------------------------------------------------------------------------
void glViewer::actionDrawMenu( QAction * _action )
{
unsigned int mode( _action->data().toUInt() );
// combine draw modes
if (qApp->keyboardModifiers() & Qt::ShiftModifier)
{
if (drawMode() & mode)
drawMode(drawMode() & ~mode);
else
drawMode(drawMode() | mode);
}
// simply switch draw mode
else
{
// clear all other checked items
std::vector< QAction * >::iterator aIter, aEnd;
aEnd = drawMenuActions_.end();
for( aIter = drawMenuActions_.begin();
aIter != aEnd;
++aIter )
{
if( (*aIter)->data().toUInt() != mode )
(*aIter)->setChecked( false );
}
drawMode(mode);
}
hidePopupMenus();
updateGL();
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
......
...@@ -259,16 +259,6 @@ public: ...@@ -259,16 +259,6 @@ public:
/// map glarea coords to global coords /// map glarea coords to global coords
QPoint glMapToGlobal( const QPoint& _pos ) const; QPoint glMapToGlobal( const QPoint& _pos ) const;
/// set draw mode (No test if this mode is available!)
void drawMode(unsigned int _mode)
{
curDrawMode_ = _mode;
}
/// get current draw mode
unsigned int drawMode() { return curDrawMode_; }
/// convert current view to text representation /// convert current view to text representation
void encodeView(QString& _view); void encodeView(QString& _view);
/** Decode and apply text representation of view encoded by encodeView(). /** Decode and apply text representation of view encoded by encodeView().
...@@ -348,7 +338,6 @@ public slots: ...@@ -348,7 +338,6 @@ public slots:
virtual void setView( const ACG::GLMatrixd& _modelview, virtual void setView( const ACG::GLMatrixd& _modelview,
const ACG::GLMatrixd& _inverse_modelview ); const ACG::GLMatrixd& _inverse_modelview );
void actionDrawMenu( QAction * _action );
void actionPickMenu( QAction * _action ); void actionPickMenu( QAction * _action );
void actionPasteView(); void actionPasteView();
...@@ -533,8 +522,6 @@ private: ...@@ -533,8 +522,6 @@ private:
// scenegraph stuff // scenegraph stuff
ACG::SceneGraph::BaseNode* sceneGraphRoot_; ACG::SceneGraph::BaseNode* sceneGraphRoot_;
unsigned int curDrawMode_;
bool projectionUpdateLocked_; bool projectionUpdateLocked_;
bool blending_; bool blending_;
......
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