Der Name des default branch ist ab jetzt für neue Repositories main. The name of the default branch for new repositories is from now on main.

Commit 59d2e5b9 authored by Daniel Müller's avatar Daniel Müller
Browse files

Merge branch 'fb-image_display_fix' into 'master'

Fb image display fix

See merge request !5
parents 5b5ea9f1 7a99c1d5
......@@ -105,9 +105,7 @@ signals:
protected:
/** @brief Qt related */
virtual void paintEvent(QPaintEvent* event);
virtual void resizeEvent(QResizeEvent* event);
virtual void showEvent(QShowEvent* event);
virtual void moveEvent(QMoveEvent* event);
private:
......
......@@ -87,13 +87,11 @@ void ImageDisplay::paintEvent(QPaintEvent*)
// if there is only one element in the queue we do not remove it here, because we have to
// wait until the timer fires;
rotateAndDrawImage(&qpainter, image_queue_.front());
update();
break;
default:
// more than one image in the queue, paint the image at the front of the queue and pop it
// then
rotateAndDrawImage(&qpainter, image_queue_.front());
update();
pop_image_from_queue();
break;
}
......
......@@ -74,12 +74,11 @@ TalkingHead::TalkingHead(QWidget* parent, std::string mesh_string,
redraw_timer_ = new QTimer(this); // create internal timer
connect(redraw_timer_, SIGNAL(timeout()), SLOT(updateOverlay()));
connect(this, SIGNAL(timerChanged(int)), SLOT(setTimer(int)));
// redraw_timer_->start( 1 );
connect(this, SIGNAL(faceCleared()), SLOT(clearFace()));
// setVisible( false );
redraw_timer_->start(3001);
ROS_INFO("Initialising talkinghead - waiting 3000 ms for things to get ready.");
redraw_timer_->start(3000);
redraw_timer_->setSingleShot(true);
initPhoneMap();
srand((unsigned)time(0));
......@@ -93,7 +92,6 @@ TalkingHead::TalkingHead(QWidget* parent, std::string mesh_string,
smileys_.push_back(".");
smileys_.push_back(":&");
mesh_string_ = mesh_string;
material_vector_ = material_vector;
window_rotation_ = window_rotation;
......@@ -105,51 +103,51 @@ TalkingHead::~TalkingHead()
remove("phonemes.txt");
remove("words.txt");
if (redraw_timer_)
{
delete redraw_timer_;
}
Ogre::WindowEventUtilities::removeWindowEventListener(window_, this);
windowClosed(window_);
if (root_)
{
delete root_;
}
}
//---------------------------------------------------------------------------
void TalkingHead::updateOverlay()
{
// Restart the timer
emit timerChanged(50); // 20 fps
if (init_)
{
ROS_INFO("hallo talkinghead");
emit timerChanged(50);
init_ = false;
is_visible_ = true;
initOgreSystem();
}
setVisible(is_visible_);
Ogre::Root::getSingleton()._fireFrameStarted();
window_->update();
Ogre::Root::getSingleton()._fireFrameRenderingQueued();
Ogre::Root::getSingleton()._fireFrameEnded();
update();
}
is_visible_ = true;
window_->setHidden(!is_visible_);
this->setVisible(is_visible_);
void TalkingHead::showEvent(QShowEvent* event)
{
if (!root_)
// Render next frame
if (!root_->renderOneFrame())
{
initOgreSystem();
root_->getRenderSystem()->shutdown();
ros::shutdown();
}
QWidget::showEvent(event);
}
//---------------------------------------------------------------------------
if (window_->isClosed())
{
root_->getRenderSystem()->shutdown();
ros::shutdown();
}
void TalkingHead::paintEvent(QPaintEvent* event)
{
Ogre::Root::getSingleton()._fireFrameStarted();
window_->update();
Ogre::Root::getSingleton()._fireFrameRenderingQueued();
Ogre::Root::getSingleton()._fireFrameEnded();
update();
//Ogre::WindowEventUtilities::messagePump();
}
//---------------------------------------------------------------------------
......@@ -163,7 +161,6 @@ void TalkingHead::moveEvent(QMoveEvent* event)
update();
}
}
//---------------------------------------------------------------------------
void TalkingHead::resizeEvent(QResizeEvent* event)
{
......@@ -341,25 +338,6 @@ void TalkingHead::initOgreSystem(void)
root_->addFrameListener(this);
while (ros::ok())
{
// Render next frame
if (!root_->renderOneFrame())
{
root_->getRenderSystem()->shutdown();
ros::shutdown();
}
if (window_->isClosed())
{
root_->getRenderSystem()->shutdown();
ros::shutdown();
}
window_->update();
// Ogre::WindowEventUtilities::messagePump();
}
return;
}
//---------------------------------------------------------------------------
......@@ -368,11 +346,10 @@ bool TalkingHead::frameRenderingQueued(const Ogre::FrameEvent& evt)
{
bool ret = Ogre::FrameListener::frameRenderingQueued(evt);
if (window_->isClosed())
return false;
if (shut_down_)
if (window_->isClosed() || window_->isHidden() || shut_down_)
{
return false;
}
Ogre::AnimationStateIterator animations_it = anim_set_->getAnimationStateIterator();
......@@ -426,8 +403,6 @@ bool TalkingHead::frameRenderingQueued(const Ogre::FrameEvent& evt)
}
}
setVisible(is_visible_);
return ret;
}
//---------------------------------------------------------------------------
......@@ -1175,7 +1150,12 @@ void TalkingHead::callbackShowMatImage(const sensor_msgs::ImageConstPtr& msg)
void TalkingHead::clearFace()
{
setVisible(false);
is_visible_ = false;
// Hide the Face by hiding the ogre renderwindow only
window_->setHidden(!is_visible_);
// Do not set the qwidget to hidden - this will break the ogre renderwindow
// this->setVisible(is_visible_);
}
void TalkingHead::setTimer(int msec)
......
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