[Bf-python] How to copy MVerts?
Ken Hughes
khughes at pacific.edu
Mon Dec 26 22:24:05 CET 2005
Tron Thomas wrote:
> I am working with export geometry from Blender. Currently when an
> object like a cube is created, Blender only provide 8 vertices for that
> cube. This means that there are only 8 normal vectors. However each
> vertex of a cube is shared between 3 different face and therefore 24
> normal vectors are needed to define all the faces for the cube. I am
> interested in copying each vertex so that there will be 24 vertices with
> 24 normals vectors when defining the cube geometry.
>
> By default Python creates additional references to objects rather than
> copies. Attempts to use copy.copy and copy.deepcopy on MVerts causes
> run time errors.
>
> How can I make copies of the cube vertices using the Python scripting
> API's?
Try something like this:
#----------------
import Blender
me = Blender.Mesh.Get('Mesh')
verts = [v.co for v in me.verts]
verts += verts
me.verts.extend(v)
#----------------
me.vert.extend should accept a list of MVerts or PVerts also, but
doesn't right now (and I discovered it also doesn't throw an exception
if you do pass it these).
Ken
More information about the Bf-python
mailing list