PDA

View Full Version : Simple help: scanning vertex locations in polys



jeric_synergy
01-02-2011, 10:01 PM
If someone could point me at the relevant functions, I'll figure out the rest (just can find 'em in the dox):

I want to determine the location of all the points in a given, selected batch of polygons, so I need to 'scan' their points. What's the LScript function to increment along the index to the points of a given polygon?

(I also have to scan THRU an array of polys, but I figure that method will pop out soon enough.)

Thanks!

jameswillmott
01-02-2011, 10:54 PM
For a given polygon you should be able to access an array called points[] and simply walk through it. This will double up if the points are shared between more than one polygon, I'm not sure if that's an issue for you?


//p is a polygon
//make sure you're in meshedit mode frst

editbegin();

for ( i = 0 ; i < p.pointCount ; i++ )
{
//..do something with p.points[i]
}

editend();

jeric_synergy
01-03-2011, 12:15 AM
Thanks James, that should get me close enough.

I'm just making a utility that will double the number of segments in a polychain, which seems like something we should be able to do, but I haven't found a function for it amongst the subdivision tools (dagnabit).

This is for existing hairguides that need to react more smoothly with dynamics.

It's probably also a way to reliably crash FFX. (I'm pretty sure if you muck w/hairguides in modeler, it crashes FFX if running simultaneously.)

jeric_synergy
01-03-2011, 10:15 PM
Hmmm.... okayyyy, having a bit of difficulty grokking the "dot" nomenclature. Aren't polygons accessed via their index and the
"polygons[]" array? So, how is "p" made a reference to a specific polygon?

(This is where having a tablet to peruse the PDFs would be sooooooo handy.......)


For a given polygon you should be able to access an array called points[] and simply walk through it. This will double up if the points are shared between more than one polygon, I'm not sure if that's an issue for you?


//p is a polygon
//make sure you're in meshedit mode frst

editbegin();

for ( i = 0 ; i < p.pointCount ; i++ )
{
//..do something with p.points[i]
}

editend();

jameswillmott
01-03-2011, 10:25 PM
Hmmm.... okayyyy, having a bit of difficulty grokking the "dot" nomenclature. Aren't polygons accessed via their index and the
"polygons[]" array? So, how is "p" made a reference to a specific polygon?



p = polygons[4];

info ( p.pointCount() ); // point count of polygon #4

I think you could also refer to the item directly...


polygons[4].pointCount();