ufe.SelectionChanged() usage to track selected USD prims

641 views
Skip to first unread message

riga_rig

unread,
Jun 23, 2022, 10:50:27 AM6/23/22
to Python Programming for Autodesk Maya
Hi!
I use "SelectionChanged" event callback to add items to PySide ComboBox.
It works quite good for native Maya objects, but unfortunately doesn't work for USD prims.
What is a proper way to create something like SelectionChanged callback for USD primitives? Is ufe.SelectionChanged() class could work for this?
Regards,
Oleg Solovjov

Tim Fowler

unread,
Jun 23, 2022, 3:21:54 PM6/23/22
to python_in...@googlegroups.com
There is also a "UFESelectionChanged" event that you can use in
scriptJob's. Have you tried that?

-Tim
> --
> You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/67fe3a0b-2f05-4d83-bba7-e24073fcb853n%40googlegroups.com.

riga_rig

unread,
Jun 24, 2022, 4:37:25 AM6/24/22
to Python Programming for Autodesk Maya
I spend some time with Autodesk UFE documentation and found that SelectionChanged is a subclass from Notification class.
It should work as a subscriber in Observer design pattern. There is also ufe.Observer class and ufe.ObserverSelection classes.
Could anybody point me to documentation or example snippet, 
how I should configure those classes to implement SelectionChanged event for USD prims in Maya?

riga_rig

unread,
Jun 24, 2022, 4:41:38 AM6/24/22
to Python Programming for Autodesk Maya
Thank you Tim!
I just read all scriptJob command documentation and can't believe I overlooked it.
I would test it right now.

riga_rig

unread,
Jun 24, 2022, 5:17:53 AM6/24/22
to Python Programming for Autodesk Maya
It works as needed with scriptJob and with OpenMaya.EventMessage! Thank you Tim once more!
Reply all
Reply to author
Forward
0 new messages