View Full Version : getting the render globals into a text file

11 November 2003, 02:55 AM
Still working on my mel/perl interface to the command line render. I have a bit of code that is supposed to read the render global values for a specific scene file into a txt file on the c drive.
When I run it I get the error

// Error: line 9: Message attributes have no data values. //

Not sure why this dosent work. What am I missing here? From what I though I did this cycles thru all the attributes and querries their values. I think it is dying on the first value "message" does anyone know what this is?



string $globals[] = `listAttr defaultRenderGlobals`;
$globals = `sort $globals`;
string $filename = ("c:\\render_globals.txt");
int $fileID = `fopen $filename "w"`;

for ( $eachitem in $globals ){
string $atribValueCmd = "defaultRenderGlobals." + $eachitem;
$atribValueCmd = " defaultRenderGlobals." + $eachitem;
string $atribValue = `getAttr $atribValueCmd`;
fprint $fileID ($eachitem + "\n" + $atribValue);

fclose $fileID;

11 November 2003, 03:40 PM
You can't do a getAttr on a message attribute. message attributes are (as far as I can tell) just a convient way to make a connection between 2 objects. We tend to use them on our character rigs quite a bit.
I'd just skip this in your script.
The other thing I'd look into for this is to save the render globals as a preset.


11 November 2003, 06:01 PM
there is a number of renderGlobals-attributes, that do not carry values and therefore cause errors along with execution-halts.

you'd need to do some "type"-checking before the "getAttr"-bit, which is tideous, letmetellyou!

i wrote a script that kinda reports current renderglobalwindow-settings into an executable mel.script, and i did it comme ca ("that's french, vern!"):

string $rg [] , $rs [] , $rq [] ;
$rg = sort(`listAttr -s -v -r -w "defaultRenderGlobals"`) ;
$rs = `listAttr -v -w "defaultResolution"` ;
$rq = `listAttr -v -w "defaultRenderQuality"` ;

(the 'sort'ing is only for it to look prettier! ;))

i forgot what the shorthand options all mean, but it does the trick, if you miss any other attrib. you need to check whether it returns data of the right kind.


CGTalk Moderation
01 January 2006, 02:00 PM
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.