You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Fixing protobuf loading bug, preventing tracker and object detection from loading correctly.
This commit is contained in:
@@ -362,11 +362,14 @@ void ObjectDetection::SetJsonValue(const Json::Value root)
|
||||
EffectBase::SetJsonValue(root);
|
||||
|
||||
// If a protobuf path is provided, load & prefix IDs
|
||||
if (!root["protobuf_data_path"].isNull() && protobuf_data_path.empty()) {
|
||||
protobuf_data_path = root["protobuf_data_path"].asString();
|
||||
if (!LoadObjDetectdData(protobuf_data_path)) {
|
||||
throw InvalidFile("Invalid protobuf data path", "");
|
||||
}
|
||||
if (!root["protobuf_data_path"].isNull()) {
|
||||
std::string new_path = root["protobuf_data_path"].asString();
|
||||
if (protobuf_data_path != new_path || trackedObjects.empty()) {
|
||||
protobuf_data_path = new_path;
|
||||
if (!LoadObjDetectdData(protobuf_data_path)) {
|
||||
throw InvalidFile("Invalid protobuf data path", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Selected index, thresholds, UI flags, filters, etc.
|
||||
|
||||
@@ -220,22 +220,25 @@ void Tracker::SetJsonValue(const Json::Value root) {
|
||||
TimeScale = root["TimeScale"].asDouble();
|
||||
}
|
||||
|
||||
if (!root["protobuf_data_path"].isNull() && protobuf_data_path.empty()) {
|
||||
protobuf_data_path = root["protobuf_data_path"].asString();
|
||||
if (!trackedData->LoadBoxData(protobuf_data_path)) {
|
||||
std::clog << "Invalid protobuf data path " << protobuf_data_path << '\n';
|
||||
protobuf_data_path.clear();
|
||||
}
|
||||
else {
|
||||
// prefix "<effectUUID>-<index>" for each entry
|
||||
for (auto& kv : trackedObjects) {
|
||||
auto idx = kv.first;
|
||||
auto ptr = kv.second;
|
||||
if (ptr) {
|
||||
std::string prefix = this->Id();
|
||||
if (!prefix.empty())
|
||||
prefix += "-";
|
||||
ptr->Id(prefix + std::to_string(idx));
|
||||
if (!root["protobuf_data_path"].isNull()) {
|
||||
std::string new_path = root["protobuf_data_path"].asString();
|
||||
if (protobuf_data_path != new_path || trackedData->GetLength() == 0) {
|
||||
protobuf_data_path = new_path;
|
||||
if (!trackedData->LoadBoxData(protobuf_data_path)) {
|
||||
std::clog << "Invalid protobuf data path " << protobuf_data_path << '\n';
|
||||
protobuf_data_path.clear();
|
||||
}
|
||||
else {
|
||||
// prefix "<effectUUID>-<index>" for each entry
|
||||
for (auto& kv : trackedObjects) {
|
||||
auto idx = kv.first;
|
||||
auto ptr = kv.second;
|
||||
if (ptr) {
|
||||
std::string prefix = this->Id();
|
||||
if (!prefix.empty())
|
||||
prefix += "-";
|
||||
ptr->Id(prefix + std::to_string(idx));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user