Lou
Hey there,

Does anyone know a way to filter arrays and keep a part of it ?

Let say I apply a point node to a curve made of ten CVs and manipulate the point position.

Position PP attribute gives me an array of all CVs positions, but if I want to output or collect a CV in particular and not all of them ?

How can I filter and extract the data I need ?

Thanks
Reply 0 0
pshipkov
You can use group node to supply only part of the curve's CVs but the number of elements in the output arrays will always match the number of processed components - in this case CVs.
I assume you are collecting the elements you are interested in with mel/python or expressions, correct ?
In this case just read that segment of the array:
if python do this:
l = mc.getAttr("point1.outPositionPP") or []
each point position has 3 components, so to trim the array to points 10 to 20 do this:
l = l[10*3:20*3]
that basically answers your questions.
But further more - if you want to deal with say the Y translation of the points do this:
for i in range(len(l)):
    if i%2: print l[i]

Hope this helps.
Reply 0 0
Lou
It does a lot, thanks.
Reply 0 0
Reply