[Bf-python] Adding objects and scenes refactor
Willian Padovani Germano
wgermano at superig.com.br
Mon Aug 28 18:25:05 CEST 2006
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), 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
More information about the Bf-python
mailing list