Skip to content

Commit

Permalink
Part: improve disabling of element mapping in PropertyTopoShape
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder committed Aug 25, 2024
1 parent adb8c66 commit 4a9bc67
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Mod/Part/App/PropertyTopoShape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<App::DocumentObject>(getContainer());
if(obj) {
auto tag = obj->getID();
Expand All @@ -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();
Expand All @@ -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<App::DocumentObject>(getContainer()))
res.Tag = parent->getID();
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/Mod/Part/App/PropertyTopoShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4a9bc67

Please sign in to comment.