Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-09-01 15:16:11 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-09-01 15:16:11 +0400
commit7532bc23254b6efbee26f69b02da04d66b32c0bb (patch)
treeb4b2d582d124a09577492a29c70f4ea1014d7754 /release/scripts/modules/bpy/ops.py
parent4a427fa4ff7cc2bebbbe9b9be3d89e947752fc29 (diff)
poll function for py api operator access
eg: if bpy.ops.object.mode_set.poll(): ...
Diffstat (limited to 'release/scripts/modules/bpy/ops.py')
-rw-r--r--release/scripts/modules/bpy/ops.py4
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