Any way to script handles on a Digital Asset?

   Views 4589   Replies 4   Subscribers 5
User Avatar
Member
20 posts
Joined: July 2012
Offline
I'm creating a digital asset, and hitting a roadblock with what looks like not-yet-implemented functionality. Here's the situation I'm trying to solve:

The user of the digital asset will be placing a number of objects. (Let's say they're spheres.) The number of spheres is not known in advance. The user might place one, three, maybe even 12 of them, but it is guaranteed to never be more than 20 or so. (I mean, they could try, but it wouldn't make sense for this application. The number is expected to stay small.)

The Digital Asset's job is to take those placed spheres and create something around them.

The way I wanted it to work was this:

1: User sets an integer parameter to be the number of spheres he wants. (Let's say there are 5.)
2: Digital asset sees this change and creates 5 manipulator handles and 5 attributes, and links them together. User now sees a sphere at each handle, and can move them around with minimal hassle.
3: When finished, the user turns the asset from “Preview” to “Final” mode and the complex geometry around the spheres is created as output.

It's looking like that method won't work though, because all Python functions related to interacting with handles are “not yet implemented.” (hou.HandleBinding, hou.HandleListPane, hou.HandleNodeTypeParmBinding, hou.HandleType, hou.PersistentHandle, anything in hou with ‘handle’ in the name is not yet implemented.)

Can this be done with hscript as a fallback? I can't find those functions so far.

I could also use one handle and provide an interface to change which sphere it's controlling, but the Python functionality for changing what a handle controls is also not yet implemented. If I can't do it the other way, maybe there's a way to do it this way?

I'm on 12.5, but I checked the docs for 13.0 and these functions are not implemented in that version eiither.

The Catch: The Digital Asset is to be used by someone with practically no Houdini training. It is to be a tool for use by a trained expert in a non-CG field, allowing them to use Houdini's powerful math skills to create a shape that would otherwise be very difficult to program from scratch. This person will have assistance from someone with more Houdini skills. That person will set everything up, then the expert will come in, use manipulators to place the spheres, and the assistant will handle the geo export.
User Avatar
Member
106 posts
Joined: June 2011
Offline
Hey fella,

You can script handles in a digital asset. Hscript has commands to create and attach handles to objects. You need to embed them in your python code as handles are not implemented in python yet.

http://www.sidefx.com/docs/houdini12.0/commands/pomadd [sidefx.com]
http://www.sidefx.com/docs/houdini12.0/commands/pomattach [sidefx.com]

These are the ones that you need for the most part but there are other functions which I recommend you to look at.

You can use these hscript commands in python directly like this.

hou.hscript('pomadd “New Xform” xform')

Hope this helps . Let me know if you need anything.

Cheers
-J
User Avatar
Member
20 posts
Joined: July 2012
Offline
Wonderful, thank you!

I was having a hard time finding things in the hscript documentation. I don't think I ever would have seen ‘pomadd’ and realized that was what I was looking for.
User Avatar
Member
623 posts
Joined: Aug. 2008
Offline
thanks cool,
i am sure they will implement the python commands later on.
User Avatar
Member
1805 posts
Joined: Oct. 2010
Offline
hope to see these as python soon! I would also recommend making python SOPs which manage manipulators for future simplicity (i.e. make a python SOP that handles creation and deletion of handles and tie it to your network)
-G
  • Quick Links