X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fautos.C;h=b895a9049085c03a99db492cc171c90ace8fa2c3;hb=667ff598ae2a94f48c7056aee1d77d7cde39066b;hp=7ab31dd54ff3696657cae871de179406306eb203;hpb=2ba7e9962ea989863e152373e96a09b00a0b4eb8;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/autos.C b/cinelerra-5.1/cinelerra/autos.C index 7ab31dd5..b895a904 100644 --- a/cinelerra-5.1/cinelerra/autos.C +++ b/cinelerra-5.1/cinelerra/autos.C @@ -204,7 +204,7 @@ Auto* Autos::get_prev_auto(int64_t position, while(current && current->position > position) current = PREVIOUS; } - if(!current) + if(!current && first && first->position <= position) { for(current = last; current && current->position > position; @@ -222,7 +222,7 @@ Auto* Autos::get_prev_auto(int64_t position, while(current && current->position < position) current = NEXT; } - if(!current) + if(!current && last && last->position >= position) { for(current = first; current && current->position < position; @@ -287,14 +287,15 @@ Auto* Autos::get_auto_for_editing(double position) } Auto *result = 0; - position = edl->align_to_frame(position, 0); + get_prev_auto(track->to_units(position, 0), PLAY_FORWARD, result); + if( edl->session->auto_keyframes && (!result || result->is_default || + !EQUIV(track->from_units(result->position), position)) ) { +//printf("Autos::get_auto_for_editing %p %p %p\n", default_auto, first, result); + position = edl->align_to_frame(position, 0); + result = insert_auto(track->to_units(position, 0)); + } //printf("Autos::get_auto_for_editing %p %p\n", first, default_auto); - result = edl->session->auto_keyframes ? - insert_auto(track->to_units(position, 0)) : - get_prev_auto(track->to_units(position, 0), PLAY_FORWARD, result); - -//printf("Autos::get_auto_for_editing %p %p %p\n", default_auto, first, result); return result; } @@ -309,7 +310,7 @@ Auto* Autos::get_next_auto(int64_t position, int direction, Auto* ¤t, int while(current && current->position < position) current = NEXT; } - if(!current) + if(!current && last && last->position > position) { for(current = first; current && current->position <= position; @@ -328,7 +329,7 @@ Auto* Autos::get_next_auto(int64_t position, int direction, Auto* ¤t, int while(current && current->position > position) current = PREVIOUS; } - if(!current) + if(!current && first && first->position <= position) { for(current = last; current && current->position > position;