From d0642bd09b1add976c42787aed1513f599b40aab Mon Sep 17 00:00:00 2001 From: dbv Date: Tue, 1 Sep 2015 16:07:08 +0300 Subject: [PATCH] Make parts of compsolids unselectable if whole compsolid is selected --- src/PartSet/PartSet_Validators.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/PartSet/PartSet_Validators.cpp b/src/PartSet/PartSet_Validators.cpp index 613e41f3b..6aac44781 100755 --- a/src/PartSet/PartSet_Validators.cpp +++ b/src/PartSet/PartSet_Validators.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -284,9 +285,25 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute std::dynamic_pointer_cast(*anAttrItr); for(int i = 0; i < aCurSelList->size(); i++) { std::shared_ptr aCurSel = aCurSelList->value(i); + ResultPtr aCurSelContext = aCurSel->context(); + ResultCompSolidPtr aCurSelCompSolidPtr = ModelAPI_Tools::compSolidOwner(aCurSelContext); + std::shared_ptr aCurSelCompSolid; + if(aCurSelCompSolidPtr.get()) { + aCurSelCompSolid = aCurSelCompSolidPtr->shape(); + } for(int j = 0; j < aRefSelList->size(); j++) { std::shared_ptr aRefSel = aRefSelList->value(j); - if(aCurSel->context() == aRefSel->context()) { + ResultPtr aRefSelContext = aRefSel->context(); + ResultCompSolidPtr aRefSelCompSolidPtr = ModelAPI_Tools::compSolidOwner(aRefSelContext); + std::shared_ptr aRefSelCompSolid; + if(aRefSelCompSolidPtr.get()) { + aRefSelCompSolid = aRefSelCompSolidPtr->shape(); + } + if((aCurSelCompSolid.get() && aCurSelCompSolid->isEqual(aRefSel->value())) + || (aRefSelCompSolid.get() && aRefSelCompSolid->isEqual(aCurSel->value()))) { + return false; + } + if(aCurSelContext == aRefSelContext) { if(aCurSel->value().get() == NULL || aRefSel->value().get() == NULL || aCurSel->value()->isEqual(aRefSel->value())) { return false; -- 2.39.2