PDA

View Full Version : tri and texture seam toggle?


rob-beddall
04-20-2006, 02:15 PM
hey!!

i'm looking for a couple of scripts. :)
the first one i need as a toggle for the hidden triangle's on poly's to be on/off.

the 2nd I need one that can toggle the the texture borders on/off on poly objects.
I need to be able to assign these commends to either a hot key or a shelf button.

any help on this would be greatly appreciated as i know absolutely nothing about Mel scripting.

cheers!!

Robert Bateman
04-20-2006, 03:48 PM
I don't know if this is what you mean. If you look in the node and attr reference for mesh, you should see a bunch of bool attributes that can replace the "displayTriangles" below and should work. You can turn the borders on there, however i'm not sure about how to set the UV border display.


global proc turnOnTris()
{
$meshes = `ls -type mesh`;
for( $m in $meshes )
{
setAttr ($m+".displayTriangles") 1;
}
}
global proc turnOffTris()
{
$meshes = `ls -type mesh`;
for( $m in $meshes )
{
setAttr ($m+".displayTriangles") 0;
}
}

Segmoria
04-20-2006, 04:12 PM
And the UV border display can be toggled using:
polyOptions -displayMapBorder 1; // on
polyOptions -displayMapBorder 0; // off

Segmoria
04-20-2006, 04:51 PM
And because I suspect that you won't be able to assemble a working script solely by our comments, here they are:


// operation: Turn on/off triangles //
{
$meshes = `ls -sl`;
for( $m in $meshes )
{
int $dispTri = `getAttr ($m+".displayTriangles")`;
if ($dispTri==1)
{
setAttr ($m+".displayTriangles") 0;
}
if ($dispTri==0)
{
setAttr ($m+".displayTriangles") 1;
}
}
}


// operation: Turn on/off UV map Borders
{
string $meshes[] = `ls -sl`;
for( $m in $meshes )
{
select -r ($m);
int $dispUV[] = `polyOptions -q -displayMapBorder`;
if ($dispUV[0]==1)
{
polyOptions -displayMapBorder 0;
}
if ($dispUV[0]==0)
{
polyOptions -displayMapBorder 1;
}
}
select $meshes;
}

Now copy and paste each of those scripts (one at a time) into the script editor, select all of it and middle-drag-and-drop it into a shelf, and here is your button. (Each script is for a different button).
To run properly this script just select the polygon objects you want to toggle and press the button that corresponds to the toggle type you want to perform.

CGTalk Moderation
04-20-2006, 04:51 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.