View Full Version : Script - Hardware Texturing Auto Redraw
10-18-2010, 01:31 AM
-I just upgraded to maya 2011 so I'm not sure if this if this is needed anymore, but it is worth a try
I'm trying to write a quick script that allows me redraw any texture and quickly get rid of artifacts while working in the UV Editor. I saw in a a video they did this by manually by changing the hardware texturing resolution and switching up resolutions. I just want to automate this by making a shelf button. I'm not very familiar with maya scripting, so the only thing I can manage is echo all commands deal.
Any suggestions to what I could do?
10-20-2010, 01:44 AM
I saw in a a video they did this by manually by changing the hardware texturing resolution and switching up resolutions.
Can you post a link to this vid, or some picture that shows your problem?
10-20-2010, 03:13 AM
The video I saw it in was UV mapping 101 part of the Gnonmon workshop collection.
I thought it would be useful to create a small script that would allow me to quickly change the hardware texture res back and forth to sort of redraw or refresh the texture if I get any artifacts.
Hey man, I had this problem myself a few years back, you can throw this into a button and it will do the trick for you. I apologise that there is no comments or anything, its one of my written for production jobbys.
string $selObj = `ls -sl -type "transform"`;
for ($obj in $selObj)
string $shapes = `listRelatives -s $obj`;
string $shapeNode = $shapes;
string $shadingGroups = `listConnections -s false -d true -type "shadingEngine" $shapeNode`;
string $shadingGroup = $shadingGroups;
for ($shadingGroup in $shadingGroups)
string $matInfo = `listConnections -type "materialInfo" $shadingGroup`;
$info = $matInfo;
string $shader = `listConnections -d false -s true ($shadingGroup + ".surfaceShader")`;
string $texCon = `listConnections -s true -d false ($shader + ".color")`;
string $texture = $texCon;
$connections = `listConnections -connections true -shapes true ($info+".texture")`;
if (`attributeQuery -node $texture -exists "resolution"`)
deleteAttr -at resolution $texture;
for ($i = size($connections); $i > 0; $i -= 2)
disconnectAttr ($connections[$i-1]+".message") $connections[$i-2];
connectAttr ($texture+".message") ($info+".texture");
addAttr -ln resolution -at long -dv 32 $texture;
setAttr ($texture+".resolution") 256;
10-28-2010, 12:04 AM
Wow this is perfect! It was driving me crazy trying to figure this out, thanks for the help!
10-28-2010, 12:04 AM
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.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.