diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 020a993f4f..636096124c 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -587,18 +587,13 @@ bool AvatarData::hasReferential() { } bool AvatarData::isPlaying() { - if (!_player) { - return false; - } - if (QThread::currentThread() != thread()) { - bool result; - QMetaObject::invokeMethod(this, "isPlaying", Qt::BlockingQueuedConnection, - Q_RETURN_ARG(bool, result)); - return result; - } return _player && _player->isPlaying(); } +bool AvatarData::isPaused() { + return _player && _player->isPaused(); +} + qint64 AvatarData::playerElapsed() { if (!_player) { return 0; @@ -626,29 +621,11 @@ qint64 AvatarData::playerLength() { } int AvatarData::playerCurrentFrame() { - if (!_player) { - return 0; - } - if (QThread::currentThread() != thread()) { - int result; - QMetaObject::invokeMethod(this, "playerCurrentFrame", Qt::BlockingQueuedConnection, - Q_RETURN_ARG(int, result)); - return result; - } - return _player->getCurrentFrame(); + return (_player) ? _player->getCurrentFrame() : 0; } int AvatarData::playerFrameNumber() { - if (!_player) { - return 0; - } - if (QThread::currentThread() != thread()) { - int result; - QMetaObject::invokeMethod(this, "playerFrameNumber", Qt::BlockingQueuedConnection, - Q_RETURN_ARG(int, result)); - return result; - } - return _player->getRecording()->getFrameNumber(); + return (_player) ? _player->getRecording()->getFrameNumber() : 0; } void AvatarData::loadRecording(QString filename) { @@ -734,6 +711,20 @@ void AvatarData::play() { } } +void AvatarData::pausePlayer() { + if (!_player) { + return; + } + if (QThread::currentThread() != thread()) { + QMetaObject::invokeMethod(this, "pausePlayer", Qt::BlockingQueuedConnection); + return; + } + if (_player) { + _player->pausePlayer(); + } + +} + void AvatarData::stopPlaying() { if (!_player) { return; diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index 46061b162b..9b28fdc258 100755 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -296,6 +296,7 @@ public slots: bool hasReferential(); bool isPlaying(); + bool isPaused(); qint64 playerElapsed(); qint64 playerLength(); int playerCurrentFrame(); @@ -312,6 +313,7 @@ public slots: void setPlayerUseHeadModel(bool useHeadModel); void setPlayerUseSkeletonModel(bool useSkeletonModel); void play(); + void pausePlayer(); void stopPlaying(); protected: