diff --git a/Sofa/Component/Visual/src/sofa/component/visual/VisualModelImpl.cpp b/Sofa/Component/Visual/src/sofa/component/visual/VisualModelImpl.cpp index 5698776ff6c..c6f0a176dd7 100644 --- a/Sofa/Component/Visual/src/sofa/component/visual/VisualModelImpl.cpp +++ b/Sofa/Component/Visual/src/sofa/component/visual/VisualModelImpl.cpp @@ -788,8 +788,9 @@ void VisualModelImpl::init() d_translation.setValue(Vec3Real()); d_rotation.setValue(Vec3Real()); d_scale.setValue(Vec3Real(1, 1, 1)); -} + m_savedMaterial = d_material.getValue(); +} void VisualModelImpl::initPositionFromVertices() { diff --git a/Sofa/Component/Visual/src/sofa/component/visual/VisualModelImpl.h b/Sofa/Component/Visual/src/sofa/component/visual/VisualModelImpl.h index ef92f77d03c..959f4e314b7 100644 --- a/Sofa/Component/Visual/src/sofa/component/visual/VisualModelImpl.h +++ b/Sofa/Component/Visual/src/sofa/component/visual/VisualModelImpl.h @@ -346,6 +346,8 @@ class SOFA_COMPONENT_VISUAL_API VisualModelImpl : public core::visual::VisualMod d_edges.setValue(*e); } + const sofa::type::Material& getSavedMaterial() {return m_savedMaterial;} + virtual void computePositions(); virtual void computeMesh(); virtual void computeNormals(); @@ -399,6 +401,9 @@ class SOFA_COMPONENT_VISUAL_API VisualModelImpl : public core::visual::VisualMod /// Internal buffer similar to @sa m_dirtyTriangles but to be used by topolgy Data @sa d_quads callback when points are removed. std::set< sofa::core::topology::BaseMeshTopology::QuadID> m_dirtyQuads; + + /// Store the material information, to restore it after rendering with a specific material for selection (GUI related). + sofa::type::Material m_savedMaterial; };