@@ -26,20 +26,19 @@ using namespace openshot;
2626
2727// Default Constructor, delegating
2828TrackedObjectBBox::TrackedObjectBBox ()
29- : TrackedObjectBBox::TrackedObjectBBox(0 , 0 , 255 , 0 ) {}
29+ : TrackedObjectBBox::TrackedObjectBBox(0 , 0 , 255 , 255 ) {}
3030
3131// Constructor that takes RGBA values for stroke, and sets the bounding-box
3232// displacement as 0 and the scales as 1 for the first frame
3333TrackedObjectBBox::TrackedObjectBBox (int Red, int Green, int Blue, int Alfa)
3434 : delta_x(0.0 ), delta_y(0.0 ),
3535 scale_x(1.0 ), scale_y(1.0 ), rotation(0.0 ),
36- background_alpha(1 .0 ), background_corner(0 ),
37- stroke_width(2 ) , stroke_alpha(0.0 ),
36+ background_alpha(0 .0 ), background_corner(12 ),
37+ stroke_width(2 ) , stroke_alpha(0.7 ),
3838 stroke(Red, Green, Blue, Alfa),
39- background(0 , 0 , 255 , 0 )
39+ background(0 , 0 , 255 , Alfa )
4040{
4141 this ->TimeScale = 1.0 ;
42- return ;
4342}
4443
4544// Add a BBox to the BoxVec map
@@ -315,7 +314,6 @@ Json::Value TrackedObjectBBox::JsonValue() const
315314 root[" BaseFPS" ][" num" ] = BaseFps.num ;
316315 root[" BaseFPS" ][" den" ] = BaseFps.den ;
317316 root[" TimeScale" ] = TimeScale;
318- root[" child_clip_id" ] = ChildClipId ();
319317
320318 // Keyframe's properties
321319 root[" delta_x" ] = delta_x.JsonValue ();
@@ -380,11 +378,6 @@ void TrackedObjectBBox::SetJsonValue(const Json::Value root)
380378 if (!root[" protobuf_data_path" ].isNull ())
381379 protobufDataPath = root[" protobuf_data_path" ].asString ();
382380
383- // Set the id of the child clip
384- if (!root[" child_clip_id" ].isNull () && root[" child_clip_id" ].asString () != Id ()){
385- ChildClipId (root[" child_clip_id" ].asString ());
386- }
387-
388381 // Set the Keyframes by the given JSON object
389382 if (!root[" delta_x" ].isNull ())
390383 delta_x.SetJsonValue (root[" delta_x" ]);
@@ -426,26 +419,23 @@ Json::Value TrackedObjectBBox::PropertiesJSON(int64_t requested_frame) const
426419 // Add the ID of this object to the JSON object
427420 root[" box_id" ] = add_property_json (" Box ID" , 0.0 , " string" , Id (), NULL , -1 , -1 , true , requested_frame);
428421
429- // Add the ID of this object's child clip to the JSON object
430- root[" child_clip_id" ] = add_property_json (" Child Clip ID" , 0.0 , " string" , ChildClipId (), NULL , -1 , -1 , false , requested_frame);
431-
432422 // Add the data of given frame bounding-box to the JSON object
433- root[" x1" ] = add_property_json (" X1" , box.cx -(box.width /2 ), " float" , " " , NULL , 0.0 , 1.0 , false , requested_frame);
434- root[" y1" ] = add_property_json (" Y1" , box.cy -(box.height /2 ), " float" , " " , NULL , 0.0 , 1.0 , false , requested_frame);
435- root[" x2" ] = add_property_json (" X2" , box.cx +(box.width /2 ), " float" , " " , NULL , 0.0 , 1.0 , false , requested_frame);
436- root[" y2" ] = add_property_json (" Y2" , box.cy +(box.height /2 ), " float" , " " , NULL , 0.0 , 1.0 , false , requested_frame);
423+ root[" x1" ] = add_property_json (" X1" , box.cx -(box.width /2 ), " float" , " " , NULL , 0.0 , 1.0 , true , requested_frame);
424+ root[" y1" ] = add_property_json (" Y1" , box.cy -(box.height /2 ), " float" , " " , NULL , 0.0 , 1.0 , true , requested_frame);
425+ root[" x2" ] = add_property_json (" X2" , box.cx +(box.width /2 ), " float" , " " , NULL , 0.0 , 1.0 , true , requested_frame);
426+ root[" y2" ] = add_property_json (" Y2" , box.cy +(box.height /2 ), " float" , " " , NULL , 0.0 , 1.0 , true , requested_frame);
437427
438428 // Add the bounding-box Keyframes to the JSON object
439429 root[" delta_x" ] = add_property_json (" Displacement X-axis" , delta_x.GetValue (requested_frame), " float" , " " , &delta_x, -1.0 , 1.0 , false , requested_frame);
440430 root[" delta_y" ] = add_property_json (" Displacement Y-axis" , delta_y.GetValue (requested_frame), " float" , " " , &delta_y, -1.0 , 1.0 , false , requested_frame);
441431 root[" scale_x" ] = add_property_json (" Scale (Width)" , scale_x.GetValue (requested_frame), " float" , " " , &scale_x, 0.0 , 1.0 , false , requested_frame);
442432 root[" scale_y" ] = add_property_json (" Scale (Height)" , scale_y.GetValue (requested_frame), " float" , " " , &scale_y, 0.0 , 1.0 , false , requested_frame);
443433 root[" rotation" ] = add_property_json (" Rotation" , rotation.GetValue (requested_frame), " float" , " " , &rotation, 0 , 360 , false , requested_frame);
444- root[" visible" ] = add_property_json (" Visible" , visible.GetValue (requested_frame), " int" , " " , &visible, 0 , 1 , false , requested_frame);
434+ root[" visible" ] = add_property_json (" Visible" , visible.GetValue (requested_frame), " int" , " " , &visible, 0 , 1 , true , requested_frame);
445435
446- root[" draw_box" ] = add_property_json (" Draw Box" , draw_box.GetValue (requested_frame), " int" , " " , &draw_box, - 1 , 1.0 , false , requested_frame);
447- root[" draw_box" ][" choices" ].append (add_property_choice_json (" Off " , 0 , draw_box.GetValue (requested_frame)));
448- root[" draw_box" ][" choices" ].append (add_property_choice_json (" On " , 1 , draw_box.GetValue (requested_frame)));
436+ root[" draw_box" ] = add_property_json (" Draw Box" , draw_box.GetValue (requested_frame), " int" , " " , &draw_box, 0 , 1 , false , requested_frame);
437+ root[" draw_box" ][" choices" ].append (add_property_choice_json (" Yes " , true , draw_box.GetValue (requested_frame)));
438+ root[" draw_box" ][" choices" ].append (add_property_choice_json (" No " , false , draw_box.GetValue (requested_frame)));
449439
450440 root[" stroke" ] = add_property_json (" Border" , 0.0 , " color" , " " , NULL , 0 , 255 , false , requested_frame);
451441 root[" stroke" ][" red" ] = add_property_json (" Red" , stroke.red .GetValue (requested_frame), " float" , " " , &stroke.red , 0 , 255 , false , requested_frame);
@@ -455,7 +445,7 @@ Json::Value TrackedObjectBBox::PropertiesJSON(int64_t requested_frame) const
455445 root[" stroke_alpha" ] = add_property_json (" Stroke alpha" , stroke_alpha.GetValue (requested_frame), " float" , " " , &stroke_alpha, 0.0 , 1.0 , false , requested_frame);
456446
457447 root[" background_alpha" ] = add_property_json (" Background Alpha" , background_alpha.GetValue (requested_frame), " float" , " " , &background_alpha, 0.0 , 1.0 , false , requested_frame);
458- root[" background_corner" ] = add_property_json (" Background Corner Radius" , background_corner.GetValue (requested_frame), " int" , " " , &background_corner, 0.0 , 60 .0 , false , requested_frame);
448+ root[" background_corner" ] = add_property_json (" Background Corner Radius" , background_corner.GetValue (requested_frame), " int" , " " , &background_corner, 0.0 , 150 .0 , false , requested_frame);
459449
460450 root[" background" ] = add_property_json (" Background" , 0.0 , " color" , " " , NULL , 0 , 255 , false , requested_frame);
461451 root[" background" ][" red" ] = add_property_json (" Red" , background.red .GetValue (requested_frame), " float" , " " , &background.red , 0 , 255 , false , requested_frame);
@@ -530,36 +520,3 @@ std::map<std::string, float> TrackedObjectBBox::GetBoxValues(int64_t frame_numbe
530520
531521 return boxValues;
532522}
533-
534- // Return a map that contains the properties of this object's parent clip
535- std::map<std::string, float > TrackedObjectBBox::GetParentClipProperties (int64_t frame_number) const {
536-
537- // Get the parent clip of this object as a Clip pointer
538- Clip* parentClip = (Clip *) ParentClip ();
539-
540- // Calculate parentClip's frame number
541- long parentClip_start_position = round ( parentClip->Position () * parentClip->info .fps .ToDouble () ) + 1 ;
542- long parentClip_start_frame = ( parentClip->Start () * parentClip->info .fps .ToDouble () ) + 1 ;
543- float parentClip_frame_number = round (frame_number - parentClip_start_position) + parentClip_start_frame;
544-
545- // Get parentClip's Keyframes
546- float parentClip_location_x = parentClip->location_x .GetValue (parentClip_frame_number);
547- float parentClip_location_y = parentClip->location_y .GetValue (parentClip_frame_number);
548- float parentClip_scale_x = parentClip->scale_x .GetValue (parentClip_frame_number);
549- float parentClip_scale_y = parentClip->scale_y .GetValue (parentClip_frame_number);
550- float parentClip_rotation = parentClip->rotation .GetValue (parentClip_frame_number);
551-
552- // Initialize the parent clip properties map
553- std::map<std::string, float > parentClipProperties;
554-
555- // Set the map properties
556- parentClipProperties[" frame_number" ] = parentClip_frame_number;
557- parentClipProperties[" timeline_frame_number" ] = frame_number;
558- parentClipProperties[" location_x" ] = parentClip_location_x;
559- parentClipProperties[" location_y" ] = parentClip_location_y;
560- parentClipProperties[" scale_x" ] = parentClip_scale_x;
561- parentClipProperties[" scale_y" ] = parentClip_scale_y;
562- parentClipProperties[" rotation" ] = parentClip_rotation;
563-
564- return parentClipProperties;
565- }
0 commit comments