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

View File

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

View File

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

View File

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