Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to set "Use Outliner Color" with python ?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
huseila
704 Views, 2 Replies

How to set "Use Outliner Color" with python ?

Hi all,

 

I tried to set "Use Outliner Color", "Hidden In Outliner" and "Outliner Color" with commands like this:

 

import maya.cmds as cmds

cmds.setAttr('pSphere1.useOutlinerColor', True)

cmds.setAttr('pSphere1.hiddenInOutliner', True)

cmds.setAttr('pSphere1.outlinerColor', 0.1, 0.5, 0.7, 'float3')

but it doesn't work at all. The most strange thing is I don't get any mel command feedback when toggling these options. Is this a bug ?

 

 

 

2 REPLIES 2
Message 2 of 3
Kahylan
in reply to: huseila

Hi!

 

Your commands work perfectly fine. the only problem is, that your attribute editor and outliner aren't updating, if you select and unselect your "pSphere1" the changes should show.

If you want the changes to show immediately, you need to forcefully update the Attribute editor. Sadly there isn't a command in maya.cmds that updates the Attribute Editor, but you can use python to call the MEL command:

import maya.cmds as cmds
import maya.mel as mm

cmds.setAttr('pSphere1.useOutlinerColor', True)

cmds.setAttr('pSphere1.hiddenInOutliner', True)

cmds.setAttr('pSphere1.outlinerColor', 0.1, 0.5, 0.7, 'float3')

mm.eval("updateAE pSphere1 ")

 

I hope it helps!

Message 3 of 3
huseila
in reply to: Kahylan

It works perfectly ! Thank you for your help 🙂

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report