diff --git a/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/GenericConstraintCorrection.cpp b/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/GenericConstraintCorrection.cpp index 30a0efcfdcd..fddcc8fde5c 100644 --- a/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/GenericConstraintCorrection.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/GenericConstraintCorrection.cpp @@ -264,7 +264,10 @@ void GenericConstraintCorrection::applyPredictiveConstraintForce(const Constrain void GenericConstraintCorrection::resetContactForce(){} -int GenericConstraintCorrectionClass = RegisterObject("") - .add< GenericConstraintCorrection >(); +void registerGenericConstraintCorrection(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Generic Constraint Correction.") + .add< GenericConstraintCorrection >()); +} } //namespace sofa::component::constraint::lagrangian::correction diff --git a/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/LinearSolverConstraintCorrection.cpp b/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/LinearSolverConstraintCorrection.cpp index 86e7a2b64d9..55c270756bd 100644 --- a/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/LinearSolverConstraintCorrection.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/LinearSolverConstraintCorrection.cpp @@ -27,20 +27,21 @@ namespace sofa::component::constraint::lagrangian::correction { + using namespace sofa::defaulttype; -int LinearSolverContactCorrectionClass = core::RegisterObject("") +void registerLinearSolverConstraintCorrection(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Constraint Correction for Linear Solvers.") .add< LinearSolverConstraintCorrection >() .add< LinearSolverConstraintCorrection >() .add< LinearSolverConstraintCorrection >() - .add< LinearSolverConstraintCorrection >() + .add< LinearSolverConstraintCorrection >()); +} - ; template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_CORRECTION_API LinearSolverConstraintCorrection; template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_CORRECTION_API LinearSolverConstraintCorrection; template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_CORRECTION_API LinearSolverConstraintCorrection; template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_CORRECTION_API LinearSolverConstraintCorrection; - - } //namespace sofa::component::constraint::lagrangian::correction diff --git a/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/PrecomputedConstraintCorrection.cpp b/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/PrecomputedConstraintCorrection.cpp index f276fe52a75..9a69337d036 100644 --- a/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/PrecomputedConstraintCorrection.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/PrecomputedConstraintCorrection.cpp @@ -121,17 +121,15 @@ SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_CORRECTION_API void PrecomputedConstraintCo { } - - - using namespace sofa::defaulttype; -int PrecomputedConstraintCorrectionClass = core::RegisterObject("Component computing constraint forces within a simulated body using the compliance method.") +void registerPrecomputedConstraintCorrection(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Component precomputing constraint forces within a simulated body using the compliance method.") .add< PrecomputedConstraintCorrection >() .add< PrecomputedConstraintCorrection >() - .add< PrecomputedConstraintCorrection >() - - ; + .add< PrecomputedConstraintCorrection >()); +} template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_CORRECTION_API PrecomputedConstraintCorrection; template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_CORRECTION_API PrecomputedConstraintCorrection; diff --git a/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/UncoupledConstraintCorrection.cpp b/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/UncoupledConstraintCorrection.cpp index bfa4e4ec3e1..541d30d660b 100644 --- a/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/UncoupledConstraintCorrection.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/UncoupledConstraintCorrection.cpp @@ -155,13 +155,14 @@ SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_CORRECTION_API void UncoupledConstraintCorr } } - -int UncoupledConstraintCorrectionClass = core::RegisterObject("Component computing constraint forces within a simulated body using the compliance method.") +void registerUncoupledConstraintCorrection(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Component computing constraint forces within a simulated body using the compliance method.") .add< UncoupledConstraintCorrection< Vec1Types > >() .add< UncoupledConstraintCorrection< Vec2Types > >() .add< UncoupledConstraintCorrection< Vec3Types > >() - .add< UncoupledConstraintCorrection< Rigid3Types > >() - ; + .add< UncoupledConstraintCorrection< Rigid3Types > >()); +} template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_CORRECTION_API UncoupledConstraintCorrection< Vec1Types >; template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_CORRECTION_API UncoupledConstraintCorrection< Vec2Types >; diff --git a/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/init.cpp b/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/init.cpp index 814cfc507c7..a0173c9e2b2 100644 --- a/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/init.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/init.cpp @@ -21,13 +21,21 @@ ******************************************************************************/ #include #include +#include + namespace sofa::component::constraint::lagrangian::correction { +extern void registerGenericConstraintCorrection(sofa::core::ObjectFactory* factory); +extern void registerLinearSolverConstraintCorrection(sofa::core::ObjectFactory* factory); +extern void registerPrecomputedConstraintCorrection(sofa::core::ObjectFactory* factory); +extern void registerUncoupledConstraintCorrection(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) +{ + registerGenericConstraintCorrection(factory); + registerLinearSolverConstraintCorrection(factory); + registerPrecomputedConstraintCorrection(factory); + registerUncoupledConstraintCorrection(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/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/BilateralLagrangianConstraint.cpp b/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/BilateralLagrangianConstraint.cpp index 9d9c5a28167..e6932abfdae 100644 --- a/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/BilateralLagrangianConstraint.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/BilateralLagrangianConstraint.cpp @@ -317,12 +317,12 @@ void BilateralLagrangianConstraint::addContact(Deriv n id, localid) ; } - - -int BilateralLagrangianConstraintClass = core::RegisterObject("BilateralLagrangianConstraint defining an holonomic equality constraint (attachment)") +void registerBilateralLagrangianConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("BilateralLagrangianConstraint defining an holonomic equality constraint (attachment).") .add< BilateralLagrangianConstraint >() - .add< BilateralLagrangianConstraint >() - ; + .add< BilateralLagrangianConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_MODEL_API BilateralLagrangianConstraint; template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_MODEL_API BilateralLagrangianConstraint; diff --git a/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/FixedLagrangianConstraint.cpp b/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/FixedLagrangianConstraint.cpp index dd1c908d3cd..34c719a02dd 100644 --- a/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/FixedLagrangianConstraint.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/FixedLagrangianConstraint.cpp @@ -237,14 +237,15 @@ void FixedLagrangianConstraint::doGetSingleConstraintResolution(std offset += 3; } - - -int FixedLagrangianConstraintClass = core::RegisterObject("Lagrangian-based fixation of DOFs of the model") +void registerFixedLagrangianConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Lagrangian-based fixation of DOFs of the model.") .add< FixedLagrangianConstraint >() .add< FixedLagrangianConstraint >() .add< FixedLagrangianConstraint >() .add< FixedLagrangianConstraint >() - .add< FixedLagrangianConstraint >(); + .add< FixedLagrangianConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_MODEL_API FixedLagrangianConstraint; template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_MODEL_API FixedLagrangianConstraint; diff --git a/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/SlidingLagrangianConstraint.cpp b/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/SlidingLagrangianConstraint.cpp index 86f42c1935b..d004c21de25 100644 --- a/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/SlidingLagrangianConstraint.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/SlidingLagrangianConstraint.cpp @@ -30,12 +30,13 @@ namespace sofa::component::constraint::lagrangian::model { using namespace sofa::defaulttype; -using namespace sofa::helper; -int SlidingLagrangianConstraintClass = core::RegisterObject("TODO-SlidingLagrangianConstraint") - .add< SlidingLagrangianConstraint >(true); +void registerSlidingLagrangianConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Lagrangian-based partial fixation of DOFs of the model, along an axis.") + .add< SlidingLagrangianConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_MODEL_API SlidingLagrangianConstraint; - } //namespace sofa::component::constraint::lagrangian::model diff --git a/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/StopperLagrangianConstraint.cpp b/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/StopperLagrangianConstraint.cpp index 431a80e8428..097d012e46f 100644 --- a/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/StopperLagrangianConstraint.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/StopperLagrangianConstraint.cpp @@ -29,14 +29,13 @@ namespace sofa::component::constraint::lagrangian::model { using namespace sofa::defaulttype; -using namespace sofa::helper; -int StopperLagrangianConstraintClass = core::RegisterObject("TODO-StopperLagrangianConstraint") - .add< StopperLagrangianConstraint >() - - ; +void registerStopperLagrangianConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Lagrangian-based constraint forcing a 1D DoF to be inside a given range.") + .add< StopperLagrangianConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_MODEL_API StopperLagrangianConstraint; - } //namespace sofa::component::constraint::lagrangian::model diff --git a/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/UniformLagrangianConstraint.cpp b/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/UniformLagrangianConstraint.cpp index eb993968042..1c9265e65ef 100644 --- a/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/UniformLagrangianConstraint.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/UniformLagrangianConstraint.cpp @@ -28,9 +28,11 @@ namespace sofa::component::constraint::lagrangian::model { -int UniformLagrangianConstraintClass = sofa::core::RegisterObject("A constraint equation applied on all dofs.") -.add< UniformLagrangianConstraint >() -; +void registerUniformLagrangianConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("A constraint equation applied on all dofs.") + .add< UniformLagrangianConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_MODEL_API UniformLagrangianConstraint; diff --git a/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/UnilateralLagrangianConstraint.cpp b/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/UnilateralLagrangianConstraint.cpp index 911955ed2e5..ab1fa1724c8 100644 --- a/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/UnilateralLagrangianConstraint.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/UnilateralLagrangianConstraint.cpp @@ -28,14 +28,12 @@ namespace sofa::component::constraint::lagrangian::model { using namespace sofa::defaulttype; -using namespace sofa::helper; - -//TODO(dmarchal) What does this TODO mean ? -int UnilateralLagrangianConstraintClass = core::RegisterObject("TODO-UnilateralLagrangianConstraint") - .add< UnilateralLagrangianConstraint >() - - ; +void registerUnilateralLagrangianConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Lagrangian-based inequality constraint") + .add< UnilateralLagrangianConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_MODEL_API UnilateralLagrangianConstraint; diff --git a/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/init.cpp b/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/init.cpp index 4e24afdcaad..de09f9f65d9 100644 --- a/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/init.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/init.cpp @@ -21,13 +21,23 @@ ******************************************************************************/ #include #include +#include + namespace sofa::component::constraint::lagrangian::model { +extern void registerBilateralLagrangianConstraint(sofa::core::ObjectFactory* factory); +extern void registerFixedLagrangianConstraint(sofa::core::ObjectFactory* factory); +extern void registerSlidingLagrangianConstraint(sofa::core::ObjectFactory* factory); +extern void registerStopperLagrangianConstraint(sofa::core::ObjectFactory* factory); +extern void registerUniformLagrangianConstraint(sofa::core::ObjectFactory* factory); +extern void registerUnilateralLagrangianConstraint(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 +55,24 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerBilateralLagrangianConstraint(factory); + registerFixedLagrangianConstraint(factory); + registerSlidingLagrangianConstraint(factory); + registerStopperLagrangianConstraint(factory); + registerUniformLagrangianConstraint(factory); + registerUnilateralLagrangianConstraint(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/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/GenericConstraintSolver.cpp b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/GenericConstraintSolver.cpp index 7a60a110c4e..81506a5b8f3 100644 --- a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/GenericConstraintSolver.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/GenericConstraintSolver.cpp @@ -617,8 +617,10 @@ sofa::core::MultiVecDerivId GenericConstraintSolver::getDx() const return m_dxId; } - -int GenericConstraintSolverClass = core::RegisterObject("A Generic Constraint Solver using the Linear Complementarity Problem formulation to solve Constraint based components") - .add< GenericConstraintSolver >(); +void registerGenericConstraintSolver(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("A Generic Constraint Solver using the Linear Complementarity Problem formulation to solve Constraint based components") + .add< GenericConstraintSolver >()); +} } //namespace sofa::component::constraint::lagrangian::solver diff --git a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/LCPConstraintSolver.cpp b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/LCPConstraintSolver.cpp index 88176a20a26..c5ce582ddc6 100644 --- a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/LCPConstraintSolver.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/LCPConstraintSolver.cpp @@ -1331,7 +1331,10 @@ void LCPConstraintSolver::draw(const core::visual::VisualParams* vparams) } -int LCPConstraintSolverClass = core::RegisterObject("A Constraint Solver using the Linear Complementarity Problem formulation to solve BaseConstraint based components") - .add< LCPConstraintSolver >(); +void registerLCPConstraintSolver(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("A Constraint Solver using the Linear Complementarity Problem formulation to solve BaseConstraint based components.") + .add< LCPConstraintSolver >()); +} } //namespace sofa::component::constraint::lagrangian::solver diff --git a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/init.cpp b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/init.cpp index 49035665928..d814d090dd3 100644 --- a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/init.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/init.cpp @@ -21,14 +21,19 @@ ******************************************************************************/ #include #include +#include namespace sofa::component::constraint::lagrangian::solver { +extern void registerGenericConstraintSolver(sofa::core::ObjectFactory* factory); +extern void registerLCPConstraintSolver(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() @@ -46,11 +51,20 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerGenericConstraintSolver(factory); + registerLCPConstraintSolver(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/Constraint/Lagrangian/src/sofa/component/constraint/lagrangian/init.cpp b/Sofa/Component/Constraint/Lagrangian/src/sofa/component/constraint/lagrangian/init.cpp index db4109f59f4..b0f8cbd6009 100644 --- a/Sofa/Component/Constraint/Lagrangian/src/sofa/component/constraint/lagrangian/init.cpp +++ b/Sofa/Component/Constraint/Lagrangian/src/sofa/component/constraint/lagrangian/init.cpp @@ -21,10 +21,13 @@ ******************************************************************************/ #include -#include #include +#include #include +#include +#include + namespace sofa::component::constraint::lagrangian { @@ -32,6 +35,7 @@ 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() @@ -49,15 +53,26 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + factory->registerObjectsFromPlugin("Sofa.Component.Constraint.Lagrangian.Correction"); + factory->registerObjectsFromPlugin("Sofa.Component.Constraint.Lagrangian.Model"); + factory->registerObjectsFromPlugin("Sofa.Component.Constraint.Lagrangian.Solver"); +} + void init() { static bool first = true; if (first) { // force dependencies at compile-time - sofa::component::constraint::lagrangian::model::init(); sofa::component::constraint::lagrangian::correction::init(); + sofa::component::constraint::lagrangian::model::init(); sofa::component::constraint::lagrangian::solver::init(); + + // 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/Constraint/Projective/src/sofa/component/constraint/projective/AffineMovementProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/AffineMovementProjectiveConstraint.cpp index a34416970dc..92545757a7d 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/AffineMovementProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/AffineMovementProjectiveConstraint.cpp @@ -31,10 +31,12 @@ namespace sofa::component::constraint::projective { -int AffineMovementProjectiveConstraintRegister = core::RegisterObject("Constraint the movement by a rigid transform.") +void registerAffineMovementProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Constraint the movement by a rigid transform.") .add< AffineMovementProjectiveConstraint >() - .add< AffineMovementProjectiveConstraint >() - ; + .add< AffineMovementProjectiveConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API AffineMovementProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API AffineMovementProjectiveConstraint; diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/AttachProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/AttachProjectiveConstraint.cpp index 2c2683c9d1c..6fa5cd004f7 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/AttachProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/AttachProjectiveConstraint.cpp @@ -28,15 +28,16 @@ namespace sofa::component::constraint::projective using namespace sofa::type; using namespace sofa::defaulttype; -using namespace sofa::helper; -int AttachProjectiveConstraintClass = core::RegisterObject("Attach given pair of particles, projecting the positions of the second particles to the first ones") +void registerAttachProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Attach given pair of particles, projecting the positions of the second particles to the first ones.") .add< AttachProjectiveConstraint >() .add< AttachProjectiveConstraint >() .add< AttachProjectiveConstraint >() .add< AttachProjectiveConstraint >() - .add< AttachProjectiveConstraint >() - ; + .add< AttachProjectiveConstraint >()); +} template <> SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API void AttachProjectiveConstraint::calcRestRotations() @@ -67,6 +68,4 @@ template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API AttachProjectiveConstrai template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API AttachProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API AttachProjectiveConstraint; - - } // namespace sofa::component::constraint::projective diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/DirectionProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/DirectionProjectiveConstraint.cpp index 2d0a68442dd..7b080f6ea8e 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/DirectionProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/DirectionProjectiveConstraint.cpp @@ -29,16 +29,15 @@ namespace sofa::component::constraint::projective { using namespace sofa::defaulttype; -using namespace sofa::helper; - -int DirectionProjectiveConstraintClass = core::RegisterObject("Attach given particles to their initial positions") +void registerDirectionProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Attach given particles to their initial positions.") .add< DirectionProjectiveConstraint >() - .add< DirectionProjectiveConstraint >() - ; + .add< DirectionProjectiveConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API DirectionProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API DirectionProjectiveConstraint; - } // namespace sofa::component::constraint::projective diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/FixedPlaneProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/FixedPlaneProjectiveConstraint.cpp index ab9c9e49cc6..14fd1b6c8e6 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/FixedPlaneProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/FixedPlaneProjectiveConstraint.cpp @@ -29,15 +29,14 @@ namespace sofa::component::constraint::projective { using namespace sofa::defaulttype; -using namespace sofa::helper; - -int FixedPlaneProjectiveConstraintClass = core::RegisterObject("Project particles on a given plane") +void registerFixedPlaneProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Project particles on a given plane.") .add< FixedPlaneProjectiveConstraint >() .add< FixedPlaneProjectiveConstraint >() - .add< FixedPlaneProjectiveConstraint >() - - ; + .add< FixedPlaneProjectiveConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API FixedPlaneProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API FixedPlaneProjectiveConstraint; diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/FixedProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/FixedProjectiveConstraint.cpp index 86f1a9bca7d..1854302ef87 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/FixedProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/FixedProjectiveConstraint.cpp @@ -31,15 +31,16 @@ namespace sofa::component::constraint::projective using namespace sofa::defaulttype; using namespace sofa::helper; - -int FixedProjectiveConstraintClass = core::RegisterObject("Attach given particles to their initial positions") +void registerFixedProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Attach given particles to their initial positions.") .add< FixedProjectiveConstraint >() .add< FixedProjectiveConstraint >() .add< FixedProjectiveConstraint >() .add< FixedProjectiveConstraint >() .add< FixedProjectiveConstraint >() - .add< FixedProjectiveConstraint >() - ; + .add< FixedProjectiveConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API FixedProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API FixedProjectiveConstraint; diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/FixedRotationProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/FixedRotationProjectiveConstraint.cpp index d812af0e473..d0fd218cd2b 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/FixedRotationProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/FixedRotationProjectiveConstraint.cpp @@ -30,11 +30,11 @@ namespace sofa::component::constraint::projective using namespace sofa::defaulttype; - -int FixedRotationProjectiveConstraintClass = core::RegisterObject("Prevents rotation around x or/and y or/and z axis") - .add< FixedRotationProjectiveConstraint >() - - ; +void registerFixedRotationProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Prevents rotation around x or/and y or/and z axis.") + .add< FixedRotationProjectiveConstraint >()); +} template class FixedRotationProjectiveConstraint; diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/FixedTranslationProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/FixedTranslationProjectiveConstraint.cpp index e65ea931ed2..a443ae956d4 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/FixedTranslationProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/FixedTranslationProjectiveConstraint.cpp @@ -29,17 +29,17 @@ namespace sofa::component::constraint::projective { using namespace sofa::defaulttype; -using namespace sofa::helper; -int FixedTranslationProjectiveConstraintClass = core::RegisterObject("Attach given rigids to their initial positions but they still can have rotations") +void registerFixedTranslationProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Attach given rigids to their initial positions but they still can have rotations.") .add< FixedTranslationProjectiveConstraint >() .add< FixedTranslationProjectiveConstraint >() - .add< FixedTranslationProjectiveConstraint >() - ; + .add< FixedTranslationProjectiveConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API FixedTranslationProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API FixedTranslationProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API FixedTranslationProjectiveConstraint; - } // namespace sofa::component::constraint::projective diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/HermiteSplineProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/HermiteSplineProjectiveConstraint.cpp index aa10b586bf7..31c43fcdc3f 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/HermiteSplineProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/HermiteSplineProjectiveConstraint.cpp @@ -28,12 +28,14 @@ namespace sofa::component::constraint::projective { -int HermiteSplineProjectiveConstraintClass = core::RegisterObject("Apply a hermite cubic spline trajectory to given points") +void registerHermiteSplineProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Apply a hermite cubic spline trajectory to given points.") .add< HermiteSplineProjectiveConstraint >() - .add< HermiteSplineProjectiveConstraint >() - ; + .add< HermiteSplineProjectiveConstraint >()); +} -template <> +template <> SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API void HermiteSplineProjectiveConstraint::init() { this->core::behavior::ProjectiveConstraintSet::init(); diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/LineProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/LineProjectiveConstraint.cpp index e22a8f51b56..b36ebda8f53 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/LineProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/LineProjectiveConstraint.cpp @@ -27,13 +27,13 @@ namespace sofa::component::constraint::projective { using namespace sofa::defaulttype; -using namespace sofa::helper; - -int LineProjectiveConstraintClass = core::RegisterObject("Attach given particles to their initial positions") +void registerLineProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Attach given particles to their initial positions.") .add< LineProjectiveConstraint >() - .add< LineProjectiveConstraint >() - ; + .add< LineProjectiveConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API LineProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API LineProjectiveConstraint; diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/LinearMovementProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/LinearMovementProjectiveConstraint.cpp index e3f98526572..15318052280 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/LinearMovementProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/LinearMovementProjectiveConstraint.cpp @@ -40,16 +40,15 @@ void LinearMovementProjectiveConstraint::init() finished = false; } - -//declaration of the class, for the factory -int LinearMovementProjectiveConstraintClass = core::RegisterObject("translate given particles") +void registerLinearMovementProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Impose a motion to given DOFs (translation and rotation).") .add< LinearMovementProjectiveConstraint >() .add< LinearMovementProjectiveConstraint >() .add< LinearMovementProjectiveConstraint >() .add< LinearMovementProjectiveConstraint >() - .add< LinearMovementProjectiveConstraint >() - ; - + .add< LinearMovementProjectiveConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API LinearMovementProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API LinearMovementProjectiveConstraint; diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/LinearVelocityProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/LinearVelocityProjectiveConstraint.cpp index 5c8c0ef4a29..ceca8557230 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/LinearVelocityProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/LinearVelocityProjectiveConstraint.cpp @@ -29,16 +29,16 @@ namespace sofa::component::constraint::projective { using namespace sofa::defaulttype; -using namespace sofa::helper; -//declaration of the class, for the factory -int LinearVelocityProjectiveConstraintClass = core::RegisterObject("apply velocity to given particles") +void registerLinearVelocityProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Impose a velocity to given DOFs (translation and rotation).") .add< LinearVelocityProjectiveConstraint >() .add< LinearVelocityProjectiveConstraint >() .add< LinearVelocityProjectiveConstraint >() .add< LinearVelocityProjectiveConstraint >() - .add< LinearVelocityProjectiveConstraint >() - ; + .add< LinearVelocityProjectiveConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API LinearVelocityProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API LinearVelocityProjectiveConstraint; diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/OscillatorProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/OscillatorProjectiveConstraint.cpp index 967fb6e369d..39643c5d9e5 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/OscillatorProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/OscillatorProjectiveConstraint.cpp @@ -29,12 +29,13 @@ namespace sofa::component::constraint::projective { using namespace sofa::defaulttype; -using namespace sofa::helper; -int OscillatorProjectiveConstraintClass = core::RegisterObject("Apply a sinusoidal trajectory to given points") +void registerOscillatorProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Apply a sinusoidal trajectory to given points.") .add< OscillatorProjectiveConstraint >() - .add< OscillatorProjectiveConstraint >() - ; + .add< OscillatorProjectiveConstraint >()); +} template class OscillatorProjectiveConstraint; template class OscillatorProjectiveConstraint; diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/ParabolicProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/ParabolicProjectiveConstraint.cpp index 47503a2d77f..1e3b78c67be 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/ParabolicProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/ParabolicProjectiveConstraint.cpp @@ -28,10 +28,12 @@ namespace sofa::component::constraint::projective { -int ParabolicProjectiveConstraintClass = core::RegisterObject("Apply a parabolic trajectory to given points") +void registerParabolicProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Apply a parabolic trajectory to given points.") .add< ParabolicProjectiveConstraint >() - .add< ParabolicProjectiveConstraint >() - ; + .add< ParabolicProjectiveConstraint >()); +} template class ParabolicProjectiveConstraint; template class ParabolicProjectiveConstraint; diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PartialFixedProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PartialFixedProjectiveConstraint.cpp index a28195e0254..8d2b1ff8d8e 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PartialFixedProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PartialFixedProjectiveConstraint.cpp @@ -28,17 +28,17 @@ namespace sofa::component::constraint::projective { using namespace sofa::defaulttype; -using namespace sofa::helper; - -int PartialFixedProjectiveConstraintClass = core::RegisterObject("Attach given particles to their initial positions") +void registerPartialFixedProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Attach given particles to their initial positions, in some directions only.") .add< PartialFixedProjectiveConstraint >() .add< PartialFixedProjectiveConstraint >() .add< PartialFixedProjectiveConstraint >() .add< PartialFixedProjectiveConstraint >() .add< PartialFixedProjectiveConstraint >() - .add< PartialFixedProjectiveConstraint >() - ; + .add< PartialFixedProjectiveConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API PartialFixedProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API PartialFixedProjectiveConstraint; diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PartialLinearMovementProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PartialLinearMovementProjectiveConstraint.cpp index fed36af54b7..493333c1080 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PartialLinearMovementProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PartialLinearMovementProjectiveConstraint.cpp @@ -28,14 +28,15 @@ namespace sofa::component::constraint::projective { -//declaration of the class, for the factory -int PartialLinearMovementProjectiveConstraintClass = core::RegisterObject("translate given particles") +void registerPartialLinearMovementProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Impose a motion to given DOFs (translation and rotation) in some directions only.") .add< PartialLinearMovementProjectiveConstraint >() .add< PartialLinearMovementProjectiveConstraint >() .add< PartialLinearMovementProjectiveConstraint >() .add< PartialLinearMovementProjectiveConstraint >() - .add< PartialLinearMovementProjectiveConstraint >() - ; + .add< PartialLinearMovementProjectiveConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API PartialLinearMovementProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API PartialLinearMovementProjectiveConstraint; diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PatchTestMovementProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PatchTestMovementProjectiveConstraint.cpp index 3b17d682ecd..461d47e8676 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PatchTestMovementProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PatchTestMovementProjectiveConstraint.cpp @@ -28,11 +28,12 @@ namespace sofa::component::constraint::projective { -//declaration of the class, for the factory -int PatchTestMovementProjectiveConstraintClass = core::RegisterObject("bilinear constraint") +void registerPatchTestMovementProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Impose a motion to all the boundary points of a mesh.") .add< PatchTestMovementProjectiveConstraint >() - .add< PatchTestMovementProjectiveConstraint >() - ; + .add< PatchTestMovementProjectiveConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API PatchTestMovementProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API PatchTestMovementProjectiveConstraint; diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PlaneProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PlaneProjectiveConstraint.cpp index dc33393e99f..7db51a5b85e 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PlaneProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PlaneProjectiveConstraint.cpp @@ -27,13 +27,13 @@ namespace sofa::component::constraint::projective { using namespace sofa::defaulttype; -using namespace sofa::helper; - -int PlaneProjectiveConstraintClass = core::RegisterObject("Attach given particles to their initial positions") +void registerPlaneProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Project particles to an affine plane.") .add< PlaneProjectiveConstraint >() - .add< PlaneProjectiveConstraint >() - ; + .add< PlaneProjectiveConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API PlaneProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API PlaneProjectiveConstraint; diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PointProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PointProjectiveConstraint.cpp index cac90a54160..4d998b2ab03 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PointProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PointProjectiveConstraint.cpp @@ -29,15 +29,15 @@ namespace sofa::component::constraint::projective { using namespace sofa::defaulttype; -using namespace sofa::helper; - -int PointProjectiveConstraintClass = core::RegisterObject("Project particles to a point") +void registerPointProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Project particles to a point") .add< PointProjectiveConstraint >() .add< PointProjectiveConstraint >() .add< PointProjectiveConstraint >() - .add< PointProjectiveConstraint >() - ; + .add< PointProjectiveConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API PointProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API PointProjectiveConstraint; diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PositionBasedDynamicsProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PositionBasedDynamicsProjectiveConstraint.cpp index 20d3cf9f3cd..21327d56cb8 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PositionBasedDynamicsProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/PositionBasedDynamicsProjectiveConstraint.cpp @@ -32,26 +32,23 @@ namespace sofa::component::constraint::projective using namespace sofa::type; using namespace sofa::defaulttype; -using namespace sofa::helper; - -int PositionBasedDynamicsProjectiveConstraintClass = core::RegisterObject("Position-based dynamics") +void registerPositionBasedDynamicsProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Position-based dynamics") .add< PositionBasedDynamicsProjectiveConstraint >(true) .add< PositionBasedDynamicsProjectiveConstraint >() .add< PositionBasedDynamicsProjectiveConstraint >() .add< PositionBasedDynamicsProjectiveConstraint >() - .add< PositionBasedDynamicsProjectiveConstraint >() - ; + .add< PositionBasedDynamicsProjectiveConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API PositionBasedDynamicsProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API PositionBasedDynamicsProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API PositionBasedDynamicsProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API PositionBasedDynamicsProjectiveConstraint; template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API PositionBasedDynamicsProjectiveConstraint; -//template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API PositionBasedDynamicsProjectiveConstraint; - - // specialization for rigids diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/SkeletalMotionProjectiveConstraint.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/SkeletalMotionProjectiveConstraint.cpp index 7116610d74d..8c59b58b0ea 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/SkeletalMotionProjectiveConstraint.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/SkeletalMotionProjectiveConstraint.cpp @@ -27,10 +27,11 @@ namespace sofa::component::constraint::projective { -//declaration of the class, for the factory -int SkeletalMotionProjectiveConstraintClass = core::RegisterObject("animate a skeleton") - .add< SkeletalMotionProjectiveConstraint >() - ; +void registerSkeletalMotionProjectiveConstraint(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Animate a skeleton.") + .add< SkeletalMotionProjectiveConstraint >()); +} template class SOFA_COMPONENT_CONSTRAINT_PROJECTIVE_API SkeletalMotionProjectiveConstraint; diff --git a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/init.cpp b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/init.cpp index b774107ac0f..466a4dee5ee 100644 --- a/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/init.cpp +++ b/Sofa/Component/Constraint/Projective/src/sofa/component/constraint/projective/init.cpp @@ -21,13 +21,37 @@ ******************************************************************************/ #include #include +#include + namespace sofa::component::constraint::projective { +extern void registerAffineMovementProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerAttachProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerDirectionProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerFixedPlaneProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerFixedProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerFixedRotationProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerFixedTranslationProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerHermiteSplineProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerLinearMovementProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerLinearVelocityProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerLineProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerOscillatorProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerParabolicProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerPartialFixedProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerPartialLinearMovementProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerPatchTestMovementProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerPlaneProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerPointProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerPositionBasedDynamicsProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerSkeletalMotionProjectiveConstraint(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 +69,38 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerAffineMovementProjectiveConstraint(factory); + registerAttachProjectiveConstraint(factory); + registerDirectionProjectiveConstraint(factory); + registerFixedPlaneProjectiveConstraint(factory); + registerFixedProjectiveConstraint(factory); + registerFixedRotationProjectiveConstraint(factory); + registerFixedTranslationProjectiveConstraint(factory); + registerHermiteSplineProjectiveConstraint(factory); + registerLinearMovementProjectiveConstraint(factory); + registerLinearVelocityProjectiveConstraint(factory); + registerLineProjectiveConstraint(factory); + registerOscillatorProjectiveConstraint(factory); + registerParabolicProjectiveConstraint(factory); + registerPartialFixedProjectiveConstraint(factory); + registerPartialLinearMovementProjectiveConstraint(factory); + registerPatchTestMovementProjectiveConstraint(factory); + registerPlaneProjectiveConstraint(factory); + registerPointProjectiveConstraint(factory); + registerPositionBasedDynamicsProjectiveConstraint(factory); + registerSkeletalMotionProjectiveConstraint(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/Constraint/src/sofa/component/constraint/init.cpp b/Sofa/Component/Constraint/src/sofa/component/constraint/init.cpp index 3e5bad0fd96..73d6424d02b 100644 --- a/Sofa/Component/Constraint/src/sofa/component/constraint/init.cpp +++ b/Sofa/Component/Constraint/src/sofa/component/constraint/init.cpp @@ -24,6 +24,9 @@ #include #include +#include +#include + namespace sofa::component::constraint { @@ -31,6 +34,7 @@ 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() @@ -48,6 +52,12 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + factory->registerObjectsFromPlugin("Sofa.Component.Constraint.Lagrangian"); + factory->registerObjectsFromPlugin("Sofa.Component.Constraint.Projective"); +} + void init() { static bool first = true; @@ -57,6 +67,9 @@ void init() sofa::component::constraint::lagrangian::init(); sofa::component::constraint::projective::init(); + // 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 9f34dcdd8a3..6a19d4af83d 100644 --- a/Sofa/Component/src/sofa/component/init.cpp +++ b/Sofa/Component/src/sofa/component/init.cpp @@ -91,6 +91,7 @@ void registerObjects(sofa::core::ObjectFactory* factory) factory->registerObjectsFromPlugin("Sofa.Component.Engine"); factory->registerObjectsFromPlugin("Sofa.Component.Collision"); factory->registerObjectsFromPlugin("Sofa.Component.SolidMechanics"); + factory->registerObjectsFromPlugin("Sofa.Component.Constraint"); } void init()