Using polys instead of curves for controls

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.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.

If you’re willing to tag your nodes with an attribute'*.attribute_name') should return every node that has that attribute in one call.

You can also flag any control with the Controller Tag (basically a network node connection under the hood) - when enabled you can use custom pick-walking with them and visibility based on proximity. They’ll also get a speed up if you enabled them in the animation setting to take advantage of parallel evaluation - you’ll be able to filter by them too:

1 Like