Skip to content
Snippets Groups Projects
Commit 3f25208d authored by Raphael Grimm's avatar Raphael Grimm
Browse files

Use ArmarXDataPath::SearchReadableFile to search for model paths

parent 10956344
No related branches found
No related tags found
No related merge requests found
......@@ -63,7 +63,6 @@ namespace armarx::viz
l.add(std::forward<Ts>(elems)...);
return l;
}
// ////////////////////////////////////////////////////////////////// //
//enqueue
void enqueueLayer(const Layer& l)
......
......@@ -26,25 +26,16 @@ namespace armarx::viz::coin
return result;
}
if (project.size() > 0)
ArmarXDataPath::FindPackageAndAddDataPath(project);
std::string fullFilename;
if (!ArmarXDataPath::SearchReadableFile(filename, fullFilename))
{
ARMARX_INFO << "Adding to datapaths of " << project;
armarx::CMakePackageFinder finder(project);
if (!finder.packageFound())
{
ARMARX_WARNING << "ArmarX Package " << project << " has not been found!";
}
else
{
ARMARX_INFO << "Adding to datapaths: " << finder.getDataDir();
armarx::ArmarXDataPath::addDataPaths(finder.getDataDir());
}
ARMARX_INFO << deactivateSpam()
<< "Unable to find readable file for name "
<< filename;
return result;
}
std::string fullFilename = filename;
ArmarXDataPath::getAbsolutePath(fullFilename, fullFilename);
try
{
ARMARX_INFO << "Loading object from " << fullFilename;
......
#include <regex>
#include <fstream>
#include "VisualizationRobot.h"
#include <ArmarXCore/core/system/cmake/CMakePackageFinder.h>
......@@ -22,30 +25,20 @@ namespace armarx::viz::coin
return result;
}
if (project.size() > 0)
ArmarXDataPath::FindPackageAndAddDataPath(project);
std::string fullFilename;
if (!ArmarXDataPath::SearchReadableFile(filename, fullFilename))
{
ARMARX_INFO << "Adding to datapaths of " << project;
armarx::CMakePackageFinder finder(project);
if (!finder.packageFound())
{
ARMARX_WARNING << "ArmarX Package " << project << " has not been found!";
}
else
{
ARMARX_INFO << "Adding to datapaths: " << finder.getDataDir();
armarx::ArmarXDataPath::addDataPaths(finder.getDataDir());
}
ARMARX_INFO << deactivateSpam()
<< "Unable to find readable file for name "
<< filename;
return result;
}
std::string fullFilename = filename;
ArmarXDataPath::getAbsolutePath(fullFilename, fullFilename);
// Always load full model. Visualization can choose between full and collision model
VirtualRobot::RobotIO::RobotDescription loadMode = VirtualRobot::RobotIO::eFull;
try
{
// Always load full model. Visualization can choose between full and collision model
VirtualRobot::RobotIO::RobotDescription loadMode = VirtualRobot::RobotIO::eFull;
ARMARX_INFO << "Loading robot from " << fullFilename;
result = VirtualRobot::RobotIO::loadRobot(fullFilename, loadMode);
result->setThreadsafe(false);
......@@ -75,12 +68,15 @@ namespace armarx::viz::coin
{
if (loaded.project == project && loaded.filename == filename)
{
ARMARX_DEBUG << "loading robot from chace " << VAROUT(project) << ", " << VAROUT(filename);
result = loaded;
result.robot = loaded.robot->clone();
//do not scale the robot and do not clone meshes if scaling = 1
result.robot = loaded.robot->clone(nullptr, 1, true);
return result;
}
}
ARMARX_DEBUG << "loading robot from file " << VAROUT(project) << ", " << VAROUT(filename);
result.project = project;
result.filename = filename;
result.robot = loadRobot(project, filename);
......
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