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

Method SetJsonValue

src/Clip.cpp:1012–1212  ·  view source on GitHub ↗

Load Json::Value into this object

Source from the content-addressed store, hash-verified

1010
1011// Load Json::Value into this object
1012void Clip::SetJsonValue(const Json::Value root) {
1013 auto ensure_default_keyframe = [](Keyframe& kf, double default_value) {
1014 if (kf.GetCount() == 0) {
1015 kf = Keyframe(default_value);
1016 }
1017 };
1018
1019 // Set parent data
1020 ClipBase::SetJsonValue(root);
1021
1022 // Set data from Json (if key is found)
1023 if (!root["parentObjectId"].isNull()){
1024 parentObjectId = root["parentObjectId"].asString();
1025 if (parentObjectId.size() > 0 && parentObjectId != ""){
1026 AttachToObject(parentObjectId);
1027 } else{
1028 parentTrackedObject = nullptr;
1029 parentClipObject = NULL;
1030 }
1031 }
1032 if (!root["gravity"].isNull())
1033 gravity = (GravityType) root["gravity"].asInt();
1034 if (!root["scale"].isNull())
1035 scale = (ScaleType) root["scale"].asInt();
1036 if (!root["anchor"].isNull())
1037 anchor = (AnchorType) root["anchor"].asInt();
1038 if (!root["display"].isNull())
1039 display = (FrameDisplayType) root["display"].asInt();
1040 if (!root["mixing"].isNull())
1041 mixing = (VolumeMixType) root["mixing"].asInt();
1042 if (!root["composite"].isNull())
1043 composite = (CompositeType) root["composite"].asInt();
1044 if (!root["waveform"].isNull())
1045 waveform = root["waveform"].asBool();
1046 if (!root["scale_x"].isNull())
1047 scale_x.SetJsonValue(root["scale_x"]);
1048 if (!root["scale_y"].isNull())
1049 scale_y.SetJsonValue(root["scale_y"]);
1050 if (!root["location_x"].isNull())
1051 location_x.SetJsonValue(root["location_x"]);
1052 if (!root["location_y"].isNull())
1053 location_y.SetJsonValue(root["location_y"]);
1054 if (!root["alpha"].isNull())
1055 alpha.SetJsonValue(root["alpha"]);
1056 if (!root["rotation"].isNull())
1057 rotation.SetJsonValue(root["rotation"]);
1058 if (!root["time"].isNull())
1059 time.SetJsonValue(root["time"]);
1060 if (!root["volume"].isNull())
1061 volume.SetJsonValue(root["volume"]);
1062 if (!root["wave_color"].isNull())
1063 wave_color.SetJsonValue(root["wave_color"]);
1064 if (!root["shear_x"].isNull())
1065 shear_x.SetJsonValue(root["shear_x"]);
1066 if (!root["shear_y"].isNull())
1067 shear_y.SetJsonValue(root["shear_y"]);
1068 if (!root["origin_x"].isNull())
1069 origin_x.SetJsonValue(root["origin_x"]);

Callers 1

ResolveWaveformReaderMethod · 0.45

Calls 9

KeyframeClass · 0.85
GetCountMethod · 0.80
CreateEffectMethod · 0.80
EffectInfoClass · 0.70
clearMethod · 0.45
IsOpenMethod · 0.45
ParentClipMethod · 0.45
OpenMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected