libanim

changeset 62:eb024fa08fe6

avoid starting an animation blend transition with the same animation as source and target
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 30 Dec 2013 15:22:44 +0200
parents 29946a9423a4
children 091dd6e6be59 817a5c3a7f96
files src/anim.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/src/anim.c	Mon Dec 30 15:20:31 2013 +0200
     1.2 +++ b/src/anim.c	Mon Dec 30 15:22:44 2013 +0200
     1.3 @@ -476,6 +476,11 @@
     1.4  void anm_transition(struct anm_node *node, int anmidx, anm_time_t start, anm_time_t dur)
     1.5  {
     1.6  	struct anm_node *c = node->child;
     1.7 +
     1.8 +	if(anmidx == node->cur_anim[0]) {
     1.9 +		return;
    1.10 +	}
    1.11 +
    1.12  	while(c) {
    1.13  		anm_transition(c, anmidx, start, dur);
    1.14  		c = c->next;
    1.15 @@ -486,6 +491,10 @@
    1.16  
    1.17  void anm_node_transition(struct anm_node *node, int anmidx, anm_time_t start, anm_time_t dur)
    1.18  {
    1.19 +	if(anmidx == node->cur_anim[0]) {
    1.20 +		return;
    1.21 +	}
    1.22 +
    1.23  	node->cur_anim[1] = anmidx;
    1.24  	node->cur_anim_offset[1] = start;
    1.25  	node->blend_dur = dur;