From 298e14670bcc33a1a4a8c958a743df75b28ffbf3 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Fri, 26 Jul 2024 03:37:28 +0900 Subject: [PATCH] [Sofa.GL] OglModel: Deprecate/Remove isEnabled Data (#4822) deprecate and remove d_isEnabled data in OglModel --- .../sofa/gl/component/rendering3d/OglModel.cpp | 16 ++++++++++++---- .../src/sofa/gl/component/rendering3d/OglModel.h | 6 ++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglModel.cpp b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglModel.cpp index c08faf3f1d5..0c3f0e96f72 100644 --- a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglModel.cpp +++ b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglModel.cpp @@ -53,7 +53,6 @@ OglModel::OglModel() , pointSize(initData(&pointSize, 1.0f, "pointSize", "Point size (set if != 1, only for points rendering)")) , lineSmooth(initData(&lineSmooth, false, "lineSmooth", "Enable smooth line rendering")) , pointSmooth(initData(&pointSmooth, false, "pointSmooth", "Enable smooth point rendering")) - , isEnabled( initData(&isEnabled, true, "isEnabled", "Activate/deactive the component.")) , primitiveType( initData(&primitiveType, "primitiveType", "Select types of primitives to send (necessary for some shader types such as geometry or tesselation)")) , blendEquation( initData(&blendEquation, "blendEquation", "if alpha blending is enabled this specifies how source and destination colors are combined") ) , sourceFactor( initData(&sourceFactor, "sfactor", "if alpha blending is enabled this specifies how the red, green, blue, and alpha source blending factors are computed") ) @@ -73,6 +72,18 @@ OglModel::OglModel() primitiveType.setValue(helper::OptionsGroup{"DEFAULT", "LINES_ADJACENCY", "PATCHES", "POINTS"}.setSelectedItem(0)); } +void OglModel::parse(core::objectmodel::BaseObjectDescription* arg) +{ + if (arg->getAttribute("isEnabled")) + { + msg_warning() << "isEnabled field has been renamed to \'enabled\' since v23.12 (#3931)."; + + this->d_enable.setValue(std::strcmp(arg->getAttribute("isEnabled"), "true") == 0 || arg->getAttributeAsInt("isEnabled")); + } + + Inherit::parse(arg); +} + void OglModel::deleteTextures() { if (tex!=nullptr) delete tex; @@ -331,9 +342,6 @@ void OglModel::internalDraw(const core::visual::VisualParams* vparams, bool tran if (!vparams->displayFlags().getShowVisualModels()) return; - if(!isEnabled.getValue()) - return; - /// Checks that the VBO's are ready. if(!VBOGenDone) return; diff --git a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglModel.h b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglModel.h index bd32fb21904..3888a668aba 100644 --- a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglModel.h +++ b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglModel.h @@ -61,8 +61,9 @@ class SOFA_GL_COMPONENT_RENDERING3D_API OglModel : public sofa::component::visua Data pointSize; ///< Point size (set if != 1, only for points rendering) Data lineSmooth; ///< Enable smooth line rendering Data pointSmooth; ///< Enable smooth point rendering - /// Suppress field for save as function - Data < bool > isEnabled; + + // SOFA_ATTRIBUTE_DISABLED("v24.12", "v25.06") + DeprecatedAndRemoved isEnabled; // primitive types Data primitiveType; ///< Select types of primitives to send (necessary for some shader types such as geometry or tesselation) @@ -102,6 +103,7 @@ class SOFA_GL_COMPONENT_RENDERING3D_API OglModel : public sofa::component::visua ~OglModel() override; public: + void parse(core::objectmodel::BaseObjectDescription* arg) override; bool loadTexture(const std::string& filename) override; bool loadTextures() override;