diff --git a/VirtualRobot/SceneObject.cpp b/VirtualRobot/SceneObject.cpp index 96925f44c617a5d5f33ec9123d6e803e5d8d6892..1466ed3e9d7bc6c6538f2783ddd5352d1f483840 100644 --- a/VirtualRobot/SceneObject.cpp +++ b/VirtualRobot/SceneObject.cpp @@ -1464,7 +1464,7 @@ namespace VirtualRobot return scaling; } - bool SceneObject::reloadVisualizationFromXML(bool useVisAsColModelIfMissing) { + bool SceneObject::reloadVisualizationFromXML(bool useVisAsColModelIfMissing, bool loadColOnly) { bool reloaded = false; if (!collisionModelXML.empty()) { @@ -1484,7 +1484,8 @@ namespace VirtualRobot } reloaded = true; } - if (!visualizationModelXML.empty()) + if ((!loadColOnly || (!collisionModel && useVisAsColModelIfMissing)) + && !visualizationModelXML.empty()) { rapidxml::xml_document<> doc; std::vector<char> cstr(visualizationModelXML.size() + 1); // Create char buffer to store string copy @@ -1492,13 +1493,16 @@ namespace VirtualRobot doc.parse<0>(cstr.data()); bool useAsColModel; auto visualizationModel = BaseIO::processVisualizationTag(doc.first_node(), name, basePath, useAsColModel); - if (visualizationModel && scaling != 1.0f) + if (!loadColOnly) { - setVisualization(visualizationModel->clone(true, scaling)); - } - else - { - setVisualization(visualizationModel); + if (visualizationModel && scaling != 1.0f) + { + setVisualization(visualizationModel->clone(true, scaling)); + } + else + { + setVisualization(visualizationModel); + } } if (visualizationModel && collisionModel == nullptr && (useVisAsColModelIfMissing || useAsColModel)) { @@ -1507,7 +1511,7 @@ namespace VirtualRobot reloaded = true; } for (auto child : this->getChildren()) { - reloaded |= child->reloadVisualizationFromXML(useVisAsColModelIfMissing); + reloaded |= child->reloadVisualizationFromXML(useVisAsColModelIfMissing, loadColOnly); } return reloaded; } diff --git a/VirtualRobot/SceneObject.h b/VirtualRobot/SceneObject.h index 3fb7348e3d1443b39797732a2d15fbda53b9acd7..5572e1cae677c92020227a9095f44536de205ced 100644 --- a/VirtualRobot/SceneObject.h +++ b/VirtualRobot/SceneObject.h @@ -420,7 +420,7 @@ namespace VirtualRobot void setScaling(float scaling); float getScaling(); - bool reloadVisualizationFromXML(bool useVisAsColModelIfMissing = true); + bool reloadVisualizationFromXML(bool useVisAsColModelIfMissing = true, bool loadColOnly = false); const std::string& getVisualizationModelXML() const;