From ac7be905447f51f88763501902ca7633b2d4f65a Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Thu, 1 Oct 2015 18:51:59 -0500 Subject: [PATCH] Fixed a few issues with Color keyframes --- src/Color.cpp | 2 +- src/KeyFrame.cpp | 4 ++-- src/effects/ChromaKey.cpp | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Color.cpp b/src/Color.cpp index 925b5c99..d9cd7db9 100644 --- a/src/Color.cpp +++ b/src/Color.cpp @@ -136,5 +136,5 @@ void Color::SetJsonValue(Json::Value root) { if (!root["blue"].isNull()) blue.SetJsonValue(root["blue"]); if (!root["alpha"].isNull()) - blue.SetJsonValue(root["alpha"]); + alpha.SetJsonValue(root["alpha"]); } diff --git a/src/KeyFrame.cpp b/src/KeyFrame.cpp index 849366a3..75623dba 100644 --- a/src/KeyFrame.cpp +++ b/src/KeyFrame.cpp @@ -202,10 +202,10 @@ Point Keyframe::GetClosestPoint(Point p) { // Handle edge cases (if no point was found) if (closest.co.X == -1) { - if (p.co.X < 1) + if (p.co.X < 1 && Points.size() > 0) // Assign 1st point closest = Points[0]; - else + else if (Points.size() > 0) // Assign last point closest = Points[Points.size() - 1]; } diff --git a/src/effects/ChromaKey.cpp b/src/effects/ChromaKey.cpp index f1dcace9..e8d43c79 100644 --- a/src/effects/ChromaKey.cpp +++ b/src/effects/ChromaKey.cpp @@ -169,6 +169,7 @@ string ChromaKey::PropertiesJSON(long int requested_frame) { root["duration"] = add_property_json("Duration", Duration(), "float", "", false, 0, 0, 1000 * 60 * 30, CONSTANT, -1, true); // Keyframes + root["color"] = add_property_json("Key Color", 0.0, "color", "", color.red.Contains(requested_point), color.red.GetCount(), -10000, 10000, color.red.GetClosestPoint(requested_point).interpolation, color.red.GetClosestPoint(requested_point).co.X, false); root["color"]["red"] = add_property_json("Red", color.red.GetValue(requested_frame), "float", "", color.red.Contains(requested_point), color.red.GetCount(), -10000, 10000, color.red.GetClosestPoint(requested_point).interpolation, color.red.GetClosestPoint(requested_point).co.X, false); root["color"]["blue"] = add_property_json("Blue", color.blue.GetValue(requested_frame), "float", "", color.blue.Contains(requested_point), color.blue.GetCount(), -10000, 10000, color.blue.GetClosestPoint(requested_point).interpolation, color.blue.GetClosestPoint(requested_point).co.X, false); root["color"]["green"] = add_property_json("Green", color.green.GetValue(requested_frame), "float", "", color.green.Contains(requested_point), color.green.GetCount(), -10000, 10000, color.green.GetClosestPoint(requested_point).interpolation, color.green.GetClosestPoint(requested_point).co.X, false);