From 2428770042801d1bc2b2073faea03ab10f23f558 Mon Sep 17 00:00:00 2001 From: Andreas Boltres <andreas.boltres@student.kit.edu> Date: Wed, 24 May 2017 17:08:36 +0200 Subject: [PATCH] DebugDrawer: caching of robot visualizations now possible. --- .../components/DebugDrawer/DebugDrawerComponent.cpp | 9 +++++++-- .../components/DebugDrawer/DebugDrawerComponent.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp index 2da9f8701..d9d8dcfdf 100644 --- a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp +++ b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp @@ -1266,7 +1266,12 @@ namespace armarx try { - result = RobotIO::loadRobot(filename, loadMode); + if (loadedRobots.find(filename) == loadedRobots.end()) + { + loadedRobots[filename] = RobotIO::loadRobot(filename, loadMode); + } + + result = loadedRobots[filename]->clone(d.name); } catch (...) { @@ -2477,7 +2482,7 @@ namespace armarx } accumulatedUpdateData.arrows.clear(); - for (auto & e : accumulatedUpdateData.triMeshes) + for (auto& e : accumulatedUpdateData.triMeshes) { drawTriMesh(e.second); } diff --git a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.h b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.h index e79605361..cee6a1c37 100644 --- a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.h +++ b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.h @@ -580,7 +580,7 @@ namespace armarx Mutex timerSensorMutex; void removeAccumulatedData(const std::string& layerName); - + std::map<std::string, VirtualRobot::RobotPtr> loadedRobots; }; -- GitLab