1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0033114: Visualization - AIS_Animation returns 0 elapsed time after finishing playback

Added -elapsedTime option to DRAW vanim command
This commit is contained in:
mzernova 2022-09-02 18:08:46 +03:00
parent a939fd40eb
commit b9f787f180
2 changed files with 27 additions and 9 deletions

View File

@ -251,7 +251,9 @@ void AIS_Animation::Stop()
myState = AnimationState_Stopped;
if (!myTimer.IsNull())
{
const Standard_Real anElapsedTime = ElapsedTime();
myTimer->Stop();
myTimer->Seek (Min (Duration(), anElapsedTime));
}
for (NCollection_Sequence<Handle(AIS_Animation)>::Iterator anIter (myAnimations); anIter.More(); anIter.Next())

View File

@ -7296,9 +7296,10 @@ static Standard_Integer VAnimation (Draw_Interpretor& theDI,
Standard_Real aPlaySpeed = 1.0;
Standard_Real aPlayStartTime = anAnimation->StartPts();
Standard_Real aPlayDuration = anAnimation->Duration();
Standard_Boolean isFreeCamera = Standard_False;
Standard_Boolean isFreeCamera = Standard_False;
Standard_Boolean toPauseOnClick = Standard_True;
Standard_Boolean isLockLoop = Standard_False;
Standard_Boolean isLockLoop = Standard_False;
Standard_Boolean toPrintElapsedTime = Standard_False;
// video recording parameters
TCollection_AsciiString aRecFile;
@ -7352,6 +7353,11 @@ static Standard_Integer VAnimation (Draw_Interpretor& theDI,
}
}
}
else if (anArg == "-elapsedtime"
|| anArg == "-elapsed")
{
toPrintElapsedTime = Standard_True;
}
else if (anArg == "-resume")
{
toPlay = Standard_True;
@ -7760,8 +7766,17 @@ static Standard_Integer VAnimation (Draw_Interpretor& theDI,
}
}
ViewerTest::CurrentEventManager()->AbortViewAnimation();
ViewerTest::CurrentEventManager()->SetObjectsAnimation (Handle(AIS_Animation)());
if (anAnimation.IsNull() || anAnimation->IsStopped())
{
ViewerTest::CurrentEventManager()->AbortViewAnimation();
ViewerTest::CurrentEventManager()->SetObjectsAnimation(Handle(AIS_Animation)());
}
if (toPrintElapsedTime)
{
theDI << "Elapsed Time: " << anAnimation->ElapsedTime() << " s\n";
}
if (!toPlay && aRecFile.IsEmpty())
{
return 0;
@ -14338,13 +14353,14 @@ List existing animations:
vanim
Animation playback:
vanim name {-play|-resume|-pause|-stop} [playFrom [playDuration]]
[-speed Coeff] [-freeLook] [-noPauseOnClick] [-lockLoop]
vanim name {-play|-resume|-pause|-stop} [playFrom [playDuration]] [-speed Coeff]
[-freeLook] [-noPauseOnClick] [-lockLoop] [-elapsedTime]
-speed playback speed (1.0 is normal speed)
-freeLook skip camera animations
-speed playback speed (1.0 is normal speed)
-freeLook skip camera animations
-noPauseOnClick do not pause animation on mouse click
-lockLoop disable any interactions
-lockLoop disable any interactions
-elapsedTime prints elapsed time in seconds"
Animation definition:
vanim Name/sub/name [-clear] [-delete]