Working Netboxes: part 1 — Where to Start …

Network Boxes or simply  ‘netboxes’ are  great ways to organize nodes in the network graph.  They don’t alter the node hierarchy and therefore a safe way to organize and visually group and can be a sort of nondestructive replacement for a subnetwork. However they are intended as visual aids they lack some scripting and interface features we have come to expect from nodes. Although some of these limitations makes absolute sense in terms within in the structure of Houdini, visually one might expect otherwise.  Some of these features can be added and made more convenient via some creative python and HOM

Typical H11 Network Box

Typical Network Box in default gray.

While working on the mod I realized, although I have been trying up to this point to keep blog post in a 1:1 ratio with modules, it wasn’t worth the trouble for the confusion it will in this case likely cause. For example, a function retrieving a netbox from on of its member nodes — actually belongs in a module dealing with nodes, as we are requesting something of the nodes, in this case, and not a network box – despite what is being returned. As a result this series of post introduces in addition to Also introduced is, which has more general functions and is in in a similar vein to hou.ui. Lastly, stores GUI dialogs specific to eyevexTools (largely for shelf buttons), since it is a good practice to separate such interfaces which are not needed for command line functionality. mod includes a function extendHouNodeClass() and netbox incudes similarly extendHouNetworkBoxClass().  These two functions add the methods in the mods to the hou.Node and hou.Networkbox classes respectively in session .  Techniques like this is partly what makes python so popular and also what makes many coders of other compiled languages cringe. However it is convenient and allows the methods to be called along side the provided ones. The added functions appear on the object as methods prefixed with ‘evt_’ hopefully make the distinct None of the code in eyevexTools nor the shelves actually use this technique.

These will also be the first series of posts/download featuring shelf buttons.  For artists coming from other applications such as Maya or Mudbox, the shelf is a familiar interface and the first place where common tasks are often looked for. eyevexTools lib download will also have a folder ‘Icons’ as well as ‘toolbar’. The installation instructions have been updated to include these. Shelf tools are great way to make things quick and accessible via a mouse pointer. Many times when asked to create a ‘a simple tool’ for Houdini, all that was required is querying a selection and running a method that already existed, as there are so many functions it would be absurdly cluttered to present them all in the interface. So, sometimes special use cases just require elevating one of these function to be accessible to non-scripters.

SVGs are a scalable vector graphic and a standard format that are accepted many place in Houdini (some of which will also accepts PNGs) Since they are vector they scale better in the shelves for different ui sizes and look much better. Plus, places where PNG might be required, like a help card, a PNG can also be exported from most any vector graphic  software. Inkscape is a free and open fully featured native SVG editor that runs on linux, windows, and OSX. I used it to create all the icons and highly recommend it.

These posts will not be going further in depth on shelves. Basic creation of a shelf and tool is easy, create a new shelf via “+” button on the upper right of the shelf set. The RMB on a blank spot on the new shelf, and choose “New Tool.” Give it a name, label, and icon if desired and then decide what script you want to run and accept. You can then edit the shelf file directly by looking in you $HOME/houdiniXX.x/toolbar folder in you favorite text editor, to see what was written out. If you do want to make changes by hand makes sure all Houdini sessions are closed or it can become illegible quickly)

OK, lets get get started…..

Leave a Reply

Your email address will not be published. Required fields are marked *