X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Ftracks.C;h=c8a6abd4df022c43c730f092492a71f232926974;hb=3643286e2dbb3002604a62e3e6fd834716b4ae63;hp=7feb1f99cfc1febeec05653ee8843c244ec52f1f;hpb=7718f72da6995e7b2b2a59dcc61cc80a2f4bf38f;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/tracks.C b/cinelerra-5.1/cinelerra/tracks.C index 7feb1f99..c8a6abd4 100644 --- a/cinelerra-5.1/cinelerra/tracks.C +++ b/cinelerra-5.1/cinelerra/tracks.C @@ -522,14 +522,62 @@ double Tracks::total_length_framealigned(double fps) return 0; } -void Tracks::translate_projector(float offset_x, float offset_y) +void Tracks::translate_fauto_xy(int fauto, float dx, float dy, int all) { - for(Track *current = first; current; current = NEXT) - { - if(current->data_type == TRACK_VIDEO) - { - ((VTrack*)current)->translate(offset_x, offset_y, 0); - } + Track *track = first; + for( ; track; track=track->next ) { + if( !all && !track->record ) continue; + if( track->data_type != TRACK_VIDEO ) continue; + ((VTrack*)track)->translate(fauto, dx, dy, all); + } +} + +void Tracks::translate_projector(float dx, float dy, int all) +{ + translate_fauto_xy(AUTOMATION_PROJECTOR_X, dx, dy, all); +} + +void Tracks::translate_camera(float dx, float dy, int all) +{ + translate_fauto_xy(AUTOMATION_CAMERA_X, dx, dy, all); +} + +void Tracks::crop_resize(float x, float y, float z) +{ + float ctr_x = edl->session->output_w / 2.; + float ctr_y = edl->session->output_h / 2.; + Track *track = first; + for( ; track; track=track->next ) { + if( !track->record ) continue; + if( track->data_type != TRACK_VIDEO ) continue; + float px, py, pz; + track->get_projector(px, py, pz); + float old_x = px + ctr_x; + float old_y = py + ctr_y; + float nx = (old_x - x) * z; + float ny = (old_y - y) * z; + track->set_projector(nx, ny, pz * z); + } +} + +void Tracks::crop_shrink(float x, float y, float z) +{ + float ctr_x = edl->session->output_w / 2.; + float ctr_y = edl->session->output_h / 2.; + Track *track = first; + for( ; track; track=track->next ) { + if( !track->record ) continue; + if( track->data_type != TRACK_VIDEO ) continue; + float cx, cy, cz, px, py, pz; + track->get_camera(cx, cy, cz); + track->get_projector(px, py, pz); + float dx = x - (px + ctr_x); + float dy = y - (py + ctr_y); + cz *= pz; + cx += dx / cz; cy += dy / cz; + track->set_camera(cx, cy, cz * z); + px += dx; py += dy; + track->set_projector(px, py, 1 / z); } } @@ -604,7 +652,7 @@ int Tracks::totalpixels() int result = 0; for(Track* current = first; current; current = NEXT) { - result += edl->local_session->zoom_track; + result += current->data_h; } return result; } @@ -647,13 +695,14 @@ int Tracks::total_playable_vtracks() return result; } -int Tracks::plugin_exists(Plugin *plugin) +Plugin *Tracks::plugin_exists(int plugin_id) { - for(Track *track = first; track; track = track->next) - { - if(track->plugin_exists(plugin)) return 1; + if( plugin_id < 0 ) return 0; + Plugin *plugin = 0; + for( Track *track=first; !plugin && track; track=track->next ) { + plugin = track->plugin_exists(plugin_id); } - return 0; + return plugin; } int Tracks::track_exists(Track *track)