[Bf-python] Proposed BPyAPI Additions.
Willian Padovani Germano
wgermano at superig.com.br
Sat Sep 2 02:49:17 CEST 2006
Hi,
Rainy days here, only connected now because of lightnings since last
night. Nothing big, though.
This email is to make sure we're all talking about the same thing:
(corrections / additions welcome)
- We're not creating a whole new API now, it's not a good time for that
yet. What we can do is the cleanup and some additions for *alternative*
ways to work (that can slowly create a new API, in fact, if we're smart).
- There are some problems with the current API that Ton, specially, has
asked us to fix. Things like objects with no obdata and also unlinked
objects and obdata should be avoided.
- The current API is too verbose for simple things. This can be fought
with new ways in the API itself or in a wrapper API on top of our C one.
Constants are posing a problem for the easy / less verbose interface.
- Of course we need to keep the big picture in mind, but to get
something done it's better to concentrate on specific topics, like this
one (object and obdata creation).
One of the things we can do to fix the issues is to promote access
always starting from a scene. When you add an object, it is added to
this scene automatically.
So we keep the old way:
import Blender
from Blender import Object, Scene # or import *
ob = Object.New()
scene = Scene.GetCurrent()
scene.link(ob)
But add something nicer as a complete alternative.
Having scenes iterator in the Blender module is a first idea, following
Campbell's suggestion:
import Blender
from Blender import Mesh
scene = Blender.scenes.active
scene.objects.add_or_new(???) # whatever style / naming we end up with
Moving on, I'll write a suggestion in another email.
Martin Poirier wrote:
>> scn.meshes holds objects, not obdata, which could be
>> confusing since we
>> have Mesh / NMesh modules that relate to obdata.
>
> This would be the only source of possible problems,
> all the other obdata have only one BPy counterpart.
Ah, I wasn't clear. What I meant was that modules like Mesh, NMesh,
Lamp, Camera, etc. deal with obdata, not objects and, e.g., scn.meshes
or scn.lamps being object iterators would be a little confusing then. In
one place mesh would refer to obdata, in another, to ob. Anyway, we can
choose a way that doesn't bring this confusion, no problem.
--
Willian
More information about the Bf-python
mailing list