Select a single edge loop on many objects?

Select a single edge loop on many objects?

Anonymous
Not applicable
1,633 Views
5 Replies
Message 1 of 6

Select a single edge loop on many objects?

Anonymous
Not applicable

Might be a longshot, but I'm there is a way to automate a process.

 

I have a hair groom that was done in Max and was able to get the strands into Maya as polygons. Next I  would like to convert these 3-sided polygon strands into Curves.

 

I can do this by selecting an edge loop on a single strand and selecting modify>convert>polygon edges to curve.

 

Now, how can I automate this for all polygonal strands?

1,634 Views
5 Replies
Replies (5)
Message 2 of 6

dariush
Advocate
Advocate

Really interesting situation. Ok, so I know this is what MEL returns when you select an edge loop (on a torus in this example):

select -add pTorus1.e[180:199] ;

So IF your objects are named in such a way that you can put them numerically (hair001, hair002, etc) to be put into a loop, and you know what edge numbers a loop represents, then you can conceivably script this to work.

For for example, you could loop something like this (where X is the number of the hair, and assuming edges 1-8 will give you the loop):

select -r pTorusX.e[1:8] ;

 

Then you can run the conversion MEL, which for me returned this MEL for the 8 edges I selected with the previous command:

polyToCurve -form 2 -degree 3 -conformToSmoothMeshPreview 1;

So you would just need to loop the X to step through each hair object, and run the select/convert lines.

 

Message 3 of 6

Anonymous
Not applicable
I see your line of thinking, man, I wish I spent more time scripting
sometimes. The trouble with this approach is that the hair strands are
different lengths and therefore would have different edge counts. I'd also
need to separate each strand into its own shape first.

One direction I am thinking is that because the tips of the strands are not
capped, there may be a way to select borders, deselect 2 of the 3 vertices
on each border and create an edge loop selecting from the single vertice
(only if the loop is greater than 3 edges, to avoid the loop going around
the border).... hm...

There may also be a way to solve this in UV space, if the UV's were
generated in a uniform manner and all laid on top of each other
0 Likes
Message 4 of 6

dariush
Advocate
Advocate

Yeah, se, this is when I would grab an intern and have them do it. 😉

 

UV is a very interesting proposition, are the strands at least on the same plane at the tip? In this way maybe there's a way to flat project UVs on them, but I suppose they are facing different directions, but you can get some sort of height information on them.

I have a feeling this will turn out to be one of those things that takes longer to solve than it does to do it yourself (or throw to an intern).

0 Likes
Message 5 of 6

Anonymous
Not applicable
Yup! That's the dilemma! The only payoff would be through repetition.
Thanks for weighing in.
0 Likes
Message 6 of 6

dariush
Advocate
Advocate

I was just thinking. If you select ALL the edges on one hair, and then run the conversion, Maya will ONLY convert the first run of edges in a loop it finds and doesn't do anything with the remaining selected edges after returning a warning in the script editor. So you may be able to script to select a large number of edges (like [1-99] and trust that the NURBS curve to be made out of the first loop only. This assumes you're ok with indiscriminate selection of loops.

 

So now if the object naming can be used in a loop (a For loop I think, I don't really script, I just help guide the pipe with smarter people than me] then you can scrip this all day long.

If the naming is random, then I'd select one hair, run a script (see below) and then go and select the next one, to at least minimize the manual nature of it. The script would:

  1. read the name of the selected object and assign it as a variable (let's say N)
  2. then it runs the select edges mel command to select edges[1-99] on N object
  3. then it runs the conversion
  4. then it assigns the geom to an invisible display layer to get it out of the way

That way you pick and hit one button on your shelf, and then pick, etc. This is if the naming is FUBAR and can't be looped. Otherwise I think this would work. Some hairs may fail if the first loop Maya finds is a short one, but that hopefully will be a small percentage.