diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-09-01 15:16:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-09-01 15:16:11 +0400 |
commit | 7532bc23254b6efbee26f69b02da04d66b32c0bb (patch) | |
tree | b4b2d582d124a09577492a29c70f4ea1014d7754 /release | |
parent | 4a427fa4ff7cc2bebbbe9b9be3d89e947752fc29 (diff) |
poll function for py api operator access
eg:
if bpy.ops.object.mode_set.poll():
...
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/modules/bpy/ops.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/release/scripts/modules/bpy/ops.py b/release/scripts/modules/bpy/ops.py index 15e5df15246..223a5a89471 100644 --- a/release/scripts/modules/bpy/ops.py +++ b/release/scripts/modules/bpy/ops.py @@ -23,6 +23,7 @@ from _bpy import ops as ops_module # op_add = ops_module.add op_dir = ops_module.dir +op_poll = ops_module.poll op_call = ops_module.call op_as_string = ops_module.as_string op_get_rna = ops_module.get_rna @@ -120,6 +121,9 @@ class bpy_ops_submodule_op(object): self.module = module self.func = func + def poll(self, context=None): + return op_poll(self.idname_py(), context) + def idname(self): # submod.foo -> SUBMOD_OT_foo return self.module.upper() + "_OT_" + self.func |