[Bf-python] Proposed BPyAPI Additions.

Willian Padovani Germano wgermano at superig.com.br
Sat Dec 9 20:01:41 CET 2006


Hi,

Yesterday I discussed with Stephen and Ken a little about updating 
Object.New() to make it safer:

- always link new object to obdata
- always link new object to a scene

For this we can add two keyword arguments to Object.New():

Right now it's:
Object.New(type, name)

It can become:
Object.New(type, name, data = None, scene = None)

If the user doesn't provide data, it's created automatically. Doesn't 
provide a scene: the new object is linked to the current scene.

So, with these updates, this:

import Blender
ob = Blender.Object.New('Lamp')
scene = Blender.Scene.GetCurrent()
scene.link(ob)

can safely be written as:

import Blender
ob = Blender.Object.New('Lamp')

This should be added early next week, unless someone has a good point 
against it.

PS:

Tomorrow before and after the meeting we can informally discuss more 
about Campbell's iterators and other ideas to have *alternative* cleaner 
/ less verbose ways to use the API, everyone interested is invited.

Ken and Stephen: being away from coding for quite some time, I was still 
warming up and later realized (or remembered) more issues which we all 
need to think about and discuss. So, excuse me if I end up contradicting 
some ideas I expressed. I'm doing my homework now.

-- 
Willian



More information about the Bf-python mailing list