[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.
This commit is contained in:
Chris Hennes
2021-03-23 09:12:56 -05:00
parent 7d118f31b7
commit ffcd0f5c65

View File

@@ -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):