CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 10-04-2012, 05:17 AM   #1
DEVILSAN
Earth Born>> goo.gl/mJh20
 
DEVILSAN's Avatar
portfolio
Sanjeev Kumar
MPC
India
 
Join Date: Jan 2005
Posts: 290
Question using getattr to set value of checkbox in mel

isnt it supposed to be like this
Code:
cmds.checkBox(onc=cmds.setattr("miDefaultFramebuffer.contourEnable", 0), value=cmds.getattr('miDefaultFramebuffer.contourEn able'))
I am trying to get the value of miDefaultFramebuffer.contourEnable and pass the value to checkbox

I keep getting error saying AttributeError: 'module' object has no attribute 'getattr' #

Last edited by DEVILSAN : 10-04-2012 at 05:32 AM.
 
Old 10-04-2012, 08:00 AM   #2
PozestStar
Your Majesty
portfolio
Melissa Starks
Cloth Sim Queen! Kinda...
Starving Artist ><
USA
 
Join Date: May 2007
Posts: 185
Send a message via AIM to PozestStar
The "a" in your getAttr and setAttr should be capitalized.
 
Old 10-04-2012, 08:44 AM   #3
DEVILSAN
Earth Born>> goo.gl/mJh20
 
DEVILSAN's Avatar
portfolio
Sanjeev Kumar
MPC
India
 
Join Date: Jan 2005
Posts: 290
strange behaviour by checkbox even label not working as expected

aaww , coz i am using an IDE and instead of tying cmds i typed getattr that brought up this !!

thanks btw now I found strange behavior of checkbox , the label is not showing up aand onc and ofc are not working as expected. first of all the value that getAttr gets from miDefaultFramebuffer.contourEnable doesnt gets reflected in the checkbox I am making then even if its checbox is drawn as unchecked , so if i turn it on nothing happens but if I turn it of it sets the value to false for miDefaultFramebuffer.contourEnable ...
I tried to do it with change command(cc) instead of using onc or ofc state change but still got the same problem
 
Old 10-04-2012, 09:59 AM   #4
zaskar
Expert
portfolio
franky****inFourFingaz
-
Dresden, Germany
 
Join Date: Dec 2010
Posts: 321
Maybe you show a portion of your code to get usefull help?
 
Old 10-04-2012, 10:18 AM   #5
DEVILSAN
Earth Born>> goo.gl/mJh20
 
DEVILSAN's Avatar
portfolio
Sanjeev Kumar
MPC
India
 
Join Date: Jan 2005
Posts: 290
there it is...

Code:
cmds.checkBox(label='Enable Contour Rendering' , onc='cmds.setAttr("miDefaultFramebuffer.contourEnable", 0)', value=cmds.getAttr('miDefaultFramebuffer.contourEn able'))

Last edited by DEVILSAN : 10-04-2012 at 10:21 AM.
 
Old 10-04-2012, 11:03 AM   #6
zaskar
Expert
portfolio
franky****inFourFingaz
-
Dresden, Germany
 
Join Date: Dec 2010
Posts: 321
Talking

here, this should work, you just set the false argument for enable, must be "1" ;]
Code:
cmds.checkBox(label='Enable Contour Rendering' , onc='cmds.setAttr("miDefaultFramebuffer.contourEnable", 1)', ofc='cmds.setAttr("miDefaultFramebuffer.contourEnable", 0)', value=cmds.getAttr('miDefaultFramebuffer.contourEn able'))

The label is displayed correctly, but if it shows up depends if your parent layout gives it enough space to be drawn by the UI. Also you should know that the miDefaultFramebuffer node wont exist until you open the quality tab of the RenderGlobals the first time.
PS you can make your UI reflect the change of the state inside the RenderGlobals by setting up a scriptJob that gets triggered if the attribute "miDefaultFramebuffer.contourEnable" changes, the script job then could be removeds if the UI of your tool is deleted.
 
Old 10-04-2012, 11:03 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 06:53 AM.


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