fix transition keyframe update when autogenerate keyframes set, revert copy operators...
authorGood Guy <good1.2guy@gmail.com>
Thu, 12 Mar 2020 01:01:14 +0000 (19:01 -0600)
committerGood Guy <good1.2guy@gmail.com>
Thu, 12 Mar 2020 01:01:14 +0000 (19:01 -0600)
cinelerra-5.1/cinelerra/edit.C
cinelerra-5.1/cinelerra/edit.h
cinelerra-5.1/cinelerra/edits.C
cinelerra-5.1/cinelerra/edits.h
cinelerra-5.1/cinelerra/plugin.C
cinelerra-5.1/cinelerra/plugin.h
cinelerra-5.1/cinelerra/pluginserver.C
cinelerra-5.1/cinelerra/transition.C
cinelerra-5.1/cinelerra/transition.h
cinelerra-5.1/doc/shortcuts.html

index 72f179907fe8758143b7337b7491e06dd283f7f9..56329af3caecc76d71c32c7092bad0429ee6e57c 100644 (file)
@@ -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();
index 51cdb7a2e2c7a3aaeada849309df8bbf774496b7..290bf63e5b46800aa1fa7dbb712c4b95cce4cb4c 100644 (file)
@@ -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
index ea67b6cb976fa8783d458dc262e0945508e842ca..de93e5830d351d41ce3cd68e7a489f999e2c1312 100644 (file)
@@ -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 &&
index efd7f88e7f6c9729d66516ad4d94f08e470977d9..76c0171da50c69c7b792f35f167ee66cfb1107b1 100644 (file)
@@ -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,
index d884f7079fac6f9f9e27361168742d2c44b082d8..36b10330a52fd7c6010f78fed7f42571f4fc8eb0 100644 (file)
@@ -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;
index a0bd80b4c016c4bd6798fb48f035ad125bfeded3..92eff4f0046365a1e621730d5a23395e772b1c70 100644 (file)
@@ -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);
index f8e8a8f9f80a8cf662fd0c63fba2aa6eb1c81eed..cf40152a86e6da4312b1b596422c4439ea1394db 100644 (file)
@@ -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);
index f321c47235233e73351101a6d3439610c95c5ac5..28c9079be08e04e9857141a80bcdb07abb396359 100644 (file)
@@ -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)
index 924330587085b0c4b2655dde5f5f4a9f06ca719c..9ad77a3b44977d5410a0e2f6d24b2947c02087c1 100644 (file)
@@ -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();
index d59f0dfeb66f12b55ffa7b3141733ba23c1adfe2..5b547db9648cfbba26726bef0b6c161545a3007a 100644 (file)
@@ -7,7 +7,7 @@
        <title></title>
        <meta name="generator" content="LibreOffice 5.2.7.2 (Linux)"/>
        <meta name="created" content="00:00:00"/>
-       <meta name="changed" content="2019-11-18T19:40:27.221227659"/>
+       <meta name="changed" content="2020-02-11T19:40:27.221227659"/>
        
        <style type="text/css">
                body,div,table,thead,tbody,tfoot,tr,th,td,p { font-family:"Liberation Sans"; font-size:x-small }