Passing parameters to python viewer handles

   2538   5   0
User Avatar
Member
146 posts
Joined: June 2019
Online
Right now I can bind parameters and settings to a handle so I can use exported parameters and hou.Handle.applySetting

But what if I want to pass geometry (or any other custom data) to the handle. One use case for example is custom collision for a handle.

I just can't wrap my head around it. Is there a way to communicate with the handle other from bound parameters and settings?
User Avatar
Staff
450 posts
Joined: Feb. 2018
Offline
The way to communicate with handles in Houdini (built-in or python handles) is done through parameters, which provides a generic way for handling to We don't allow handles to access geometries directly for instance. Internally we have an intermediate object called a PI (not exposed to python) which is responsible to manage the parameter mapping/access between a node and a handle. We have some use cases internally that let the PI do pretty much whatever it wants with handles. Introducing a hook between a python state and a python handle is probably harmful for the encapsulation, but I guess it would make sense for highly specialized handles.
User Avatar
Member
146 posts
Joined: June 2019
Online
Thanks!

Well, I've managed to pass a node session id as an integer setting (I just set it through hou.Handle.applySetting on state enter). So basically I have reference to whatever I want.
It's actually working but I'm not sure how bad it is
User Avatar
Staff
450 posts
Joined: Feb. 2018
Offline
elovikov
Thanks!

Well, I've managed to pass a node session id as an integer setting (I just set it through hou.Handle.applySetting on state enter). So basically I have reference to whatever I want.
It's actually working but I'm not sure how bad it is

I'm curious, are you binding a new setting and passing the node id to applySetting or just reusing an existing handle setting ?
Edited by mabelzile - May 26, 2021 10:37:13
User Avatar
Member
146 posts
Joined: June 2019
Online
Not sure if I'm not overcomplicating things...

I'm binding a new integer setting (like node_id) and then just pass node id on state start. That of course not ideal, setting is exposed and handle is not usable without a state.

But this is the only way I found where I can interact with the geometry.

Simple example is aligned handle:


I've attached a very basic example with the handle from image to illustrate what I'm doing

Attachments:
aligned_handle_demo.zip (33.2 KB)
aligned_handle.gif (1.7 MB)

User Avatar
Staff
450 posts
Joined: Feb. 2018
Offline
elovikov
Not sure if I'm not overcomplicating things...

I'm binding a new integer setting (like node_id) and then just pass node id on state start. That of course not ideal, setting is exposed and handle is not usable without a state.

But this is the only way I found where I can interact with the geometry.

Simple example is aligned handle:
Image Not Found


I've attached a very basic example with the handle from image to illustrate what I'm doing

Technically it works but it's also potentially problematic for the handle to cook a node it might be bound to in order to get the geometry. An alternative would be to align the handle from the state itself.

Take a look at geo_deformer_demo.hip
  • Quick Links