diff --git a/Sofa/Component/Setting/src/sofa/component/setting/BackgroundSetting.cpp b/Sofa/Component/Setting/src/sofa/component/setting/BackgroundSetting.cpp index 2ad8b97883a..c98511a6cd9 100644 --- a/Sofa/Component/Setting/src/sofa/component/setting/BackgroundSetting.cpp +++ b/Sofa/Component/Setting/src/sofa/component/setting/BackgroundSetting.cpp @@ -32,9 +32,11 @@ int BackgroundSettingClass = core::RegisterObject("Background setting") ; BackgroundSetting::BackgroundSetting(): - color(initData(&color, "color", "Color of the background")) - , image(initData(&image, "image", "Image to be used as background")) + d_color(initData(&d_color, "color", "Color of the background")), + d_image(initData(&d_image, "image", "Image to be used as background")) { + color.setParent(&d_color); + image.setParent(&d_image); } } // namespace sofa::component::setting diff --git a/Sofa/Component/Setting/src/sofa/component/setting/BackgroundSetting.h b/Sofa/Component/Setting/src/sofa/component/setting/BackgroundSetting.h index c0d1536a924..5073e51a12a 100644 --- a/Sofa/Component/Setting/src/sofa/component/setting/BackgroundSetting.h +++ b/Sofa/Component/Setting/src/sofa/component/setting/BackgroundSetting.h @@ -39,9 +39,16 @@ class SOFA_COMPONENT_SETTING_API BackgroundSetting: public core::objectmodel::Co BackgroundSetting(); ///< Default constructor public: - Data color; ///< Color of the Background of the Viewer. + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data color; + + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() sofa::core::objectmodel::DataFileName image; ///< Image to be used as background of the viewer. + + Data d_color; ///< Color of the Background of the Viewer. + sofa::core::objectmodel::DataFileName d_image; ///< Image to be used as background of the viewer. + }; } // namespace sofa::component::setting diff --git a/Sofa/Component/Setting/src/sofa/component/setting/MouseButtonSetting.cpp b/Sofa/Component/Setting/src/sofa/component/setting/MouseButtonSetting.cpp index dbcfd1b9ca7..ddcef8176a1 100644 --- a/Sofa/Component/Setting/src/sofa/component/setting/MouseButtonSetting.cpp +++ b/Sofa/Component/Setting/src/sofa/component/setting/MouseButtonSetting.cpp @@ -28,10 +28,12 @@ namespace sofa::component::setting { MouseButtonSetting::MouseButtonSetting(): - button(initData(&button, "button", "Mouse button used")) + d_button(initData(&d_button, "button", "Mouse button used")) { const sofa::helper::OptionsGroup buttonGroup{"Left","Middle","Right"}; - button.setValue(buttonGroup); + d_button.setValue(buttonGroup); + button.setParent(&d_button); + } } // namespace sofa::component::setting diff --git a/Sofa/Component/Setting/src/sofa/component/setting/MouseButtonSetting.h b/Sofa/Component/Setting/src/sofa/component/setting/MouseButtonSetting.h index e3580ce312d..6c599dc7099 100644 --- a/Sofa/Component/Setting/src/sofa/component/setting/MouseButtonSetting.h +++ b/Sofa/Component/Setting/src/sofa/component/setting/MouseButtonSetting.h @@ -38,8 +38,10 @@ class SOFA_COMPONENT_SETTING_API MouseButtonSetting: public core::objectmodel::C public: virtual std::string getOperationType()=0; + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + core::objectmodel::Data button; - core::objectmodel::Data button; ///< Mouse button used + core::objectmodel::Data d_button; ///< Mouse button used }; diff --git a/Sofa/Component/Setting/src/sofa/component/setting/SofaDefaultPathSetting.cpp b/Sofa/Component/Setting/src/sofa/component/setting/SofaDefaultPathSetting.cpp index f54ab6fa83d..ff5e3d70902 100644 --- a/Sofa/Component/Setting/src/sofa/component/setting/SofaDefaultPathSetting.cpp +++ b/Sofa/Component/Setting/src/sofa/component/setting/SofaDefaultPathSetting.cpp @@ -33,8 +33,8 @@ int SofaDefaultPathSettingClass = core::RegisterObject("Default Paths for Sofa A ; SofaDefaultPathSetting::SofaDefaultPathSetting(): - gnuplotPath(initData(&gnuplotPath, "gnuplotPath", "Path where will be saved the gnuplot files")) + d_gnuplotPath(initData(&d_gnuplotPath, "gnuplotPath", "Path where will be saved the gnuplot files")) { - + gnuplotPath.setParent(&d_gnuplotPath); } } // namespace sofa::component::setting \ No newline at end of file diff --git a/Sofa/Component/Setting/src/sofa/component/setting/SofaDefaultPathSetting.h b/Sofa/Component/Setting/src/sofa/component/setting/SofaDefaultPathSetting.h index d644c6b8801..72367429e4e 100644 --- a/Sofa/Component/Setting/src/sofa/component/setting/SofaDefaultPathSetting.h +++ b/Sofa/Component/Setting/src/sofa/component/setting/SofaDefaultPathSetting.h @@ -37,7 +37,10 @@ class SOFA_COMPONENT_SETTING_API SofaDefaultPathSetting: public core::objectmode protected: SofaDefaultPathSetting(); /// gnuplotPath; /// gnuplotPath; + + sofa::core::objectmodel::Data d_gnuplotPath; /// dumpState; ///< If true, dump state vectors at each time step of the simulation. - Data logTime; ///< If true, output in the console an average of the time spent during different stages of the simulation. - Data exportState; ///< If true, create GNUPLOT files with the positions, velocities and forces of all the simulated objects of the scene. + + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data dumpState; + + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data logTime; + + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data exportState; + + + Data d_dumpState; ///< If true, dump state vectors at each time step of the simulation. + Data d_logTime; ///< If true, output in the console an average of the time spent during different stages of the simulation. + Data d_exportState; ///< If true, create GNUPLOT files with the positions, velocities and forces of all the simulated objects of the scene. #ifdef SOFA_DUMP_VISITOR_INFO Data traceVisitors; ///< If true, trace the time spent by each visitor, and allows to profile precisely one step of a simulation. #endif diff --git a/Sofa/Component/Setting/src/sofa/component/setting/ViewerSetting.cpp b/Sofa/Component/Setting/src/sofa/component/setting/ViewerSetting.cpp index 2162dc4d038..81328ff43fd 100644 --- a/Sofa/Component/Setting/src/sofa/component/setting/ViewerSetting.cpp +++ b/Sofa/Component/Setting/src/sofa/component/setting/ViewerSetting.cpp @@ -36,10 +36,15 @@ int ViewerSettingClass = core::RegisterObject("Configuration for the Viewer of y ; ViewerSetting::ViewerSetting() - : resolution(initData(&resolution, Vec<2,int>(800,600), "resolution", "resolution of the Viewer")) - , fullscreen(initData(&fullscreen, false, "fullscreen", "Fullscreen mode")) - , cameraMode(initData(&cameraMode, {"Perspective","Orthographic"}, "cameraMode", "Camera mode")) - , objectPickingMethod(initData(&objectPickingMethod, {"Ray casting","Selection buffer"}, "objectPickingMethod","The method used to pick objects")) -{} + : d_resolution(initData(&d_resolution, Vec<2,int>(800, 600), "resolution", "resolution of the Viewer")) + , d_fullscreen(initData(&d_fullscreen, false, "fullscreen", "Fullscreen mode")) + , d_cameraMode(initData(&d_cameraMode, {"Perspective", "Orthographic"}, "cameraMode", "Camera mode")) + , d_objectPickingMethod(initData(&d_objectPickingMethod, {"Ray casting", "Selection buffer"}, "objectPickingMethod", "The method used to pick objects")) +{ + resolution.setParent(&d_resolution); + fullscreen.setParent (&d_fullscreen); + cameraMode.setParent(&d_cameraMode); + objectPickingMethod.setParent(&d_objectPickingMethod); +} } // namespace sofa::component::setting diff --git a/Sofa/Component/Setting/src/sofa/component/setting/ViewerSetting.h b/Sofa/Component/Setting/src/sofa/component/setting/ViewerSetting.h index 5a6d8dc88f6..53d6f366a82 100644 --- a/Sofa/Component/Setting/src/sofa/component/setting/ViewerSetting.h +++ b/Sofa/Component/Setting/src/sofa/component/setting/ViewerSetting.h @@ -49,13 +49,25 @@ class SOFA_COMPONENT_SETTING_API ViewerSetting: public sofa::core::objectmodel:: ViewerSetting(); public: - Data > resolution; ///< Screen resolution (width, height). - Data fullscreen; ///< True if viewer should be fullscreen. - Data cameraMode; ///< Camera mode. + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data > resolution; + + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data fullscreen; + + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data cameraMode; + + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data objectPickingMethod; + + Data > d_resolution; ///< Screen resolution (width, height). + Data d_fullscreen; ///< True if viewer should be fullscreen. + Data d_cameraMode; ///< Camera mode. /**< \arg Perspective. * \arg Orthographic. */ - Data objectPickingMethod; ///< Picking Method. + Data d_objectPickingMethod; ///< Picking Method. /**< \arg Ray casting. * \arg Selection Buffer. */ diff --git a/Sofa/Component/Setting/src/sofa/component/setting/config.h.in b/Sofa/Component/Setting/src/sofa/component/setting/config.h.in index df47c52fef0..dd0f75383ee 100644 --- a/Sofa/Component/Setting/src/sofa/component/setting/config.h.in +++ b/Sofa/Component/Setting/src/sofa/component/setting/config.h.in @@ -36,3 +36,12 @@ namespace sofa::component::setting constexpr const char* MODULE_NAME = "@PROJECT_NAME@"; constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@"; } // namespace sofa::component::setting + +#ifdef SOFA_BUILD_SOFA_COMPONENT_SETTING +#define SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() +#else +#define SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() \ + SOFA_ATTRIBUTE_DEPRECATED( \ + "v24.06", "v24.12", \ + "Data renamed according to the guidelines") +#endif \ No newline at end of file diff --git a/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglLabel.cpp b/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglLabel.cpp index e5044920ff5..6db3a691335 100644 --- a/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglLabel.cpp +++ b/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglLabel.cpp @@ -96,7 +96,7 @@ void OglLabel::reinit() if (backgroundSetting) { //in contrast mode, the text color is selected between black or white depending on the background color - const RGBAColor& backgroundColor = backgroundSetting->color.getValue(); + const RGBAColor& backgroundColor = backgroundSetting->d_color.getValue(); float yiq = (float)(backgroundColor[0]*255*299 + backgroundColor[1]*255*587 + backgroundColor[2]*255*114); yiq /= 1000; if (yiq >= 128) diff --git a/Sofa/GUI/Common/src/sofa/gui/common/BaseGUI.cpp b/Sofa/GUI/Common/src/sofa/gui/common/BaseGUI.cpp index 90b87cf34ac..ad53e6ab34e 100644 --- a/Sofa/GUI/Common/src/sofa/gui/common/BaseGUI.cpp +++ b/Sofa/GUI/Common/src/sofa/gui/common/BaseGUI.cpp @@ -70,8 +70,8 @@ void BaseGUI::configureGUI(sofa::simulation::Node::SPtr groot) groot->get(defaultPath, sofa::core::objectmodel::BaseContext::SearchRoot); if (defaultPath) { - if (!defaultPath->gnuplotPath.getValue().empty()) - setGnuplotPath(defaultPath->gnuplotPath.getValue()); + if (!defaultPath->d_gnuplotPath.getValue().empty()) + setGnuplotPath(defaultPath->d_gnuplotPath.getValue()); } @@ -80,10 +80,10 @@ void BaseGUI::configureGUI(sofa::simulation::Node::SPtr groot) groot->get(background, sofa::core::objectmodel::BaseContext::SearchRoot); if (background) { - if (background->image.getValue().empty()) - setBackgroundColor(background->color.getValue()); + if (background->d_image.getValue().empty()) + setBackgroundColor(background->d_color.getValue()); else - setBackgroundImage(background->image.getFullPath()); + setBackgroundImage(background->d_image.getFullPath()); } //Stats @@ -91,9 +91,9 @@ void BaseGUI::configureGUI(sofa::simulation::Node::SPtr groot) groot->get(stats, sofa::core::objectmodel::BaseContext::SearchRoot); if (stats) { - setDumpState(stats->dumpState.getValue()); - setLogTime(stats->logTime.getValue()); - setExportState(stats->exportState.getValue()); + setDumpState(stats->d_dumpState.getValue()); + setLogTime(stats->d_logTime.getValue()); + setExportState(stats->d_exportState.getValue()); #ifdef SOFA_DUMP_VISITOR_INFO setTraceVisitors(stats->traceVisitors.getValue()); #endif diff --git a/Sofa/GUI/Common/src/sofa/gui/common/BaseViewer.cpp b/Sofa/GUI/Common/src/sofa/gui/common/BaseViewer.cpp index 945fc09a1ef..42ef287d242 100644 --- a/Sofa/GUI/Common/src/sofa/gui/common/BaseViewer.cpp +++ b/Sofa/GUI/Common/src/sofa/gui/common/BaseViewer.cpp @@ -96,7 +96,7 @@ void BaseViewer::wait() void BaseViewer::configure(sofa::component::setting::ViewerSetting* viewerConf) { using namespace core::visual; - if (viewerConf->cameraMode.getValue().getSelectedId() == VisualParams::ORTHOGRAPHIC_TYPE) + if (viewerConf->d_cameraMode.getValue().getSelectedId() == VisualParams::ORTHOGRAPHIC_TYPE) setCameraMode(VisualParams::ORTHOGRAPHIC_TYPE); else setCameraMode(VisualParams::PERSPECTIVE_TYPE); diff --git a/Sofa/GUI/Common/src/sofa/gui/common/MouseOperations.h b/Sofa/GUI/Common/src/sofa/gui/common/MouseOperations.h index 7fba20a3cd4..9b017ba8324 100644 --- a/Sofa/GUI/Common/src/sofa/gui/common/MouseOperations.h +++ b/Sofa/GUI/Common/src/sofa/gui/common/MouseOperations.h @@ -61,7 +61,7 @@ class SOFA_GUI_COMMON_API Operation virtual ~Operation() {} virtual void configure(PickHandler*picker, MOUSE_BUTTON b) { pickHandle=picker; button=b; } virtual void configure(PickHandler* picker, sofa::component::setting::MouseButtonSetting* s) - { setSetting(s); configure(picker,GetMouseId(s->button.getValue().getSelectedId())); } + { setSetting(s); configure(picker,GetMouseId(s->d_button.getValue().getSelectedId())); } virtual void start(); /// This function is called each time the mouse is clicked. virtual void execution() {} virtual void end(); /// This function is called after each mouse click. diff --git a/Sofa/GUI/Common/src/sofa/gui/common/PickHandler.cpp b/Sofa/GUI/Common/src/sofa/gui/common/PickHandler.cpp index f4ae3fdfc31..d33fd16d216 100644 --- a/Sofa/GUI/Common/src/sofa/gui/common/PickHandler.cpp +++ b/Sofa/GUI/Common/src/sofa/gui/common/PickHandler.cpp @@ -164,16 +164,16 @@ void PickHandler::unload() Operation *PickHandler::changeOperation(sofa::component::setting::MouseButtonSetting* setting) { - if (operations[setting->button.getValue().getSelectedId()]) + if (operations[setting->d_button.getValue().getSelectedId()]) { - delete operations[setting->button.getValue().getSelectedId()]; - operations[setting->button.getValue().getSelectedId()] = nullptr; + delete operations[setting->d_button.getValue().getSelectedId()]; + operations[setting->d_button.getValue().getSelectedId()] = nullptr; } Operation *mouseOp=OperationFactory::Instanciate(setting->getOperationType()); if (mouseOp) { mouseOp->configure(this,setting); - operations[setting->button.getValue().getSelectedId()]=mouseOp; + operations[setting->d_button.getValue().getSelectedId()]=mouseOp; } return mouseOp; diff --git a/Sofa/GUI/Qt/src/sofa/gui/qt/QMouseOperations.cpp b/Sofa/GUI/Qt/src/sofa/gui/qt/QMouseOperations.cpp index 91fca155b71..d659b744eba 100644 --- a/Sofa/GUI/Qt/src/sofa/gui/qt/QMouseOperations.cpp +++ b/Sofa/GUI/Qt/src/sofa/gui/qt/QMouseOperations.cpp @@ -90,7 +90,7 @@ void QAttachOperation::configure(PickHandler *picker, sofa::component::setting:: { if (const sofa::gui::component::AttachBodyButtonSetting* attachSetting=dynamic_cast(button)) { - AttachOperation::configure(picker,GetMouseId(button->button.getValue().getSelectedId())); + AttachOperation::configure(picker,GetMouseId(button->d_button.getValue().getSelectedId())); setting->d_stiffness.copyValueFrom(&(attachSetting->d_stiffness)); setting->d_arrowSize.copyValueFrom(&(attachSetting->d_arrowSize) ); setting->d_showFactorSize.copyValueFrom(&( attachSetting->d_showFactorSize) ) ; @@ -98,7 +98,7 @@ void QAttachOperation::configure(PickHandler *picker, sofa::component::setting:: stiffnessWidget->updateWidgetValue(); arrowSizeWidget->updateWidgetValue(); } - else AttachOperation::configure(picker,GetMouseId(button->button.getValue().getSelectedId())); + else AttachOperation::configure(picker,GetMouseId(button->d_button.getValue().getSelectedId())); } //******************************************************************************************* @@ -111,9 +111,9 @@ void QAddRecordedCameraOperation::configure(PickHandler *picker, sofa::component { if (dynamic_cast(button)) { - AddRecordedCameraOperation::configure(picker,GetMouseId(button->button.getValue().getSelectedId())); + AddRecordedCameraOperation::configure(picker,GetMouseId(button->d_button.getValue().getSelectedId())); } - else AddRecordedCameraOperation::configure(picker,GetMouseId(button->button.getValue().getSelectedId())); + else AddRecordedCameraOperation::configure(picker,GetMouseId(button->d_button.getValue().getSelectedId())); } //******************************************************************************************* @@ -127,9 +127,9 @@ void QStartNavigationOperation::configure(PickHandler *picker, sofa::component:: { if (dynamic_cast(button)) { - StartNavigationOperation::configure(picker,GetMouseId(button->button.getValue().getSelectedId())); + StartNavigationOperation::configure(picker,GetMouseId(button->d_button.getValue().getSelectedId())); } - else StartNavigationOperation::configure(picker,GetMouseId(button->button.getValue().getSelectedId())); + else StartNavigationOperation::configure(picker,GetMouseId(button->d_button.getValue().getSelectedId())); } //******************************************************************************************* @@ -151,12 +151,12 @@ void QFixOperation::configure(PickHandler *picker, sofa::component::setting::Mou { if (const auto* fixSetting=dynamic_cast(button)) { - FixOperation::configure(picker,GetMouseId(button->button.getValue().getSelectedId() )) ; + FixOperation::configure(picker,GetMouseId(button->d_button.getValue().getSelectedId() )) ; setting->stiffness.setValue(fixSetting->stiffness.getValue()); stiffnessWidget->updateWidgetValue(); } - else FixOperation::configure(picker,GetMouseId(button->button.getValue().getSelectedId())); + else FixOperation::configure(picker,GetMouseId(button->d_button.getValue().getSelectedId())); } //******************************************************************************************* diff --git a/Sofa/GUI/Qt/src/sofa/gui/qt/RealGUI.cpp b/Sofa/GUI/Qt/src/sofa/gui/qt/RealGUI.cpp index 8596d3c7e75..c874b02b2ae 100644 --- a/Sofa/GUI/Qt/src/sofa/gui/qt/RealGUI.cpp +++ b/Sofa/GUI/Qt/src/sofa/gui/qt/RealGUI.cpp @@ -1038,9 +1038,9 @@ void RealGUI::setBackgroundImage(const std::string& c) void RealGUI::setViewerConfiguration(sofa::component::setting::ViewerSetting* viewerConf) { - const type::Vec<2,int> &res=viewerConf->resolution.getValue(); + const type::Vec<2,int> &res=viewerConf->d_resolution.getValue(); - if (viewerConf->fullscreen.getValue()) + if (viewerConf->d_fullscreen.getValue()) setFullScreen(); else setViewerResolution(res[0], res[1]); diff --git a/Sofa/GUI/Qt/src/sofa/gui/qt/viewer/GLBackend.cpp b/Sofa/GUI/Qt/src/sofa/gui/qt/viewer/GLBackend.cpp index a1d9369a8b9..9c6b852a209 100644 --- a/Sofa/GUI/Qt/src/sofa/gui/qt/viewer/GLBackend.cpp +++ b/Sofa/GUI/Qt/src/sofa/gui/qt/viewer/GLBackend.cpp @@ -43,7 +43,7 @@ GLBackend::~GLBackend() void GLBackend::setPickingMethod(sofa::gui::common::PickHandler* pick, sofa::component::setting::ViewerSetting* viewerConf) { - if ( viewerConf->objectPickingMethod.getValue().getSelectedId() == gui::common::PickHandler::RAY_CASTING) + if (viewerConf->d_objectPickingMethod.getValue().getSelectedId() == gui::common::PickHandler::RAY_CASTING) pick->setPickingMethod( gui::common::PickHandler::RAY_CASTING ); else pick->setPickingMethod( gui::common::PickHandler::SELECTION_BUFFER);