Roman Volodin
2015-04-06 12:00:16 UTC
Hi everyone.
I have an idea/proposal to convert operators into class methods.
For now operators are not so convenient, I can't do something like:
obj = bpy.ops.mesh.primitive_cube_add(...)
And I have to worry about context (which is not quite clear for me to be
honest).
So I thought it'd be nice to use an operator as a class method, for example:
box = bpy.data.objects.primitive_cube_add(...)
instead of
bpy.ops.mesh.primitive_cube_add(...)
or
Fcurve.smooth()
instead of
bpy.ops.graph.smooth()
or
Constraint.set_inverse() # (if Constraint.type == 'CHILD_OF')
instead of
bpy.ops.constraint.childof_set_inverse(constraint="Child Of",
owner='OBJECT')
I especially interested in last two, because I had to write my own
functions to avoid using ops.
Is it hard? Is it easy? Is it possible at all?
-Roman
I have an idea/proposal to convert operators into class methods.
For now operators are not so convenient, I can't do something like:
obj = bpy.ops.mesh.primitive_cube_add(...)
And I have to worry about context (which is not quite clear for me to be
honest).
So I thought it'd be nice to use an operator as a class method, for example:
box = bpy.data.objects.primitive_cube_add(...)
instead of
bpy.ops.mesh.primitive_cube_add(...)
or
Fcurve.smooth()
instead of
bpy.ops.graph.smooth()
or
Constraint.set_inverse() # (if Constraint.type == 'CHILD_OF')
instead of
bpy.ops.constraint.childof_set_inverse(constraint="Child Of",
owner='OBJECT')
I especially interested in last two, because I had to write my own
functions to avoid using ops.
Is it hard? Is it easy? Is it possible at all?
-Roman