From ffcd0f5c659876597da661e61ba48396e40dd5cf Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Tue, 23 Mar 2021 09:12:56 -0500 Subject: [PATCH] [Draft] Enable Transform context menu item The "Transform" and "Set Colors..." context menu items did not work on most Draft objects because the View Provider has a setEdit() function, which overrides any edit action provided at a higher level (e.g. by Part). This commit checks the mode of the edit, and if it is not zero, behaves as though the setEdit() function does not exist, allowing Part to provide the required context menu behavior. --- src/Mod/Draft/draftviewproviders/view_base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Mod/Draft/draftviewproviders/view_base.py b/src/Mod/Draft/draftviewproviders/view_base.py index 32e5554fd0..162f0db950 100644 --- a/src/Mod/Draft/draftviewproviders/view_base.py +++ b/src/Mod/Draft/draftviewproviders/view_base.py @@ -383,13 +383,19 @@ class ViewProviderDraft(object): Returns ------- - bool + bool or None It is `True` if `mode` is 0, and `Draft_Edit` ran successfully. + None if mode is not zero. It is `False` otherwise. """ if mode == 0 and App.GuiUp: #remove guard after splitting every viewprovider Gui.runCommand("Draft_Edit") return True + elif mode != 0: + # Act like this function doesn't even exist, so the command falls back to Part (e.g. in the + # case of an unrecognized context menu action) + return None + return False def unsetEdit(self, vobj, mode=0):