Commit 1787cf8a authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[CHANGE #382] stipped unused code from old wgeviewer

parent 3462f457
......@@ -407,3 +407,13 @@ bool WGEViewer::getPaused() const
{
return m_paused;
}
void WGEViewer::handleVisibilityChange( bool visible )
{
getView()->getScene()->getSceneData()->setNodeMask( visible * 0xFFFFFFFF );
}
void WGEViewer::requestContinuousUpdate( bool continuous )
{
getView()->requestContinuousUpdate( continuous );
}
......@@ -131,6 +131,20 @@ public:
osg::ref_ptr<osgViewer::View> getView();
#endif
/**
* If the widget is not visible, we might be able to reduce CPU load. This does not hide the widget.
*
* \param visible true to show again.
*/
void handleVisibilityChange( bool visible );
/**
* Update the view automatically (the default). Use this to disable it explicitly.
*
* \param continuous
*/
void requestContinuousUpdate( bool continuous = true );
/**
* Resets the view using the installed manipulator.
*/
......
......@@ -87,6 +87,36 @@ public:
*/
std::string getName() const;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Handle Cam, Scene
// getScene, setScene
// getCameraManipulator setCameraManipulator
// reset()
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Screen Capture, Effects, ...
// getProperties()
// getScreenCapture
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Technical aspects
// handleVisibilityChange( bool visible )
// requestContinuousUpdate( bool continuous ); isContinuousUpdate
// mousevent,keyevent?
// resize?
// paint?
// setClosed?
protected:
private:
/**
......
......@@ -179,11 +179,7 @@ WQtGLWidget* WQtGLDockWidget::getGLWidget() const
void WQtGLDockWidget::handleVisibilityChange( bool visible )
{
// this can help to reduce CPU load. Especially if multithreading viewers are used with cull thread per context.
if( m_glWidget->getViewer() )
{
m_glWidget->getViewer()->getView()->getScene()->getSceneData()->setNodeMask( visible * 0xFFFFFFFF );
}
m_glWidget->getViewer()->handleVisibilityChange( visible );
}
void WQtGLDockWidget::closeEvent( QCloseEvent *event )
......
......@@ -189,54 +189,6 @@ WQtGLScreenCapture::WQtGLScreenCapture( WQtGLDockWidget* parent ):
movieLayout->addWidget( m_movieRecButton );
movieLayout->addWidget( m_movieStopButton );
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// animation tools
/////////////////////////////////////////////////////////////////////////////////////////////////////////
m_animationWidget = new QWidget();
QVBoxLayout* animationLayout = new QVBoxLayout();
m_animationWidget->setLayout( animationLayout );
QLabel* nyiLabel = new QLabel();
nyiLabel->setWordWrap( true );
nyiLabel->setText( "<font color=\"#f00\">NOT YET IMPLEMENTED!</font><br/>"
"We currently have one hard-coded animation sequence for testing. We are currently working on a script based animation "
"system. Stay tuned."
);
QGroupBox* animationControlGroup = new QGroupBox( "Animation Control" );
QGridLayout* animationControlGroupLayout = new QGridLayout();
animationControlGroup->setLayout( animationControlGroupLayout );
m_animationPlayButton = new QPushButton( "Play" );
connect( m_animationPlayButton, SIGNAL( clicked( bool ) ), this, SLOT( playAnim() ) );
m_animationRecButton = new QPushButton( "Record" );
connect( m_animationRecButton, SIGNAL( clicked( bool ) ), this, SLOT( recAnim() ) );
m_animationStopButton = new QPushButton( "Stop" );
connect( m_animationStopButton, SIGNAL( clicked( bool ) ), this, SLOT( stopAnim() ) );
animationControlGroupLayout->addWidget( m_animationPlayButton, 1, 0 );
animationControlGroupLayout->addWidget( m_animationRecButton, 1, 1 );
animationControlGroupLayout->addWidget( m_animationStopButton, 1, 2 );
QGroupBox* animationFileGroup = new QGroupBox( "Animation Script" );
QVBoxLayout* animationFileGroupLayout = new QVBoxLayout();
animationFileGroup->setLayout( animationFileGroupLayout );
QLabel* animationFileLabel = new QLabel();
animationFileLabel->setText( "Animation Script:" );
m_animationFileEdit = new QLineEdit();
m_animationFileEdit->setText( QDir::homePath() + QDir::separator() + "Animation.owanim" );
animationFileGroupLayout->addWidget( animationFileLabel );
animationFileGroupLayout->addWidget( m_animationFileEdit );
// plug it into the layout
animationLayout->addWidget( nyiLabel );
animationLayout->addWidget( animationFileGroup );
animationLayout->addWidget( animationControlGroup );
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// plug it together
/////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -249,10 +201,6 @@ WQtGLScreenCapture::WQtGLScreenCapture( WQtGLDockWidget* parent ):
m_toolbox->insertItem( 1, m_screenshotWidget, WQtGui::getIconManager()->getIcon( "image" ), "Screenshot" );
m_toolbox->insertItem( 2, m_movieWidget, WQtGui::getIconManager()->getIcon( "video" ), "Movie" );
// hide it as long as issue #127 is not done.
// m_toolbox->insertItem( 3, m_animationWidget, WQtGui::getIconManager()->getIcon( "video" ), "Animation" );
m_animationWidget->setHidden( true );
// we need to be notified about the screen grabbers state
m_recordConnection = m_viewer->getScreenCapture()->getRecordCondition()->subscribeSignal( boost::bind( &WQtGLScreenCapture::recCallback, this ) );
m_imageConnection = m_viewer->getScreenCapture()->subscribeSignal( boost::bind( &WQtGLScreenCapture::handleImage, this, _1, _2, _3 ) );
......@@ -378,41 +326,9 @@ void WQtGLScreenCapture::recCallback()
QCoreApplication::postEvent( this, new QEvent( static_cast< QEvent::Type >( WQT_SCREENCAPTURE_EVENT ) ) );
}
void WQtGLScreenCapture::playAnim()
void WQtGLScreenCapture::toolBoxChanged( int /* index */ )
{
wlog::debug( "WQtGLScreenCapture" ) << "Starting animation playback.";
}
void WQtGLScreenCapture::stopAnim()
{
wlog::debug( "WQtGLScreenCapture" ) << "Stoping animation playback.";
m_viewer->getScreenCapture()->recordStop();
WGEAnimationManipulator::RefPtr anim = m_viewer->animationMode();
anim->home( 0 );
}
void WQtGLScreenCapture::recAnim()
{
wlog::info( "WQtGLScreenCapture" ) << "Starting animation record.";
// NOTE: this needs some tuning. This is not really thread-safe
WGEAnimationManipulator::RefPtr anim = m_viewer->animationMode();
anim->setTimer( m_viewer->getScreenCapture()->getFrameTimer() );
anim->home( 0 );
m_viewer->getScreenCapture()->recordStart();
}
void WQtGLScreenCapture::toolBoxChanged( int index )
{
if( index != 3 )
{
wlog::debug( "WQtGLScreenCapture" ) << "Deactivating animation mode.";
m_viewer->animationMode( false );
return;
}
wlog::debug( "WQtGLScreenCapture" ) << "Activating animation mode.";
m_viewer->animationMode();
// no operation if toolbox changes.
}
void WQtGLScreenCapture::resolutionChange( bool force )
......
......@@ -116,21 +116,6 @@ private slots:
*/
void resetFrames();
/**
* Slot triggered by m_animationPlayButton.
*/
void playAnim();
/**
* Slot triggered by m_animationStopButton.
*/
void stopAnim();
/**
* Slot triggered by m_animationRecButton.
*/
void recAnim();
/**
* Someone changed the open tab in the toolbox.
*
......@@ -233,31 +218,6 @@ private:
QPushButton* m_movieRecButton; //!< record button
QPushButton* m_movieStopButton; //!< stop button
/**
* The widget containing all the animation options and buttons.
*/
QWidget* m_animationWidget;
/**
* Plays the current animation.
*/
QPushButton* m_animationPlayButton;
/**
* Stops animation playback/record
*/
QPushButton* m_animationStopButton;
/**
* Records the animated scene as movie.
*/
QPushButton* m_animationRecButton;
/**
* File containing the animation.
*/
QLineEdit* m_animationFileEdit;
/**
* Stores the resolution the user wants to have.
*/
......
......@@ -47,7 +47,6 @@
#include "WQtGui.h"
#include "WQtGLScreenCapture.h"
#include "events/WRenderedFrameEvent.h"
#include "events/WEventTypes.h"
#include "WSettingAction.h"
#include "WMainWindow.h"
......@@ -102,8 +101,6 @@ WQtGLWidget::WQtGLWidget( std::string nameOfViewer, QWidget* parent, WGECamera::
m_Timer.start( 10 );
#endif
m_Viewer->isFrameRendered()->getCondition()->subscribeSignal( boost::bind( &WQtGLWidget::notifyFirstRenderedFrame, this ) );
m_cameraResetAction = new QAction( WQtGui::getIconManager()->getIcon( "view" ), "Reset", this );
connect( m_cameraResetAction, SIGNAL( triggered( bool ) ), this, SLOT( reset() ) );
m_cameraResetAction->setToolTip( "Reset view" );
......@@ -435,17 +432,6 @@ void WQtGLWidget::wheelEvent( QWheelEvent* event )
}
}
bool WQtGLWidget::event( QEvent* event )
{
if( event->type() == WQT_RENDERED_FRAME_EVENT )
{
emit renderedFirstFrame();
return true;
}
return WQtGLWidgetParent::event( event );
}
void WQtGLWidget::reset()
{
if( m_Viewer )
......@@ -461,11 +447,6 @@ const QGLFormat WQtGLWidget::getDefaultFormat()
return format;
}
void WQtGLWidget::notifyFirstRenderedFrame()
{
QCoreApplication::postEvent( this, new WRenderedFrameEvent() );
}
void WQtGLWidget::setPresetViewLeft()
{
if( m_Viewer )
......
......@@ -164,13 +164,6 @@ public:
*/
bool getPaused() const;
signals:
/**
* Signals that the first frame was rendered.
*/
void renderedFirstFrame();
public slots:
/**
* Resets the contained view using the installed manipulator.
......@@ -313,18 +306,6 @@ protected:
*/
WGECamera::ProjectionMode m_initialProjectionMode;
/**
* Custom event dispatcher. Gets called by QT's Event system every time an event got sent to this widget. This event handler
* processes the notifyrender events. Others get forwarded.
*
* \note QT Doc says: use event() for custom events.
*
* \param event the event that got transmitted.
*
* \return true if the event got handled properly.
*/
virtual bool event( QEvent* event );
/**
* Called on close. Accept the event to accept the close call.
*
......@@ -348,11 +329,6 @@ private:
*/
bool m_firstPaint;
/**
* Called by the WGEViewer to notify about the first frame rendered
*/
void notifyFirstRenderedFrame();
/**
* Camera menu
*/
......
......@@ -49,7 +49,7 @@ WQtNavGLWidget::WQtNavGLWidget( QString viewTitle, QString dockTitle, QWidget* p
m_scene = new WGEScene();
m_scene->setDataVariance( osg::Object::DYNAMIC );
getGLWidget()->getViewer()->getView()->requestContinuousUpdate( false );
getGLWidget()->getViewer()->requestContinuousUpdate( false );
getGLWidget()->getViewer()->setScene( m_scene );
}
......
......@@ -66,9 +66,6 @@
// when a module connection got closed.
#define WQT_MODULE_DISCONNECT_EVENT QEvent::User + 11
// a frame got rendered
#define WQT_RENDERED_FRAME_EVENT QEvent::User + 12
// a connector of a module changed state or value
#define WQT_MODULE_CONNECTOR_EVENT QEvent::User + 13
......
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