Jump to content

creating a scenegraph node

Recommended Posts

Hello! I'm pretty new to HDK programming, and I have a more conceptual question:

I want to create a node whose job is to create and manage a set of child nodes; more or less a scenegraph. What would be the best way to do this?

So for example I have a simple text file, scenegraph.txt, which looks something like this:

sphere 50 50 50
cube 0 100 100
monster.obj 0 0 0

I want to create a custom Houdini node that has a single parameter: "scenegraph_file", where I will put the full path to this text file. When it "cooks", I'd want it to create geometry objects for all of the components in the text file. It could do this in the same network that it lives, or it could create a new subnetwork containing those nodes. Does Houdini allow for this kind of thing? I want to create a node that can add/remove/edit other nodes. Does this jive with Houdini's nodegraph design?

If this is not possible, my fallback solution is to create an OTL with a custom python script that runs every time a parameter is changed, that grinds through the file manually invokes hou module calls to manage the scenegraph assets inside the OTL. Can anyone think of a better/cleaner/more-houdini-esque way to do this?


Link to comment
Share on other sites

I'm not sure about what you want to do. What do the three numbers after the object name mean? Are they sizes, or translates? How would the objects be related to each other? Will you have a relative path defined to existing geometry that you want to load with a File SOP?

I think your question is too vague to give a good answer to. Please be more specific.


Link to comment
Share on other sites

What I really care about is what is the most appropriate method in houdini for procedurally creating and deleting objects in the scene.

Consider a simpler example: I want to create a Houdini node, which has a single parameter: "number_of_spheres". I want this node to create and delete Geometry nodes with Sphere SOPs inside them, so that the number of spheres matches the parameter I set.

They'd all be created with a standard name, "mysphere_01", "my_sphere_02", etc., and initially have an identity transform, which could then be modified after creation.

Does it make sense for this to be a custom node or OTL? or should this type of thing be done be more appropriately handled with an HScript or Python script that I run every time I want to modify my scene?


Link to comment
Share on other sites

Have you considered a .otl with some python scripts? If it's about creating nodes and writing stuff out or reading stuff back in from a text. I would consider python. I'm not yet totally in to Python but for what I've so far it's very powerful.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...