From: Good Guy Date: Thu, 12 Mar 2020 01:01:14 +0000 (-0600) Subject: fix transition keyframe update when autogenerate keyframes set, revert copy operators... X-Git-Tag: 2020-03~15 X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=2d6e0243914af46dbc07eb91aeb951630d71adf4;p=goodguy%2Fcinelerra.git fix transition keyframe update when autogenerate keyframes set, revert copy operators, tweak shortcut docs --- diff --git a/cinelerra-5.1/cinelerra/edit.C b/cinelerra-5.1/cinelerra/edit.C index 72f17990..56329af3 100644 --- a/cinelerra-5.1/cinelerra/edit.C +++ b/cinelerra-5.1/cinelerra/edit.C @@ -85,7 +85,6 @@ void Edit::reset() channel = 0; user_title[0] = 0; nested_edl = 0; - is_plugin = 0; is_selected = 0; hard_left = 0; hard_right = 0; @@ -326,6 +325,13 @@ void Edit::equivalent_output(Edit *edit, int64_t *result) } +Edit& Edit::operator=(Edit& edit) +{ +//printf("Edit::operator= called\n"); + copy_from(&edit); + return *this; +} + void Edit::synchronize_params(Edit *edit) { copy_from(edit); @@ -345,6 +351,11 @@ int Edit::identical(Edit &edit) return result; } +int Edit::operator==(Edit &edit) +{ + return identical(edit); +} + double Edit::frames_per_picon() { return Units::round(picon_w()) / frame_w(); diff --git a/cinelerra-5.1/cinelerra/edit.h b/cinelerra-5.1/cinelerra/edit.h index 51cdb7a2..290bf63e 100644 --- a/cinelerra-5.1/cinelerra/edit.h +++ b/cinelerra-5.1/cinelerra/edit.h @@ -57,13 +57,17 @@ public: virtual void clone_from(Edit *edit); // Compare with edit in same EDL virtual int identical(Edit &edit); + virtual Edit& operator=(Edit& edit); // Called by Edits and PluginSet. // Compare with edit in different EDL virtual void equivalent_output(Edit *edit, int64_t *result); + virtual int operator==(Edit& edit); // When inherited by a plugin need to resample keyframes virtual void synchronize_params(Edit *edit); // Used by Edits::insert_edits to shift plugin keyframes virtual void shift_keyframes(int64_t position) {}; + virtual int is_plugin() { return 0; } + virtual int is_transition() { return 0; } // Get size of frame to draw on timeline double picon_w(); @@ -110,7 +114,7 @@ public: int group_id; // User defined title for timeline char user_title[BCTEXTLEN]; - int is_plugin, is_selected; + int is_selected; // edge cannot be optimized int hard_left, hard_right; // title bar color diff --git a/cinelerra-5.1/cinelerra/edits.C b/cinelerra-5.1/cinelerra/edits.C index ea67b6cb..de93e583 100644 --- a/cinelerra-5.1/cinelerra/edits.C +++ b/cinelerra-5.1/cinelerra/edits.C @@ -102,6 +102,15 @@ void Edits::copy_from(Edits *edits) } } + +Edits& Edits::operator=(Edits& edits) +{ +printf("Edits::operator= 1\n"); + copy_from(&edits); + return *this; +} + + void Edits::insert_asset(Asset *asset, EDL *nested_edl, int64_t length, int64_t position, int track_number) { @@ -403,8 +412,8 @@ int Edits::optimize() if( is_glitch(next_edit) ) break; // both edits are silence & not a plugin - if( !current->is_plugin && current->silence() && - !next_edit->is_plugin && next_edit->silence() ) + if( !current->is_plugin() && current->silence() && + !next_edit->is_plugin() && next_edit->silence() ) break; // source channels are identical & assets are identical if( !result && current->channel == next_edit->channel && diff --git a/cinelerra-5.1/cinelerra/edits.h b/cinelerra-5.1/cinelerra/edits.h index efd7f88e..76c0171d 100644 --- a/cinelerra-5.1/cinelerra/edits.h +++ b/cinelerra-5.1/cinelerra/edits.h @@ -43,6 +43,7 @@ public: void equivalent_output(Edits *edits, int64_t *result); virtual void copy_from(Edits *edits); + virtual Edits& operator=(Edits& edits); // Insert edits from different EDL void insert_edits(Edits *edits, int64_t position, diff --git a/cinelerra-5.1/cinelerra/plugin.C b/cinelerra-5.1/cinelerra/plugin.C index d884f707..36b10330 100644 --- a/cinelerra-5.1/cinelerra/plugin.C +++ b/cinelerra-5.1/cinelerra/plugin.C @@ -40,7 +40,6 @@ Plugin::Plugin(EDL *edl, Track *track, const char *title) : Edit(edl, track) { - is_plugin = 1; this->track = track; this->plugin_set = 0; strcpy(this->title, title); @@ -58,7 +57,6 @@ Plugin::Plugin(EDL *edl, Track *track, const char *title) Plugin::Plugin(EDL *edl, PluginSet *plugin_set, const char *title) : Edit(edl, plugin_set) { - is_plugin = 1; this->track = plugin_set->track; this->plugin_set = plugin_set; strcpy(this->title, title); @@ -78,6 +76,28 @@ Plugin::~Plugin() delete keyframes; } +Edit& Plugin::operator=(Edit& edit) +{ + copy_from(&edit); + return *this; +} + +Plugin& Plugin::operator=(Plugin& edit) +{ + copy_from(&edit); + return *this; +} + +int Plugin::operator==(Plugin& that) +{ + return identical(&that); +} + +int Plugin::operator==(Edit& that) +{ + return identical((Plugin*)&that); +} + int Plugin::silence() { return plugin_type == PLUGIN_NONE ? 1 : 0; diff --git a/cinelerra-5.1/cinelerra/plugin.h b/cinelerra-5.1/cinelerra/plugin.h index a0bd80b4..92eff4f0 100644 --- a/cinelerra-5.1/cinelerra/plugin.h +++ b/cinelerra-5.1/cinelerra/plugin.h @@ -59,6 +59,9 @@ public: const char *title); virtual ~Plugin(); + virtual Plugin& operator=(Plugin& edit); + virtual Edit& operator=(Edit& edit); + // Called by Edits::equivalent_output to override the keyframe behavior and check // title. void equivalent_output(Edit *edit, int64_t *result); @@ -68,6 +71,9 @@ public: // Descends the plugin tree without creating a virtual console. int is_synthesis(int64_t position, int direction, int depth); + virtual int operator==(Plugin& that); + virtual int operator==(Edit& that); + void init(const char *title, int64_t unit_position, int64_t unit_length, int plugin_type, SharedLocation *shared_location, KeyFrame *default_keyframe); @@ -75,6 +81,7 @@ public: virtual void copy_from(Edit *edit); +// Called by == operators, Edit::equivalent output // to test title and keyframe of transition. virtual int identical(Plugin *that); virtual void synchronize_params(Edit *edit); diff --git a/cinelerra-5.1/cinelerra/pluginserver.C b/cinelerra-5.1/cinelerra/pluginserver.C index f8e8a8f9..cf40152a 100644 --- a/cinelerra-5.1/cinelerra/pluginserver.C +++ b/cinelerra-5.1/cinelerra/pluginserver.C @@ -1168,6 +1168,8 @@ void PluginServer::apply_keyframe(KeyFrame *src) Plugin *plugin = edl->tracks->plugin_exists(plugin_id); if( !plugin ) keyframe->copy_data(src); + else if( plugin->is_transition() ) + plugin->get_keyframe()->copy_data(src); else // Span keyframes plugin->keyframes->update_parameter(src); diff --git a/cinelerra-5.1/cinelerra/transition.C b/cinelerra-5.1/cinelerra/transition.C index f321c472..28c9079b 100644 --- a/cinelerra-5.1/cinelerra/transition.C +++ b/cinelerra-5.1/cinelerra/transition.C @@ -160,8 +160,7 @@ void Transition::save_xml(FileXML *file) file->tag.set_property("TITLE", title); file->tag.set_property("LENGTH", length); file->append_tag(); - if(on) - { + if( on ) { file->tag.set_title("ON"); file->append_tag(); file->tag.set_title("/ON"); @@ -175,36 +174,20 @@ void Transition::save_xml(FileXML *file) void Transition::load_xml(FileXML *file) { - int result = 0; file->tag.get_property("TITLE", title); Plugin::fix_plugin_title(title); length = file->tag.get_property("LENGTH", length); on = 0; - do{ - result = file->read_tag(); - if(!result) - { - if(file->tag.title_is("/TRANSITION")) - { - result = 1; - } - else - if(file->tag.title_is("ON")) - { - on = 1; - } - else - if(file->tag.title_is("KEYFRAME")) - { - keyframes->default_auto->load(file);; - } - } - }while(!result); + while( !file->read_tag() ) { + if( file->tag.title_is("/TRANSITION") ) break; + if( file->tag.title_is("ON") ) { on = 1; continue; } + if( file->tag.title_is("KEYFRAME") ) + keyframes->default_auto->load(file);; + } } - int Transition::popup_transition(int x, int y) { // if(mwindow->session->tracks_vertical) diff --git a/cinelerra-5.1/cinelerra/transition.h b/cinelerra-5.1/cinelerra/transition.h index 92433058..9ad77a3b 100644 --- a/cinelerra-5.1/cinelerra/transition.h +++ b/cinelerra-5.1/cinelerra/transition.h @@ -64,17 +64,12 @@ public: Transition(EDL *edl, Edit *edit, const char *title, long unit_length); Edit *edit; - - - void save_xml(FileXML *file); void load_xml(FileXML *file); - - - Transition(Transition *that, Edit *edit); ~Transition(); + int is_transition() { return 1; } KeyFrame* get_keyframe(); int reset_parameters(); diff --git a/cinelerra-5.1/doc/shortcuts.html b/cinelerra-5.1/doc/shortcuts.html index d59f0dfe..5b547db9 100644 --- a/cinelerra-5.1/doc/shortcuts.html +++ b/cinelerra-5.1/doc/shortcuts.html @@ -7,7 +7,7 @@ - +