Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/esp/core/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,8 @@ void Configuration::writeSubconfigsToJson(io::JsonGenericValue& jsonObj,
auto cfgIterPair = getSubconfigIterator();
for (auto& cfgIter = cfgIterPair.first; cfgIter != cfgIterPair.second;
++cfgIter) {
// only save if subconfig has entries
if (cfgIter->second->getNumEntries() > 0) {
// only save if subconfig tree has value entries
if (cfgIter->second->getConfigTreeNumValues() > 0) {
// Create Generic value for key, using allocator, to make sure its a copy
// and lives long enough
io::JsonGenericValue name{cfgIter->first.c_str(), allocator};
Expand Down
39 changes: 6 additions & 33 deletions src/esp/metadata/attributes/MarkerSets.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,7 @@ class LinkSet : public esp::core::config::Configuration {
*/
void setMarkerSetPoints(const std::string& markerSetName,
const std::vector<Mn::Vector3>& markerList) {
if (markerList.size() == 0) {
removeMarkerSet(markerSetName);
} else {
editMarkerSet(markerSetName)->setAllPoints(markerList);
}
editMarkerSet(markerSetName)->setAllPoints(markerList);
}

/**
Expand Down Expand Up @@ -325,12 +321,7 @@ class TaskSet : public esp::core::config::Configuration {
void setLinkMarkerSetPoints(const std::string& linkSetName,
const std::string& markerSetName,
const std::vector<Mn::Vector3>& markerList) {
auto linkSet = editLinkSet(linkSetName);
linkSet->setMarkerSetPoints(markerSetName, markerList);
// The above may result in the link set being empty. If so remove it.
if (linkSet->getNumMarkerSets() == 0) {
removeLinkSet(linkSetName);
}
editLinkSet(linkSetName)->setMarkerSetPoints(markerSetName, markerList);
}

/**
Expand All @@ -345,12 +336,7 @@ class TaskSet : public esp::core::config::Configuration {
const std::string& linkSetName,
const std::unordered_map<std::string, std::vector<Mn::Vector3>>&
markers) {
auto linkSet = editLinkSet(linkSetName);
linkSet->setAllMarkerPoints(markers);
// The above may result in the link set being empty. If so remove it.
if (linkSet->getNumMarkerSets() == 0) {
removeLinkSet(linkSetName);
}
editLinkSet(linkSetName)->setAllMarkerPoints(markers);
}

/**
Expand Down Expand Up @@ -585,12 +571,8 @@ class MarkerSets : public esp::core::config::Configuration {
const std::string& linkSetName,
const std::string& markerSetName,
const std::vector<Mn::Vector3>& markerList) {
auto taskSetPtr = editTaskSet(taskSetName);
taskSetPtr->setLinkMarkerSetPoints(linkSetName, markerSetName, markerList);
// After this process, the taskset might be empty, if so, delete it.
if (taskSetPtr->getNumLinkSets() == 0) {
removeTaskSet(taskSetName);
}
editTaskSet(taskSetName)
->setLinkMarkerSetPoints(linkSetName, markerSetName, markerList);
}

/**
Expand All @@ -607,12 +589,7 @@ class MarkerSets : public esp::core::config::Configuration {
const std::string& linkSetName,
const std::unordered_map<std::string, std::vector<Mn::Vector3>>&
markerMap) {
auto taskSetPtr = editTaskSet(taskSetName);
taskSetPtr->setLinkSetPoints(linkSetName, markerMap);
// After this process, the taskset might be empty, if so, delete it.
if (taskSetPtr->getNumLinkSets() == 0) {
removeTaskSet(taskSetName);
}
editTaskSet(taskSetName)->setLinkSetPoints(linkSetName, markerMap);
}

/**
Expand All @@ -632,10 +609,6 @@ class MarkerSets : public esp::core::config::Configuration {
for (const auto& markers : markerMap) {
taskSetPtr->setLinkSetPoints(markers.first, markers.second);
}
// After this process, the taskset might be empty, if so, delete it.
if (taskSetPtr->getNumLinkSets() == 0) {
removeTaskSet(taskSetName);
}
}

/**
Expand Down