Skip to content

Commit d7b3d75

Browse files
[visual] VisualModelImpl: add resetMaterial variable (#6057)
* [visual] VisualModelImpl: adds resetMaterial variable * implement requested changes (rename, protected, getter) --------- Co-authored-by: Hugo <hugo.talbot@sofa-framework.org>
1 parent 7a25989 commit d7b3d75

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

Sofa/Component/Visual/src/sofa/component/visual/VisualModelImpl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,8 +788,9 @@ void VisualModelImpl::init()
788788
d_translation.setValue(Vec3Real());
789789
d_rotation.setValue(Vec3Real());
790790
d_scale.setValue(Vec3Real(1, 1, 1));
791-
}
792791

792+
m_savedMaterial = d_material.getValue();
793+
}
793794

794795
void VisualModelImpl::initPositionFromVertices()
795796
{

Sofa/Component/Visual/src/sofa/component/visual/VisualModelImpl.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ class SOFA_COMPONENT_VISUAL_API VisualModelImpl : public core::visual::VisualMod
346346
d_edges.setValue(*e);
347347
}
348348

349+
const sofa::type::Material& getSavedMaterial() {return m_savedMaterial;}
350+
349351
virtual void computePositions();
350352
virtual void computeMesh();
351353
virtual void computeNormals();
@@ -399,6 +401,9 @@ class SOFA_COMPONENT_VISUAL_API VisualModelImpl : public core::visual::VisualMod
399401

400402
/// Internal buffer similar to @sa m_dirtyTriangles but to be used by topolgy Data @sa d_quads callback when points are removed.
401403
std::set< sofa::core::topology::BaseMeshTopology::QuadID> m_dirtyQuads;
404+
405+
/// Store the material information, to restore it after rendering with a specific material for selection (GUI related).
406+
sofa::type::Material m_savedMaterial;
402407
};
403408

404409

0 commit comments

Comments
 (0)