I've tried something new that i think is working.
Since i can source the mel script and run the procedure in it without errors and it STILL makes no changes in the original file, I've now tried just appending all the mel commands i was using to the end of the maya file.
When i run these mel commands through the script editor they don't seem to be directly thrown into the ma file. They end up adding lines that dont resemble the original mel commands, but it seems like if i add the mel lines to the end, at render time they're run just as if they were put into the script editor and it SEEMS to be producing frames equivalent to those treated through the script editor.
Can anyone tell me if it makes sense to do this? is maya just interpreting the mel commands and making the changes right at render time? it sure seems to be...
QUOTE(starkes @ 06/23/09, 07:35 AM) [snapback]309961[/snapback]
Hi,
I've been trying to get a mel script to run on a maya file without opening maya.
I need to run the following lines on a scene before it gets sent off to the render farm, but without manually opening each file and doing it because it takes more time to do than the rest of the render submission process:
setAttr "defaultResolution.width" 1280;
setAttr "defaultResolution.height" 720;
setAttr "frontShape.renderable" 0;
setAttr "perspShape.renderable" 0;
setAttr "sideShape.renderable" 0;
setAttr "topShape.renderable" 0;
string $rendQual[] = listConnections defaultRenderGlobals.qual
;
setAttr ($rendQual[0] + ".edgeAntiAliasing") 0;
setAttr ($rendQual[0] + ".useMultiPixelFilter") 1;
setAttr ($rendQual[0] + ".shadingSamples") 2;
setAttr ($rendQual[0] + ".maxShadingSamples") 8;
setAttr ($rendQual[0] + ".visibilitySamples") 1;
setAttr ($rendQual[0] + ".maxVisibilitySamples") 4;
setAttr ($rendQual[0] + ".redThreshold") 0.4;
setAttr ($rendQual[0] + ".greenThreshold") 0.3;
setAttr ($rendQual[0] + ".blueThreshold") 0.6;
setAttr ($rendQual[0] + ".reflections") 10;
setAttr ($rendQual[0] + ".refractions") 10;
setAttr ($rendQual[0] + ".shadows") 10;
I have tried throwing the lines into a mel file and running it through the command line but it never seems to work.
currently, i've tried a few different things, the first i thought would run these lines when it sources the mel file:
maya -batch -file MELTEST.ma -command "source prerender.mel"
also, i've put all the above lines into a procedure called prepRender and tried calling it like this:
maya -batch -file /db/PSIrender/scenes/MELTEST.ma -script "prerender.mel" -command "prepRender"
it cant find the procedure, although i know it can find the mel file containing it because if i move the mel file from one of the default directories it will throw an error.
All i need to do is run these lines, which work perfectly when they're thrown into the script editor. I've looked through a few examples of people doing something similar but it seems like just sourcing the file doesn't run the commands inside it somehow for me. Everything remains unchanged.
Any ideas?
edit - this is the output i get when i run my current shot at it. it seems like i can now source the mel file and run the function inside it called setRenderGlobals, but the resulting ma file is no different than the first. i'm checking this by rendering it after changing the resolution i specify in the mel file, both come out the same whereas if i run the mel commands in the script editor, they will render with different resolutions. the errors that show up are not the problem:
[root@psiren07 scenes]# maya -batch -file /db/PSIrender/scenes/renderGlobalsLinux.01.ma -c ommand "source prerender.mel; setRenderGlobals" > results.txt
Maya