Open wiremas opened 2 years ago
Hi @wiremas, thanks for your report. I'd like to know what you're trying to do. What you're currently doing is changing the selection from a selection replaced callback, which is not good. The reason is that if there are many selection observers in Maya, those before you will see a selection replaced notification, and those after you would see a selection cleared notification --- if this works at all, which from your report appears that it doesn't.
In general, the philosophy of callbacks when a given datum changes is that you should update viewers and your data structures within the callback, but not change the datum itself, because at that point you're doing a callback order dependant re-entrant change, which makes the entire system unpredictable and hard to understand.
Is there a reason why you want the selection to be cleared when you see that it's been replaced?
Thanks @ppt-adsk for your quick reply.
We're currently investigating the switch form the AL_usd_maya
to the mayaUSD
plugin. For our environment authoring workflow we want to restrict artists from selecting certain prims that are not meant to be manipulated. Up until now we were using a customized version of the Luma Outliner to selectively display components relevant to environment authoring. Moving forward we're aiming for a more Maya native approach to ease the learning curve for new artists and remove clutter from the interface. To achieve this we have a few different ideas floating around - see separate discussion here.
The idea behind this particular issue was to remap the Outliner selection to relevant prims on the selection changed notification similar to the usd selection mode in the view port. However, the usd selection mode might not be ideal for us for two reasons:
Ideally, we'd be able to take full control over the remap behavior regardless whether an artist selects a prim in the view port, the Outliner or by whichever other means.
Just to entertain the idea of remapping prim selection on the selection changed notification for a little longer: Is there some kind of transaction manager in the UFE notice system that would allow us to "silence" or queue up notifications? (Even though this might be a bad idea and come with a whole set of other problems)
Hi all,
We're encountering an issue with selection highlighting in the Outliner when we clear the UFE selection inside a
ufe.SelectionReplaced
notification. The Outliner is still highlighting the selected prim despite nothing is actually selected. Note that we only see this issue when selecting a prim in the Outliner. When selecting a prim in the view port the selection is cleared as expected and nothing is highlighted in the Outliner.Steps to reproduce
Add New Prim
).MySelectionObserver
to the global selection:class MySelectionObserver(ufe.Observer): def call(self, notification): if isinstance(notification, ufe.SelectionReplaced): self._clearSelection(notification)
observer = MySelectionObserver() selection = ufe.GlobalSelection.get() selection.addObserver(observer)
Specs (if applicable):