CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 03-08-2011, 08:27 PM   #1
Sorath
Expert
 
Sorath's Avatar
portfolio
Bastian Traunfellner
rays of light
Wien, Austria
 
Join Date: Jan 2005
Posts: 356
calling python from maya does not work anymore..

I'm trying to call inside a standalone mel script for submitting to the farm a python script..
and messing around for hours now.. wtf is wrong with this???

Code:
import sys sys.path.append('L:/_deadline/submission/Maya') import checkGamma checkGamma.gamma()


Quote:
# Error: AttributeError: 'module' object has no attribute 'gamma' #


like that what I try from within mel

Code:
python("import checkGamma"); python("checkGamma.gamma()");


and the python code I am calling inside mel is this:

Code:
import maya.cmds as mc def global gamma(): cams = mc.listCameras (p=True) for i in cams: isRenderable = mc.getAttr (i + '.renderable') if isRenderable == True: lensShader = mc.listConnections (i + '.miLensShader') gamma = mc.getAttr (lensShader[0] + '.gamma') if not gamma == 1: request = mc.confirmDialog (title='note', message='gamma is set to 2.2 change to 1.0', button= ['yes', 'no'], defaultButton='yes', cancelButton='no', dismissString='no') if request == 'yes': mc.setAttr (lensShader[0] + '.gamma', 1) print 'gamma was set to 1' else: print 'your lensShader is set to Gamma %s' %gamma continue else: print 'your lensShader is set to Gamma %s' %gamma continue


very thankfull for input!~
 
Old 03-08-2011, 09:50 PM   #2
nessus
Frequenter
NeS
Vancouver, Canada
 
Join Date: Oct 2005
Posts: 195
You sure the py code can run fine?
def global gamma()?? really? I have never seen this.
 
Old 03-09-2011, 09:50 AM   #3
Sorath
Expert
 
Sorath's Avatar
portfolio
Bastian Traunfellner
rays of light
Wien, Austria
 
Join Date: Jan 2005
Posts: 356
it doesn't matter what I name my function.
global because It seems only to work like that when you source it from within mel.. (acc. to internet)..
 
Old 03-09-2011, 11:22 AM   #4
earlyworm
car unenthusiast
 
earlyworm's Avatar
Will Earl
craftsperson
Grizzly Country, Canada
 
Join Date: Mar 2005
Posts: 1,681
Does your def global gamma() function even work if you run it by itself? I get syntax errors when I try to define a function with global in there like you've put - I also never seen it used in python - could you point out the link where you saw this information?
 
Old 03-09-2011, 11:39 AM   #5
NaughtyNathan
HighEnd3D deserter
 
NaughtyNathan's Avatar
Naughty Nathan
Technical Artist
Sony SCEE Liverpool
Manchester, United Kingdom
 
Join Date: May 2008
Posts: 2,608
I think you must be getting mixed up between MEL and python Sorath, you don't "source" python from "within MEL"... I'm with earlyworm, def global is probably the problem...

:nathaN
 
Old 03-10-2011, 11:53 AM   #6
Sorath
Expert
 
Sorath's Avatar
portfolio
Bastian Traunfellner
rays of light
Wien, Austria
 
Join Date: Jan 2005
Posts: 356
hmm.. ok, I think I really messed something up here.
nevermind I integrated my check routines directly in the submit script.. and called all other mel stuff with maya.mel.eval
 
Old 03-10-2011, 11:53 AM   #7
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 02:44 AM.


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