Skip to content

Instantly share code, notes, and snippets.

@hmasato
Last active August 29, 2015 13:56
Show Gist options
  • Save hmasato/8818402 to your computer and use it in GitHub Desktop.
Save hmasato/8818402 to your computer and use it in GitHub Desktop.
[Maya, mel] _ovrAttr
//override & set
proc _ovrAttr(string $node, string $attr, string $v)
{
string $plg = $node + "." + $attr;
if(!objExists($plg)) return;
editRenderLayerAdjustment($plg);
string $cmd = "setAttr \""+$plg+"\"";
string $typ = `getAttr -type $plg`;
switch($typ){
case "string": $cmd += " -type \"string\" \"" + $v + "\""; break;
case "float3": $cmd += " -type \"float3\" " + $v; break;
case "double3": $cmd += " -type \"double3\" " + $v; break;
//case "...": $cmd += ......; break;
default: $cmd += " " + $v; break;
}
eval($cmd);
}
//ex:
//string $node = "defaultRenderGlobals";
//_ovrAttr($node, "imageFilePrefix", "<RenderLayer>\\\<RenderLayer>");
//_ovrAttr($node, "imageFormat", 3);
//_ovrAttr($node, "animation", yes);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment