View Single Post
# 15 30-08-2011 , 03:05 PM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988

#1
in case files get overwritten, how can I integrate an "auto-YES, please overwrite that file" into the script?

Before "if (`getApplicationVersionAsFloat` >= 2011)", put:

Code:
string $renderedFilename = ($folder + "/" + $outputFolder + $layer);

if (`filetest -e $renderedFilename`)    // image exists. delete it.
    sysFile -del $renderedFilename;

#2

Code:
# Error: AttributeError: ImageFormats instance has no attribute 'oldOutf' #
if I replace
Code:
`getAttr defaultRenderGlobals.imageFormat`
with
Code:
"PNG"
result:
Code:
// Error:  // 
// Error: Syntax error //

The AttributeError is not a problem. It still renders.

Replace `getAttr defaultRenderGlobals.imageFormat` with 32 (the file extension enumeration index).

Eg.

Code:
renderWindowSaveImageCallback ($renderPanel, ($folder + "/" + $outputFolder + $layer), 32);

#3

Code:
connectAttr -force ($myDiffuseTexture + ".outColor") shader_gamma.value;
connectAttr -force ($myNormalTexture + ".outAlpha") shader_bump2d.bumpValue;
if the corresponding textures are already applied,
Code:
// Warning: 'DT_2.outColor' is already connected to 'shader_gamma.value'. //
and the script stops there. I tried to make use of the catch() command, but maya always returns
Code:
// Error: Invalid use of Maya object "connectAttr". //

Not sure what the problem is there. Did you put:
Code:
catch(eval(connectAttr -force ($myDiffuseTexture + ".outColor") shader_gamma.value));
?


Imagination is more important than knowledge.