[Bf-python] Object.link

Michel Selten michel.s at home.nl
Mon Sep 15 19:22:56 CEST 2003


On Sun, 2003-09-14 at 04:59, Willian Padovani Germano wrote:
> *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).

As you've written in your own reply, it would be nicer to create the
requested object if it does not exist yet.

> 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.
> >From docs (even older ones like the 2.25 reference) people learned to use
> Object.New() in conjunction with Lamp.New(), for example, so maybe not much
> will be broken. This would break, case anyone used it:
> 
> ob = Object.New(type)
> data = ob.getData()  # should return None until ob gets linked to real data.

Definately go for option #2 :) Especially with the added functionality
to the getData() method.

If there are no problems/issues that we've overlooked, I'm willing to
implement/update the Object module with this.

With regards,
	Michel





More information about the Bf-python mailing list