Python States: Dynamic Parameters?

   1606   4   1
User Avatar
Member
575 posts
Joined: Nov. 2005
Offline
Hi I want to change a menu parameter of a state, depending on the input geometry. similar to the weight paint tool, that shows all the bones that are available to paint.
How can I achieve this. The menu gets defined in the createViewerStateTemplate method, but there I have no access to the object that invokes the state.
I also guess, that this is not the right place to define a dynamic behavior of the menu

is there a way to modify the content of a menu parameter in relation to the input geometry, for example?

thanks You for Your time
User Avatar
Staff
396 posts
Joined: Feb. 2018
Offline
There is no support yet to define a context menu dynamically but you can update the menu and menu items with `onMenuPreOpen`.

Check out the context menu help. [www.sidefx.com]
User Avatar
Member
575 posts
Joined: Nov. 2005
Offline
Thank You.
.
Edit: Maybe I'm missing this, but I can not see a way to build menu entries from scratch in the onMenuPreOpen method.
Edited by sanostol - Jan. 13, 2021 09:13:43
User Avatar
Staff
396 posts
Joined: Feb. 2018
Offline
sanostol
Thank You.
.
Edit: Maybe I'm missing this, but I can not see a way to build menu entries from scratch in the onMenuPreOpen method.

You can only update the existing context menu like enabling/disabling a menu, setting a menu item value (i.e. toggle menu) or changing a menu item's label, etc...
User Avatar
Member
575 posts
Joined: Nov. 2005
Offline
Thanks for clarifying.
  • Quick Links