On 15/10/2013 at 05:05, xxxxxxxx wrote:
well simpy use polys = nbr.GetPointPolys(pid) to its full extend then. the method does return
all polygons attached to a point, so polys holds all polygons attached to a selected point from our
point selection list., which means you have access to all uvw_dict indices that define a uvw vector
for that point index. i just used the first polygon as this was just an example.
import c4d
from c4d import utils
def main() :
if op:
uvwtag = op.GetTag(c4d.Tuvw)
if uvwtag is not None:
nbr = utils.Neighbor()
nbr.Init(op)
seldata = op.GetPointS().GetAll(op.GetPointCount())
pnt_ids = [id for id, val in enumerate (seldata) if val == True]
for pid in pnt_ids:
polys = nbr.GetPointPolys(pid)
if isinstance(polys, list) :
print 'point index: ', pid
print 'attached uvw_coords:'
for i in xrange(len(polys)) :
cpoly = op.GetPolygon(polys[i])
uvwdict = uvwtag.GetSlow(polys[i])
if pid == cpoly.a:
print 'polygon ID {0}, a : {1}'.format(polys[i], uvwdict['a'])
elif pid == cpoly.b:
print 'polygon ID {0}, b : {1}'.format(polys[i], uvwdict['b'])
elif pid == cpoly.c:
print 'polygon ID {0}, c : {1}'.format(polys[i], uvwdict['c'])
elif pid == cpoly.d:
print 'polygon ID {0}, d : {1}'.format(polys[i], uvwdict['d'])
if __name__=='__main__':
main()
point index: 1
attached uvw_coords:
polygon ID 4, a : Vector(0, 1, 0)
polygon ID 3, c : Vector(1, 0, 0)
polygon ID 0, b : Vector(0, 0, 0)
point index: 7
attached uvw_coords:
polygon ID 4, b : Vector(0, 0, 0)
polygon ID 3, b : Vector(0, 0, 0)
polygon ID 2, c : Vector(1, 0, 0)