Skip to content

Commit

Permalink
[Sofa.GL] OglModel: Deprecate/Remove isEnabled Data (#4822)
Browse files Browse the repository at this point in the history
deprecate and remove d_isEnabled data in OglModel
  • Loading branch information
fredroy authored Jul 25, 2024
1 parent 5e9242c commit 298e146
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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") )
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ class SOFA_GL_COMPONENT_RENDERING3D_API OglModel : public sofa::component::visua
Data<GLfloat> pointSize; ///< Point size (set if != 1, only for points rendering)
Data<bool> lineSmooth; ///< Enable smooth line rendering
Data<bool> 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<sofa::helper::OptionsGroup> primitiveType; ///< Select types of primitives to send (necessary for some shader types such as geometry or tesselation)
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 298e146

Please sign in to comment.