From 4a9bc679996af7edb466d783d3bef2621e15ad9b Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Sat, 24 Aug 2024 22:37:51 +0800 Subject: [PATCH] Part: improve disabling of element mapping in PropertyTopoShape --- src/Mod/Part/App/PropertyTopoShape.cpp | 10 ++++++++-- src/Mod/Part/App/PropertyTopoShape.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Mod/Part/App/PropertyTopoShape.cpp b/src/Mod/Part/App/PropertyTopoShape.cpp index bd696dd90bb9..ebe9b78b2bfb 100644 --- a/src/Mod/Part/App/PropertyTopoShape.cpp +++ b/src/Mod/Part/App/PropertyTopoShape.cpp @@ -104,6 +104,8 @@ void PropertyPartShape::setValue(const TopoShape& sh) { aboutToSetValue(); _Shape = sh; + _ShapeNoName.setShape(sh.getShape(), true); + _ShapeNoName.Tag = -1; auto obj = Base::freecad_dynamic_cast(getContainer()); if(obj) { auto tag = obj->getID(); @@ -129,6 +131,8 @@ void PropertyPartShape::setValue(const TopoDS_Shape& sh, bool resetElementMap) if(obj) _Shape.Tag = obj->getID(); _Shape.setShape(sh,resetElementMap); + _ShapeNoName.setShape(sh, true); + _ShapeNoName.Tag = -1; validateShape(obj); hasSetValue(); _Ver.clear(); @@ -144,7 +148,7 @@ TopoShape PropertyPartShape::getShape() const _Shape.initCache(-1); auto res = _Shape; if (Feature::isElementMappingDisabled(getContainer())) - res.Tag = -1; + return _ShapeNoName; else if (!res.Tag) { if (auto parent = Base::freecad_dynamic_cast(getContainer())) res.Tag = parent->getID(); @@ -155,7 +159,9 @@ TopoShape PropertyPartShape::getShape() const const Data::ComplexGeoData* PropertyPartShape::getComplexData() const { _Shape.initCache(-1); - return &(this->_Shape); + if (Feature::isElementMappingDisabled(getContainer())) + return &_ShapeNoName; + return &_Shape; } Base::BoundBox3d PropertyPartShape::getBoundingBox() const diff --git a/src/Mod/Part/App/PropertyTopoShape.h b/src/Mod/Part/App/PropertyTopoShape.h index 38349fca387a..e22de0f0daab 100644 --- a/src/Mod/Part/App/PropertyTopoShape.h +++ b/src/Mod/Part/App/PropertyTopoShape.h @@ -121,6 +121,7 @@ class PartExport PropertyPartShape : public App::PropertyComplexGeoData private: TopoShape _Shape; + TopoShape _ShapeNoName; std::string _Ver; mutable int _HasherIndex = 0; mutable bool _SaveHasher = false;