<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
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.<br>
<br>
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.<br>
<br>
I tried the following with the default scene that is created for new
document:<br>
<br>
<br>
import Blender<br>
<br>
mesh = Blender.Mesh.Get('Cube')<br>
<br>
moreVertices = [vertex.co for vertex in mesh.verts]<br>
vertex = moreVertices[0]<br>
vertex.no = Blender.Mathutils.Vector(1, 1, 1)<br>
<br>
<br>
This resulted in the following run time output:<br>
Traceback (most recent call list):<br>
File "Text.001", line 7, in 7<br>
TypeError: vector.attribute = x: argument not a number<br>
<br>
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.<br>
<br>
<blockquote cite="mid20051227110016.8F23C1C07A7@bserve2.blender.org"
type="cite">
<pre wrap="">Date: Mon, 26 Dec 2005 13:24:05 -0800
From: Ken Hughes <a class="moz-txt-link-rfc2396E" href="mailto:khughes@pacific.edu"><khughes@pacific.edu></a>
Subject: Re: [Bf-python] How to copy MVerts?
To: Blender Foundation Python list <a class="moz-txt-link-rfc2396E" href="mailto:bf-python@projects.blender.org"><bf-python@projects.blender.org></a>
Message-ID: <a class="moz-txt-link-rfc2396E" href="mailto:43B05F75.702@pacific.edu"><43B05F75.702@pacific.edu></a>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Tron Thomas wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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?
</pre>
</blockquote>
<pre wrap=""><!---->
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
</pre>
</blockquote>
<br>
</body>
</html>