Mel - Python Problem

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  05 May 2017
Mel - Python Problem

Hi CG Forum,

I'm pretty new in Python Programming and needed to use a Mel Script in my Code. Unfortunately, it doesn't work at the Moment. I get the error message:
// Error: Line 9.62: "$varia" is an undeclared variable. //
// Error: setAttr "defaultRenderGlobals.imageFormat" $format;
// Error: Line 11.54: "$format" is an undeclared variable. //

I need the Mel Script for creating Screenshots (I know there is a way in Python).
Any Help would be appreciated.
Greetings Eli

---------My Python Function
def melScript(path, Name):
mel.eval('source"'+path+'";') #works #makes Screenshot only Problem: Name übergeben

-------Mel File
global proc makePic(String $path,String $name)
// keep the old format
String $varia = $path+$name
int $format = `getAttr "defaultRenderGlobals.imageFormat"`;
// set to render to .png image
setAttr "defaultRenderGlobals.imageFormat" 32;
// playblast one frame to a specific file
playblast -frame 1 -format "image" -cf $varia -v 0 -wh 240 175 -p 100;
// restore the old format
setAttr "defaultRenderGlobals.imageFormat" $format;


Another Problem would be the function cmds.file seems to ignore the material Setting (I want to export Objs without Material Files). If someone knows a good Workaround that would be great.

cmds.file(ChoosenPathObj +'/'+ownName, exportSelected=True, pr=False, typ="OBJexport",force=False,shader=False,stx='never',op="groups=0; ptgroups=0; materials=False; smoothing=0; normals=0")
reply share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 12:24 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.