Skip to content

Commit a3c9866

Browse files
authored
Merge branch 'master' into add_fixed_weak_constraint
2 parents 0754eb8 + 240e4e6 commit a3c9866

File tree

54 files changed

+531
-363
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+531
-363
lines changed

Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/GenericConstraintCorrection.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ using sofa::core::MultiVecDerivId;
4444
using sofa::core::MultiVecCoordId;
4545
using sofa::core::ExecParams;
4646
using sofa::linearalgebra::BaseVector;
47-
using sofa::core::RegisterObject;
4847
using sofa::core::ConstMultiVecDerivId;
4948
using sofa::core::VecDerivId;
5049
using sofa::core::VecCoordId;

Sofa/GL/Component/Engine/src/sofa/gl/component/engine/TextureInterpolation.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ namespace sofa::gl::component::engine
2929

3030
using namespace sofa::defaulttype;
3131

32-
int TextureInterpolationClass = core::RegisterObject("Create texture coordinate for a given field")
32+
void registerTextureInterpolation(sofa::core::ObjectFactory* factory)
33+
{
34+
factory->registerObjects(core::ObjectRegistrationData("Create texture coordinate for a given field.")
3335
.add< TextureInterpolation <Vec1Types> >()
3436
.add< TextureInterpolation <Vec2Types> >()
35-
.add< TextureInterpolation <Vec3Types> >()
36-
37-
;
37+
.add< TextureInterpolation <Vec3Types> >());
38+
}
3839

3940
template class SOFA_GL_COMPONENT_ENGINE_API TextureInterpolation <Vec1Types>;
4041
template class SOFA_GL_COMPONENT_ENGINE_API TextureInterpolation <Vec2Types>;

Sofa/GL/Component/Engine/src/sofa/gl/component/engine/init.cpp

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,24 @@
2121
******************************************************************************/
2222
#include <sofa/gl/component/engine/init.h>
2323

24+
#include <sofa/core/ObjectFactory.h>
25+
#include <sofa/helper/system/PluginManager.h>
26+
2427
namespace sofa::gl::component::engine
2528
{
26-
29+
30+
extern void registerTextureInterpolation(sofa::core::ObjectFactory* factory);
31+
2732
extern "C" {
2833
SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule();
2934
SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName();
3035
SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion();
36+
SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory);
3137
}
3238

3339
void initExternalModule()
3440
{
35-
static bool first = true;
36-
if (first)
37-
{
38-
first = false;
39-
}
41+
init();
4042
}
4143

4244
const char* getModuleName()
@@ -49,9 +51,21 @@ const char* getModuleVersion()
4951
return MODULE_VERSION;
5052
}
5153

54+
void registerObjects(sofa::core::ObjectFactory* factory)
55+
{
56+
registerTextureInterpolation(factory);
57+
}
58+
5259
void init()
5360
{
54-
initExternalModule();
61+
static bool first = true;
62+
if (first)
63+
{
64+
// make sure that this plugin is registered into the PluginManager
65+
sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME);
66+
67+
first = false;
68+
}
5569
}
5670

5771
} // namespace sofa::gl::component::engine

Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglColorMap.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@
3333
namespace sofa::gl::component::rendering2d
3434
{
3535

36-
int OglColorMapClass = core::RegisterObject("Provides color palette and support for conversion of numbers to colors.")
37-
.add< OglColorMap >()
38-
.addAlias("ColorMap")
39-
;
36+
void registerOglColorMap(sofa::core::ObjectFactory* factory)
37+
{
38+
factory->registerObjects(core::ObjectRegistrationData("Provides color palette and support for conversion of numbers to colors.")
39+
.add< OglColorMap >());
40+
}
4041

4142
OglColorMap::OglColorMap()
4243
: d_paletteSize(initData(&d_paletteSize, (unsigned int)256, "paletteSize", "How many colors to use"))

Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglLabel.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,10 @@ void OglLabel::setColor(float r, float g, float b, float a)
169169
d_color.endEdit();
170170
}
171171

172-
173-
int OglLabelClass = core::RegisterObject("Display 2D text in the viewport.")
174-
.add< OglLabel >()
175-
;
172+
void registerOglLabel(sofa::core::ObjectFactory* factory)
173+
{
174+
factory->registerObjects(core::ObjectRegistrationData("Display 2D text in the viewport.")
175+
.add< OglLabel >());
176+
}
176177

177178
} // namespace sofa::gl::component::rendering2d

Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglViewport.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ namespace sofa::gl::component::rendering2d
3636
using namespace sofa::type;
3737
using namespace sofa::defaulttype;
3838

39-
//Register OglViewport in the Object Factory
40-
int OglViewportClass = core::RegisterObject("OglViewport")
41-
.add< OglViewport >()
42-
;
43-
39+
void registerOglViewport(sofa::core::ObjectFactory* factory)
40+
{
41+
factory->registerObjects(core::ObjectRegistrationData("Set an additional viewport into the main one.")
42+
.add< OglViewport >());
43+
}
4444

4545
OglViewport::OglViewport()
4646
:p_screenPosition(initData(&p_screenPosition, "screenPosition", "Viewport position"))

Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/init.cpp

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,25 @@
2121
******************************************************************************/
2222
#include <sofa/gl/component/rendering2d/init.h>
2323
#include <sofa/core/ObjectFactory.h>
24+
#include <sofa/helper/system/PluginManager.h>
25+
2426
namespace sofa::gl::component::rendering2d
2527
{
26-
28+
29+
extern void registerOglColorMap(sofa::core::ObjectFactory* factory);
30+
extern void registerOglLabel(sofa::core::ObjectFactory* factory);
31+
extern void registerOglViewport(sofa::core::ObjectFactory* factory);
32+
2733
extern "C" {
2834
SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule();
2935
SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName();
3036
SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion();
37+
SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory);
3138
}
3239

3340
void initExternalModule()
3441
{
35-
static bool first = true;
36-
if (first)
37-
{
38-
first = false;
39-
}
42+
init();
4043
}
4144

4245
const char* getModuleName()
@@ -49,9 +52,23 @@ const char* getModuleVersion()
4952
return MODULE_VERSION;
5053
}
5154

55+
void registerObjects(sofa::core::ObjectFactory* factory)
56+
{
57+
registerOglColorMap(factory);
58+
registerOglLabel(factory);
59+
registerOglViewport(factory);
60+
}
61+
5262
void init()
5363
{
54-
initExternalModule();
64+
static bool first = true;
65+
if (first)
66+
{
67+
// make sure that this plugin is registered into the PluginManager
68+
sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME);
69+
70+
first = false;
71+
}
5572
}
5673

5774
} // namespace sofa::gl::component::rendering2d

Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/ClipPlane.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ using sofa::core::objectmodel::ComponentState ;
2828
namespace sofa::gl::component::rendering3d
2929
{
3030

31-
int ClipPlaneClass = core::RegisterObject("OpenGL Clipping Plane")
32-
.add< ClipPlane >()
33-
;
34-
31+
void registerClipPlane(sofa::core::ObjectFactory* factory)
32+
{
33+
factory->registerObjects(core::ObjectRegistrationData("Define arbitrary clipping plane into OpenGL.")
34+
.add< ClipPlane >());
35+
}
3536

3637
ClipPlane::ClipPlane()
3738
: position(initData(&position, sofa::type::Vec3(0,0,0), "position", "Point crossed by the clipping plane"))

Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/DataDisplay.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ using namespace sofa::type;
3535
using namespace sofa::defaulttype;
3636
using sofa::gl::component::rendering2d::OglColorMap;
3737

38-
int DataDisplayClass = core::RegisterObject("Rendering of meshes colored by data")
39-
.add< DataDisplay >()
40-
;
38+
void registerDataDisplay(sofa::core::ObjectFactory* factory)
39+
{
40+
factory->registerObjects(core::ObjectRegistrationData("Color rendering of data associated with a mesh.")
41+
.add< DataDisplay >());
42+
}
4143

4244
DataDisplay::DataDisplay()
4345
: f_maximalRange(initData(&f_maximalRange, true, "maximalRange", "Keep the maximal range through all timesteps"))

Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/MergeVisualModels.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525
namespace sofa::gl::component::rendering3d
2626
{
2727

28-
int MergeVisualModelsClass = core::RegisterObject("Merge several visual models")
29-
.add< MergeVisualModels >(true);
30-
31-
28+
void registerMergeVisualModels(sofa::core::ObjectFactory* factory)
29+
{
30+
factory->registerObjects(core::ObjectRegistrationData("Merge several visual models.")
31+
.add< MergeVisualModels >());
32+
}
3233

3334
} // namespace sofa::gl::component::rendering3d

Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglCylinderModel.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@
3131
namespace sofa::gl::component::rendering3d
3232
{
3333

34-
int OglCylinderModelClass = core::RegisterObject("A simple visualization for set of cylinder.")
35-
.add< OglCylinderModel >()
36-
;
34+
void registerOglCylinderModel(sofa::core::ObjectFactory* factory)
35+
{
36+
factory->registerObjects(core::ObjectRegistrationData("OpenGL-based visualization for a cylinders over edges.")
37+
.add< OglCylinderModel >());
38+
}
3739

3840
using namespace sofa::defaulttype;
3941
using namespace sofa::core::topology;

Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglModel.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ using sofa::type::RGBAColor;
3838
using sofa::type::Material;
3939
using namespace sofa::type;
4040

41-
int OglModelClass = core::RegisterObject("Generic visual model for OpenGL display")
42-
.add< OglModel >();
43-
41+
void registerOglModel(sofa::core::ObjectFactory* factory)
42+
{
43+
factory->registerObjects(core::ObjectRegistrationData("Generic visual model for OpenGL display.")
44+
.add< OglModel >());
45+
}
4446

4547
OglModel::OglModel()
4648
: blendTransparency(initData(&blendTransparency, true, "blendTranslucency", "Blend transparent parts"))

Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglSceneFrame.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@
2626
namespace sofa::gl::component::rendering3d
2727
{
2828

29-
int OglSceneFrameClass = core::RegisterObject("Display a frame at the corner of the scene view")
30-
.add< OglSceneFrame >()
31-
;
29+
void registerOglSceneFrame(sofa::core::ObjectFactory* factory)
30+
{
31+
factory->registerObjects(core::ObjectRegistrationData("Display a frame at the corner of the scene view.")
32+
.add< OglSceneFrame >());
33+
}
3234

3335
using namespace sofa::defaulttype;
3436

Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/PointSplatModel.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@
4141
namespace sofa::gl::component::rendering3d
4242
{
4343

44-
int PointSplatModelClass = core::RegisterObject("A simple visualization for a cloud of points.")
45-
.add< PointSplatModel >()
46-
.addAlias("PointSplat")
47-
;
44+
void registerPointSplatModel(sofa::core::ObjectFactory* factory)
45+
{
46+
factory->registerObjects(core::ObjectRegistrationData("Visualization for a cloud of points using splatting.")
47+
.add< PointSplatModel >());
48+
}
4849

4950
using namespace sofa::defaulttype;
5051
using namespace sofa::core::topology;

Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/SlicedVolumetricModel.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@
4444
namespace sofa::gl::component::rendering3d
4545
{
4646

47-
int SlicedVolumetricModelClass = core::RegisterObject("A simple visualization for a cloud of points.")
48-
.add< SlicedVolumetricModel >()
49-
;
47+
void registerSlicedVolumetricModel(sofa::core::ObjectFactory* factory)
48+
{
49+
factory->registerObjects(core::ObjectRegistrationData("Sliced visualization for a volumetric model defined with hexahedra.")
50+
.add< SlicedVolumetricModel >());
51+
}
5052

5153
using namespace sofa::defaulttype;
5254
using namespace sofa::core::topology;

Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/init.cpp

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,30 @@
2121
******************************************************************************/
2222
#include <sofa/gl/component/rendering3d/init.h>
2323
#include <sofa/core/ObjectFactory.h>
24+
#include <sofa/helper/system/PluginManager.h>
25+
2426
namespace sofa::gl::component::rendering3d
2527
{
26-
28+
29+
extern void registerClipPlane(sofa::core::ObjectFactory* factory);
30+
extern void registerDataDisplay(sofa::core::ObjectFactory* factory);
31+
extern void registerMergeVisualModels(sofa::core::ObjectFactory* factory);
32+
extern void registerOglCylinderModel(sofa::core::ObjectFactory* factory);
33+
extern void registerOglModel(sofa::core::ObjectFactory* factory);
34+
extern void registerOglSceneFrame(sofa::core::ObjectFactory* factory);
35+
extern void registerPointSplatModel(sofa::core::ObjectFactory* factory);
36+
extern void registerSlicedVolumetricModel(sofa::core::ObjectFactory* factory);
37+
2738
extern "C" {
2839
SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule();
2940
SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName();
3041
SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion();
42+
SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory);
3143
}
3244

3345
void initExternalModule()
3446
{
35-
static bool first = true;
36-
if (first)
37-
{
38-
first = false;
39-
}
47+
init();
4048
}
4149

4250
const char* getModuleName()
@@ -49,9 +57,28 @@ const char* getModuleVersion()
4957
return MODULE_VERSION;
5058
}
5159

60+
void registerObjects(sofa::core::ObjectFactory* factory)
61+
{
62+
registerClipPlane(factory);
63+
registerDataDisplay(factory);
64+
registerMergeVisualModels(factory);
65+
registerOglCylinderModel(factory);
66+
registerOglModel(factory);
67+
registerOglSceneFrame(factory);
68+
registerPointSplatModel(factory);
69+
registerSlicedVolumetricModel(factory);
70+
}
71+
5272
void init()
5373
{
54-
initExternalModule();
74+
static bool first = true;
75+
if (first)
76+
{
77+
// make sure that this plugin is registered into the PluginManager
78+
sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME);
79+
80+
first = false;
81+
}
5582
}
5683

5784
} // namespace sofa::gl::component::rendering3d

Sofa/GL/Component/Shader/src/sofa/gl/component/shader/CompositingVisualLoop.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929
namespace sofa::gl::component::shader
3030
{
3131

32-
int CompositingVisualLoopClass = core::RegisterObject("Visual loop enabling multipass rendering. Needs multiple fbo data and a compositing shader")
33-
.add< CompositingVisualLoop >()
34-
;
32+
void registerCompositingVisualLoop(sofa::core::ObjectFactory* factory)
33+
{
34+
factory->registerObjects(core::ObjectRegistrationData("Visual loop enabling multipass rendering. Needs multiple fbo data and a compositing shader.")
35+
.add< CompositingVisualLoop >());
36+
}
3537

3638
CompositingVisualLoop::CompositingVisualLoop()
3739
: simulation::DefaultVisualManagerLoop(),

0 commit comments

Comments
 (0)