Is there a plug-in or a MEL script that would allow for auto texture updating, or updating with a press of a custom button? Like, anything so I don't have to keep going into the attribute window of the shader node and such and such to refresh. I've tried looking for one and even through the settings, but I guess I'm not searching for the correct words or something.
Replies
http://www.highend3d.com/maya/mel/?section=rendering&sort=dt_modified+desc
Warghoul/the EA guys have a version too.
Thanks, though, Cheese.
Google -> "Maya reload texture script" ... it really is as easy as that. Saves time and effort on everyone's part if you just Google it before making a new thread
MoP
<font class="small">Code:</font><hr /><pre>
//global proc CRupdateTexAll(){
{
waitCursor -state on;
string $fileTextures[] = `ls -tex`;
int $count=0;
source AEfileTemplate.mel;
for ($node in $fileTextures)
{
if (`attributeQuery -node $node -ex fileTextureName`)
{
AEfileTextureReloadCmd ($node+".fileTextureName");
$count = ++$count;
}
}
waitCursor -state off;
print ("Reloaded "+$count+" textures"+"\n");
}
</pre><hr />
I wrote this about 5 years ago
Just used that script for a new key Saves a ton of time.
Is there any way that it could be set up to just reload a specific texture with a hotkey, instead of all textures in a scene?
Like if I was to call my texture node "WIP_Texture" or something similarly identifiable, could I edit the script to affect only that specific texture node?
MoP
If you wanted to just reload a single texture node, just change it like this:
<font class="small">Code:</font><hr /><pre>
//global proc CRupdateTexAll(){
{
string $node = "myNode";
waitCursor -state on;
source AEfileTemplate.mel;
if (`attributeQuery -node $node -ex fileTextureName`)
AEfileTextureReloadCmd ($node+".fileTextureName");
waitCursor -state off;
}
</pre><hr />
And change "myNode" to the name of the node you want reloaded.
<font class="small">Code:</font><hr /><pre>
//global proc CRupdateTexSelected()
{
waitCursor -state on;
source AEfileTemplate.mel;
string $mats[];
string $files[];
string $sel[]=`ls -sl -tr -l`;
for ($node in $sel)
{
string $shapes[] = `listRelatives -f -s -ni $node`;
for ($shape in $shapes)
{
string $sgs[] = `listConnections -d 1 -s 0 -p 0 -t "shadingEngine" $shape`;
for ($sg in $sgs)
{
if (`connectionInfo -id ($sg+".surfaceShader")`)
{
string $matCon = `connectionInfo -sfd ($sg+".surfaceShader")`;
$mats[`size($mats)`] = `match "[^.]*" $matCon`;
}
}
}
}
$mats = `stringArrayRemoveDuplicates $mats`;
for ($mat in $mats)
{
string $nodes[] =`listHistory $mat`;
for ($node in $nodes)
{
if (`nodeType $node`=="file" || `nodeType $node`=="psdFileTex")
$files[`size($files)`]=$node;
}
}
$files = `stringArrayRemoveDuplicates $files`;
int $count=0;
int $count2=0;
for ($file in $files)
{
if (`attributeQuery -node $file -ex fileTextureName`)
{
string $theFile = `getAttr ($file+".fileTextureName")`;
if (`filetest -r $theFile`)
{
AEfileTextureReloadCmd ($file+".fileTextureName");
$count++;
}
else $count2++;
}
}
if ($count2) print ("Reloaded "+$count+" texture"+ ($count>1?"s":"")+", skipped "+$count2 +" texture"+ ($count2>1?"s":"")+"\n");
else print ("Reloaded "+$count+" texture"+ ($count>1?"s":"")+"\n");
waitCursor -state off;
}
</pre><hr />
I added a few nice things:
* It does file nodes & psd file nodes
* It does all maps in the shader heirarchy
* Doesn't try to reload missing map files (when you get stuff from other people, eg.)
Works great Whargoul, thanks.