From b8e8f20e3f3b6763fb45a0fc1d249b82d113fb54 Mon Sep 17 00:00:00 2001 From: alxbilger Date: Tue, 29 Jun 2021 09:56:00 +0200 Subject: [PATCH 1/4] [SofaCore] Link: case where Data parent is invalid --- .../SofaCore/src/sofa/core/objectmodel/Base.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp b/SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp index 2cf27b2130d..f9acaa88676 100644 --- a/SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp +++ b/SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp @@ -475,8 +475,19 @@ bool Base::parseField( const std::string& attribute, const std::string& value) } else { - BaseData* parentData = dataVec[d]->getParent(); - msg_info() << "Link from parent Data " << value << " (" << parentData->getValueTypeInfo()->name() << ") to Data " << attribute << "(" << dataVec[d]->getValueTypeInfo()->name() << ") OK"; + if (BaseData* parentData = dataVec[d]->getParent()) + { + msg_info() << "Link from parent Data " << value + << " (" << parentData->getValueTypeInfo()->name() + << ") to Data " << attribute + << " (" << dataVec[d]->getValueTypeInfo()->name() << ") OK"; + } + else + { + msg_warning() << "Link Data '" << attribute << "' to invalid Data '" << value << '\''; + ok = false; + continue; + } } /* children Data cannot be modified changing the parent Data value */ dataVec[d]->setReadOnly(true); From 734da280284e851e24229e495f37d6fa1078bdf8 Mon Sep 17 00:00:00 2001 From: alxbilger Date: Tue, 29 Jun 2021 10:03:39 +0200 Subject: [PATCH 2/4] [SofaCore] error instead of warning --- SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp b/SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp index f9acaa88676..0cacc0f89c2 100644 --- a/SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp +++ b/SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp @@ -484,7 +484,7 @@ bool Base::parseField( const std::string& attribute, const std::string& value) } else { - msg_warning() << "Link Data '" << attribute << "' to invalid Data '" << value << '\''; + msg_error() << "Link Data '" << attribute << "' to invalid Data '" << value << '\''; ok = false; continue; } From 22792cd2e08b038063ae227ce917b2580e98c6ac Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Wed, 30 Jun 2021 12:20:00 +0200 Subject: [PATCH 3/4] Remove else --- .../modules/SofaCore/src/sofa/core/objectmodel/Base.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp b/SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp index 0cacc0f89c2..96bc62cd3d8 100644 --- a/SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp +++ b/SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp @@ -482,12 +482,6 @@ bool Base::parseField( const std::string& attribute, const std::string& value) << ") to Data " << attribute << " (" << dataVec[d]->getValueTypeInfo()->name() << ") OK"; } - else - { - msg_error() << "Link Data '" << attribute << "' to invalid Data '" << value << '\''; - ok = false; - continue; - } } /* children Data cannot be modified changing the parent Data value */ dataVec[d]->setReadOnly(true); From bb6f1ec23148553fb2bec9b31b5ec9b2a919d3c2 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Wed, 30 Jun 2021 06:20:43 -0400 Subject: [PATCH 4/4] Update SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp Co-authored-by: Guillaume Paran --- .../modules/SofaCore/src/sofa/core/objectmodel/Base.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp b/SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp index 96bc62cd3d8..7ff88d47e23 100644 --- a/SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp +++ b/SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.cpp @@ -477,10 +477,11 @@ bool Base::parseField( const std::string& attribute, const std::string& value) { if (BaseData* parentData = dataVec[d]->getParent()) { - msg_info() << "Link from parent Data " << value - << " (" << parentData->getValueTypeInfo()->name() - << ") to Data " << attribute - << " (" << dataVec[d]->getValueTypeInfo()->name() << ") OK"; + msg_info() << "Link from parent Data " + << value << " (" << parentData->getValueTypeInfo()->name() << ") " + << "to Data " + << attribute << " (" << dataVec[d]->getValueTypeInfo()->name() << ") " + << "OK"; } } /* children Data cannot be modified changing the parent Data value */