Skip to content

Commit d094ad5

Browse files
committed
refresh for Sofa v25.12
1 parent dc73fd8 commit d094ad5

File tree

5 files changed

+75
-21
lines changed

5 files changed

+75
-21
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ set(PLUGIN_SKELETONIZATION_SRC_DIR src/MeshSkeletonizationPlugin)
1313

1414
set(HEADER_FILES
1515
${PLUGIN_SKELETONIZATION_SRC_DIR}/config.h.in
16+
${PLUGIN_SKELETONIZATION_SRC_DIR}/init.h
1617
${PLUGIN_SKELETONIZATION_SRC_DIR}/MeshSkeletonization.h
1718
${PLUGIN_SKELETONIZATION_SRC_DIR}/MeshSkeletonization.inl
1819
)
1920

2021
set(SOURCE_FILES
21-
${PLUGIN_SKELETONIZATION_SRC_DIR}/initMeshSkeletonizationPlugin.cpp
22+
${PLUGIN_SKELETONIZATION_SRC_DIR}/init.cpp
2223
${PLUGIN_SKELETONIZATION_SRC_DIR}/MeshSkeletonization.cpp
2324
)
2425

src/MeshSkeletonizationPlugin/MeshSkeletonization.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ namespace meshskeletonizationplugin
3434

3535
using namespace sofa::defaulttype;
3636

37-
const int MeshSkeletonizationClass = sofa::core::RegisterObject("Ouput the skeleton of a triangulated mesh, from .off file or .obj (MeshLoader) using CGAL")
38-
.add< MeshSkeletonization<Vec3Types> >()
39-
;
37+
void registerMeshSkeletonization(sofa::core::ObjectFactory* factory)
38+
{
39+
factory->registerObjects(sofa::core::ObjectRegistrationData("Ouput the skeleton of a triangulated mesh, from .off file or .obj (MeshLoader) using CGAL")
40+
.add< MeshSkeletonization<Vec3Types> >());
41+
}
4042

4143
template class SOFA_MESHSKELETONIZATIONPLUGIN_API MeshSkeletonization<Vec3Types>;
4244

src/MeshSkeletonizationPlugin/config.h.in

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,17 @@
2222
#pragma once
2323

2424
#include <sofa/config.h>
25-
26-
#define MESHSKELETONIZATIONPLUGIN_VERSION @PROJECT_VERSION@
25+
#include <sofa/config/sharedlibrary_defines.h>
2726

2827
#ifdef SOFA_BUILD_MESHSKELETONIZATIONPLUGIN
2928
# define SOFA_TARGET @PROJECT_NAME@
3029
# define SOFA_MESHSKELETONIZATIONPLUGIN_API SOFA_EXPORT_DYNAMIC_LIBRARY
3130
#else
3231
# define SOFA_MESHSKELETONIZATIONPLUGIN_API SOFA_IMPORT_DYNAMIC_LIBRARY
3332
#endif
33+
34+
namespace meshskeletonizationplugin
35+
{
36+
constexpr const char* MODULE_NAME = "@PROJECT_NAME@";
37+
constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@";
38+
} // namespace meshskeletonizationplugin

src/MeshSkeletonizationPlugin/initMeshSkeletonizationPlugin.cpp renamed to src/MeshSkeletonizationPlugin/init.cpp

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,49 +19,66 @@
1919
* *
2020
* Contact information: contact@sofa-framework.org *
2121
******************************************************************************/
22-
#include <MeshSkeletonizationPlugin/config.h>
22+
#include <MeshSkeletonizationPlugin/init.h>
23+
24+
#include <sofa/core/ObjectFactory.h>
25+
#include <sofa/helper/system/PluginManager.h>
2326

2427
namespace meshskeletonizationplugin
2528
{
2629

27-
//Here are just several convenient functions to help users know what the plugin contains
30+
extern void registerMeshSkeletonization(sofa::core::ObjectFactory* factory);
2831

32+
//Here are just several convenient functions to help users know what the plugin contains
2933
extern "C" {
30-
SOFA_MESHSKELETONIZATIONPLUGIN_API void initExternalModule();
31-
SOFA_MESHSKELETONIZATIONPLUGIN_API const char* getModuleName();
32-
SOFA_MESHSKELETONIZATIONPLUGIN_API const char* getModuleVersion();
33-
SOFA_MESHSKELETONIZATIONPLUGIN_API const char* getModuleLicense();
34-
SOFA_MESHSKELETONIZATIONPLUGIN_API const char* getModuleDescription();
34+
SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule();
35+
SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName();
36+
SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion();
37+
SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleLicense();
38+
SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleDescription();
39+
SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory);
3540
}
3641

3742
void initExternalModule()
3843
{
39-
static bool first = true;
40-
if (first)
41-
{
42-
first = false;
43-
}
44+
init();
4445
}
4546

4647
const char* getModuleName()
4748
{
48-
return sofa_tostring(SOFA_TARGET);
49+
return MODULE_NAME;
4950
}
5051

5152
const char* getModuleVersion()
5253
{
53-
return sofa_tostring(MESHSKELETONIZATIONPLUGIN_VERSION);
54+
return MODULE_VERSION;
5455
}
5556

5657
const char* getModuleLicense()
5758
{
5859
return "GPL";
5960
}
6061

61-
6262
const char* getModuleDescription()
6363
{
6464
return "Use CGAL to generate mesh skeleton";
6565
}
6666

67+
void init()
68+
{
69+
static bool first = true;
70+
if (first)
71+
{
72+
// make sure that this plugin is registered into the PluginManager
73+
sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME);
74+
75+
first = false;
76+
}
77+
}
78+
79+
void registerObjects(sofa::core::ObjectFactory* factory)
80+
{
81+
registerMeshSkeletonization(factory);
82+
}
83+
6784
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/******************************************************************************
2+
* SOFA, Simulation Open-Framework Architecture *
3+
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
4+
* *
5+
* This program is free software; you can redistribute it and/or modify it *
6+
* under the terms of the GNU Lesser General Public License as published by *
7+
* the Free Software Foundation; either version 2.1 of the License, or (at *
8+
* your option) any later version. *
9+
* *
10+
* This program is distributed in the hope that it will be useful, but WITHOUT *
11+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
12+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
13+
* for more details. *
14+
* *
15+
* You should have received a copy of the GNU Lesser General Public License *
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
17+
*******************************************************************************
18+
* Authors: The SOFA Team and external contributors (see Authors.txt) *
19+
* *
20+
* Contact information: contact@sofa-framework.org *
21+
******************************************************************************/
22+
#pragma once
23+
24+
#include <MeshSkeletonizationPlugin/config.h>
25+
26+
namespace meshskeletonizationplugin
27+
{
28+
SOFA_MESHSKELETONIZATIONPLUGIN_API void init();
29+
} // namespace meshskeletonizationplugin

0 commit comments

Comments
 (0)