You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Changed None to empty string, corrected dynamic pointers
This commit is contained in:
10
src/Clip.cpp
10
src/Clip.cpp
@@ -749,7 +749,7 @@ std::string Clip::PropertiesJSON(int64_t requested_frame) const {
|
||||
if (!parentObjectId.empty()) {
|
||||
root["parentObjectId"] = add_property_json("Parent", 0.0, "string", parentObjectId, NULL, -1, -1, false, requested_frame);
|
||||
} else {
|
||||
root["parentObjectId"] = add_property_json("Parent", 0.0, "string", "None", NULL, -1, -1, false, requested_frame);
|
||||
root["parentObjectId"] = add_property_json("Parent", 0.0, "string", "", NULL, -1, -1, false, requested_frame);
|
||||
}
|
||||
// Add gravity choices (dropdown style)
|
||||
root["gravity"]["choices"].append(add_property_choice_json("Top Left", GRAVITY_TOP_LEFT, gravity));
|
||||
@@ -766,16 +766,16 @@ std::string Clip::PropertiesJSON(int64_t requested_frame) const {
|
||||
root["scale"]["choices"].append(add_property_choice_json("Crop", SCALE_CROP, scale));
|
||||
root["scale"]["choices"].append(add_property_choice_json("Best Fit", SCALE_FIT, scale));
|
||||
root["scale"]["choices"].append(add_property_choice_json("Stretch", SCALE_STRETCH, scale));
|
||||
root["scale"]["choices"].append(add_property_choice_json("None", SCALE_NONE, scale));
|
||||
root["scale"]["choices"].append(add_property_choice_json("", SCALE_NONE, scale));
|
||||
|
||||
// Add frame number display choices (dropdown style)
|
||||
root["display"]["choices"].append(add_property_choice_json("None", FRAME_DISPLAY_NONE, display));
|
||||
root["display"]["choices"].append(add_property_choice_json("", FRAME_DISPLAY_NONE, display));
|
||||
root["display"]["choices"].append(add_property_choice_json("Clip", FRAME_DISPLAY_CLIP, display));
|
||||
root["display"]["choices"].append(add_property_choice_json("Timeline", FRAME_DISPLAY_TIMELINE, display));
|
||||
root["display"]["choices"].append(add_property_choice_json("Both", FRAME_DISPLAY_BOTH, display));
|
||||
|
||||
// Add volume mixing choices (dropdown style)
|
||||
root["mixing"]["choices"].append(add_property_choice_json("None", VOLUME_MIX_NONE, mixing));
|
||||
root["mixing"]["choices"].append(add_property_choice_json("", VOLUME_MIX_NONE, mixing));
|
||||
root["mixing"]["choices"].append(add_property_choice_json("Average", VOLUME_MIX_AVERAGE, mixing));
|
||||
root["mixing"]["choices"].append(add_property_choice_json("Reduce", VOLUME_MIX_REDUCE, mixing));
|
||||
|
||||
@@ -962,7 +962,7 @@ void Clip::SetJsonValue(const Json::Value root) {
|
||||
// Set data from Json (if key is found)
|
||||
if (!root["parentObjectId"].isNull()){
|
||||
parentObjectId = root["parentObjectId"].asString();
|
||||
if (parentObjectId.size() > 0 && parentObjectId != "None"){
|
||||
if (parentObjectId.size() > 0 && parentObjectId != ""){
|
||||
AttachToObject(parentObjectId);
|
||||
} else{
|
||||
parentTrackedObject = nullptr;
|
||||
|
||||
@@ -52,7 +52,7 @@ void EffectBase::InitEffectInfo()
|
||||
info.has_tracked_object = false;
|
||||
info.name = "";
|
||||
info.description = "";
|
||||
info.parent_effect_id = "None";
|
||||
info.parent_effect_id = "";
|
||||
}
|
||||
|
||||
// Display file information
|
||||
@@ -160,7 +160,7 @@ void EffectBase::SetJsonValue(Json::Value root) {
|
||||
|
||||
if (!root["parent_effect_id"].isNull()){
|
||||
info.parent_effect_id = root["parent_effect_id"].asString();
|
||||
if (info.parent_effect_id.size() > 0 && info.parent_effect_id != "None" && parentEffect == NULL)
|
||||
if (info.parent_effect_id.size() > 0 && info.parent_effect_id != "" && parentEffect == NULL)
|
||||
SetParentEffect(info.parent_effect_id);
|
||||
else
|
||||
parentEffect = NULL;
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
#include <cassert> // For assert()
|
||||
#include <iostream> // For std::cout
|
||||
#include <iomanip> // For std::setprecision
|
||||
#include <cassert> // For assert()
|
||||
#include <iostream> // For std::cout
|
||||
#include <iomanip> // For std::setprecision
|
||||
|
||||
using namespace std;
|
||||
using namespace openshot;
|
||||
@@ -92,7 +92,6 @@ namespace openshot{
|
||||
t_step /= 2;
|
||||
} while (true);
|
||||
}
|
||||
|
||||
// Interpolate two points using the right Point's interpolation method
|
||||
double InterpolateBetween(Point const & left, Point const & right, double target, double allowed_error) {
|
||||
assert(left.co.X < target);
|
||||
|
||||
@@ -370,7 +370,7 @@ void TrackedObjectBBox::SetJsonValue(const Json::Value root)
|
||||
{
|
||||
|
||||
// Set the Id by the given JSON object
|
||||
if (!root["box_id"].isNull() && root["box_id"].asString() != "None")
|
||||
if (!root["box_id"].isNull() && root["box_id"].asString() != "")
|
||||
Id(root["box_id"].asString());
|
||||
|
||||
// Set the BaseFps by the given JSON object
|
||||
@@ -395,7 +395,7 @@ void TrackedObjectBBox::SetJsonValue(const Json::Value root)
|
||||
|
||||
// Set the id of the child clip
|
||||
// Does not allow to link to the parent clip
|
||||
if (!root["child_clip_id"].isNull() && root["box_id"].asString() != "None"){
|
||||
if (!root["child_clip_id"].isNull() && root["box_id"].asString() != ""){
|
||||
Clip* parentClip = (Clip *) ParentClip();
|
||||
|
||||
if(parentClip && (root["child_clip_id"].asString() != parentClip->Id())){
|
||||
|
||||
@@ -39,16 +39,16 @@ namespace openshot
|
||||
// Blank constructor
|
||||
TrackedObjectBase::TrackedObjectBase() : visible(1.0), draw_box(1)
|
||||
{
|
||||
// Initializes the id as "None"
|
||||
id = "None";
|
||||
childClipId = "None";
|
||||
// Initializes the id as ""
|
||||
id = "";
|
||||
childClipId = "";
|
||||
}
|
||||
|
||||
// Default constructor
|
||||
TrackedObjectBase::TrackedObjectBase(std::string _id) : visible(1.0)
|
||||
{
|
||||
Id(_id);
|
||||
childClipId = "None";
|
||||
childClipId = "";
|
||||
}
|
||||
|
||||
Json::Value TrackedObjectBase::add_property_choice_json(std::string name, int value, int selected_value) const
|
||||
|
||||
@@ -132,7 +132,7 @@ std::shared_ptr<Frame> Tracker::GetFrame(std::shared_ptr<Frame> frame, int64_t f
|
||||
}
|
||||
|
||||
// Get the image of the Tracked Object' child clip
|
||||
if (trackedData->ChildClipId() != "None"){
|
||||
if (trackedData->ChildClipId() != ""){
|
||||
// Cast the parent timeline of this effect
|
||||
Timeline* parentTimeline = (Timeline *) ParentTimeline();
|
||||
if (parentTimeline){
|
||||
|
||||
@@ -693,8 +693,9 @@ TEST_CASE( "AttachToObject", "[libopenshot][keyframe]" )
|
||||
auto trackedDataJson = trackedData->JsonValue();
|
||||
|
||||
// Get and cast the trakcedObject
|
||||
auto trackedObject_base = t.GetTrackedObject("None");
|
||||
std::shared_ptr<TrackedObjectBBox> trackedObject = std::static_pointer_cast<TrackedObjectBBox>(trackedObject_base);
|
||||
auto trackedObject_base = t.GetTrackedObject("");
|
||||
auto trackedObject = std::make_shared<TrackedObjectBBox>();
|
||||
trackedObject = std::dynamic_pointer_cast<TrackedObjectBBox>(trackedObject_base);
|
||||
CHECK(trackedObject == trackedData);
|
||||
|
||||
// Set trackedObject Json Value
|
||||
@@ -705,7 +706,8 @@ TEST_CASE( "AttachToObject", "[libopenshot][keyframe]" )
|
||||
childClip.Open();
|
||||
childClip.AttachToObject(tracked_id);
|
||||
|
||||
std::shared_ptr<TrackedObjectBBox> trackedTest = std::static_pointer_cast<TrackedObjectBBox>(childClip.GetAttachedObject());
|
||||
auto trackedTest = std::make_shared<TrackedObjectBBox>();
|
||||
trackedTest = std::dynamic_pointer_cast<TrackedObjectBBox>(childClip.GetAttachedObject());
|
||||
|
||||
CHECK(trackedData->scale_x.GetValue(1) == trackedTest->scale_x.GetValue(1));
|
||||
|
||||
@@ -719,7 +721,7 @@ TEST_CASE( "GetBoxValues", "[libopenshot][keyframe]" )
|
||||
TrackedObjectBBox trackedDataObject;
|
||||
trackedDataObject.AddBox(1, 10.0, 10.0, 20.0, 20.0, 30.0);
|
||||
|
||||
std::shared_ptr<TrackedObjectBase> trackedData = std::make_shared<TrackedObjectBBox>(trackedDataObject);
|
||||
auto trackedData = std::make_shared<TrackedObjectBBox>(trackedDataObject);
|
||||
|
||||
auto boxValues = trackedData->GetBoxValues(1);
|
||||
|
||||
|
||||
@@ -670,7 +670,7 @@ TEST(Attach_test){
|
||||
auto trackedDataJson = trackedData->JsonValue();
|
||||
|
||||
// Get and cast the trakcedObject
|
||||
auto trackedObject_base = t.GetTrackedObject("None");
|
||||
auto trackedObject_base = t.GetTrackedObject("");
|
||||
std::shared_ptr<TrackedObjectBBox> trackedObject = std::static_pointer_cast<TrackedObjectBBox>(trackedObject_base);
|
||||
CHECK_EQUAL(trackedData, trackedObject);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user