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

Method SetJsonValue

src/TrackedObjectBBox.cpp:356–409  ·  view source on GitHub ↗

Load Json::Value into this object

Source from the content-addressed store, hash-verified

354
355// Load Json::Value into this object
356void TrackedObjectBBox::SetJsonValue(const Json::Value root)
357{
358
359 // Set the Id by the given JSON object
360 if (!root["box_id"].isNull() && root["box_id"].asString() != "")
361 Id(root["box_id"].asString());
362
363 // Set the BaseFps by the given JSON object
364 if (!root["BaseFPS"].isNull() && root["BaseFPS"].isObject())
365 {
366 if (!root["BaseFPS"]["num"].isNull())
367 BaseFps.num = (int)root["BaseFPS"]["num"].asInt();
368 if (!root["BaseFPS"]["den"].isNull())
369 BaseFps.den = (int)root["BaseFPS"]["den"].asInt();
370 }
371 // Set the TimeScale by the given JSON object
372 if (!root["TimeScale"].isNull())
373 {
374 double scale = (double)root["TimeScale"].asDouble();
375 this->ScalePoints(scale);
376 }
377 // Set the protobuf data path by the given JSON object
378 if (!root["protobuf_data_path"].isNull())
379 protobufDataPath = root["protobuf_data_path"].asString();
380
381 // Set the Keyframes by the given JSON object
382 if (!root["delta_x"].isNull())
383 delta_x.SetJsonValue(root["delta_x"]);
384 if (!root["delta_y"].isNull())
385 delta_y.SetJsonValue(root["delta_y"]);
386 if (!root["scale_x"].isNull())
387 scale_x.SetJsonValue(root["scale_x"]);
388 if (!root["scale_y"].isNull())
389 scale_y.SetJsonValue(root["scale_y"]);
390 if (!root["rotation"].isNull())
391 rotation.SetJsonValue(root["rotation"]);
392 if (!root["visible"].isNull())
393 visible.SetJsonValue(root["visible"]);
394 if (!root["draw_box"].isNull())
395 draw_box.SetJsonValue(root["draw_box"]);
396 if (!root["stroke"].isNull())
397 stroke.SetJsonValue(root["stroke"]);
398 if (!root["background_alpha"].isNull())
399 background_alpha.SetJsonValue(root["background_alpha"]);
400 if (!root["background_corner"].isNull())
401 background_corner.SetJsonValue(root["background_corner"]);
402 if (!root["background"].isNull())
403 background.SetJsonValue(root["background"]);
404 if (!root["stroke_width"].isNull())
405 stroke_width.SetJsonValue(root["stroke_width"]);
406 if (!root["stroke_alpha"].isNull())
407 stroke_alpha.SetJsonValue(root["stroke_alpha"]);
408 return;
409}
410
411// Get all properties for a specific frame (perfect for a UI to display the current state
412// of all properties at any time)

Callers

nothing calls this directly

Calls 1

ScalePointsMethod · 0.95

Tested by

no test coverage detected