[Bf-python] Re: Bf-python Digest, Vol 17, Issue 25

Tron Thomas tron.thomas at verizon.net
Tue Dec 27 18:02:24 CET 2005


What is a PVert?  I saw brief mention of in the documentation for the 
__init__ method of MVert, and never found any information about what it 
is or how it works.

I am not interested in modifying the geometry of the cube.  I just want 
to create extra geometry to temporarily aid in the exporting of 
information for the cube.  So adding extra vertices to the cube's vertex 
buffer is not required.

I tried the following with the default scene that is created for new 
document:


import Blender

mesh = Blender.Mesh.Get('Cube')

moreVertices = [vertex.co for vertex in mesh.verts]
vertex = moreVertices[0]
vertex.no = Blender.Mathutils.Vector(1, 1, 1)


This resulted in the following run time output:
Traceback (most recent call list):
  File "Text.001", line 7, in 7
TypeError: vector.attribute = x: argument not a number

I don't understand this error, and if I cannot specify a normal vector, 
texture coordinates and index into the vertex buffer, then these vertex 
copies are not useful to me.

>Date: Mon, 26 Dec 2005 13:24:05 -0800
>From: Ken Hughes <khughes at pacific.edu>
>Subject: Re: [Bf-python] How to copy MVerts?
>To: Blender Foundation Python list <bf-python at projects.blender.org>
>Message-ID: <43B05F75.702 at pacific.edu>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>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
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20051227/158ab71e/attachment.html>


More information about the Bf-python mailing list