From 07e4458c03141e100500c8ef45e5d799fdaa0195 Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Mon, 26 Feb 2024 16:45:30 -0600 Subject: [PATCH] Removing "ChildClipId" property, no longer used for attaching clips to tracker or object detection effects: Use clip->Parent to attach clips to tracked objects now. --- src/TrackedObjectBBox.cpp | 9 --------- src/TrackedObjectBase.cpp | 2 +- src/TrackedObjectBase.h | 5 ----- src/effects/ObjectDetection.cpp | 16 ---------------- src/effects/Tracker.cpp | 19 ------------------- 5 files changed, 1 insertion(+), 50 deletions(-) diff --git a/src/TrackedObjectBBox.cpp b/src/TrackedObjectBBox.cpp index 960939b2b..d1a1b5836 100644 --- a/src/TrackedObjectBBox.cpp +++ b/src/TrackedObjectBBox.cpp @@ -314,7 +314,6 @@ Json::Value TrackedObjectBBox::JsonValue() const root["BaseFPS"]["num"] = BaseFps.num; root["BaseFPS"]["den"] = BaseFps.den; root["TimeScale"] = TimeScale; - root["child_clip_id"] = ChildClipId(); // Keyframe's properties root["delta_x"] = delta_x.JsonValue(); @@ -379,11 +378,6 @@ void TrackedObjectBBox::SetJsonValue(const Json::Value root) if (!root["protobuf_data_path"].isNull()) protobufDataPath = root["protobuf_data_path"].asString(); - // Set the id of the child clip - if (!root["child_clip_id"].isNull() && root["child_clip_id"].asString() != Id()){ - ChildClipId(root["child_clip_id"].asString()); - } - // Set the Keyframes by the given JSON object if (!root["delta_x"].isNull()) delta_x.SetJsonValue(root["delta_x"]); @@ -425,9 +419,6 @@ Json::Value TrackedObjectBBox::PropertiesJSON(int64_t requested_frame) const // Add the ID of this object to the JSON object root["box_id"] = add_property_json("Box ID", 0.0, "string", Id(), NULL, -1, -1, true, requested_frame); - // Add the ID of this object's child clip to the JSON object - root["child_clip_id"] = add_property_json("Child Clip ID", 0.0, "string", ChildClipId(), NULL, -1, -1, false, requested_frame); - // Add the data of given frame bounding-box to the JSON object root["x1"] = add_property_json("X1", box.cx-(box.width/2), "float", "", NULL, 0.0, 1.0, true, requested_frame); root["y1"] = add_property_json("Y1", box.cy-(box.height/2), "float", "", NULL, 0.0, 1.0, true, requested_frame); diff --git a/src/TrackedObjectBase.cpp b/src/TrackedObjectBase.cpp index f268ab99a..0fa4a05d5 100644 --- a/src/TrackedObjectBase.cpp +++ b/src/TrackedObjectBase.cpp @@ -23,7 +23,7 @@ namespace openshot // Constructor TrackedObjectBase::TrackedObjectBase(std::string _id) - : visible(1.0), draw_box(1), id(_id), childClipId("") {} + : visible(1.0), draw_box(1), id(_id) {} Json::Value TrackedObjectBase::add_property_choice_json( std::string name, int value, int selected_value) const diff --git a/src/TrackedObjectBase.h b/src/TrackedObjectBase.h index 657def16b..faac178aa 100644 --- a/src/TrackedObjectBase.h +++ b/src/TrackedObjectBase.h @@ -35,8 +35,6 @@ namespace openshot { class TrackedObjectBase { protected: std::string id; - std::string childClipId; - ClipBase* parentClip; public: @@ -60,9 +58,6 @@ namespace openshot { /// Get and set the parentClip of this object ClipBase* ParentClip() const { return parentClip; } void ParentClip(ClipBase* clip) { parentClip = clip; } - /// Get and set the Id of the childClip of this object - std::string ChildClipId() const { return childClipId; }; - void ChildClipId(std::string _childClipId) { childClipId = _childClipId; }; /// Check if there is data for the exact frame number virtual bool ExactlyContains(int64_t frame_number) const { return {}; }; diff --git a/src/effects/ObjectDetection.cpp b/src/effects/ObjectDetection.cpp index be6e96ec2..9c0d65b79 100644 --- a/src/effects/ObjectDetection.cpp +++ b/src/effects/ObjectDetection.cpp @@ -157,22 +157,6 @@ std::shared_ptr ObjectDetection::GetFrame(std::shared_ptr frame, i painter.drawText(QPointF(left, top), label); } } - - // Get the image of the Tracked Object' child clip - if (trackedObject->ChildClipId() != "") { - Timeline* parentTimeline = static_cast(ParentTimeline()); - if (parentTimeline) { - Clip* childClip = parentTimeline->GetClip(trackedObject->ChildClipId()); - if (childClip) { - std::shared_ptr childClipFrame = childClip->GetFrame(frame_number); - std::shared_ptr childClipImage = childClipFrame->GetImage(); - - // Scale the original bounding box to this image - QRectF scaledRect = Tracker::scaleAndCenterRect(QRectF(childClipImage->rect()), boxRect); - painter.drawImage(scaledRect, *childClipImage); - } - } - } } } } diff --git a/src/effects/Tracker.cpp b/src/effects/Tracker.cpp index 508107a1d..557098793 100644 --- a/src/effects/Tracker.cpp +++ b/src/effects/Tracker.cpp @@ -128,25 +128,6 @@ std::shared_ptr Tracker::GetFrame(std::shared_ptr frame, int64_t f painter.drawRoundedRect(boxRect, bg_corner, bg_corner); } - // Get the image of the Tracked Object' child clip - if (trackedData->ChildClipId() != ""){ - // Cast the parent timeline of this effect - Timeline* parentTimeline = static_cast(ParentTimeline()); - if (parentTimeline){ - // Get the Tracked Object's child clip - Clip* childClip = parentTimeline->GetClip(trackedData->ChildClipId()); - if (childClip){ - // Get the image of the child clip for this frame - std::shared_ptr childClipFrame = childClip->GetFrame(frame_number); - std::shared_ptr childClipImage = childClipFrame->GetImage(); - - // Scale the original bounding box to this image - QRectF scaledRect = scaleAndCenterRect(QRectF(childClipImage->rect()), boxRect); - painter.drawImage(scaledRect, *childClipImage); - } - } - } - painter.end(); }