fix for python not being able to call operators with a executuon context.

This commit is contained in:
2010-02-10 11:10:38 +00:00
parent fbc201d2dd
commit c2b2ccde45
6 changed files with 34 additions and 39 deletions

View File

@@ -27,19 +27,6 @@ op_call = ops_module.call
op_as_string = ops_module.as_string
op_get_rna = ops_module.get_rna
# Keep in sync with WM_types.h
context_dict = {
'INVOKE_DEFAULT': 0,
'INVOKE_REGION_WIN': 1,
'INVOKE_AREA': 2,
'INVOKE_SCREEN': 3,
'EXEC_DEFAULT': 4,
'EXEC_REGION_WIN': 5,
'EXEC_AREA': 6,
'EXEC_SCREEN': 7,
}
class bpy_ops(object):
'''
Fake module like class.
@@ -161,16 +148,10 @@ class bpy_ops_submodule_op(object):
else:
C_exec = args[0]
try:
context = context_dict[C_exec]
except:
raise ValueError("Expected a single context argument in: " + \
str(list(context_dict.keys())))
if len(args) == 2:
C_dict = args[1]
ret = op_call(self.idname_py(), C_dict, kw, context)
ret = op_call(self.idname_py(), C_dict, kw, C_exec)
else:
ret = op_call(self.idname_py(), C_dict, kw)