Skip to content
Snippets Groups Projects

[fix] Next/Previous frame was jumping some frame

Merged Nick Laurenson requested to merge fix/VCRNextFrame into master
1 file
+ 7
3
Compare changes
  • Side-by-side
  • Inline
@@ -46,6 +46,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <vtkSMPropertyHelper.h>
#include <vtkSMIntVectorProperty.h>
// vtkAnimationScene doesn't have a enum for PLAYMODE_SNAP_TO_TIMESTEP despite this mode is implemented
constexpr int PLAYMODE_SNAP_TO_TIMESTEP = 2;
// Scene Property Helpers
namespace {
void SetProperty(QPointer<pqAnimationScene> scene, const char* property, int value)
@@ -243,7 +246,7 @@ void lqPlayerControlsController::setSceneTime(double time)
void lqPlayerControlsController::onNextFrame()
{
// need to change the mode as in realtime next frame is actually t = t+1s
SetProperty(this->Scene, "PlayMode", vtkAnimationScene::PLAYMODE_SEQUENCE);
SetProperty(this->Scene, "PlayMode", PLAYMODE_SNAP_TO_TIMESTEP);
this->Scene->getProxy()->InvokeCommand("GoToNext");
}
@@ -251,7 +254,7 @@ void lqPlayerControlsController::onNextFrame()
void lqPlayerControlsController::onPreviousFrame()
{
// need to change the mode as in realtime previous frame is actually t = t-1s
SetProperty(this->Scene, "PlayMode", vtkAnimationScene::PLAYMODE_SEQUENCE);
SetProperty(this->Scene, "PlayMode", PLAYMODE_SNAP_TO_TIMESTEP);
this->Scene->getProxy()->InvokeCommand("GoToPrevious");
}
@@ -262,7 +265,8 @@ void lqPlayerControlsController::setPlayMode(double speed){
if (speed <= 0)
{
SetProperty(this->Scene, "PlayMode", vtkAnimationScene::PLAYMODE_SEQUENCE);
// There is no enum for
SetProperty(this->Scene, "PlayMode", PLAYMODE_SNAP_TO_TIMESTEP);
}
else
{
Loading