Hello,
I'm writing a python state embedded in an HDA.
I'm trying to make a viewer state where a user can add points by clicking the LMB. At the same time I would like to show a 'translate' handle per point. (similar to the 'add' node viewer state)
Adding points is easy, as there is a sample viewer state for that.
But I can't seem to add a translate handle when a point is created. I keep getting 'invalid input' errors because Houdini doesn't recognize the handle name, probably because I can't call .bindHandle or .bindHandleStatic from within the viewer state class.
Right now I solved my problem by adding an arbitrary amount of (static) handles in the "createViewerStateTemplate()" function and then setting them to visible when the user adds a point. This way however there is only a maximum amount of handles I can show.
So, is there a way to add handles to a state without having to create them in the "createViewerStateTemplate()" function first?
Thanks in advance!
Python Viewer State: generating handles at runtime
2527 5 1-
- Jehs_Joris
- Member
- 5 posts
- Joined: Sept. 2020
- Offline
-
- mabelzile
- Staff
- 454 posts
- Joined: Feb. 2018
- Offline
There is no way at the moment to add handles dynamically. Your workaround seems fine however you could limit the number of static handles bound to the state and use drawables to represent a handle "marker" for each point. You could show the handle and hide the drawable when the user click on the handle "marker". This is similar to the approach used for the KineFx rig pose.
-
- Jehs_Joris
- Member
- 5 posts
- Joined: Sept. 2020
- Offline
-
- mabelzile
- Staff
- 454 posts
- Joined: Feb. 2018
- Offline
-
- jsmack
- Member
- 8322 posts
- Joined: Sept. 2011
- Online
-
- Jehs_Joris
- Member
- 5 posts
- Joined: Sept. 2020
- Offline
mabelzileI was referring to the viewer state for the add SOP. When you add a point and enter the node's viewer state, there's a translate handle for each point.
Are you referring to the python state add demo ?
jsmackJehs_Joris
Thank for the answer. I wonder though how the 'add' node viewer state manages to do it? Or maybe built-in nodes have more options available?
The add sop has a bunch of dead handles at the origin for inactive points. I don't think it's dynamic.
So it's similar to the way I solved it, thanks!
-
- Quick Links


