AnimControlCollection methods should take floating-point frame numbers to match AnimInterface

This commit is contained in:
rdb 2015-07-27 12:56:13 +02:00
parent d7b5fe37da
commit e8e155f218
4 changed files with 15 additions and 15 deletions

View File

@ -153,7 +153,7 @@ class AnimControlInterval(Interval.Interval):
else:
frame = max(min(absFrame, numFrames - 1), 0)
self.controls.poseAll(int(frame))
self.controls.poseAll(frame)
self.state = CInterval.SStarted
self.currT = t
@ -169,9 +169,9 @@ class AnimControlInterval(Interval.Interval):
# a hitch in the animation when it plays back-to-back with
# the next cycle.
if self.reverse:
self.controls.poseAll(int(self.startFrame))
self.controls.poseAll(self.startFrame)
else:
self.controls.poseAll(int(self.endFrame))
self.controls.poseAll(self.endFrame)
else:
# Otherwise, the user-specified duration determines which

View File

@ -35,7 +35,7 @@ play(const string &anim_name) {
// Description: Starts the named animation playing.
////////////////////////////////////////////////////////////////////
INLINE bool AnimControlCollection::
play(const string &anim_name, int from, int to) {
play(const string &anim_name, double from, double to) {
AnimControl *control = find_anim(anim_name);
if (control == (AnimControl *)NULL) {
return false;
@ -67,7 +67,7 @@ loop(const string &anim_name, bool restart) {
// Description: Starts the named animation looping.
////////////////////////////////////////////////////////////////////
INLINE bool AnimControlCollection::
loop(const string &anim_name, bool restart, int from, int to) {
loop(const string &anim_name, bool restart, double from, double to) {
AnimControl *control = find_anim(anim_name);
if (control == (AnimControl *)NULL) {
return false;
@ -99,7 +99,7 @@ stop(const string &anim_name) {
// Description: Sets to a particular frame in the named animation.
////////////////////////////////////////////////////////////////////
INLINE bool AnimControlCollection::
pose(const string &anim_name, int frame) {
pose(const string &anim_name, double frame) {
AnimControl *control = find_anim(anim_name);
if (control == (AnimControl *)NULL) {
return false;

View File

@ -191,7 +191,7 @@ play_all() {
// Description: Starts all animations playing.
////////////////////////////////////////////////////////////////////
void AnimControlCollection::
play_all(int from, int to) {
play_all(double from, double to) {
Controls::const_iterator ci;
for (ci = _controls.begin(); ci != _controls.end(); ++ci) {
(*ci)._control->play(from, to);
@ -219,7 +219,7 @@ loop_all(bool restart) {
// Description: Starts all animations looping.
////////////////////////////////////////////////////////////////////
void AnimControlCollection::
loop_all(bool restart, int from, int to) {
loop_all(bool restart, double from, double to) {
Controls::const_iterator ci;
for (ci = _controls.begin(); ci != _controls.end(); ++ci) {
(*ci)._control->loop(restart, from, to);
@ -254,7 +254,7 @@ stop_all() {
// Description: Sets all animations to the indicated frame.
////////////////////////////////////////////////////////////////////
void AnimControlCollection::
pose_all(int frame) {
pose_all(double frame) {
Controls::const_iterator ci;
for (ci = _controls.begin(); ci != _controls.end(); ++ci) {
(*ci)._control->pose(frame);

View File

@ -55,19 +55,19 @@ PUBLISHED:
// directly into the AnimControl's functionality by anim name.
INLINE bool play(const string &anim_name);
INLINE bool play(const string &anim_name, int from, int to);
INLINE bool play(const string &anim_name, double from, double to);
INLINE bool loop(const string &anim_name, bool restart);
INLINE bool loop(const string &anim_name, bool restart, int from, int to);
INLINE bool loop(const string &anim_name, bool restart, double from, double to);
INLINE bool stop(const string &anim_name);
INLINE bool pose(const string &anim_name, int frame);
INLINE bool pose(const string &anim_name, double frame);
// These functions operate on all anims at once.
void play_all();
void play_all(int from, int to);
void play_all(double from, double to);
void loop_all(bool restart);
void loop_all(bool restart, int from, int to);
void loop_all(bool restart, double from, double to);
bool stop_all();
void pose_all(int frame);
void pose_all(double frame);
INLINE int get_frame(const string &anim_name) const;
INLINE int get_frame() const;