diff --git a/Sofa/Component/Collision/Detection/Algorithm/tests/CollisionPipeline_test.cpp b/Sofa/Component/Collision/Detection/Algorithm/tests/CollisionPipeline_test.cpp
index 75536b51a12..3078fc26c56 100644
--- a/Sofa/Component/Collision/Detection/Algorithm/tests/CollisionPipeline_test.cpp
+++ b/Sofa/Component/Collision/Detection/Algorithm/tests/CollisionPipeline_test.cpp
@@ -102,7 +102,7 @@ void TestCollisionPipeline::checkCollisionPipelineWithNoAttributes()
" \n"
" \n"
" \n"
- " \n"
+ " \n"
" \n"
" \n" ;
@@ -126,7 +126,7 @@ void TestCollisionPipeline::checkCollisionPipelineWithMissingIntersection()
" \n"
" \n"
" \n"
- " \n"
+ " \n"
" \n" ;
root = SceneLoaderXML::loadFromMemory ("testscene", scene.str().c_str());
@@ -147,7 +147,7 @@ void TestCollisionPipeline::checkCollisionPipelineWithMissingBroadPhase()
" \n"
" \n"
" \n"
- " \n"
+ " \n"
" \n"
" \n" ;
@@ -168,7 +168,7 @@ void TestCollisionPipeline::checkCollisionPipelineWithMissingNarrowPhase()
" \n"
" \n"
" \n"
- " \n"
+ " \n"
" \n"
" \n" ;
@@ -210,7 +210,7 @@ int TestCollisionPipeline::checkCollisionPipelineWithMonkeyValueForDepth(int dva
" \n"
" \n"
" \n"
- " \n"
+ " \n"
" \n"
" \n" ;
diff --git a/Sofa/Component/Collision/Response/Contact/src/sofa/component/collision/response/contact/CollisionResponse.cpp b/Sofa/Component/Collision/Response/Contact/src/sofa/component/collision/response/contact/CollisionResponse.cpp
index c225ffa731c..40292b89c8c 100644
--- a/Sofa/Component/Collision/Response/Contact/src/sofa/component/collision/response/contact/CollisionResponse.cpp
+++ b/Sofa/Component/Collision/Response/Contact/src/sofa/component/collision/response/contact/CollisionResponse.cpp
@@ -62,18 +62,28 @@ sofa::helper::OptionsGroup CollisionResponse::initializeResponseOptions(sofa::co
}
sofa::helper::OptionsGroup responseOptions(listResponse);
- if (listResponse.contains("PenalityContactForceField"))
- responseOptions.setSelectedItem("PenalityContactForceField");
-
return responseOptions;
}
void CollisionResponse::init()
{
Inherit1::init();
+
+ if(!d_response.isSet())
+ {
+ msg_error() << "No response method has been set";
+ return;
+ }
+
if (d_response.getValue().size() == 0)
{
- d_response.setValue(initializeResponseOptions(getContext()));
+ sofa::helper::OptionsGroup responseOptions = initializeResponseOptions(getContext());
+ msg_error() << "Response method is wrongly set. Option list is: " << responseOptions.getItemNames();
+ d_response.setValue(responseOptions);
+ }
+ else
+ {
+ msg_info() << "Valid response method: " << d_response.getValue().getSelectedItem();
}
}
@@ -111,7 +121,6 @@ void CollisionResponse::setDefaultResponseType(const std::string &responseT)
}
}
-
void CollisionResponse::changeInstance(Instance inst)
{
core::collision::ContactManager::changeInstance(inst);
diff --git a/Sofa/Component/Collision/Response/Contact/src/sofa/component/collision/response/contact/CollisionResponse.h b/Sofa/Component/Collision/Response/Contact/src/sofa/component/collision/response/contact/CollisionResponse.h
index 9a6ee36d869..9466991e8d2 100644
--- a/Sofa/Component/Collision/Response/Contact/src/sofa/component/collision/response/contact/CollisionResponse.h
+++ b/Sofa/Component/Collision/Response/Contact/src/sofa/component/collision/response/contact/CollisionResponse.h
@@ -52,7 +52,13 @@ public :
{
context->addObject(obj);
sofa::helper::OptionsGroup options = initializeResponseOptions(context);
- obj->d_response.setValue(options);
+ const std::string responseName = arg->getAttribute("response","");
+ // Check if the response is valid and not empty, only then set the response
+ if(options.isInOptionsList(responseName) >= 0 && responseName != "")
+ {
+ options.setSelectedItem(responseName);
+ obj->d_response.setValue(options);
+ }
}
if (arg)
@@ -112,7 +118,6 @@ public :
/// The number of contacts corresponds to the number of collision models
/// currently in contact with a collision model.
void setNumberOfContacts() const;
-
};
diff --git a/Sofa/framework/Helper/src/sofa/helper/OptionsGroup.cpp b/Sofa/framework/Helper/src/sofa/helper/OptionsGroup.cpp
index 322be736e4a..fdec98807d5 100644
--- a/Sofa/framework/Helper/src/sofa/helper/OptionsGroup.cpp
+++ b/Sofa/framework/Helper/src/sofa/helper/OptionsGroup.cpp
@@ -45,6 +45,11 @@ void OptionsGroup::setNbItems(const size_type nbofRadioButton )
selectedItem = 0;
}
///////////////////////////////////////
+type::vector OptionsGroup::getItemNames()
+{
+ return textItems;
+}
+///////////////////////////////////////
void OptionsGroup::setItemName(const unsigned int id_item, const std::string& name )
{
if(id_item < textItems.size())
diff --git a/Sofa/framework/Helper/src/sofa/helper/OptionsGroup.h b/Sofa/framework/Helper/src/sofa/helper/OptionsGroup.h
index 10616060c85..8423f2d0a40 100644
--- a/Sofa/framework/Helper/src/sofa/helper/OptionsGroup.h
+++ b/Sofa/framework/Helper/src/sofa/helper/OptionsGroup.h
@@ -71,6 +71,9 @@ public :
///Set the name of the id-th item
void setItemName( unsigned int id_item, const std::string& name );
+ ///Get the vector of names available
+ type::vector getItemNames();
+
template
void setNames(const std::initializer_list& list);
diff --git a/applications/plugins/ArticulatedSystemPlugin/examples/ArticulatedSystemMapping.scn b/applications/plugins/ArticulatedSystemPlugin/examples/ArticulatedSystemMapping.scn
index 08d18390f81..5b25539dfc8 100644
--- a/applications/plugins/ArticulatedSystemPlugin/examples/ArticulatedSystemMapping.scn
+++ b/applications/plugins/ArticulatedSystemPlugin/examples/ArticulatedSystemMapping.scn
@@ -15,13 +15,13 @@
+
+
+
-
-
+
-
-
diff --git a/applications/plugins/SofaCUDA/examples/quadSpringSphere.scn b/applications/plugins/SofaCUDA/examples/quadSpringSphere.scn
index 2bb630e301f..041fbed6155 100644
--- a/applications/plugins/SofaCUDA/examples/quadSpringSphere.scn
+++ b/applications/plugins/SofaCUDA/examples/quadSpringSphere.scn
@@ -18,7 +18,7 @@
-
+
-
+
diff --git a/examples/Component/Mapping/Linear/SkinningMapping.scn b/examples/Component/Mapping/Linear/SkinningMapping.scn
index 4d78200855f..f431d4e888f 100644
--- a/examples/Component/Mapping/Linear/SkinningMapping.scn
+++ b/examples/Component/Mapping/Linear/SkinningMapping.scn
@@ -17,7 +17,7 @@
-
+
diff --git a/examples/Component/Mapping/Linear/SubsetMapping.scn b/examples/Component/Mapping/Linear/SubsetMapping.scn
index c4cf30f49e3..3b72a7759ba 100644
--- a/examples/Component/Mapping/Linear/SubsetMapping.scn
+++ b/examples/Component/Mapping/Linear/SubsetMapping.scn
@@ -24,7 +24,7 @@
-
+
diff --git a/examples/Component/MechanicalLoad/EllipsoidForceField.scn b/examples/Component/MechanicalLoad/EllipsoidForceField.scn
index 308bff7bfe3..321d17e251e 100644
--- a/examples/Component/MechanicalLoad/EllipsoidForceField.scn
+++ b/examples/Component/MechanicalLoad/EllipsoidForceField.scn
@@ -23,7 +23,7 @@
-
+
diff --git a/examples/Component/MechanicalLoad/InteractionEllipsoidForceField.scn b/examples/Component/MechanicalLoad/InteractionEllipsoidForceField.scn
index ef1a0060d8a..e4d9ab0c261 100644
--- a/examples/Component/MechanicalLoad/InteractionEllipsoidForceField.scn
+++ b/examples/Component/MechanicalLoad/InteractionEllipsoidForceField.scn
@@ -22,7 +22,7 @@
-
+
diff --git a/examples/Component/SolidMechanics/Spring/QuadBendingSprings.scn b/examples/Component/SolidMechanics/Spring/QuadBendingSprings.scn
index a558ca9c461..8deab333fcc 100644
--- a/examples/Component/SolidMechanics/Spring/QuadBendingSprings.scn
+++ b/examples/Component/SolidMechanics/Spring/QuadBendingSprings.scn
@@ -16,7 +16,7 @@
-
+
diff --git a/examples/Component/Topology/Container/Grid/SparseGridTopology.scn b/examples/Component/Topology/Container/Grid/SparseGridTopology.scn
index 665e19b7f72..ccf79e2c017 100644
--- a/examples/Component/Topology/Container/Grid/SparseGridTopology.scn
+++ b/examples/Component/Topology/Container/Grid/SparseGridTopology.scn
@@ -23,7 +23,7 @@
-
+
diff --git a/examples/Demos/fallingBeamAugmentedLagrangianCollision.scn b/examples/Demos/fallingBeamAugmentedLagrangianCollision.scn
index a15852e9cda..9f4d8bf264a 100644
--- a/examples/Demos/fallingBeamAugmentedLagrangianCollision.scn
+++ b/examples/Demos/fallingBeamAugmentedLagrangianCollision.scn
@@ -22,7 +22,6 @@
- Container,TriangleSetTopologyModifier] -->
@@ -32,7 +31,7 @@
-
+
@@ -88,5 +87,3 @@
-
-
diff --git a/examples/Tutorials/Collision/AdvancedSolversMultipleGroupsSolver.scn b/examples/Tutorials/Collision/AdvancedSolversMultipleGroupsSolver.scn
index d07e8293b93..e55512e2c3c 100644
--- a/examples/Tutorials/Collision/AdvancedSolversMultipleGroupsSolver.scn
+++ b/examples/Tutorials/Collision/AdvancedSolversMultipleGroupsSolver.scn
@@ -18,7 +18,7 @@
-
+
diff --git a/examples/Tutorials/Collision/ModelizationSphereBased.scn b/examples/Tutorials/Collision/ModelizationSphereBased.scn
index 8cbe0a32096..8bab830675a 100644
--- a/examples/Tutorials/Collision/ModelizationSphereBased.scn
+++ b/examples/Tutorials/Collision/ModelizationSphereBased.scn
@@ -18,7 +18,7 @@
-
+
diff --git a/examples/Tutorials/Collision/ModelizationTriangleBased.scn b/examples/Tutorials/Collision/ModelizationTriangleBased.scn
index f89340d1694..4c3eea42dbc 100644
--- a/examples/Tutorials/Collision/ModelizationTriangleBased.scn
+++ b/examples/Tutorials/Collision/ModelizationTriangleBased.scn
@@ -18,7 +18,7 @@
-
+
diff --git a/examples/Tutorials/Collision/MultipleObjectsTwoCubes.scn b/examples/Tutorials/Collision/MultipleObjectsTwoCubes.scn
index ced8c200b92..d7ab6437d95 100644
--- a/examples/Tutorials/Collision/MultipleObjectsTwoCubes.scn
+++ b/examples/Tutorials/Collision/MultipleObjectsTwoCubes.scn
@@ -19,7 +19,7 @@
-
+
diff --git a/examples/Tutorials/Topologies/TopologyDynamicSurfaceMesh.scn b/examples/Tutorials/Topologies/TopologyDynamicSurfaceMesh.scn
index 613ee62a277..eebc1776f39 100644
--- a/examples/Tutorials/Topologies/TopologyDynamicSurfaceMesh.scn
+++ b/examples/Tutorials/Topologies/TopologyDynamicSurfaceMesh.scn
@@ -24,7 +24,7 @@
-
+
diff --git a/examples/Tutorials/Topologies/TopologyHexa2QuadTopologicalMapping.scn b/examples/Tutorials/Topologies/TopologyHexa2QuadTopologicalMapping.scn
index 24397ec455e..62b9ffb61ad 100644
--- a/examples/Tutorials/Topologies/TopologyHexa2QuadTopologicalMapping.scn
+++ b/examples/Tutorials/Topologies/TopologyHexa2QuadTopologicalMapping.scn
@@ -24,7 +24,7 @@
-
+
diff --git a/examples/Tutorials/Topologies/TopologyHexa2TetraTopologicalMapping.scn b/examples/Tutorials/Topologies/TopologyHexa2TetraTopologicalMapping.scn
index 0988993861d..060defd6592 100644
--- a/examples/Tutorials/Topologies/TopologyHexa2TetraTopologicalMapping.scn
+++ b/examples/Tutorials/Topologies/TopologyHexa2TetraTopologicalMapping.scn
@@ -24,7 +24,7 @@
-
+
diff --git a/examples/Tutorials/Topologies/TopologyLinearDifferentMesh.scn b/examples/Tutorials/Topologies/TopologyLinearDifferentMesh.scn
index 119c1304ba3..6c9b7dfcb35 100644
--- a/examples/Tutorials/Topologies/TopologyLinearDifferentMesh.scn
+++ b/examples/Tutorials/Topologies/TopologyLinearDifferentMesh.scn
@@ -21,7 +21,7 @@
-
+
diff --git a/examples/Tutorials/Topologies/TopologyLinearMesh.scn b/examples/Tutorials/Topologies/TopologyLinearMesh.scn
index 7ebd9a1fed8..a3e3739f790 100644
--- a/examples/Tutorials/Topologies/TopologyLinearMesh.scn
+++ b/examples/Tutorials/Topologies/TopologyLinearMesh.scn
@@ -19,7 +19,7 @@
-
+
diff --git a/examples/Tutorials/Topologies/TopologyQuad2TriangleTopologicalMapping.scn b/examples/Tutorials/Topologies/TopologyQuad2TriangleTopologicalMapping.scn
index 405995b6f4e..46d15db893b 100644
--- a/examples/Tutorials/Topologies/TopologyQuad2TriangleTopologicalMapping.scn
+++ b/examples/Tutorials/Topologies/TopologyQuad2TriangleTopologicalMapping.scn
@@ -24,7 +24,7 @@
-
+
diff --git a/examples/Tutorials/Topologies/TopologySurfaceDifferentMesh.scn b/examples/Tutorials/Topologies/TopologySurfaceDifferentMesh.scn
index f106babd7c7..8b87b16e59b 100644
--- a/examples/Tutorials/Topologies/TopologySurfaceDifferentMesh.scn
+++ b/examples/Tutorials/Topologies/TopologySurfaceDifferentMesh.scn
@@ -24,7 +24,7 @@
-
+
diff --git a/examples/Tutorials/Topologies/TopologyTetra2TriangleTopologicalMapping.scn b/examples/Tutorials/Topologies/TopologyTetra2TriangleTopologicalMapping.scn
index 2cad2dc31e2..bf2a817bfd6 100644
--- a/examples/Tutorials/Topologies/TopologyTetra2TriangleTopologicalMapping.scn
+++ b/examples/Tutorials/Topologies/TopologyTetra2TriangleTopologicalMapping.scn
@@ -24,7 +24,7 @@
-
+
diff --git a/examples/Tutorials/Topologies/TopologyTriangle2EdgeTopologicalMapping.scn b/examples/Tutorials/Topologies/TopologyTriangle2EdgeTopologicalMapping.scn
index 864bbb4448b..9ee2b4a7d24 100644
--- a/examples/Tutorials/Topologies/TopologyTriangle2EdgeTopologicalMapping.scn
+++ b/examples/Tutorials/Topologies/TopologyTriangle2EdgeTopologicalMapping.scn
@@ -22,7 +22,7 @@
-
+
diff --git a/examples/Tutorials/Topologies/TopologyVolumeDifferentMesh.scn b/examples/Tutorials/Topologies/TopologyVolumeDifferentMesh.scn
index 51c3c060145..8ab0493bf04 100644
--- a/examples/Tutorials/Topologies/TopologyVolumeDifferentMesh.scn
+++ b/examples/Tutorials/Topologies/TopologyVolumeDifferentMesh.scn
@@ -26,7 +26,7 @@
-
+