Fix T38145: python error popup when pressing shift+Z in blender game mode.

This commit is contained in:
Brecht Van Lommel 2014-01-11 00:59:22 +01:00
parent 4d72a5e34a
commit 6d6bb2d130
Notes: blender-bot 2023-02-14 11:21:43 +01:00
Referenced by issue #38166, Vertex slide broken
Referenced by issue #38145, Pressing Shift+Z in the game engine results in an error
1 changed files with 10 additions and 5 deletions

View File

@ -347,11 +347,16 @@ class WM_OT_context_toggle_enum(Operator):
if context_path_validate(context, data_path) is Ellipsis:
return {'PASS_THROUGH'}
exec("context.%s = ('%s', '%s')[context.%s != '%s']" %
(data_path, self.value_1,
self.value_2, data_path,
self.value_2,
))
# failing silently is not ideal, but we don't want errors for shortcut
# keys that some values that are only available in a particular context
try:
exec("context.%s = ('%s', '%s')[context.%s != '%s']" %
(data_path, self.value_1,
self.value_2, data_path,
self.value_2,
))
except:
return {'PASS_THROUGH'}
return operator_path_undo_return(context, data_path)