@@ -89,6 +89,8 @@ void Clip::init_settings()
8989 // Init shear and perspective curves
9090 shear_x = Keyframe (0.0 );
9191 shear_y = Keyframe (0.0 );
92+ origin_x = Keyframe (0.5 );
93+ origin_y = Keyframe (0.5 );
9294 perspective_c1_x = Keyframe (-1.0 );
9395 perspective_c1_y = Keyframe (-1.0 );
9496 perspective_c2_x = Keyframe (-1.0 );
@@ -148,8 +150,11 @@ Clip::Clip(ReaderBase* new_reader) : resampler(NULL), reader(new_reader), alloca
148150 Open ();
149151 Close ();
150152
151- // Update duration
152- End (reader->info .duration );
153+ // Update duration and set parent
154+ if (reader) {
155+ End (reader->info .duration );
156+ reader->SetClip (this );
157+ }
153158}
154159
155160// Constructor with filepath
@@ -202,9 +207,10 @@ Clip::Clip(std::string path) : resampler(NULL), reader(NULL), allocated_reader(N
202207 }
203208 }
204209
205- // Update duration
210+ // Update duration and set parent
206211 if (reader) {
207212 End (reader->info .duration );
213+ reader->SetClip (this );
208214 allocated_reader = reader;
209215 init_reader_rotation ();
210216 }
@@ -712,6 +718,8 @@ std::string Clip::PropertiesJSON(int64_t requested_frame) const {
712718 root[" shear_x" ] = add_property_json (" Shear X" , shear_x.GetValue (requested_frame), " float" , " " , &shear_x, -1.0 , 1.0 , false , requested_frame);
713719 root[" shear_y" ] = add_property_json (" Shear Y" , shear_y.GetValue (requested_frame), " float" , " " , &shear_y, -1.0 , 1.0 , false , requested_frame);
714720 root[" rotation" ] = add_property_json (" Rotation" , rotation.GetValue (requested_frame), " float" , " " , &rotation, -360 , 360 , false , requested_frame);
721+ root[" origin_x" ] = add_property_json (" Origin X" , origin_x.GetValue (requested_frame), " float" , " " , &origin_x, 0.0 , 1.0 , false , requested_frame);
722+ root[" origin_y" ] = add_property_json (" Origin Y" , origin_y.GetValue (requested_frame), " float" , " " , &origin_y, 0.0 , 1.0 , false , requested_frame);
715723 root[" volume" ] = add_property_json (" Volume" , volume.GetValue (requested_frame), " float" , " " , &volume, 0.0 , 1.0 , false , requested_frame);
716724 root[" time" ] = add_property_json (" Time" , time.GetValue (requested_frame), " float" , " " , &time, 0.0 , 30 * 60 * 60 * 48 , false , requested_frame);
717725 root[" channel_filter" ] = add_property_json (" Channel Filter" , channel_filter.GetValue (requested_frame), " int" , " " , &channel_filter, -1 , 10 , false , requested_frame);
@@ -768,6 +776,8 @@ Json::Value Clip::JsonValue() const {
768776 root[" crop_y" ] = crop_y.JsonValue ();
769777 root[" shear_x" ] = shear_x.JsonValue ();
770778 root[" shear_y" ] = shear_y.JsonValue ();
779+ root[" origin_x" ] = origin_x.JsonValue ();
780+ root[" origin_y" ] = origin_y.JsonValue ();
771781 root[" channel_filter" ] = channel_filter.JsonValue ();
772782 root[" channel_mapping" ] = channel_mapping.JsonValue ();
773783 root[" has_audio" ] = has_audio.JsonValue ();
@@ -865,6 +875,10 @@ void Clip::SetJsonValue(const Json::Value root) {
865875 shear_x.SetJsonValue (root[" shear_x" ]);
866876 if (!root[" shear_y" ].isNull ())
867877 shear_y.SetJsonValue (root[" shear_y" ]);
878+ if (!root[" origin_x" ].isNull ())
879+ origin_x.SetJsonValue (root[" origin_x" ]);
880+ if (!root[" origin_y" ].isNull ())
881+ origin_y.SetJsonValue (root[" origin_y" ]);
868882 if (!root[" channel_filter" ].isNull ())
869883 channel_filter.SetJsonValue (root[" channel_filter" ]);
870884 if (!root[" channel_mapping" ].isNull ())
0 commit comments