Commit f44d20cf authored by Ben Boeckel's avatar Ben Boeckel

Merge topic 'relative_mesh_collection_path_fix' into release

8b68631f LoadJSON: when reading relative mesh paths, try model reference path
18e83770 Merge branch 'fix-file-combo-resize_release' into 'release'

Merge-request: !853
parents 18e83770 8b68631f
......@@ -1156,12 +1156,28 @@ int LoadJSON::ofMeshesOfModel(
std::string file_path;
cJSON_GetStringValue(fLocationNode, file_path);
path absPath(file_path);
if (!refPath.empty() && !absPath.is_absolute())
if (!absPath.is_absolute())
path tryme = refPath / absPath;
if (exists(tryme))
std::string RefPath = refPath;
if (RefPath.empty())
absPath = canonical(tryme, refPath);
// Attempt to grab the reference path from the URL of the collection's associated model
std::string smtkURL = modelMgr->stringProperty(associatedModelId, "smtk_url")[0];
boost::filesystem::path containingDirectory =
if (boost::filesystem::is_directory(containingDirectory))
RefPath = containingDirectory.string();
if (!RefPath.empty())
path tryme = RefPath / absPath;
if (exists(tryme))
absPath = canonical(tryme, RefPath);
importedCollection = smtk::io::importMesh(absPath.string(), meshMgr);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment