| 929 | |
| 930 | |
| 931 | float GetCursor(HRigInstance instance, bool normalized) |
| 932 | { |
| 933 | RigPlayer* player = GetPlayer(instance); |
| 934 | |
| 935 | if (!player || !player->m_Animation) |
| 936 | { |
| 937 | return 0.0f; |
| 938 | } |
| 939 | |
| 940 | float duration = player->m_Animation->m_Duration; |
| 941 | if (duration == 0.0f) |
| 942 | { |
| 943 | return 0.0f; |
| 944 | } |
| 945 | |
| 946 | float t = player->m_Cursor; |
| 947 | if (player->m_Playback == dmRig::PLAYBACK_ONCE_PINGPONG && t > duration) |
| 948 | { |
| 949 | // In once-pingpong the cursor will be greater than duration during the "pong" part, compensate for that |
| 950 | t = (2.f * duration) - t; |
| 951 | } |
| 952 | |
| 953 | if (player->m_Backwards) |
| 954 | { |
| 955 | t = duration - t; |
| 956 | } |
| 957 | |
| 958 | if (normalized) |
| 959 | { |
| 960 | t = t / duration; |
| 961 | } |
| 962 | return t; |
| 963 | } |
| 964 | |
| 965 | Result SetCursor(HRigInstance instance, float cursor, bool normalized) |
| 966 | { |