[Bf-python] Discussion: Mesh PVert/MVert change?

Campbell Barton cbarton at metavr.com
Sat Jan 14 09:41:46 CET 2006


Hey Ken, so far I havnt needed pverts and it seems like theyd be a bit 
slower, but as long as fast access is available- its ok I suppose.

Just Writing a edge subdivide function and came accross 2 problems.

Non wrapped MCol objects cant exist AFAIK..

An example is rotating the colours on a face.
f.col = (f.col[1], f.col[2], f.col[0]) # Didnt worksomehow assigning to 
the wrapped data made a colour appier twice.
f.col[0] = (12,255,0) # Syntax would ben nice and easy to deal with.

- Cam


Ken Hughes wrote:
> I changed the Mesh module so that verts.extend() returns a sequence 
> with the structure as its input except each item replaced by the 
> MVerts added to the mesh.  It also accepts the same input format as 
> face.extend() and edges.extend() -- except the input is 3 floats, a 
> vector or a PVert.  If PVerts is given as input, the first instance in 
> the input sequence is added to the mesh as an MVert, and each 
> subsequent instance uses the MVert.
>
> So for example, this script created two faces which share two vertices:
>
> p1=Mesh.MVert(0,0,0)
> p2=Mesh.MVert(0,0,1)
> p3=Mesh.MVert(0,1,1)
> p4=Mesh.MVert(0,1,0)
>
> facelist=[[p1,p2,p3]]
> facelist.append([p2,p3,p4])
> me.faces.extend(me.verts.extend(facelist))
>
> The downside of this is PVerts and MVerts are still separate things; 
> if you later do:
>
> me.faces.extend(me.verts.extend([p1,p3,p4]))
>
> three new MVerts are created for this face.  Unless we convert the 
> PVerts to MVerts permanently on the fly, I don't see a way around this.
>
> Anyway, I haven't commited this to CVS yet since I wanted those of you 
> who are interested to play around with it first.  You can find it at
>
> http://www1.pacific.edu/~khughes/blender/Mesh.c
>
> Ken
> _______________________________________________
> Bf-python mailing list
> Bf-python at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-python
>


-- 
Campbell J Barton

133 Hope Street
Geelong West, Victoria 3218 Australia

URL:    http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241



More information about the Bf-python mailing list