this is a post about frustration, and quest for secret knowledges and answers.
can I attach a function to a collection of blender object to obtain for example :
bpy.data.image['an_image'].rotate()
(that is, rotate will apply to the an_image object…)
or :
how to retrieve the blender object from self and context when I attach a class as a pointer in these collections ? like :
bpy.data.image['an_image'].tools.rotate()
rotate won’t apply to an-image. rotate(self) in the Tools class does not returns an_image but the tools pointer.
so you’re stuck, as any of the two works.
can I attach to context ?
img = bpy.context.active_image
this actually is bpy.context.window.screen.areas[x].spaces[y].image or bpy.data.screens but you need loops and tests for x and y. I got this function in a script but I can’t share in an elegant way.
since operator cannot return anything but a status I can’t even directly :
img = bpy.ops.image.active
could be useful but not compatible with a row.operator() call from a draw()… which syntax to pass arguments to operators is not good sorry about that.
in many circumstance you’ll need a mini string parser then an object lookup to retrieve your objects in the operator, or a clipboard-like class as a step to pass arguments.
so as a pythonist 2nd rank programmer, I attach my functions anywhere, as a tribute to chaos. then blender first ring and silent nerds shout at you :eyebrowlift:. because in most of the script, you’ll get absurd and wild things like :
img = bpy.scene.my_supaclass.imgs.enabled()
I know class inheritance works so maybe there’s some ways to combine.
hey, I’m very happy with the new API. this is a really great job. this is really a great mainframe. and there’s lots I don’t known so maybe it can be made.
but register(), pointer props and bpy classes would need some more features or more documentation. I can contribute to that if I know practices, at least in french.
please, please… share info… thanks 