diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-07-26 22:18:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-07-26 22:18:14 +0400 |
commit | 4741137fc9639a3902a0a7bbbebb7256841ac027 (patch) | |
tree | d5a3a415ef975c6fe317c57e2a61c7d4b2e6bd74 /release | |
parent | b666f55e0e779d1f30f81035bef571db705d5913 (diff) |
misc py/rna changes
- running a script from a file now uses the PyRun_File(FILE *, ...) rather then PyRun_String("exec(open(r'/somepath.py').read())"...), aparently FILE struct on windows could not ensured to be the same between blender and python, since we use our own python on windows now it should be ok.
- generating docs works again (operator update for py style syntax broke them)
- python operator doc strings was being overwritten
- added rna property attribute "default" to get the default value of a property, not working on arrays currently because variable length arrays are not supported.
Diffstat (limited to 'release')
-rw-r--r-- | release/ui/bpy_ops.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/release/ui/bpy_ops.py b/release/ui/bpy_ops.py index aaf9edc082e..aa9bfb460f0 100644 --- a/release/ui/bpy_ops.py +++ b/release/ui/bpy_ops.py @@ -3,6 +3,7 @@ from bpy.__ops__ import add as op_add from bpy.__ops__ import remove as op_remove from bpy.__ops__ import dir as op_dir from bpy.__ops__ import call as op_call +from bpy.__ops__ import get_rna as op_get_rna class bpy_ops(object): ''' @@ -89,13 +90,22 @@ class bpy_ops_submodule_op(object): self.module = module self.func = func - def __call__(self, **kw): + def idname(self): # submod.foo -> SUBMOD_OT_foo - id_name = self.module.upper() + '_OT_' + self.func - - # Get the operator from - return op_call(id_name, kw) + return self.module.upper() + '_OT_' + self.func + + def __call__(self, **kw): + # Get the operator from blender + return op_call(self.idname(), kw) + + def get_rna(self): + ''' + currently only used for '__rna__' + ''' + return op_get_rna(self.idname()) + + def __repr__(self): return "<function bpy.ops.%s.%s at 0x%x'>" % (self.module, self.func, id(self)) |