I’m experimenting with polys instead of curves for controls ( like bungie uses).
I’m trying to achieve the effect that a set of controls is invisible but selectable,
and when selected, they become visible
I have show()
/hide()
functions that
- lists the node’s materials
- iterates the list and sets material.transparency
I have an onSelectionChanged_displayCtrls()
function that:
- finds every control object in the scene via pm.ls & pm.listConnections()
- iterates that list
- tests if they need to be shown
- shows/hides as needed
Finally I have a script Job:
pm.scriptJob(event=["SelectionChanged", onSelectionChanged_displayCtrls()])
It seems to be functioning as designed, but I wonder some things:
Is a scritpJob the only/best way to get a dagNode to respond to a SelectionChanged event?
Are there some pitfalls I should know?
I think some things which might be sped up are
- filtering all the sceneNodes to find control objects
- querying node’s materials.
I was thinking of creating a displayOnSelect Attribute for each control ,what would be connected to its material.transparency attribute, and then using pm.listAttr(“displayOnSelect”) to test each node and toggle the attribute. I think that might use less looping.
I’m interested in any feed back, and hearing how others do this.