From 7bf84dee24d6a66224b94390d7db22c4394a33db Mon Sep 17 00:00:00 2001
From: Paul Baksic <paul.baksic@outlook.fr>
Date: Wed, 29 Nov 2023 17:16:32 +0100
Subject: [PATCH] Changed the message display of sceneCheckUsingAlias when
 aliased component is in component change

---
 .../src/sofa/helper/ComponentChange.cpp       | 211 +++++++++---------
 .../Helper/src/sofa/helper/ComponentChange.h  |   1 +
 .../SceneChecking/SceneCheckUsingAlias.cpp    |   2 +-
 3 files changed, 110 insertions(+), 104 deletions(-)

diff --git a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp
index b90405afd3c..97bcbfd781c 100644
--- a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp
+++ b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp
@@ -32,7 +32,7 @@ const std::map<std::string, Deprecated, std::less<> > deprecatedComponents = {
     {"RigidRigidMapping", Deprecated("v23.06", "v23.12", "You can use the component RigidMapping with template='Rigid3,Rigid3' instead.")},
 };
 
-const std::map<std::string, ComponentChange, std::less<> > uncreatableComponents = {
+const std::map<std::string, ComponentChange, std::less<> > movedComponents = {
     // SofaValidation was pluginized in #1302
     {"CompareState", Pluginized("v20.06", "SofaValidation")},
     {"CompareTopology", Pluginized("v20.06", "SofaValidation")},
@@ -66,107 +66,6 @@ const std::map<std::string, ComponentChange, std::less<> > uncreatableComponents
     { "LMConstraintSolver", Pluginized("v20.12", "LMConstraint") },
     { "LMConstraintDirectSolver", Pluginized("v20.12", "LMConstraint") },
 
-    /***********************/
-    // REMOVED SINCE v23.06
-
-    { "OglGrid", Removed("v22.12", "v23.06")},
-    { "OglLineAxis", Removed("v22.12", "v23.06")},
-
-    /***********************/
-    // REMOVED SINCE v22.06
-
-    {"PointConstraint", Removed("v21.12", "v22.06")},
-
-    /***********************/
-    // REMOVED SINCE v21.12
-
-    { "LMDNewProximityIntersection", Removed("v21.12", "v21.12") },
-    { "LocalMinDistanceFilter", Removed("v21.12", "v21.12") },
-    { "LineLocalMinDistanceFilter", Removed("v21.12", "v21.12") },
-    { "PointLocalMinDistanceFilter", Removed("v21.12", "v21.12") },
-    { "TriangleLocalMinDistanceFilter", Removed("v21.12", "v21.12") },
-
-    /***********************/
-    // REMOVED SINCE v21.06
-
-    {"LengthContainer", Removed("v21.06", "v21.06")},
-    {"PoissonContainer", Removed("v21.06", "v21.06")},
-    {"RadiusContainer", Removed("v21.06", "v21.06")},
-    {"StiffnessContainer", Removed("v21.06", "v21.06")},
-
-    /***********************/
-    // REMOVED SINCE v20.12
-
-    { "DynamicSparseGridTopologyAlgorithms", Removed("v20.12", "v20.12") },
-    { "HexahedronSetTopologyAlgorithms", Removed("v20.12", "v20.12") },
-    { "TetrahedronSetTopologyAlgorithms", Removed("v20.12", "v20.12") },
-    { "QuadSetTopologyAlgorithms", Removed("v20.12", "v20.12") },
-    { "TriangleSetTopologyAlgorithms", Removed("v20.12", "v20.12") },
-    { "EdgeSetTopologyAlgorithms", Removed("v20.12", "v20.12") },
-    { "PointSetTopologyAlgorithms", Removed("v20.12", "v20.12") },
-
-    /***********************/
-    // REMOVED SINCE v20.06
-
-    {"Euler", Removed("v19.12", "v20.06")},
-    {"EulerExplicit", Removed("v19.12", "v20.06")},
-    {"ExplicitEuler", Removed("v19.12", "v20.06")},
-    {"EulerSolver", Removed("v19.12", "v20.06")},
-    {"ExplicitEulerSolver", Removed("v19.12", "v20.06")},
-
-    {"Capsule", Removed("v19.12", "v20.06")},
-    {"CapsuleModel", Removed("v19.12", "v20.06")},
-    {"TCapsuleModel", Removed("v19.12", "v20.06")},
-
-    {"Cube", Removed("v19.12", "v20.06")},
-    {"CubeModel", Removed("v19.12", "v20.06")},
-
-    {"CudaPoint", Removed("v19.12", "v20.06")},
-    {"CudaPointModel", Removed("v19.12", "v20.06")},
-
-    {"Cylinder", Removed("v19.12", "v20.06")},
-    {"CylinderModel", Removed("v19.12", "v20.06")},
-
-    {"Line", Removed("v19.12", "v20.06")},
-    {"TLineModel", Removed("v19.12", "v20.06")},
-    {"LineMeshModel", Removed("v19.12", "v20.06")},
-    {"LineSetModel", Removed("v19.12", "v20.06")},
-    {"LineMesh", Removed("v19.12", "v20.06")},
-    {"LineSet", Removed("v19.12", "v20.06")},
-    {"LineModel", Removed("v19.12", "v20.06")},
-
-    {"OBB", Removed("v19.12", "v20.06")},
-    {"OBBModel", Removed("v19.12", "v20.06")},
-    {"TOBBModel", Removed("v19.12", "v20.06")},
-
-    {"Point", Removed("v19.12", "v20.06")},
-    {"TPointModel", Removed("v19.12", "v20.06")},
-    {"PointModel", Removed("v19.12", "v20.06")},
-    {"PointMesh", Removed("v19.12", "v20.06")},
-    {"PointSet", Removed("v19.12", "v20.06")},
-
-    {"Ray", Removed("v19.12", "v20.06")},
-    {"RayModel", Removed("v19.12", "v20.06")},
-
-    {"RigidCapsule", Removed("v19.12", "v20.06")},
-    {"RigidCapsuleModel", Removed("v19.12", "v20.06")},
-    {"RigidCapsuleCollisionModel", Removed("v19.12", "v20.06")},
-
-    {"Sphere", Removed("v19.12", "v20.06")},
-    {"SphereModel", Removed("v19.12", "v20.06")},
-    {"TSphereModel", Removed("v19.12", "v20.06")},
-
-    {"Tetrahedron", Removed("v19.12", "v20.06")},
-    {"TetrahedronModel", Removed("v19.12", "v20.06")},
-
-    {"Triangle", Removed("v19.12", "v20.06")},
-    {"TriangleSet", Removed("v19.12", "v20.06")},
-    {"TriangleMesh", Removed("v19.12", "v20.06")},
-    {"TriangleSetModel", Removed("v19.12", "v20.06")},
-    {"TriangleMeshModel", Removed("v19.12", "v20.06")},
-    {"TriangleModel", Removed("v19.12", "v20.06")},
-    {"TTriangleModel", Removed("v19.12", "v20.06")},
-
     /***********************/
     // MOVED SINCE v21.06
     { "SpatialGridPointModel", Moved("v21.06", "SofaMiscCollision", "SofaSphFluid") },
@@ -721,7 +620,113 @@ const std::map<std::string, ComponentChange, std::less<> > uncreatableComponents
 
     // Moved to CSparseSolvers
     { "SparseCholeskySolver", Moved("v23.12", "Sofa.Component.LinearSolver.Direct", "CSparseSolvers") },
-    { "SparseLUSolver", Moved("v23.12", "Sofa.Component.LinearSolver.Direct", "CSparseSolvers") },
+    { "SparseLUSolver", Moved("v23.12", "Sofa.Component.LinearSolver.Direct", "CSparseSolvers") }
+
+};
+
+const std::map<std::string, ComponentChange, std::less<> > uncreatableComponents = {
+
+    /***********************/
+    // REMOVED SINCE v23.06
+
+    { "OglGrid", Removed("v22.12", "v23.06")},
+    { "OglLineAxis", Removed("v22.12", "v23.06")},
+
+    /***********************/
+    // REMOVED SINCE v22.06
+
+    {"PointConstraint", Removed("v21.12", "v22.06")},
+
+    /***********************/
+    // REMOVED SINCE v21.12
+
+    { "LMDNewProximityIntersection", Removed("v21.12", "v21.12") },
+    { "LocalMinDistanceFilter", Removed("v21.12", "v21.12") },
+    { "LineLocalMinDistanceFilter", Removed("v21.12", "v21.12") },
+    { "PointLocalMinDistanceFilter", Removed("v21.12", "v21.12") },
+    { "TriangleLocalMinDistanceFilter", Removed("v21.12", "v21.12") },
+
+    /***********************/
+    // REMOVED SINCE v21.06
+
+    {"LengthContainer", Removed("v21.06", "v21.06")},
+    {"PoissonContainer", Removed("v21.06", "v21.06")},
+    {"RadiusContainer", Removed("v21.06", "v21.06")},
+    {"StiffnessContainer", Removed("v21.06", "v21.06")},
+
+    /***********************/
+    // REMOVED SINCE v20.12
+
+    { "DynamicSparseGridTopologyAlgorithms", Removed("v20.12", "v20.12") },
+    { "HexahedronSetTopologyAlgorithms", Removed("v20.12", "v20.12") },
+    { "TetrahedronSetTopologyAlgorithms", Removed("v20.12", "v20.12") },
+    { "QuadSetTopologyAlgorithms", Removed("v20.12", "v20.12") },
+    { "TriangleSetTopologyAlgorithms", Removed("v20.12", "v20.12") },
+    { "EdgeSetTopologyAlgorithms", Removed("v20.12", "v20.12") },
+    { "PointSetTopologyAlgorithms", Removed("v20.12", "v20.12") },
+
+    /***********************/
+    // REMOVED SINCE v20.06
+
+    {"Euler", Removed("v19.12", "v20.06")},
+    {"EulerExplicit", Removed("v19.12", "v20.06")},
+    {"ExplicitEuler", Removed("v19.12", "v20.06")},
+    {"EulerSolver", Removed("v19.12", "v20.06")},
+    {"ExplicitEulerSolver", Removed("v19.12", "v20.06")},
+
+    {"Capsule", Removed("v19.12", "v20.06")},
+    {"CapsuleModel", Removed("v19.12", "v20.06")},
+    {"TCapsuleModel", Removed("v19.12", "v20.06")},
+
+    {"Cube", Removed("v19.12", "v20.06")},
+    {"CubeModel", Removed("v19.12", "v20.06")},
+
+    {"CudaPoint", Removed("v19.12", "v20.06")},
+    {"CudaPointModel", Removed("v19.12", "v20.06")},
+
+    {"Cylinder", Removed("v19.12", "v20.06")},
+    {"CylinderModel", Removed("v19.12", "v20.06")},
+
+    {"Line", Removed("v19.12", "v20.06")},
+    {"TLineModel", Removed("v19.12", "v20.06")},
+    {"LineMeshModel", Removed("v19.12", "v20.06")},
+    {"LineSetModel", Removed("v19.12", "v20.06")},
+    {"LineMesh", Removed("v19.12", "v20.06")},
+    {"LineSet", Removed("v19.12", "v20.06")},
+    {"LineModel", Removed("v19.12", "v20.06")},
+
+    {"OBB", Removed("v19.12", "v20.06")},
+    {"OBBModel", Removed("v19.12", "v20.06")},
+    {"TOBBModel", Removed("v19.12", "v20.06")},
+
+    {"Point", Removed("v19.12", "v20.06")},
+    {"TPointModel", Removed("v19.12", "v20.06")},
+    {"PointModel", Removed("v19.12", "v20.06")},
+    {"PointMesh", Removed("v19.12", "v20.06")},
+    {"PointSet", Removed("v19.12", "v20.06")},
+
+    {"Ray", Removed("v19.12", "v20.06")},
+    {"RayModel", Removed("v19.12", "v20.06")},
+
+    {"RigidCapsule", Removed("v19.12", "v20.06")},
+    {"RigidCapsuleModel", Removed("v19.12", "v20.06")},
+    {"RigidCapsuleCollisionModel", Removed("v19.12", "v20.06")},
+
+    {"Sphere", Removed("v19.12", "v20.06")},
+    {"SphereModel", Removed("v19.12", "v20.06")},
+    {"TSphereModel", Removed("v19.12", "v20.06")},
+
+    {"Tetrahedron", Removed("v19.12", "v20.06")},
+    {"TetrahedronModel", Removed("v19.12", "v20.06")},
+
+    {"Triangle", Removed("v19.12", "v20.06")},
+    {"TriangleSet", Removed("v19.12", "v20.06")},
+    {"TriangleMesh", Removed("v19.12", "v20.06")},
+    {"TriangleSetModel", Removed("v19.12", "v20.06")},
+    {"TriangleMeshModel", Removed("v19.12", "v20.06")},
+    {"TriangleModel", Removed("v19.12", "v20.06")},
+    {"TTriangleModel", Removed("v19.12", "v20.06")},
+
 
     // Change Constraint naming #4302
     {"AffineMovementConstraint", Renamed("v24.06","v25.06","AffineMovementProjectiveConstraint")},
diff --git a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.h b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.h
index bc92a04a532..40c94c23b19 100644
--- a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.h
+++ b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.h
@@ -126,6 +126,7 @@ class SOFA_HELPER_API Renamed : public ComponentChange
 };
 
 extern SOFA_HELPER_API const std::map< std::string, Deprecated, std::less<> > deprecatedComponents;
+extern SOFA_HELPER_API const std::map< std::string, ComponentChange, std::less<> > movedComponents;
 extern SOFA_HELPER_API const std::map< std::string, ComponentChange, std::less<> > uncreatableComponents;
 
 } // namespace sofa::helper::lifecycle
diff --git a/applications/projects/SceneChecking/src/SceneChecking/SceneCheckUsingAlias.cpp b/applications/projects/SceneChecking/src/SceneChecking/SceneCheckUsingAlias.cpp
index dcdde083ad0..12c3208029d 100644
--- a/applications/projects/SceneChecking/src/SceneChecking/SceneCheckUsingAlias.cpp
+++ b/applications/projects/SceneChecking/src/SceneChecking/SceneCheckUsingAlias.cpp
@@ -91,7 +91,7 @@ void SceneCheckUsingAlias::doPrintSummary()
             auto searchAlias = uncreatableComponents.find(unique_alias);
             if( searchAlias != uncreatableComponents.end() )
             {
-                usingAliasesWarning << " This alias will be REMOVED at the SOFA release " << searchAlias->second.getVersion() << ", please update your scenes.";
+                usingAliasesWarning << " " << searchAlias->second.getMessage();
             }
 
             if(unique_alias != unique_aliases.back()) usingAliasesWarning << msgendl;