diff --git a/Sofa/Component/Setting/src/sofa/component/setting/BackgroundSetting.cpp b/Sofa/Component/Setting/src/sofa/component/setting/BackgroundSetting.cpp index e35e06b0848..f2c923dca7f 100644 --- a/Sofa/Component/Setting/src/sofa/component/setting/BackgroundSetting.cpp +++ b/Sofa/Component/Setting/src/sofa/component/setting/BackgroundSetting.cpp @@ -26,10 +26,11 @@ namespace sofa::component::setting { -int BackgroundSettingClass = core::RegisterObject("Background setting") - .add< BackgroundSetting >() - .addAlias("Background") - ; +void registerBackgroundSetting(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Background setting.") + .add< BackgroundSetting >()); +} BackgroundSetting::BackgroundSetting(): d_color(initData(&d_color, "color", "Color of the background")), diff --git a/Sofa/Component/Setting/src/sofa/component/setting/SofaDefaultPathSetting.cpp b/Sofa/Component/Setting/src/sofa/component/setting/SofaDefaultPathSetting.cpp index 5dfa6bae98b..d2717e7716b 100644 --- a/Sofa/Component/Setting/src/sofa/component/setting/SofaDefaultPathSetting.cpp +++ b/Sofa/Component/Setting/src/sofa/component/setting/SofaDefaultPathSetting.cpp @@ -27,10 +27,11 @@ namespace sofa::component::setting { -int SofaDefaultPathSettingClass = core::RegisterObject("Default Paths for Sofa Application") - .add< SofaDefaultPathSetting >() - .addAlias("SofaDefaultPath") - ; +void registerSofaDefaultPathSetting(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Default Paths for Sofa Application.") + .add< SofaDefaultPathSetting >()); +} SofaDefaultPathSetting::SofaDefaultPathSetting(): d_gnuplotPath(initData(&d_gnuplotPath, "gnuplotPath", "Path where will be saved the gnuplot files")) diff --git a/Sofa/Component/Setting/src/sofa/component/setting/StatsSetting.cpp b/Sofa/Component/Setting/src/sofa/component/setting/StatsSetting.cpp index 8c510310be5..ea1b493b950 100644 --- a/Sofa/Component/Setting/src/sofa/component/setting/StatsSetting.cpp +++ b/Sofa/Component/Setting/src/sofa/component/setting/StatsSetting.cpp @@ -27,10 +27,11 @@ namespace sofa::component::setting { -int StatsSettingClass = core::RegisterObject("Stats settings") - .add< StatsSetting >() - .addAlias("Stats") - ; +void registerStatsSetting(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Stats settings.") + .add< StatsSetting >()); +} StatsSetting::StatsSetting(): d_dumpState(initData(&d_dumpState, false, "dumpState", "Dump state vectors at each time step of the simulation")) diff --git a/Sofa/Component/Setting/src/sofa/component/setting/ViewerSetting.cpp b/Sofa/Component/Setting/src/sofa/component/setting/ViewerSetting.cpp index ec477f03f0e..0193dbc22c4 100644 --- a/Sofa/Component/Setting/src/sofa/component/setting/ViewerSetting.cpp +++ b/Sofa/Component/Setting/src/sofa/component/setting/ViewerSetting.cpp @@ -30,10 +30,11 @@ namespace sofa::component::setting using namespace sofa::type; using namespace sofa::helper; -int ViewerSettingClass = core::RegisterObject("Configuration for the Viewer of your application") - .add< ViewerSetting >() - .addAlias("Viewer") - ; +void registerViewerSetting(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Configuration for the Viewer of your application.") + .add< ViewerSetting >()); +} ViewerSetting::ViewerSetting() : d_resolution(initData(&d_resolution, Vec<2,int>(800, 600), "resolution", "resolution of the Viewer")) diff --git a/Sofa/Component/Setting/src/sofa/component/setting/init.cpp b/Sofa/Component/Setting/src/sofa/component/setting/init.cpp index f34ee5276ad..bd3acf65f79 100644 --- a/Sofa/Component/Setting/src/sofa/component/setting/init.cpp +++ b/Sofa/Component/Setting/src/sofa/component/setting/init.cpp @@ -21,13 +21,21 @@ ******************************************************************************/ #include #include +#include + namespace sofa::component::setting { +extern void registerBackgroundSetting(sofa::core::ObjectFactory* factory); +extern void registerSofaDefaultPathSetting(sofa::core::ObjectFactory* factory); +extern void registerStatsSetting(sofa::core::ObjectFactory* factory); +extern void registerViewerSetting(sofa::core::ObjectFactory* factory); + extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() @@ -45,11 +53,22 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerBackgroundSetting(factory); + registerSofaDefaultPathSetting(factory); + registerStatsSetting(factory); + registerViewerSetting(factory); +} + void init() { static bool first = true; if (first) { + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + first = false; } } diff --git a/Sofa/Component/src/sofa/component/init.cpp b/Sofa/Component/src/sofa/component/init.cpp index e74214f07af..b037b4eea72 100644 --- a/Sofa/Component/src/sofa/component/init.cpp +++ b/Sofa/Component/src/sofa/component/init.cpp @@ -75,6 +75,7 @@ void registerObjects(sofa::core::ObjectFactory* factory) { factory->registerObjectsFromPlugin("Sofa.Component.AnimationLoop"); factory->registerObjectsFromPlugin("Sofa.Component.StateContainer"); + factory->registerObjectsFromPlugin("Sofa.Component.Setting"); factory->registerObjectsFromPlugin("Sofa.Component.Visual"); } diff --git a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp index 6466fcac7df..4fe474599f3 100644 --- a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp +++ b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp @@ -768,7 +768,12 @@ const std::map< std::string, Dealiased, std::less<> > dealiasedComponents = { {"MasterConstraintSolver", Dealiased("v24.12","ConstraintAnimationLoop")}, {"FreeMotionMasterSolver", Dealiased("v24.12","FreeMotionAnimationLoop")}, {"MultiStepMasterSolver", Dealiased("v24.12","MultiStepAnimationLoop")}, - {"MultiTagMasterSolver", Dealiased("v24.12","MultiTagAnimationLoop")} + {"MultiTagMasterSolver", Dealiased("v24.12","MultiTagAnimationLoop")}, + {"Background", Dealiased("v24.12","BackgroundSetting")}, + {"SofaDefaultPath", Dealiased("v24.12","SofaDefaultPathSetting")}, + {"Stats", Dealiased("v24.12","StatsSetting")}, + {"Viewer", Dealiased("v24.12","ViewerSetting")}, + }; } // namespace sofa::helper::lifecycle