Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

How to set RGB color for Drawing Overrides with python

How to set RGB color for Drawing Overrides with python

Anonymous
Not applicable
17,980 Views
4 Replies
Message 1 of 5

How to set RGB color for Drawing Overrides with python

Anonymous
Not applicable

Hello,

 

I did not manage to find a way to change the RGB color for my controllers via a pyhton script.

This only enables RGB, but I also found that the slider still reacts as if the mode was in Index

 

 

cmds.setAttr("controllerShape1.overrideRGBColors",1)

 

 

Is there a way to do this ?

 

Cheers

MF

0 Likes
Accepted solutions (1)
17,981 Views
4 Replies
Replies (4)
Message 2 of 5

cheng_xi_li
Autodesk Support
Autodesk Support

Hi,

 

it should be something like

 

setAttr "lambert1.color" -type double3 0.5 0.5 0.5 ;

in Python version.

 

Yours,

Li

Message 3 of 5

Anonymous
Not applicable
Accepted solution

Thanks!

 

I meant for the Drawing Overrides but thanks to you I found the attributes.

I found the attribute overrideColorR and so on.

 

def setRGBColor(ctrl, color = (1,1,1)):
    
    rgb = ("R","G","B")
    
    cmds.setAttr(ctrl + ".overrideEnabled",1)
    cmds.setAttr(ctrl + ".overrideRGBColors",1)
    
    for channel, color in zip(rgb, color):
        
        cmds.setAttr(ctrl + ".overrideColor%s" %channel, color)
Message 4 of 5

Anonymous
Not applicable

This should be the accepted answer, as the one that's accepted is wrong.

0 Likes
Message 5 of 5

Anonymous
Not applicable

Yes you are right changed the solution.

0 Likes