[Bf-python] new python development path

Willian Padovani Germano wgermano at superig.com.br
Thu Feb 9 17:27:53 CET 2006


Toni Alatalo wrote:
> so is the object model modification to be done in which side?

Each coder seems to prefer a different approach.

Some like the current way:

ob = Object.Get('obname')
me = Mesh.Get('mename') # or me = ob.data

The problem with OBDATA.Get() functions is that they give direct access 
to obdata w/o setting a clear link to some object. Ton even asked us to 
access via object, you remember.

Not letting direct access to obdata (aka removing Camera.Get('cam'), 
Mesh.Get, NMesh.GetRaw, etc.) seems to be a good way to follow Ton's 
request and also save us from problems we've found here and there. It's 
not a whole step toward oop, but may be close enough and means minimal 
changes for users to adapt to.

To access obdata, we can simply use ob.data fields:

ob = Object.Get('obname')
me = ob.data

To access unlinked obdata, we can have something like 
OBDATA.GetUnlinked(), which returns a list of obdata *names*. With these 
names we can link to an ob and only then be able to edit this obdata, 
like in Blender itself.

> we dont use python much anymore, just keep Render, Mesh, Object, Actions etc. 
> intact and the addition of an NLA api, basically just the Strip type, would 
> be nice :)
> i have drafted tests, in py, for the new object model that we discussed in 
> that one meeting. simple stuff like:
> 
> sourcearm = Blender.armatures['armature']

for this we'd need our own special dict type that only accesses data on 
demand, right? Consider a scene with hundreds of objects, it'd be a 
little expensive to create and keep Blender.armatures, .meshes, etc. dicts.

Anyway, only with an actual API written somewhere we can go on 
discussing, we need a general picture.

--
Willian



More information about the Bf-python mailing list