From fcd78a723bd497bda3affeceeb9a26980d957f74 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Wed, 2 Oct 2024 20:36:20 +0900 Subject: [PATCH] [Engine] Apply new factory registration mechanism (#5010) * apply new register mechanism to engine * Apply suggestions from code review (updates on component description) Co-authored-by: Hugo * Update PairBoxRoi.cpp (remove useless comment) --------- Co-authored-by: Hugo --- .../component/engine/analyze/AverageCoord.cpp | 10 ++-- .../engine/analyze/ClusteringEngine.cpp | 9 ++-- .../component/engine/analyze/Distances.cpp | 9 ++-- .../engine/analyze/HausdorffDistance.cpp | 9 ++-- .../engine/analyze/ShapeMatching.cpp | 9 ++-- .../component/engine/analyze/SumEngine.cpp | 10 ++-- .../sofa/component/engine/analyze/init.cpp | 25 ++++++++- .../generate/ExtrudeEdgesAndGenerateQuads.cpp | 11 ++-- .../generate/ExtrudeQuadsAndGenerateHexas.cpp | 11 ++-- .../engine/generate/ExtrudeSurface.cpp | 11 ++-- .../engine/generate/GenerateCylinder.cpp | 12 ++--- .../engine/generate/GenerateGrid.cpp | 12 ++--- .../engine/generate/GenerateRigidMass.cpp | 10 ++-- .../engine/generate/GenerateSphere.cpp | 12 ++--- .../generate/GroupFilterYoungModulus.cpp | 11 ++-- .../component/engine/generate/JoinPoints.cpp | 10 ++-- .../component/engine/generate/MergeMeshes.cpp | 11 ++-- .../component/engine/generate/MergePoints.cpp | 11 ++-- .../component/engine/generate/MergeSets.cpp | 12 ++--- .../engine/generate/MergeVectors.cpp | 32 ++++++----- .../generate/MeshBarycentricMapperEngine.cpp | 12 ++--- .../engine/generate/MeshClosingEngine.cpp | 10 ++-- .../engine/generate/MeshTetraStuffing.cpp | 8 +-- .../component/engine/generate/NormEngine.cpp | 10 ++-- .../engine/generate/NormalsFromPoints.cpp | 11 ++-- .../RandomPointDistributionInSurface.cpp | 11 ++-- .../sofa/component/engine/generate/Spiral.cpp | 11 ++-- .../sofa/component/engine/generate/init.cpp | 53 ++++++++++++++++++- .../sofa/component/engine/select/BoxROI.cpp | 19 ++++--- .../engine/select/ComplementaryROI.cpp | 10 ++-- .../engine/select/IndicesFromValues.cpp | 18 ++----- .../component/engine/select/MergeROIs.cpp | 8 +-- .../engine/select/MeshBoundaryROI.cpp | 7 ++- .../sofa/component/engine/select/MeshROI.cpp | 11 ++-- .../component/engine/select/MeshSampler.cpp | 12 ++--- .../engine/select/MeshSplittingEngine.cpp | 10 ++-- .../engine/select/MeshSubsetEngine.cpp | 10 ++-- .../engine/select/NearestPointROI.cpp | 9 ++-- .../component/engine/select/PairBoxRoi.cpp | 15 +++--- .../sofa/component/engine/select/PlaneROI.cpp | 11 ++-- .../engine/select/PointsFromIndices.cpp | 13 ++--- .../component/engine/select/ProximityROI.cpp | 12 ++--- .../select/SelectConnectedLabelsROI.cpp | 8 +-- .../engine/select/SelectLabelROI.cpp | 8 +-- .../component/engine/select/SphereROI.cpp | 10 ++-- .../engine/select/SubsetTopology.cpp | 11 ++-- .../engine/select/ValuesFromIndices.cpp | 10 ++-- .../engine/select/ValuesFromPositions.cpp | 11 ++-- .../src/sofa/component/engine/select/init.cpp | 53 ++++++++++++++++++- .../engine/transform/DifferenceEngine.cpp | 10 ++-- .../engine/transform/DilateEngine.cpp | 8 +-- .../transform/DisplacementMatrixEngine.cpp | 10 ++-- .../engine/transform/IndexValueMapper.cpp | 11 ++-- .../engine/transform/Indices2ValuesMapper.cpp | 11 ++-- .../engine/transform/Indices2ValuesMapper.inl | 1 - .../component/engine/transform/MapIndices.cpp | 8 +-- .../component/engine/transform/MathOp.cpp | 28 +++++----- .../transform/ProjectiveTransformEngine.cpp | 9 ++-- .../engine/transform/QuatToRigidEngine.cpp | 11 ++-- .../engine/transform/ROIValueMapper.cpp | 11 ++-- .../engine/transform/RigidToQuatEngine.cpp | 12 ++--- .../engine/transform/SmoothMeshEngine.cpp | 11 ++-- .../engine/transform/TransformEngine.cpp | 9 ++-- .../transform/TransformMatrixEngine.cpp | 28 +++++++--- .../engine/transform/TransformPosition.cpp | 10 ++-- .../engine/transform/Vertex2Frame.cpp | 11 ++-- .../sofa/component/engine/transform/init.cpp | 50 +++++++++++++++++ .../Engine/src/sofa/component/engine/init.cpp | 15 ++++++ Sofa/Component/src/sofa/component/init.cpp | 1 + .../src/sofa/helper/ComponentChange.cpp | 1 + 70 files changed, 549 insertions(+), 366 deletions(-) diff --git a/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/AverageCoord.cpp b/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/AverageCoord.cpp index 4daba0bc2c4..9644f4769cf 100644 --- a/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/AverageCoord.cpp +++ b/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/AverageCoord.cpp @@ -30,14 +30,14 @@ namespace sofa::component::engine::analyze using namespace sofa::defaulttype; -int AverageCoordClass = core::RegisterObject("Compute the average of coordinates") +void registerAverageCoord(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Compute the average of coordinates.") .add< AverageCoord >() .add< AverageCoord >() .add< AverageCoord >() - .add< AverageCoord >() - - ; - + .add< AverageCoord >()); +} template class SOFA_COMPONENT_ENGINE_ANALYZE_API AverageCoord; template class SOFA_COMPONENT_ENGINE_ANALYZE_API AverageCoord; diff --git a/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/ClusteringEngine.cpp b/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/ClusteringEngine.cpp index 067d8b32fb1..5f8f1b112b3 100644 --- a/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/ClusteringEngine.cpp +++ b/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/ClusteringEngine.cpp @@ -29,10 +29,11 @@ namespace sofa::component::engine::analyze using namespace sofa::defaulttype; -int ClusteringEngineClass = core::RegisterObject("Group points into overlapping clusters according to a user defined number of clusters and radius") - .add< ClusteringEngine >() - - ; +void registerClusteringEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Group points into overlapping clusters according to a user defined number of clusters and radius.") + .add< ClusteringEngine >()); +} template class SOFA_COMPONENT_ENGINE_ANALYZE_API ClusteringEngine; diff --git a/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/Distances.cpp b/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/Distances.cpp index c1becb4944f..50519602b29 100644 --- a/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/Distances.cpp +++ b/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/Distances.cpp @@ -30,10 +30,11 @@ namespace sofa::component::engine::analyze using namespace sofa::defaulttype; -int DistancesClass = core::RegisterObject("Compute distances based on a grid.") - .add< Distances >() - - ; +void registerDistances(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Compute distances based on a grid.") + .add< Distances >()); +} template class SOFA_COMPONENT_ENGINE_ANALYZE_API Distances; diff --git a/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/HausdorffDistance.cpp b/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/HausdorffDistance.cpp index fc2b4e88b8a..31260f7ca45 100644 --- a/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/HausdorffDistance.cpp +++ b/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/HausdorffDistance.cpp @@ -30,14 +30,15 @@ namespace sofa::component::engine::analyze using namespace sofa::defaulttype; -int HausdorffDistanceClass = core::RegisterObject("Compute the Hausdorff distance of two point clouds") +void registerHausdorffDistance(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Compute the Hausdorff distance of two point clouds.") .add< HausdorffDistance >() .add< HausdorffDistance >() .add< HausdorffDistance >(true) .add< HausdorffDistance >() - .add< HausdorffDistance >() - - ; + .add< HausdorffDistance >()); +} template class SOFA_COMPONENT_ENGINE_ANALYZE_API HausdorffDistance; template class SOFA_COMPONENT_ENGINE_ANALYZE_API HausdorffDistance; diff --git a/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/ShapeMatching.cpp b/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/ShapeMatching.cpp index 7df2dff0f3e..07bec50db9f 100644 --- a/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/ShapeMatching.cpp +++ b/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/ShapeMatching.cpp @@ -32,11 +32,12 @@ namespace sofa::component::engine::analyze using namespace defaulttype; -int ShapeMatchingClass = core::RegisterObject("Compute target positions using shape matching deformation method by Mueller et al.") +void registerShapeMatching(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Compute target positions using shape matching deformation method by Mueller et al.") .add< ShapeMatching >() - .add< ShapeMatching >() - - ; + .add< ShapeMatching >()); +} template class SOFA_COMPONENT_ENGINE_ANALYZE_API ShapeMatching; template class SOFA_COMPONENT_ENGINE_ANALYZE_API ShapeMatching; diff --git a/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/SumEngine.cpp b/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/SumEngine.cpp index 44e23a40712..6f42adf8dce 100644 --- a/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/SumEngine.cpp +++ b/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/SumEngine.cpp @@ -27,13 +27,13 @@ namespace sofa::component::engine::analyze { using namespace sofa::type; -using namespace sofa::defaulttype; -int SumEngineClass = core::RegisterObject("Computing the Sum between two vector of dofs") +void registerSumEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Computing the sum between two vector of dofs.") .add< SumEngine >() - .add< SumEngine >(true) // default template - - ; + .add< SumEngine >(true)); +} template class SOFA_COMPONENT_ENGINE_ANALYZE_API SumEngine; template class SOFA_COMPONENT_ENGINE_ANALYZE_API SumEngine; diff --git a/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/init.cpp b/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/init.cpp index 3cb16116d29..636efc80782 100644 --- a/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/init.cpp +++ b/Sofa/Component/Engine/Analyze/src/sofa/component/engine/analyze/init.cpp @@ -21,13 +21,23 @@ ******************************************************************************/ #include #include +#include + namespace sofa::component::engine::analyze { - + +extern void registerAverageCoord(sofa::core::ObjectFactory* factory); +extern void registerClusteringEngine(sofa::core::ObjectFactory* factory); +extern void registerDistances(sofa::core::ObjectFactory* factory); +extern void registerHausdorffDistance(sofa::core::ObjectFactory* factory); +extern void registerShapeMatching(sofa::core::ObjectFactory* factory); +extern void registerSumEngine(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) +{ + registerAverageCoord(factory); + registerClusteringEngine(factory); + registerDistances(factory); + registerHausdorffDistance(factory); + registerShapeMatching(factory); + registerSumEngine(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/Engine/Generate/src/sofa/component/engine/generate/ExtrudeEdgesAndGenerateQuads.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/ExtrudeEdgesAndGenerateQuads.cpp index 95baaf1f2d4..08672cf543d 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/ExtrudeEdgesAndGenerateQuads.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/ExtrudeEdgesAndGenerateQuads.cpp @@ -29,13 +29,12 @@ namespace sofa::component::engine::generate using namespace sofa::defaulttype; -int ExtrudeEdgesAndGenerateQuadsClass = core::RegisterObject("This engine extrudes an edge-based curve into a quad surface patch") - .add< ExtrudeEdgesAndGenerateQuads >(true) // default template - - ; +void registerExtrudeEdgesAndGenerateQuads(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine extruding an edge-based curve into a quad surface patch.") + .add< ExtrudeEdgesAndGenerateQuads >(true)); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API ExtrudeEdgesAndGenerateQuads; - - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/ExtrudeQuadsAndGenerateHexas.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/ExtrudeQuadsAndGenerateHexas.cpp index 76f27e4a39b..51fa444c9ad 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/ExtrudeQuadsAndGenerateHexas.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/ExtrudeQuadsAndGenerateHexas.cpp @@ -29,13 +29,12 @@ namespace sofa::component::engine::generate using namespace sofa::defaulttype; -int ExtrudeQuadsAndGenerateHexasClass = core::RegisterObject("This engine extrudes a quad-based surface into a set of hexahedral elements") - .add< ExtrudeQuadsAndGenerateHexas >() - - ; +void registerExtrudeQuadsAndGenerateHexas(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine extruding a quad-based surface into a set of hexahedral elements.") + .add< ExtrudeQuadsAndGenerateHexas >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API ExtrudeQuadsAndGenerateHexas; - - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/ExtrudeSurface.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/ExtrudeSurface.cpp index 4a2101dea77..725c0f67d8e 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/ExtrudeSurface.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/ExtrudeSurface.cpp @@ -30,13 +30,12 @@ namespace sofa::component::engine::generate using namespace sofa::defaulttype; -int ExtrudeSurfaceClass = core::RegisterObject("This class truns on spiral any topological model") - .add< ExtrudeSurface >() - - ; +void registerExtrudeSurface(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine creating a mesh from the extrusion of the surface of a given mesh.") + .add< ExtrudeSurface >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API ExtrudeSurface; - - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GenerateCylinder.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GenerateCylinder.cpp index 88b9afadceb..ddbc3208fe7 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GenerateCylinder.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GenerateCylinder.cpp @@ -28,14 +28,12 @@ namespace sofa::component::engine::generate { using namespace sofa::defaulttype; -int GenerateCylinderClass = core::RegisterObject("Generate a Cylindrical Tetrahedral Mesh") - .add< GenerateCylinder >() - - ; - +void registerGenerateCylinder(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine generating a cylindrical tetrahedral mesh.") + .add< GenerateCylinder >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API GenerateCylinder; - - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GenerateGrid.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GenerateGrid.cpp index 7c630069faf..1fc515fe15b 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GenerateGrid.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GenerateGrid.cpp @@ -28,16 +28,14 @@ namespace sofa::component::engine::generate { using namespace sofa::defaulttype; -int GenerateGridClass = core::RegisterObject("Generate a Grid Tetrahedral or Hexahedral Mesh") +void registerGenerateGrid(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine generating a grid tetrahedral or hexahedral mesh.") .add< GenerateGrid >() - .add< GenerateGrid >() - - ; - + .add< GenerateGrid >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API GenerateGrid; template class SOFA_COMPONENT_ENGINE_GENERATE_API GenerateGrid; - - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GenerateRigidMass.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GenerateRigidMass.cpp index f8374e99e33..27faf76ec6b 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GenerateRigidMass.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GenerateRigidMass.cpp @@ -29,12 +29,12 @@ namespace sofa::component::engine::generate using namespace sofa::defaulttype; -int GenerateRigidMassClass = core::RegisterObject("An engine computing the RigidMass of a mesh : mass, volume and inertia matrix.") - .add< GenerateRigidMass >() - - ; +void registerGenerateRigidMass(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine computing the RigidMass of a mesh: mass, volume and inertia matrix.") + .add< GenerateRigidMass >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API GenerateRigidMass; - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GenerateSphere.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GenerateSphere.cpp index bb03b81213f..5d165d2f487 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GenerateSphere.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GenerateSphere.cpp @@ -28,14 +28,12 @@ namespace sofa::component::engine::generate { using namespace sofa::defaulttype; -int GenerateSphereClass = core::RegisterObject("Generate a sphereical (Bezier) Tetrahedral and Triangular Mesh") - .add< GenerateSphere >() - - ; - +void registerGenerateSphere(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine generating a spherical (Bezier) tetrahedral and triangular mesh.") + .add< GenerateSphere >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API GenerateSphere; - - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GroupFilterYoungModulus.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GroupFilterYoungModulus.cpp index 16635fb67f9..6ecd9ecbb31 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GroupFilterYoungModulus.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/GroupFilterYoungModulus.cpp @@ -30,13 +30,12 @@ namespace sofa::component::engine::generate using namespace sofa::defaulttype; -int GroupFilterYoungModulusClass = core::RegisterObject("This class gives a vector of young modulus according of a list of defined groups") - .add< GroupFilterYoungModulus >() - - ; +void registerGroupFilterYoungModulus(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine defining a vector of young modulus according of a list of defined groups.") + .add< GroupFilterYoungModulus >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API GroupFilterYoungModulus; - - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/JoinPoints.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/JoinPoints.cpp index 378457abb9e..f83efab3d85 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/JoinPoints.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/JoinPoints.cpp @@ -29,12 +29,12 @@ namespace sofa::component::engine::generate using namespace sofa::defaulttype; -int JoinPointsClass = core::RegisterObject("?") - .add< JoinPoints >() - - ; +void registerJoinPoints(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Merge points from a set of points within a given distance.") + .add< JoinPoints >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API JoinPoints; - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MergeMeshes.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MergeMeshes.cpp index 29a8ecfd356..d4396922807 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MergeMeshes.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MergeMeshes.cpp @@ -26,21 +26,20 @@ namespace sofa::component::engine::generate { -int MergeMeshesClass = core::RegisterObject("Merge several meshes") +void registerMergeMeshes(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Merge several meshes.") .add< MergeMeshes >(true) // default template .add< MergeMeshes >() .add< MergeMeshes >() .add< MergeMeshes >() - .add< MergeMeshes >() - - ; + .add< MergeMeshes >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeMeshes; template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeMeshes; template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeMeshes; template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeMeshes; template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeMeshes; - - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MergePoints.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MergePoints.cpp index b728739c584..249bce47218 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MergePoints.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MergePoints.cpp @@ -26,14 +26,15 @@ namespace sofa::component::engine::generate { -int MergePointsClass = core::RegisterObject("Merge 2 cordinate vectors") +void registerMergePoints(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Merge 2 cordinate vectors.") .add< MergePoints >(true) // default template .add< MergePoints >() .add< MergePoints >() .add< MergePoints >() - .add< MergePoints >() - - ; + .add< MergePoints >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API MergePoints; template class SOFA_COMPONENT_ENGINE_GENERATE_API MergePoints; @@ -41,6 +42,4 @@ template class SOFA_COMPONENT_ENGINE_GENERATE_API MergePoints; template class SOFA_COMPONENT_ENGINE_GENERATE_API MergePoints; - - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MergeSets.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MergeSets.cpp index 584a7783d86..9e1d7602737 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MergeSets.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MergeSets.cpp @@ -26,16 +26,14 @@ namespace sofa::component::engine::generate { -int MergeSetsClass = core::RegisterObject("Merge two sets of indices using specified boolean operation") +void registerMergeSets(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Merge two sets of indices using specified boolean operation.") .add< MergeSets >(true) - .add< MergeSets >() -//.add< MergeSets >() -//.add< MergeSets >() - ; + .add< MergeSets >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeSets; template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeSets; -//template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeSets; -//template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeSets; } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MergeVectors.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MergeVectors.cpp index 98e469fc86d..669b954ce31 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MergeVectors.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MergeVectors.cpp @@ -26,25 +26,25 @@ namespace sofa::component::engine::generate { -int MergeVectorsClass = core::RegisterObject("Apply a merge operation to combine several inputs") - .add< MergeVectors< type::vector > >(true) - .add< MergeVectors< type::vector > >() - .add< MergeVectors< type::vector > >() - //.add< MergeVectors< type::vector > >() - .add< MergeVectors< type::vector > >() - .add< MergeVectors< type::vector > >() - .add< MergeVectors< type::vector > >() - .add< MergeVectors< type::vector > >() - .add< MergeVectors< defaulttype::Rigid2Types::VecCoord > >() - .add< MergeVectors< defaulttype::Rigid2Types::VecDeriv > >() - .add< MergeVectors< defaulttype::Rigid3Types::VecCoord > >() - .add< MergeVectors< defaulttype::Rigid3Types::VecDeriv > >(); - +void registerMergeVectors(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Apply a merge operation to combine several inputs.") + .add< MergeVectors< type::vector > >(true) + .add< MergeVectors< type::vector > >() + .add< MergeVectors< type::vector > >() + .add< MergeVectors< type::vector > >() + .add< MergeVectors< type::vector > >() + .add< MergeVectors< type::vector > >() + .add< MergeVectors< type::vector > >() + .add< MergeVectors< defaulttype::Rigid2Types::VecCoord > >() + .add< MergeVectors< defaulttype::Rigid2Types::VecDeriv > >() + .add< MergeVectors< defaulttype::Rigid3Types::VecCoord > >() + .add< MergeVectors< defaulttype::Rigid3Types::VecDeriv > >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeVectors< type::vector >; template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeVectors< type::vector >; template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeVectors< type::vector >; - template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeVectors< type::vector >; template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeVectors< type::vector >; template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeVectors< type::vector >; @@ -54,6 +54,4 @@ template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeVectors< defaulttype::Rig template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeVectors< defaulttype::Rigid3Types::VecCoord >; template class SOFA_COMPONENT_ENGINE_GENERATE_API MergeVectors< defaulttype::Rigid3Types::VecDeriv >; - - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MeshBarycentricMapperEngine.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MeshBarycentricMapperEngine.cpp index c36ff11f4ca..d85c0b5d9d5 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MeshBarycentricMapperEngine.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MeshBarycentricMapperEngine.cpp @@ -30,14 +30,12 @@ namespace sofa::component::engine::generate { using namespace sofa::defaulttype; -int MeshBarycentricMapperEngineClass = core::RegisterObject("This class maps a set of points in a topological model and provide barycentric coordinates") - .add< MeshBarycentricMapperEngine >() - - ; +void registerMeshBarycentricMapperEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine mapping a set of points in a topological model and provide barycentric coordinates") + .add< MeshBarycentricMapperEngine >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API MeshBarycentricMapperEngine; - - - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MeshClosingEngine.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MeshClosingEngine.cpp index 5970a2ad90b..60697748f86 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MeshClosingEngine.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MeshClosingEngine.cpp @@ -26,12 +26,12 @@ namespace sofa::component::engine::generate { -int MeshClosingEngineClass = core::RegisterObject("Merge several meshes") - .add< MeshClosingEngine >(true) // default template - ; +void registerMeshClosingEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Close a given mesh.") + .add< MeshClosingEngine >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API MeshClosingEngine; - - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MeshTetraStuffing.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MeshTetraStuffing.cpp index 7b40eb82e63..2afe7cb5456 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MeshTetraStuffing.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/MeshTetraStuffing.cpp @@ -34,9 +34,11 @@ namespace sofa::component::engine::generate using namespace sofa::defaulttype; using type::vector; -int MeshTetraStuffingClass = core::RegisterObject("Create a tetrahedral volume mesh from a surface, using the algorithm from F. Labelle and J.R. Shewchuk, \"Isosurface Stuffing: Fast Tetrahedral Meshes with Good Dihedral Angles\", SIGGRAPH 2007.") - .add< MeshTetraStuffing >() - ; +void registerMeshTetraStuffing(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Create a tetrahedral volume mesh from a surface, using the algorithm from F. Labelle and J.R. Shewchuk, \"Isosurface Stuffing: Fast Tetrahedral Meshes with Good Dihedral Angles\", SIGGRAPH 2007.") + .add< MeshTetraStuffing >()); +} MeshTetraStuffing::MeshTetraStuffing() : d_vbbox(initData(&d_vbbox, "vbbox", "BBox to restrict the volume to")) diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/NormEngine.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/NormEngine.cpp index 09ca7eec731..de24c00ec14 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/NormEngine.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/NormEngine.cpp @@ -26,12 +26,12 @@ namespace sofa::component::engine::generate { -int NormEngineClass = core::RegisterObject("Convert Vec in Real") - .add< NormEngine >(true) // default template - - ; +void registerNormEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Convert Vec in Real") + .add< NormEngine >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API NormEngine; - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/NormalsFromPoints.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/NormalsFromPoints.cpp index 8c9c6573bfa..953dbe0ef3d 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/NormalsFromPoints.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/NormalsFromPoints.cpp @@ -29,13 +29,12 @@ namespace sofa::component::engine::generate using namespace sofa::defaulttype; -int NormalsFromPointsClass = core::RegisterObject("Compute vertex normals by averaging face normals") - .add< NormalsFromPoints >() - - ; +void registerNormalsFromPoints(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Compute vertex normals by averaging face normals.") + .add< NormalsFromPoints >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API NormalsFromPoints; - - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/RandomPointDistributionInSurface.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/RandomPointDistributionInSurface.cpp index c2ebee7f179..ead70d5312c 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/RandomPointDistributionInSurface.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/RandomPointDistributionInSurface.cpp @@ -29,13 +29,12 @@ namespace sofa::component::engine::generate using namespace sofa::defaulttype; -int RandomPointDistributionInSurfaceClass = core::RegisterObject("This class truns on spiral any topological model") - .add< RandomPointDistributionInSurface >() - - ; +void registerRandomPointDistributionInSurface(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine distributing points over a surface randomly.") + .add< RandomPointDistributionInSurface >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API RandomPointDistributionInSurface; - - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/Spiral.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/Spiral.cpp index be857c442fe..541eea29c12 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/Spiral.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/Spiral.cpp @@ -30,13 +30,12 @@ namespace sofa::component::engine::generate using namespace sofa::defaulttype; -int SpiralClass = core::RegisterObject("This class truns on spiral any topological model") - .add< Spiral >() - - ; +void registerSpiral(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine turning on spiral any topological model.") + .add< Spiral >()); +} template class SOFA_COMPONENT_ENGINE_GENERATE_API Spiral; - - } //namespace sofa::component::engine::generate diff --git a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/init.cpp b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/init.cpp index 84dbb29dcd0..9da9eda2c5e 100644 --- a/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/init.cpp +++ b/Sofa/Component/Engine/Generate/src/sofa/component/engine/generate/init.cpp @@ -21,13 +21,37 @@ ******************************************************************************/ #include #include +#include + namespace sofa::component::engine::generate { - + +extern void registerExtrudeEdgesAndGenerateQuads(sofa::core::ObjectFactory* factory); +extern void registerExtrudeQuadsAndGenerateHexas(sofa::core::ObjectFactory* factory); +extern void registerExtrudeSurface(sofa::core::ObjectFactory* factory); +extern void registerGenerateCylinder(sofa::core::ObjectFactory* factory); +extern void registerGenerateGrid(sofa::core::ObjectFactory* factory); +extern void registerGenerateRigidMass(sofa::core::ObjectFactory* factory); +extern void registerGenerateSphere(sofa::core::ObjectFactory* factory); +extern void registerGroupFilterYoungModulus(sofa::core::ObjectFactory* factory); +extern void registerJoinPoints(sofa::core::ObjectFactory* factory); +extern void registerMergeMeshes(sofa::core::ObjectFactory* factory); +extern void registerMergePoints(sofa::core::ObjectFactory* factory); +extern void registerMergeSets(sofa::core::ObjectFactory* factory); +extern void registerMergeVectors(sofa::core::ObjectFactory* factory); +extern void registerMeshBarycentricMapperEngine(sofa::core::ObjectFactory* factory); +extern void registerMeshClosingEngine(sofa::core::ObjectFactory* factory); +extern void registerMeshTetraStuffing(sofa::core::ObjectFactory* factory); +extern void registerNormalsFromPoints(sofa::core::ObjectFactory* factory); +extern void registerNormEngine(sofa::core::ObjectFactory* factory); +extern void registerRandomPointDistributionInSurface(sofa::core::ObjectFactory* factory); +extern void registerSpiral(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) +{ + registerExtrudeEdgesAndGenerateQuads(factory); + registerExtrudeQuadsAndGenerateHexas(factory); + registerExtrudeSurface(factory); + registerGenerateCylinder(factory); + registerGenerateGrid(factory); + registerGenerateRigidMass(factory); + registerGenerateSphere(factory); + registerGroupFilterYoungModulus(factory); + registerJoinPoints(factory); + registerMergeMeshes(factory); + registerMergePoints(factory); + registerMergeSets(factory); + registerMergeVectors(factory); + registerMeshBarycentricMapperEngine(factory); + registerMeshClosingEngine(factory); + registerMeshTetraStuffing(factory); + registerNormalsFromPoints(factory); + registerNormEngine(factory); + registerRandomPointDistributionInSurface(factory); + registerSpiral(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/Engine/Select/src/sofa/component/engine/select/BoxROI.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/BoxROI.cpp index 079bc76679c..919ce24a1e3 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/BoxROI.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/BoxROI.cpp @@ -24,25 +24,30 @@ #include #include -namespace sofa::component::engine::select::boxroi +namespace sofa::component::engine::select { using namespace sofa::defaulttype; -int BoxROIClass = core::RegisterObject("Find the primitives (vertex/edge/triangle/quad/tetrahedron/hexahedron) inside given boxes") +void registerBoxROI(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine selecting the any primitives (vertex/edge/triangle/quad/tetrahedron/hexahedron) inside given boxes.") .add< BoxROI >(true) //default .add< BoxROI >() .add< BoxROI >() .add< BoxROI >() - .add< BoxROI >() - - ; + .add< BoxROI >()); +} + +namespace boxroi +{ template class SOFA_COMPONENT_ENGINE_SELECT_API BoxROI; template class SOFA_COMPONENT_ENGINE_SELECT_API BoxROI; template class SOFA_COMPONENT_ENGINE_SELECT_API BoxROI; template class SOFA_COMPONENT_ENGINE_SELECT_API BoxROI; template class SOFA_COMPONENT_ENGINE_SELECT_API BoxROI; - -} // namespace sofa::component::engine::select::boxroi +} // namespace boxroi + +} // namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/ComplementaryROI.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/ComplementaryROI.cpp index 0ad166d2833..d66fbdc3c98 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/ComplementaryROI.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/ComplementaryROI.cpp @@ -30,12 +30,12 @@ namespace sofa::component::engine::select using namespace sofa::defaulttype; -int ComplementaryROIClass = core::RegisterObject("Find the points that are NOT in the input sets") - .add >() - - ; +void registerComplementaryROI(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Find the points that are NOT in the input sets.") + .add >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API ComplementaryROI; - } //namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/IndicesFromValues.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/IndicesFromValues.cpp index 4079bf5af78..a745d976431 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/IndicesFromValues.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/IndicesFromValues.cpp @@ -28,7 +28,9 @@ namespace sofa::component::engine::select { -int IndicesFromValuesClass = core::RegisterObject("Find the indices of a list of values within a larger set of values") +void registerIndicesFromValues(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine finding the indices of a list of values within a larger set of values.") .add< IndicesFromValues >() .add< IndicesFromValues >() .add< IndicesFromValues >() @@ -38,13 +40,8 @@ int IndicesFromValuesClass = core::RegisterObject("Find the indices of a list of .add< IndicesFromValues< type::fixed_array > >() .add< IndicesFromValues >() .add< IndicesFromValues >() - .add< IndicesFromValues >() - // .add< IndicesFromValues >() - // .add< IndicesFromValues >() - // .add< IndicesFromValues >() - // .add< IndicesFromValues >() - - ; + .add< IndicesFromValues >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API IndicesFromValues; template class SOFA_COMPONENT_ENGINE_SELECT_API IndicesFromValues; @@ -56,10 +53,5 @@ template class SOFA_COMPONENT_ENGINE_SELECT_API IndicesFromValues< type::fixed_a template class SOFA_COMPONENT_ENGINE_SELECT_API IndicesFromValues; template class SOFA_COMPONENT_ENGINE_SELECT_API IndicesFromValues; template class SOFA_COMPONENT_ENGINE_SELECT_API IndicesFromValues; -// template class SOFA_COMPONENT_ENGINE_SELECT_API IndicesFromValues; -// template class SOFA_COMPONENT_ENGINE_SELECT_API IndicesFromValues; -// template class SOFA_COMPONENT_ENGINE_SELECT_API IndicesFromValues; -// template class SOFA_COMPONENT_ENGINE_SELECT_API IndicesFromValues; - } //namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MergeROIs.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MergeROIs.cpp index 6bb3910d902..fb94352fb96 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MergeROIs.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MergeROIs.cpp @@ -72,9 +72,11 @@ void MergeROIs::doUpdate() for(size_t i=0 ; i) into a single Data (vector>)") - .add< MergeROIs >(true) - ; +void registerMergeROIs(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Merge a list of ROIs (vector) into a single Data (vector>).") + .add< MergeROIs >()); +} } //namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshBoundaryROI.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshBoundaryROI.cpp index f44b1ecea31..e866d610604 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshBoundaryROI.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshBoundaryROI.cpp @@ -26,8 +26,11 @@ namespace sofa::component::engine::select { -int MeshBoundaryROIClass = core::RegisterObject("Outputs indices of boundary vertices of a triangle/quad mesh") - .add< MeshBoundaryROI >(true); +void registerMeshBoundaryROI(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Outputs indices of boundary vertices of a triangle/quad mesh") + .add< MeshBoundaryROI >()); +} MeshBoundaryROI::MeshBoundaryROI(): Inherit1() , d_triangles(initData(&d_triangles,"triangles","input triangles")) diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshROI.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshROI.cpp index 478603b985f..ea025fa74d9 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshROI.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshROI.cpp @@ -29,17 +29,16 @@ namespace sofa::component::engine::select using namespace sofa::defaulttype; -int MeshROIClass = core::RegisterObject("Find the primitives (vertex/edge/triangle/tetrahedron) inside a given mesh") +void registerMeshROI(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Find the primitives (vertex/edge/triangle/tetrahedron) inside a given mesh.") .add< MeshROI >(true) //default template .add< MeshROI >() - .add< MeshROI >() - - ; + .add< MeshROI >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API MeshROI; template class SOFA_COMPONENT_ENGINE_SELECT_API MeshROI; template class SOFA_COMPONENT_ENGINE_SELECT_API MeshROI; - - } //namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshSampler.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshSampler.cpp index e71bf8436a7..029bba009b6 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshSampler.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshSampler.cpp @@ -27,14 +27,12 @@ namespace sofa::component::engine::select { -int MeshSamplerClass = core::RegisterObject("Select uniformly distributed points on a mesh based on Euclidean or Geodesic distance measure") - .add< MeshSampler >(true) - - ; +void registerMeshSampler(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Select uniformly distributed points on a mesh based on Euclidean or Geodesic distance measure.") + .add< MeshSampler >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API MeshSampler; - - - } //namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshSplittingEngine.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshSplittingEngine.cpp index d837ccbf545..a1b828281b0 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshSplittingEngine.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshSplittingEngine.cpp @@ -26,12 +26,12 @@ namespace sofa::component::engine::select { -int MeshSplittingEngineClass = core::RegisterObject("This class breaks a mesh in multiple parts, based on selected vertices or cells.") - .add< MeshSplittingEngine >(true) // default template - ; +void registerMeshSplittingEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine breaking a mesh in multiple parts, based on selected vertices or cells.") + .add< MeshSplittingEngine >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API MeshSplittingEngine; - - } //namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshSubsetEngine.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshSubsetEngine.cpp index 6641bcba60b..82d6b58be4c 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshSubsetEngine.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/MeshSubsetEngine.cpp @@ -26,12 +26,12 @@ namespace sofa::component::engine::select { -int MeshSubsetEngineClass = core::RegisterObject("Extract a mesh subset based on selected vertices") - .add< MeshSubsetEngine >(true) // default template - ; +void registerMeshSubsetEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Extract a mesh subset based on selected vertices.") + .add< MeshSubsetEngine >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API MeshSubsetEngine; - - } //namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/NearestPointROI.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/NearestPointROI.cpp index 23d13270e01..469a8c082db 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/NearestPointROI.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/NearestPointROI.cpp @@ -28,14 +28,16 @@ namespace sofa::component::engine::select using namespace sofa::defaulttype; -int NearestPointROIClass = core::RegisterObject("Attach given pair of particles, projecting the positions of the second particles to the first ones") +void registerNearestPointROI(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< NearestPointROI >() .add< NearestPointROI >() .add< NearestPointROI >() .add< NearestPointROI >() .add< NearestPointROI >() - .add< NearestPointROI >() - ; + .add< NearestPointROI >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API NearestPointROI; template class SOFA_COMPONENT_ENGINE_SELECT_API NearestPointROI; @@ -43,4 +45,5 @@ template class SOFA_COMPONENT_ENGINE_SELECT_API NearestPointROI; template class SOFA_COMPONENT_ENGINE_SELECT_API NearestPointROI; template class SOFA_COMPONENT_ENGINE_SELECT_API NearestPointROI; + } //namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/PairBoxRoi.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/PairBoxRoi.cpp index 0ca8ab3c352..e71474a4c5a 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/PairBoxRoi.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/PairBoxRoi.cpp @@ -29,17 +29,16 @@ namespace sofa::component::engine::select using namespace sofa::defaulttype; -int PairBoxROIClass = core::RegisterObject("Find the primitives (vertex/edge/triangle/tetrahedron) inside a given box") - .add< PairBoxROI >() +void registerPairBoxROI(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Find all the points located between two boxes.") + .add< PairBoxROI >(true) .add< PairBoxROI >() - .add< PairBoxROI >() //Phuoc - - ; + .add< PairBoxROI >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API PairBoxROI; template class SOFA_COMPONENT_ENGINE_SELECT_API PairBoxROI; -template class SOFA_COMPONENT_ENGINE_SELECT_API PairBoxROI; //Phuoc - - +template class SOFA_COMPONENT_ENGINE_SELECT_API PairBoxROI; } //namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/PlaneROI.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/PlaneROI.cpp index 5576a015a4d..60f454d0f8f 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/PlaneROI.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/PlaneROI.cpp @@ -29,15 +29,14 @@ namespace sofa::component::engine::select using namespace sofa::defaulttype; -int PlaneROIClass = core::RegisterObject("Find the primitives inside a given plane") +void registerPlaneROI(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Find the primitives inside a given plane.") .add< PlaneROI >() - .add< PlaneROI >() - - ; + .add< PlaneROI >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API PlaneROI; template class SOFA_COMPONENT_ENGINE_SELECT_API PlaneROI; - - } //namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/PointsFromIndices.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/PointsFromIndices.cpp index fe68535eaab..09733432acb 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/PointsFromIndices.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/PointsFromIndices.cpp @@ -30,15 +30,12 @@ namespace sofa::component::engine::select using namespace sofa::defaulttype; -int PointsFromIndicesClass = core::RegisterObject("Find the points given a list of indices") - .add< PointsFromIndices >() -// .add< PointsFromIndices >() - - ; +void registerPointsFromIndices(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Find the points given a list of indices.") + .add< PointsFromIndices >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API PointsFromIndices; -// template class SOFA_COMPONENT_ENGINE_SELECT_API PointsFromIndices; - - } //namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/ProximityROI.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/ProximityROI.cpp index a29b50a2cf4..654d88d698e 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/ProximityROI.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/ProximityROI.cpp @@ -30,14 +30,12 @@ namespace sofa::component::engine::select using namespace sofa::defaulttype; -int ProximityROIClass = core::RegisterObject("Find the N closest primitives from a given position") - .add< ProximityROI >() - - ; +void registerProximityROI(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Find the N closest primitives from a given position.") + .add< ProximityROI >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API ProximityROI; -//template class SOFA_COMPONENT_ENGINE_SELECT_API SphereROI; - - } //namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/SelectConnectedLabelsROI.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/SelectConnectedLabelsROI.cpp index c11b1ea7b6b..c48c676c447 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/SelectConnectedLabelsROI.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/SelectConnectedLabelsROI.cpp @@ -28,12 +28,14 @@ namespace sofa::component::engine::select { -int SelectConnectedLabelsROIClass = core::RegisterObject("Select a subset of points or cells labeled from different sources, that are connected given a list of connection pairs") +void registerSelectConnectedLabelsROI(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Select a subset of points or cells labeled from different sources, that are connected given a list of connection pairs.") .add< SelectConnectedLabelsROI >(true) .add< SelectConnectedLabelsROI >() .add< SelectConnectedLabelsROI >() - .add< SelectConnectedLabelsROI >() - ; + .add< SelectConnectedLabelsROI >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API SelectConnectedLabelsROI; template class SOFA_COMPONENT_ENGINE_SELECT_API SelectConnectedLabelsROI; diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/SelectLabelROI.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/SelectLabelROI.cpp index 226951c6aaf..038d905e4b9 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/SelectLabelROI.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/SelectLabelROI.cpp @@ -28,12 +28,14 @@ namespace sofa::component::engine::select { -int SelectLabelROIClass = core::RegisterObject("Select a subset of labeled points or cells stored in (vector>) given certain labels") +void registerSelectLabelROI(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Select a subset of labeled points or cells stored in (vector>) given certain labels.") .add< SelectLabelROI >(true) .add< SelectLabelROI >() .add< SelectLabelROI >() - .add< SelectLabelROI >() - ; + .add< SelectLabelROI >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API SelectLabelROI; template class SOFA_COMPONENT_ENGINE_SELECT_API SelectLabelROI; diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/SphereROI.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/SphereROI.cpp index 55a64ef6d57..1ea4fe8801a 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/SphereROI.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/SphereROI.cpp @@ -30,14 +30,14 @@ namespace sofa::component::engine::select using namespace sofa::defaulttype; -int SphereROIClass = core::RegisterObject("Find the primitives (vertex/edge/triangle/tetrahedron) inside a given sphere") +void registerSphereROI(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine selecting the primitives (vertex/edge/triangle/tetrahedron) inside a given sphere.") .add< SphereROI >(true) - .add< SphereROI >() - ; + .add< SphereROI >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API SphereROI; template class SOFA_COMPONENT_ENGINE_SELECT_API SphereROI; - - } //namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/SubsetTopology.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/SubsetTopology.cpp index 17d5c563351..b64940945e6 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/SubsetTopology.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/SubsetTopology.cpp @@ -30,15 +30,14 @@ namespace sofa::component::engine::select using namespace sofa::defaulttype; -int SubsetTopologyClass = core::RegisterObject("Engine used to create subset topology given box, sphere, plan, ...") +void registerSubsetTopology(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine used to create subset topology given box, sphere, plan, ...") .add< SubsetTopology >() - .add< SubsetTopology >() - - ; + .add< SubsetTopology >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API SubsetTopology; template class SOFA_COMPONENT_ENGINE_SELECT_API SubsetTopology; - - } //namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/ValuesFromIndices.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/ValuesFromIndices.cpp index 0255ceb695c..3c1275d1fda 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/ValuesFromIndices.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/ValuesFromIndices.cpp @@ -28,7 +28,9 @@ namespace sofa::component::engine::select { -int ValuesFromIndicesClass = core::RegisterObject("Find the values given a list of indices") +void registerValuesFromIndices(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Find the values given a list of indices.") .add< ValuesFromIndices >() .add< ValuesFromIndices >() .add< ValuesFromIndices >() @@ -44,9 +46,8 @@ int ValuesFromIndicesClass = core::RegisterObject("Find the values given a list .add< ValuesFromIndices >() .add< ValuesFromIndices >() .add< ValuesFromIndices >() - .add< ValuesFromIndices >() - - ; + .add< ValuesFromIndices >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API ValuesFromIndices; template class SOFA_COMPONENT_ENGINE_SELECT_API ValuesFromIndices; @@ -64,6 +65,5 @@ template class SOFA_COMPONENT_ENGINE_SELECT_API ValuesFromIndices; template class SOFA_COMPONENT_ENGINE_SELECT_API ValuesFromIndices; template class SOFA_COMPONENT_ENGINE_SELECT_API ValuesFromIndices; - } //namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/ValuesFromPositions.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/ValuesFromPositions.cpp index c53cfb90d66..ceb83789ba5 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/ValuesFromPositions.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/ValuesFromPositions.cpp @@ -29,15 +29,14 @@ namespace sofa::component::engine::select using namespace sofa::defaulttype; -int ValuesFromPositionsClass = core::RegisterObject("Assign values to primitives (vertex/edge/triangle/tetrahedron) based on a linear interpolation of values along a direction") +void registerValuesFromPositions(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Assign values to primitives (vertex/edge/triangle/tetrahedron) based on a linear interpolation of values along a direction.") .add< ValuesFromPositions >() - .add< ValuesFromPositions >() - - ; + .add< ValuesFromPositions >()); +} template class SOFA_COMPONENT_ENGINE_SELECT_API ValuesFromPositions; template class SOFA_COMPONENT_ENGINE_SELECT_API ValuesFromPositions; - - } //namespace sofa::component::engine::select diff --git a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/init.cpp b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/init.cpp index 57add32cd26..4d8239a46b4 100644 --- a/Sofa/Component/Engine/Select/src/sofa/component/engine/select/init.cpp +++ b/Sofa/Component/Engine/Select/src/sofa/component/engine/select/init.cpp @@ -21,13 +21,37 @@ ******************************************************************************/ #include #include +#include + namespace sofa::component::engine::select { - + +extern void registerBoxROI(sofa::core::ObjectFactory* factory); +extern void registerComplementaryROI(sofa::core::ObjectFactory* factory); +extern void registerIndicesFromValues(sofa::core::ObjectFactory* factory); +extern void registerMergeROIs(sofa::core::ObjectFactory* factory); +extern void registerMeshBoundaryROI(sofa::core::ObjectFactory* factory); +extern void registerMeshROI(sofa::core::ObjectFactory* factory); +extern void registerMeshSampler(sofa::core::ObjectFactory* factory); +extern void registerMeshSplittingEngine(sofa::core::ObjectFactory* factory); +extern void registerMeshSubsetEngine(sofa::core::ObjectFactory* factory); +extern void registerNearestPointROI(sofa::core::ObjectFactory* factory); +extern void registerPairBoxROI(sofa::core::ObjectFactory* factory); +extern void registerPlaneROI(sofa::core::ObjectFactory* factory); +extern void registerPointsFromIndices(sofa::core::ObjectFactory* factory); +extern void registerProximityROI(sofa::core::ObjectFactory* factory); +extern void registerSelectConnectedLabelsROI(sofa::core::ObjectFactory* factory); +extern void registerSelectLabelROI(sofa::core::ObjectFactory* factory); +extern void registerSphereROI(sofa::core::ObjectFactory* factory); +extern void registerSubsetTopology(sofa::core::ObjectFactory* factory); +extern void registerValuesFromIndices(sofa::core::ObjectFactory* factory); +extern void registerValuesFromPositions(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) +{ + registerBoxROI(factory); + registerComplementaryROI(factory); + registerIndicesFromValues(factory); + registerMergeROIs(factory); + registerMeshBoundaryROI(factory); + registerMeshROI(factory); + registerMeshSampler(factory); + registerMeshSplittingEngine(factory); + registerMeshSubsetEngine(factory); + registerNearestPointROI(factory); + registerPairBoxROI(factory); + registerPlaneROI(factory); + registerPointsFromIndices(factory); + registerProximityROI(factory); + registerSelectConnectedLabelsROI(factory); + registerSelectLabelROI(factory); + registerSphereROI(factory); + registerSubsetTopology(factory); + registerValuesFromIndices(factory); + registerValuesFromPositions(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/Engine/Transform/src/sofa/component/engine/transform/DifferenceEngine.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/DifferenceEngine.cpp index 1b4614c5f9f..f5da34d688b 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/DifferenceEngine.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/DifferenceEngine.cpp @@ -29,14 +29,14 @@ namespace sofa::component::engine::transform using namespace sofa::type; using namespace sofa::defaulttype; -int DifferenceEngineClass = core::RegisterObject("Computing the difference between two vector of dofs") +void registerDifferenceEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Computing the difference between two vector of dofs.") .add< DifferenceEngine >() - .add< DifferenceEngine >(true) // default template - - ; + .add< DifferenceEngine >(true)); +} template class SOFA_COMPONENT_ENGINE_TRANSFORM_API DifferenceEngine; template class SOFA_COMPONENT_ENGINE_TRANSFORM_API DifferenceEngine; - } //namespace sofa::component::engine::transform diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/DilateEngine.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/DilateEngine.cpp index 436b8d0bf09..13699d6ed80 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/DilateEngine.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/DilateEngine.cpp @@ -28,9 +28,11 @@ namespace sofa::component::engine::transform using namespace defaulttype; -int DilateEngineClass = core::RegisterObject("Dilates a given mesh by moving vertices along their normal.") - .add< DilateEngine>(true) // default template - ; +void registerDilateEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Dilates a given mesh by moving vertices along their normal.") + .add< DilateEngine>()); +} template class SOFA_COMPONENT_ENGINE_TRANSFORM_API DilateEngine; diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/DisplacementMatrixEngine.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/DisplacementMatrixEngine.cpp index 51af18326f0..8f7eab1f906 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/DisplacementMatrixEngine.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/DisplacementMatrixEngine.cpp @@ -31,10 +31,12 @@ namespace sofa::component::engine::transform using namespace type; using namespace defaulttype; -int DisplacementTransformEngineClass = core::RegisterObject("Converts a vector of Rigid to a vector of displacement transforms.") - .add< DisplacementTransformEngine >() - .add< DisplacementTransformEngine >() -; +void registerDisplacementTransformEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Converts a vector of Rigid to a vector of displacement transforms.") + .add< DisplacementTransformEngine >() + .add< DisplacementTransformEngine >()); +} template class SOFA_COMPONENT_ENGINE_TRANSFORM_API DisplacementTransformEngine; template class SOFA_COMPONENT_ENGINE_TRANSFORM_API DisplacementTransformEngine; diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/IndexValueMapper.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/IndexValueMapper.cpp index 963bf763259..0b5108baa54 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/IndexValueMapper.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/IndexValueMapper.cpp @@ -31,13 +31,12 @@ namespace sofa::component::engine::transform using namespace sofa; using namespace sofa::defaulttype; -int IndexValueMapperClass = core::RegisterObject("Input values to output values mapper. Includes indices rules, such as replacement, resize") - .add< IndexValueMapper >(true) - - ; +void registerIndexValueMapper(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Input values to output values mapper. Includes indices rules, such as replacement, resize.") + .add< IndexValueMapper >()); +} template class SOFA_COMPONENT_ENGINE_TRANSFORM_API IndexValueMapper; - - } //namespace sofa::component::engine::transform diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/Indices2ValuesMapper.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/Indices2ValuesMapper.cpp index d44c040edaa..cd006e4371a 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/Indices2ValuesMapper.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/Indices2ValuesMapper.cpp @@ -31,13 +31,12 @@ namespace sofa::component::engine::transform using namespace sofa; using namespace sofa::defaulttype; -int Indices2ValuesMapperClass = core::RegisterObject("?") - .add< Indices2ValuesMapper >(true) - - ; +void registerIndices2ValuesMapper(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Input multiple values to output values mapper. Includes indices rules, such as replacement, resize.") + .add< Indices2ValuesMapper >()); +} template class SOFA_COMPONENT_ENGINE_TRANSFORM_API Indices2ValuesMapper; - - } //namespace sofa::component::engine::transform diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/Indices2ValuesMapper.inl b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/Indices2ValuesMapper.inl index 57ad89da5f2..60b527c11a7 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/Indices2ValuesMapper.inl +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/Indices2ValuesMapper.inl @@ -23,7 +23,6 @@ #include #include -#include namespace sofa::component::engine::transform { diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/MapIndices.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/MapIndices.cpp index f3229908db2..018c98036fb 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/MapIndices.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/MapIndices.cpp @@ -28,14 +28,16 @@ namespace sofa::component::engine::transform { -int MapIndicesClass = core::RegisterObject("Apply a permutation to a set of indices") +void registerMapIndices(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Apply a permutation to a set of indices.") .add< MapIndices >() .add< MapIndices >() .add< MapIndices< type::fixed_array > >() .add< MapIndices< type::fixed_array > >() .add< MapIndices< type::fixed_array > >() - .add< MapIndices< type::fixed_array > >() - ; + .add< MapIndices< type::fixed_array > >()); +} template class SOFA_COMPONENT_ENGINE_TRANSFORM_API MapIndices; template class SOFA_COMPONENT_ENGINE_TRANSFORM_API MapIndices; diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/MathOp.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/MathOp.cpp index afbc8c493ce..1dd7a4b0895 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/MathOp.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/MathOp.cpp @@ -26,22 +26,22 @@ namespace sofa::component::engine::transform { -int MathOpClass = core::RegisterObject("Apply a math operation to combine several inputs") - .add< MathOp< type::vector > >(true) - .add< MathOp< type::vector > >() - .add< MathOp< type::vector > >() - .add< MathOp< type::vector > >() - .add< MathOp< type::vector > >() - .add< MathOp< defaulttype::Rigid2Types::VecCoord > >() - .add< MathOp< defaulttype::Rigid2Types::VecDeriv > >() - .add< MathOp< defaulttype::Rigid3Types::VecCoord > >() - .add< MathOp< defaulttype::Rigid3Types::VecDeriv > >() - - ; +void registerMathOp(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Apply a math operation to combine several inputs.") + .add< MathOp< type::vector > >(true) + .add< MathOp< type::vector > >() + .add< MathOp< type::vector > >() + .add< MathOp< type::vector > >() + .add< MathOp< type::vector > >() + .add< MathOp< defaulttype::Rigid2Types::VecCoord > >() + .add< MathOp< defaulttype::Rigid2Types::VecDeriv > >() + .add< MathOp< defaulttype::Rigid3Types::VecCoord > >() + .add< MathOp< defaulttype::Rigid3Types::VecDeriv > >()); +} template class SOFA_COMPONENT_ENGINE_TRANSFORM_API MathOp< type::vector >; template class SOFA_COMPONENT_ENGINE_TRANSFORM_API MathOp< type::vector >; - template class SOFA_COMPONENT_ENGINE_TRANSFORM_API MathOp< type::vector >; template class SOFA_COMPONENT_ENGINE_TRANSFORM_API MathOp< type::vector >; template class SOFA_COMPONENT_ENGINE_TRANSFORM_API MathOp< type::vector >; @@ -49,7 +49,5 @@ template class SOFA_COMPONENT_ENGINE_TRANSFORM_API MathOp< defaulttype::Rigid2Ty template class SOFA_COMPONENT_ENGINE_TRANSFORM_API MathOp< defaulttype::Rigid2Types::VecDeriv >; template class SOFA_COMPONENT_ENGINE_TRANSFORM_API MathOp< defaulttype::Rigid3Types::VecCoord >; template class SOFA_COMPONENT_ENGINE_TRANSFORM_API MathOp< defaulttype::Rigid3Types::VecDeriv >; - - } //namespace sofa::component::engine::transform diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/ProjectiveTransformEngine.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/ProjectiveTransformEngine.cpp index 93e1ac3a0ba..fc1ad8e536b 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/ProjectiveTransformEngine.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/ProjectiveTransformEngine.cpp @@ -26,12 +26,13 @@ namespace sofa::component::engine::transform { -int ProjectiveTransformEngineClass = core::RegisterObject("Project the position of 3d points onto a plane according to a projection matrix") - .add< ProjectiveTransformEngine >(true) // default template - ; +void registerProjectiveTransformEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Project the position of 3d points onto a plane according to a projection matrix.") + .add< ProjectiveTransformEngine >()); +} template class SOFA_COMPONENT_ENGINE_TRANSFORM_API ProjectiveTransformEngine; - } // namespace sofa::component::engine::transform diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/QuatToRigidEngine.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/QuatToRigidEngine.cpp index 956211abae9..ab9fae4a9e7 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/QuatToRigidEngine.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/QuatToRigidEngine.cpp @@ -29,13 +29,12 @@ namespace sofa::component::engine::transform { -int QuatToRigidEngineClass = core::RegisterObject("Transform a vector of Rigids into two independant vectors for positions (Vec3) and orientations (Quat).") - .add< QuatToRigidEngine >() - - ; +void registerQuatToRigidEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Transform a vector of Rigids into two independant vectors for positions (Vec3) and orientations (Quat).") + .add< QuatToRigidEngine >()); +} template class SOFA_COMPONENT_ENGINE_TRANSFORM_API QuatToRigidEngine; - - } //namespace sofa::component::engine::transform diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/ROIValueMapper.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/ROIValueMapper.cpp index 65b67b2689e..d0f1e1d6117 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/ROIValueMapper.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/ROIValueMapper.cpp @@ -25,11 +25,10 @@ namespace sofa::component::engine::transform { -using namespace sofa; - -int ROIValueMapperClass = core::RegisterObject("Generate a list of values from value-indices pairs") - .add< ROIValueMapper >(true) - ; - +void registerROIValueMapper(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Generate a list of values from value-indices pairs.") + .add< ROIValueMapper >()); +} } //namespace sofa::component::engine::transform diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/RigidToQuatEngine.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/RigidToQuatEngine.cpp index fe7526254ba..a051c2700fa 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/RigidToQuatEngine.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/RigidToQuatEngine.cpp @@ -29,14 +29,12 @@ namespace sofa::component::engine::transform { -int RigidToQuatEngineClass = core::RegisterObject("Transform a couple of Vec3 and Quaternion in Rigid") - .add< RigidToQuatEngine >() - - .addAlias("RigidEngine") - ; +void registerRigidToQuatEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Transform a couple of Vec3 and Quaternion in Rigid.") + .add< RigidToQuatEngine >()); +} template class SOFA_COMPONENT_ENGINE_TRANSFORM_API RigidToQuatEngine; - - } //namespace sofa::component::engine::transform diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/SmoothMeshEngine.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/SmoothMeshEngine.cpp index c85baf5ba1e..e8fefddbf54 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/SmoothMeshEngine.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/SmoothMeshEngine.cpp @@ -29,13 +29,12 @@ namespace sofa::component::engine::transform using namespace sofa::defaulttype; -int SmoothMeshEngineClass = core::RegisterObject("Compute the laplacian smoothing of a mesh") - .add< SmoothMeshEngine >() - - ; +void registerSmoothMeshEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Compute the laplacian smoothing of a mesh.") + .add< SmoothMeshEngine >()); +} template class SOFA_COMPONENT_ENGINE_TRANSFORM_API SmoothMeshEngine; - - } //namespace sofa::component::engine::transform diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/TransformEngine.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/TransformEngine.cpp index 5fa0cfec169..b3c4262e2b2 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/TransformEngine.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/TransformEngine.cpp @@ -26,14 +26,15 @@ namespace sofa::component::engine::transform { -int TransformEngineClass = core::RegisterObject("Transform position of 3d points") +void registerTransformEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Engine applying a transformation on 3d points (translation / rotation).") .add< TransformEngine >(true) // default template .add< TransformEngine >() .add< TransformEngine >() .add< TransformEngine >() - .add< TransformEngine >() - - ; + .add< TransformEngine >()); +} template class SOFA_COMPONENT_ENGINE_TRANSFORM_API TransformEngine; template class SOFA_COMPONENT_ENGINE_TRANSFORM_API TransformEngine; diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/TransformMatrixEngine.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/TransformMatrixEngine.cpp index 28589f5d4b4..86f047b6cad 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/TransformMatrixEngine.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/TransformMatrixEngine.cpp @@ -33,17 +33,29 @@ namespace sofa::component::engine::transform using namespace sofa::type; using namespace sofa::defaulttype; -int TranslateTransformMatrixEngineClass = core::RegisterObject("Compose the input transform (if any) with the given translation") - .add< TranslateTransformMatrixEngine >(); +void registerTranslateTransformMatrixEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Compose the input transform (if any) with the given translation.") + .add< TranslateTransformMatrixEngine >()); +} -int InvertTransformMatrixEngineClass = core::RegisterObject("Inverts the input transform") - .add< InvertTransformMatrixEngine >(); +void registerInvertTransformMatrixEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Inverts the input transform.") + .add< InvertTransformMatrixEngine >()); +} -int ScaleTransformMatrixEngineClass = core::RegisterObject("Compose the input transform (if any) with the given scale transformation") - .add< ScaleTransformMatrixEngine >(); +void registerScaleTransformMatrixEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Compose the input transform (if any) with the given scale transformation.") + .add< ScaleTransformMatrixEngine >()); +} -int RotateTransformMatrixEngineClass = core::RegisterObject("Compose the input transform (if any) with the given rotation") - .add< RotateTransformMatrixEngine >(); +void registerRotateTransformMatrixEngine(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Compose the input transform (if any) with the given rotation.") + .add< RotateTransformMatrixEngine >()); +} /* * AbstractTransformMatrixEngine diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/TransformPosition.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/TransformPosition.cpp index c038bdc03d1..1a5fda53f3b 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/TransformPosition.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/TransformPosition.cpp @@ -30,12 +30,12 @@ namespace sofa::component::engine::transform using namespace sofa::defaulttype; -int TransformPositionClass = core::RegisterObject("Transform position of 3d points") - .add< TransformPosition >(true) - ; +void registerTransformPosition(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Transform position of 3d points.") + .add< TransformPosition >()); +} template class SOFA_COMPONENT_ENGINE_TRANSFORM_API TransformPosition; - - } //namespace sofa::component::engine::transform diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/Vertex2Frame.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/Vertex2Frame.cpp index fecc91b00c5..25990a77941 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/Vertex2Frame.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/Vertex2Frame.cpp @@ -30,13 +30,12 @@ namespace sofa::component::engine::transform using namespace sofa::defaulttype; -int Vertex2FrameClass = core::RegisterObject("") - .add< Vertex2Frame >() - - ; +void registerVertex2Frame(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Return a rigid position from the vertices, texCoords, normals and facets of any mesh.") + .add< Vertex2Frame >()); +} template class SOFA_COMPONENT_ENGINE_TRANSFORM_API Vertex2Frame; - - } //namespace sofa::component::engine::transform diff --git a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/init.cpp b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/init.cpp index c4c25209d5d..d85e6a7fae0 100644 --- a/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/init.cpp +++ b/Sofa/Component/Engine/Transform/src/sofa/component/engine/transform/init.cpp @@ -21,13 +21,37 @@ ******************************************************************************/ #include #include +#include + namespace sofa::component::engine::transform { +extern void registerDifferenceEngine(sofa::core::ObjectFactory* factory); +extern void registerDilateEngine(sofa::core::ObjectFactory* factory); +extern void registerDisplacementTransformEngine(sofa::core::ObjectFactory* factory); +extern void registerIndexValueMapper(sofa::core::ObjectFactory* factory); +extern void registerIndices2ValuesMapper(sofa::core::ObjectFactory* factory); +extern void registerMapIndices(sofa::core::ObjectFactory* factory); +extern void registerMathOp(sofa::core::ObjectFactory* factory); +extern void registerProjectiveTransformEngine(sofa::core::ObjectFactory* factory); +extern void registerQuatToRigidEngine(sofa::core::ObjectFactory* factory); +extern void registerRigidToQuatEngine(sofa::core::ObjectFactory* factory); +extern void registerROIValueMapper(sofa::core::ObjectFactory* factory); +extern void registerSmoothMeshEngine(sofa::core::ObjectFactory* factory); +extern void registerTransformEngine(sofa::core::ObjectFactory* factory); +extern void registerTranslateTransformMatrixEngine(sofa::core::ObjectFactory* factory); +extern void registerInvertTransformMatrixEngine(sofa::core::ObjectFactory* factory); +extern void registerScaleTransformMatrixEngine(sofa::core::ObjectFactory* factory); +extern void registerRotateTransformMatrixEngine(sofa::core::ObjectFactory* factory); +extern void registerTransformPosition(sofa::core::ObjectFactory* factory); +extern void registerVertex2Frame(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,37 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerDifferenceEngine(factory); + registerDilateEngine(factory); + registerDisplacementTransformEngine(factory); + registerIndexValueMapper(factory); + registerIndices2ValuesMapper(factory); + registerMapIndices(factory); + registerMathOp(factory); + registerProjectiveTransformEngine(factory); + registerQuatToRigidEngine(factory); + registerRigidToQuatEngine(factory); + registerROIValueMapper(factory); + registerSmoothMeshEngine(factory); + registerTransformEngine(factory); + registerTranslateTransformMatrixEngine(factory); + registerInvertTransformMatrixEngine(factory); + registerScaleTransformMatrixEngine(factory); + registerRotateTransformMatrixEngine(factory); + registerTransformPosition(factory); + registerVertex2Frame(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/Engine/src/sofa/component/engine/init.cpp b/Sofa/Component/Engine/src/sofa/component/engine/init.cpp index 1b376416087..05eeff6cc2b 100644 --- a/Sofa/Component/Engine/src/sofa/component/engine/init.cpp +++ b/Sofa/Component/Engine/src/sofa/component/engine/init.cpp @@ -26,6 +26,9 @@ #include #include +#include +#include + namespace sofa::component::engine { @@ -33,6 +36,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() @@ -50,6 +54,14 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + factory->registerObjectsFromPlugin("Sofa.Component.Engine.Analyze"); + factory->registerObjectsFromPlugin("Sofa.Component.Engine.Generate"); + factory->registerObjectsFromPlugin("Sofa.Component.Engine.Select"); + factory->registerObjectsFromPlugin("Sofa.Component.Engine.Transform"); +} + void init() { static bool first = true; @@ -61,6 +73,9 @@ void init() sofa::component::engine::select::init(); sofa::component::engine::transform::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 783ca1c1aeb..58834cfc9a1 100644 --- a/Sofa/Component/src/sofa/component/init.cpp +++ b/Sofa/Component/src/sofa/component/init.cpp @@ -86,6 +86,7 @@ void registerObjects(sofa::core::ObjectFactory* factory) factory->registerObjectsFromPlugin("Sofa.Component.Haptics"); factory->registerObjectsFromPlugin("Sofa.Component.Diffusion"); factory->registerObjectsFromPlugin("Sofa.Component.ODESolver"); + factory->registerObjectsFromPlugin("Sofa.Component.Engine"); } void init() diff --git a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp index a0ef1c3c0a9..d659ec8bb71 100644 --- a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp +++ b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp @@ -784,6 +784,7 @@ const std::map< std::string, Dealiased, std::less<> > dealiasedComponents = { {"ImplicitEulerSolver", Dealiased("v24.12","EulerImplicitSolver")}, {"ImplicitEuler", Dealiased("v24.12","EulerImplicitSolver")}, {"VariationalSolver", Dealiased("v24.12","VariationalSymplecticSolver")}, + {"RigidEngine", Dealiased("v24.12","RigidToQuatEngine")}, };