Load Json::Value into this object
| 370 | |
| 371 | // Load Json::Value into this object |
| 372 | void Keyframe::SetJsonValue(const Json::Value root) { |
| 373 | // Clear existing points |
| 374 | Points.clear(); |
| 375 | Points.shrink_to_fit(); |
| 376 | |
| 377 | if (root.isObject() && !root["Points"].isNull()) { |
| 378 | // loop through points in JSON Object |
| 379 | for (const auto existing_point : root["Points"]) { |
| 380 | // Create Point |
| 381 | Point p; |
| 382 | |
| 383 | // Load Json into Point |
| 384 | p.SetJsonValue(existing_point); |
| 385 | |
| 386 | // Add Point to Keyframe |
| 387 | AddPoint(p); |
| 388 | } |
| 389 | } else if (root.isNumeric()) { |
| 390 | // Create Point from Numeric value |
| 391 | Point p(root.asFloat()); |
| 392 | |
| 393 | // Add Point to Keyframe |
| 394 | AddPoint(p); |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | // Get the change in Y value (from the previous Y value) |
| 399 | double Keyframe::GetDelta(int64_t index) const { |