Skip to content
Snippets Groups Projects
Commit 0e2aed76 authored by Nick Laurenson's avatar Nick Laurenson
Browse files

[fix] Next/Previous frame was jumping some frame

When the user try to move frame by frame, some frames were skipped. This was
due to the wrong play mode been set before calling GoToPrevious or GoToNext.
There was an additional issue when the user selected 'ALL Frame' in the
PlayerControlerToolbar.

The wrong enum has been use all over this file.
parent f3a28677
No related branches found
No related tags found
1 merge request!346[fix] Next/Previous frame was jumping some frame
Pipeline #285394 failed
Pipeline: LidarView

#285395

    ......@@ -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
    {
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment