X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fpluginset.C;h=b0c096e44d8d2bdb23739f1ebc45f88e9ac0bbe2;hb=166867a58d74619aa11aeb562a994cc364d62231;hp=86bb4b6687290e24f3904ec637b021481f466cfc;hpb=53f919f88484c8611457fbcd552f6931218cc219;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/pluginset.C b/cinelerra-5.1/cinelerra/pluginset.C index 86bb4b66..b0c096e4 100644 --- a/cinelerra-5.1/cinelerra/pluginset.C +++ b/cinelerra-5.1/cinelerra/pluginset.C @@ -160,11 +160,24 @@ Edit* PluginSet::insert_edit_after(Edit *previous_edit) KeyFrame *PluginSet::nearest_keyframe(int64_t pos, int dir) { + if( first && pos < first->startproject ) + pos = first->startproject; + else if( last && pos > last->startproject+last->length ) + pos = last->startproject+last->length; + KeyFrame *keyframe = 0; Plugin *plugin = (Plugin*)editof(pos, dir, 0); - if( !plugin ) return 0; - KeyFrame *keyframe = (KeyFrame *)(dir == PLAY_FORWARD ? - plugin->keyframes->nearest_after(pos) : - plugin->keyframes->nearest_before(pos)); + if( dir == PLAY_FORWARD ) { + for( ; !keyframe && plugin; plugin=(Plugin*)plugin->next ) { + if( plugin->plugin_type == PLUGIN_NONE ) continue; + keyframe = (KeyFrame *)plugin->keyframes->nearest_after(pos); + } + } + else { + for( ; !keyframe && plugin; plugin=(Plugin*)plugin->previous ) { + if( plugin->plugin_type == PLUGIN_NONE ) continue; + keyframe = (KeyFrame *)plugin->keyframes->nearest_before(pos); + } + } return keyframe; }