[Bf-python] Adding objects and scenes refactor

Willian Padovani Germano wgermano at superig.com.br
Mon Aug 28 21:17:54 CEST 2006


Campbell Barton wrote:
> 
> Making Object_New create its own data would be bad if you had a script 
> that made linked duplicates-

Indeed, forgot about that. Yes, we can have a 'data' keyword arg in 
Object.New():

Object.New(type, name = str(type), data = None)

data = None: create obdata
data = bpy data wrapper (mesh, nmesh, camera, etc): link new ob with 
this data.

But it's not a bad idea to also use a method to duplicate objects. You 
added ob.copy(). If it can accept a keyword arg, we can have:

ob2 = ob.copy(linked = False)

And also create multiple copies with a single call (not sure about the 
orer of the args):

ob.copy(linked = False, count = 1)

(if count == 1: return new ob, if count > 1: return list or tuple of new 
objects)

If .copy is not a good idea for this, for some reason, we can simply use 
ob.duplicate(linked = False, count = 1).

-- 
Willian



More information about the Bf-python mailing list