[Bf-python] Scripting error or bur in API ?

Patrice Ferlet patrice.ferlet at wanadoo.fr
Wed Aug 27 22:20:27 CEST 2003


Ok thanks. You have a solution to clone an object as "duplicate" ?


Michel Selten a écrit :

>On Mon, 2003-08-25 at 02:02, Patrice Ferlet wrote:
>  
>
>>Hello
>>
>>I am using Blender 2.28a, and trying to duplicate object in python script.
>>
>>I get an object, named "objSrc" which is a mesh.
>>
>>I create  a new mesh and use shareFrom method:
>>
>>mymesh=Blender.Object.New('Mesh',"test_mesh")
>>mymesh.shareFrom(objSrc)
>>
>>Here is the python output:
>>In Object_GetSelected()
>>[Object "Cube"]
>>Traceback (most recent call last):
>>  File "Text", line 12, in ?
>>TypeError: argument 1 is not of type 'Object'
>>    
>>
>
>A mesh is always linked to an Object. After all, an Object has all kind
>of nice attributes which are general across most of the other object
>types within blender including Mesh.
>The shareFrom function needs to have an object of type Object as the
>argument. So, you shouldn't pass the objSrc to shareFrom, but the
>generic Object linked to the Mesh.
>
>  
>
>>So, i try to remove the "new" method and i have:
>>In Object_GetSelected()
>>[Object "Cube"]
>>Traceback (most recent call last):
>>  File "Text", line 12, in ?
>>AttributeError: type object 'object' has no attribute 'shareFrom'
>>    
>>
>
>Well, mymesh is not initialised in your script yet, so it doesn't know
>you would like it to be a blender Object. Since the shareFrom method is
>only applicable to the blender Object type, you get the above error.
>
>I hope this helps.
>
>With regards,
>	Michel
>
>
>_______________________________________________
>Bf-python mailing list
>Bf-python at blender.org
>http://www.blender.org/mailman/listinfo/bf-python
>
>  
>





More information about the Bf-python mailing list