How to set Prim Outliner Colors through scripting? #4344
-
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
|
The Outliner color information is stored as customData in the session layer. The function To set it yourself you would do something like (this assumes using a later version of Maya that has a Ufe SceneItem which supports group meta data): import ufe
from maya.internal.ufeSupport import ufeCmdWrapper as ufeCmd
item = ufe.GlobalSelection.get().back()
# Get ufe commands for the two metadata.
cmd1 = item.setGroupMetadataCmd('SessionLayer-Autodesk', 'Use Text Color', True)
ufeVec = ufe.Vector3d(0, 1, 0)
cmd2 = item.setGroupMetadataCmd('SessionLayer-Autodesk', 'Text Color', ufe.Value(ufeVec))
# Create ufe composite command from both commands above and execute it.
cmd = ufe.CompositeUndoableCommand([cmd1, cmd2])
ufeCmd.execute(cmd)Sean |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the quick reply Sean! I tested the code you sent, but it looks like our version of Maya (2024) doesn't support that yet. I was able to work around this though by manually authoring the customData in the session layer, but I found that it doesn't immediately show up until a outliner refresh occurs. Would you know how to trigger that? |
Beta Was this translation helpful? Give feedback.
-
|
Had this same issue with the outliner. You can refresh them using this: |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the help all, will close out as resolved |
Beta Was this translation helpful? Give feedback.

The Outliner color information is stored as customData in the session layer.
The function
_updateTextColorChangedin the file displayCustomControl.py is where you can see the values being set, using Ufe.To set it yourself you would do something like (this assumes using a later version of Maya that has a Ufe SceneItem which supports group meta data):