Skip to content
Snippets Groups Projects
Commit 7beb10f0 authored by Jean Patrick Mathes's avatar Jean Patrick Mathes
Browse files

Add option to reset changes

parent c513a439
No related branches found
No related tags found
1 merge request!283Resolve "Add component to interactively change the object instances in the memory via ArViz interactive"
......@@ -33,6 +33,13 @@ namespace armarx
isUpdateRequired = false;
}
if (isResetRequired)
{
reset();
isResetRequired = false;
}
if (isMemoryVizRequired)
{
visualizeMemory();
......@@ -73,6 +80,13 @@ namespace armarx
return newRequestedPoses;
}
void Editor::reset()
{
changes.clear();
isMemoryVizRequired = true;
}
void Editor::commit()
{
changes.moveNewObjectsTo(storedPoses);
......@@ -182,6 +196,10 @@ namespace armarx
{
isUpdateRequired = true;
})
.onContextMenu(description.resetAllIndex, [&]
{
isResetRequired = true;
})
.onTransformEnd([&](const Eigen::Matrix4f& transform)
{
changes.moveObject(objectPose, transform);
......@@ -293,7 +311,10 @@ namespace armarx
description.commitIndex = currentIndex++;
description.options.emplace_back("Update Unchanged");
description.updateIndex = currentIndex; // ++
description.updateIndex = currentIndex++;
description.options.emplace_back("Reset All");
description.resetAllIndex = currentIndex; // ++
return description;
}
......
......@@ -48,6 +48,7 @@ namespace armarx
size_t resetIndex = std::numeric_limits<size_t>::max();
size_t commitIndex = std::numeric_limits<size_t>::max();
size_t updateIndex = std::numeric_limits<size_t>::max();
size_t resetAllIndex = std::numeric_limits<size_t>::max();
};
class ChangeState
......@@ -89,6 +90,7 @@ namespace armarx
bool isCommitRequired;
bool isUpdateRequired;
bool isResetRequired;
bool isMemoryVizRequired;
bool isMetaVizRequired;
......@@ -97,6 +99,7 @@ namespace armarx
void commit();
objpose::ObjectPoseSeq update();
void reset();
void visualizeObject(objpose::ObjectPose &objectPose);
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment