MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / add_property_json

Method add_property_json

src/TrackedObjectBBox.cpp:461–495  ·  view source on GitHub ↗

Generate JSON for a property

Source from the content-addressed store, hash-verified

459
460// Generate JSON for a property
461Json::Value TrackedObjectBBox::add_property_json(std::string name, float value, std::string type, std::string memo, const Keyframe* keyframe, float min_value, float max_value, bool readonly, int64_t requested_frame) const {
462
463 // Requested Point
464 const Point requested_point(requested_frame, requested_frame);
465
466 // Create JSON Object
467 Json::Value prop = Json::Value(Json::objectValue);
468 prop["name"] = name;
469 prop["value"] = value;
470 prop["memo"] = memo;
471 prop["type"] = type;
472 prop["min"] = min_value;
473 prop["max"] = max_value;
474 if (keyframe) {
475 prop["keyframe"] = keyframe->Contains(requested_point);
476 prop["points"] = int(keyframe->GetCount());
477 Point closest_point = keyframe->GetClosestPoint(requested_point);
478 prop["interpolation"] = closest_point.interpolation;
479 prop["closest_point_x"] = closest_point.co.X;
480 prop["previous_point_x"] = keyframe->GetPreviousPoint(closest_point).co.X;
481 }
482 else {
483 prop["keyframe"] = false;
484 prop["points"] = 0;
485 prop["interpolation"] = CONSTANT;
486 prop["closest_point_x"] = -1;
487 prop["previous_point_x"] = -1;
488 }
489
490 prop["readonly"] = readonly;
491 prop["choices"] = Json::Value(Json::arrayValue);
492
493 // return JsonValue
494 return prop;
495}
496
497// Return a map that contains the bounding box properties and it's keyframes indexed by their names
498std::map<std::string, float> TrackedObjectBBox::GetBoxValues(int64_t frame_number) const {

Callers

nothing calls this directly

Calls 4

GetCountMethod · 0.80
GetClosestPointMethod · 0.80
GetPreviousPointMethod · 0.80
ContainsMethod · 0.45

Tested by

no test coverage detected