Pre-Transform behavior of obj HDA transform handle

   667   0   1
User Avatar
Member
39 posts
Joined: Feb. 2017
Offline
I have been trying to build some custom transform-like HDAs for our pipeline and have run into a behavior that I'm not sure I totally understand.

In a demo scene, I have two object nodes -- a geometry node with a pighead in it, and an HDA that was created from a geometry node (also with a pighead in it). The HDA has a Transform handle added to it and wired up to the default / mandatory transform parms (t, r, s, p, etc.). I've also added spare parameters for the pre-transforms, using the built-in Node Properties tab in the Operator Type Properties window, and connected them all using the OTP Handle editor:


After wiring up the HDA it seems at first to behave exactly like the default geometry node, with the HDA Transform handle changing parm values correctly. However, if I begin modifying the pivot with the Transform handle, problems become apparent.

In this test I've used the Transform handle to move each node 5 units, rotated them 45 degrees, then moved the pivots back to the origin with the handle in World Space mode. The result is the pigheads don't line up:


The values in the parm inspectors are identical, and even the pre-transform values in the spare parms I added to the HDA look correct, but if I inspect the nodes you can see that although the parms are changing on the HDA, the underlying transform matrix is not being updated.

To confirm this is specifically an issue with the Transform handle added to the HDA, I repeated the test using the discrete Translate & Rotate handles and the pigheads line up perfectly -- the parm values again look the same but this time so do the transform matrixes:


I wrote a python function in the HDA module that reads those pre-transform spare parameters and updates the underlying matrix using hou.Node.setPreTransform(), and that also produces the correct result, but I'm not clear on whether there is a way to trigger it by moving the Transform handle. Adding it as a callback to the pre-transform spare parms does nothing as they are being changed indirectly.

So I guess I have 2 questions about this scenario:

1.) Is there a way to rig up a Transform handle on an HDA that will mimic the behavior of that handle on a normal non-HDA object node?

2.) If that's not possible, is there any way to trigger a callback script from the changing of that built-in handle, or is it necessary to write a custom Python Viewer State to mimic the built-in Transform handle but properly change the matrix?

Thanks!
Edited by jedmitchell - Feb. 1, 2023 01:22:53

Attachments:
pcoip_client_ZccFzZrSTs.png (436.0 KB)
pcoip_client_NTqqAOPWI4.png (1.1 MB)
pcoip_client_SU2OUoImZu.png (707.5 KB)

  • Quick Links