[Bf-python] Object.link

Willian Padovani Germano wgermano at ig.com.br
Sun Sep 14 04:59:23 CEST 2003


*Important*  Michel and all, please read this

Joseph really found a design bug here.

Object.New() should not create object data at all.  It should create an
object of the given type, update Blender where needed (like doing
G.totlamp++ if type == Lamp) but *not* create object data.  Then on
obj.getData, if the pointer was NULL, we'd ask the user to create obdata
first, then obj.link(obdata).

To create object data there are specific functions elsewhere: Lamp.New(),
etc.

So or

1) we fix the docs in many places and tell people not to do what docs have
been telling them to, aka:

obj = Object.New('Mesh')
mesh = NMesh.New()
obj.link(mesh)

and tell them to only do:
obj = Object.New('Mesh')
mesh = obj.getData()

OR

2) we fix Object.New to not create object data.

I prefer this second option, since it fixes the design issue, avoiding
useless data being created and kept around (consider scripts that create
dozens of objects).  Remember that when the docs and the actual
implementation differed in 2.25, we sometimes went for what the docs said.
This is one of these cases.

We should discuss about compatibility, though.  It could possibly break a
few scripts that didn't follow the docs, but again: right now it is wrong.


More information about the Bf-python mailing list