[Bf-python] Adding objects and scenes refactor

Campbell Barton cbarton at metavr.com
Mon Aug 28 18:20:04 CEST 2006


Making Object_New create its own data would be bad if you had a script 
that made linked duplicates-
Before the array modifier I had an array script and made many objects - 
up to 1000s,
if every Object_New created obdata it could make a huge ammount of empty 
obdatas,

My fav solution is to make Object_New accept obdata.

ob= Object.New(mymesh)

Maybe the old way could make data instantly and the new way- above would 
allow you to add an object with existing obdata.


Willian Padovani Germano wrote:
> Hi Campbell,
>
> Campbell Barton wrote:
>> Hi Willian
>>
>> Object.New() never adds data,
>> see Object.c line 862
>> *object->data = NULL;
>
> Ah yes, sorry, you're right. We can solve that internally -- no API 
> changes -- easily, moving data creation to (calling EXPP_add_obdata() 
> in) Object_New(), unless someone has a good reason against it.
>
>> *Removing object data creation directly worries me a bit-
>
> That's just one of the possibilities, as I said I agree there are 
> situations where this is useful and also that we don't have a good 
> enough reason here to break compatibility, spedcially if we're just 
> improving and not rewriting the API.
>
> As we discussed, it seems that having two ways is a good idea:
>
> - the current one(s)
> - and a newer (preferred, recommended in docs) where creating an 
> object already links it and its obdata to a scene.
>
> Thanks for the correction!
>


-- 
Campbell J Barton

133 Hope Street
Geelong West, Victoria 3218 Australia

URL:    http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241



More information about the Bf-python mailing list