Home Technical Talk

Maya MEL Script help needed (UV border edges)

1
MoP
polycounter lvl 18
Offline / Send Message
MoP polycounter lvl 18
So I'm starting to get into MEL script, spent about 20 minutes tonight trying to make this script, and for the most part it was a success, and actually easier than I thought it would be, which is nice.

Script overview:
For any arbitrary object, find any UV border edges, and make those all Hard Edges, while leaving all other interior edges as Soft Edges.

It works 99% of the time, but will not work on UV shells which only have border verts, since the way Maya converts UV verts to edges means that it will select ALL edges attached to each selected UV vert, rather than just edges shared by selected UVs.

People keep telling me how flexible and awesome MEL script is, so now's the time to show me smile.gif

Here's an image demonstrating the problem, and the solution I'd like to reach:
maya_script_01.jpg

You'll notice that the UV shell highlighted on the left does not get its interior edges softened, because they are all attached to UV border verts. The other UV shells all work out correctly.
The lower part of the image shows what I want to achieve (basically just making the edges highlighted in red soft like the other interior edges).

Here's what the script does so far (yes, I'm aware it could probably be optimised a bit, this is my first MEL script ever, so go easy on me! smile.gif )

<font class="small">Code:</font><hr /><pre>changeSelectMode -object;
string $objList[] = `ls -sl`;
for ($subObj in $objList) {
select -r $subObj;
polyNormalPerVertex -ufn true;
polySoftEdge -a 0 -ch 1 $subObj;
select -r $subObj.map["*"];
polySelectBorderShell 1;
textureWindowSelectConvert 2;
PolySelectTraverse 2;
invertSelection;
polySoftEdge -a 180 -ch 1;
}
select -r $objList;</pre><hr />
Basically it's just stepping through what I'd do if I was going to do this manually, so it's probably possible to condense this down to just one or two lines instead of this many, but I haven't got around to that yet.

Here is an OBJ file of my simple test object, if any MEL gurus here would like to have a crack at this problem...
http://www.greveson.co.uk/dump/script_test_object.obj

Any help or advice would be much appreciated. It will be good if it's just a flag or option somewhere that I have missed...

Replies

1
Sign In or Register to comment.