From c0efc7fa323c1439e13f8ff8a2d7cd91e9649446 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Wed, 7 Jul 2021 15:45:22 +0200 Subject: [PATCH] Draft: added AutoUpdate property to shape2Dviews to disambiguate with VisibleOnly property --- src/Mod/Draft/draftobjects/shape2dview.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Mod/Draft/draftobjects/shape2dview.py b/src/Mod/Draft/draftobjects/shape2dview.py index 9c13f5f640..96a2cd10e4 100644 --- a/src/Mod/Draft/draftobjects/shape2dview.py +++ b/src/Mod/Draft/draftobjects/shape2dview.py @@ -107,8 +107,7 @@ class Shape2DView(DraftObject): obj.SegmentLength = .05 if not "VisibleOnly" in pl: _tip = QT_TRANSLATE_NOOP("App::Property", - "If this is True, this object will be recomputed only if it is \ - visible") + "If this is True, this object will include only visible objects") obj.addProperty("App::PropertyBool", "VisibleOnly", "Draft", _tip) obj.VisibleOnly = False @@ -127,6 +126,12 @@ class Shape2DView(DraftObject): "If this is True, the contents are clipped to the borders of the section plane, if applicable. This overrides the base object's Clip property") obj.addProperty("App::PropertyBool", "Clip", "Draft", _tip) + if not "AutoUpdate" in pl: + _tip = QT_TRANSLATE_NOOP("App::Property", + "This object will be recomputed only if this is True.") + obj.addProperty("App::PropertyBool", "AutoUpdate", + "Draft", _tip) + obj.AutoUpdate = True def onDocumentRestored(self, obj): @@ -179,11 +184,9 @@ class Shape2DView(DraftObject): return nedges def execute(self,obj): - if hasattr(obj,"VisibleOnly"): - if obj.VisibleOnly: - if obj.ViewObject: - if obj.ViewObject.Visibility == False: - return False + if hasattr(obj,"AutoUpdate"): + if not obj.AutoUpdate: + return True import Part, DraftGeomUtils obj.positionBySupport() pl = obj.Placement