[Bf-python] Adding objects and scenes refactor

jmsoler at free.fr jmsoler at free.fr
Mon Aug 28 18:54:42 CEST 2006


Selon Willian Padovani Germano <wgermano at superig.com.br>:

> Hi Campbell,
>
> We do need a wiki page for this topic, I'll just reply here to a small
> issue.
>
> Campbell Barton wrote:
> > Once of the biggest problems is that Python API allows you to create an
> > object with no obdata...
> > Ton was requested this be made not possible
>
> No, that was never possible. Object.New() *always creates obdata*,
> unless you're creating an Empty, of course. The issue is with obdata,
> since NMesh.New(), Camera.New(), etc. create *obdata that is not linked
> to any object*. For this reason, the docs advise people to use:
>
> ob = Object.New('Lamp')
> obdata = ob.data
>
> #instead of:
>
> obdata = Lamp.New()
> ob = Object.New('Lamp') # is created with obdata already
> ob.link(obdata) # unlinks the original obdata
>
> One possibility is to simply remove these obdata creation functions, but
> since there are situations where they are useful (and for backwards
> compatibility ...


Happy to read this .


>), we may just ad a new better way to create an ob+obdata
> already linked to a scene and keep this older way for those who need it.
>
> To all: we agreed that the API for creating data (ob, obdata, scenes,
> texts, images) deserves a wiki page for discussions, once it is created
> (anyone is free to start it) and announced here, let's continue the
> discussion there.
>
> --
> Willian
> _______________________________________________
> Bf-python mailing list
> Bf-python at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-python
>





More information about the Bf-python mailing list