Naiad theme for H16 (Circular nodes - one shape to rule them all)

   22472   34   4
User Avatar
Member
1755 posts
Joined: March 2014
Offline
mtucker
Yeah, that's the “current” node, which may or may not also be “selected”. Maybe just making the color more different from the “selected” color would be enough. In the old network editor I think “current” was white?

Hi Marc,
I hope I'm not bumping the thread needlessly, as I consider this to be bordering on the trivial. I don't remember the color prior to 16, but perhaps choosing a color that's further away on the spectrum from yellow/pink would be a better choice. An olive green maybe? Again, feel free to ignore this suggestion, as I said earlier, there are bigger fish to fry.
User Avatar
Staff
5156 posts
Joined: July 2005
Offline
McNistor
An olive green maybe?

Long, long ago, prior to Houdini 9, a non-selected current node actually was outlined in green.
User Avatar
Member
7755 posts
Joined: Sept. 2011
Offline
jason_iversen
This appeared elsewhere - I cannot take credit for it, except for lifting it shamelessly without the author's permission.

oh dear, I thought what happens in alpha, stays in alpha. ;-)
User Avatar
Member
76 posts
Joined: Sept. 2011
Online
Is the HOUDINI_NODE_WIDTH env no longer supported with H16? It doesn't seem to do anything as far as I've tried.
User Avatar
Staff
4438 posts
Joined: July 2005
Offline
No, HOUDINI_NODE_WIDTH has no meaning now that you can define node shapes of any size and shape.
User Avatar
Member
7755 posts
Joined: Sept. 2011
Offline
Will there be an Orbolt™ Asset Store for node shapes?
User Avatar
Staff
4438 posts
Joined: July 2005
Offline
jsmack
Will there be an Orbolt™ Asset Store for node shapes?

That would sort of imply official support for custom node shapes, so for now, no.
User Avatar
Member
4506 posts
Joined: Feb. 2012
Offline
jason_iversen
This appeared elsewhere - I cannot take credit for it, except for lifting it shamelessly without the author's permission.

import json
def drawOutline( outline, vex_func_name ):
    vexcode = "void {}() {}\n".format(vex_func_name,'{')
    vexcode += '  int pr,pt;\n'
    vexcode += '  pr = addprim(0,"poly");\n'
    for p in outline:
        vt = " set( {}, {}, 0 )".format(*p)
        vexcode += "  pt = addpoint(0,{});\n".format(vt)
        vexcode += "  addvertex(0,pr,pt);\n"
    vexcode += "}\n"
    vexcode += "{}();\n\n".format(vex_func_name)
    return vexcode
import math
def drawLine( line, vex_func_name ):
    vexcode = "addattrib(0,\"point\",\"tangent\",{0,0,0});\n"
    vexcode += "void {}() {}\n".format(vex_func_name,'{')
    vexcode += '  int pr,pt;\n'
    vexcode += '  pr = addprim(0,"polyline");\n'
    for p in line:
        x,y,theta = p
        theta = hou.hmath.degToRad(theta)
        vt = " set( {}, {}, 0 )".format(x,y)
        vexcode += "  pt = addpoint(0,{});\n".format(vt)
        vexcode += "  setattrib(0,\"point\",\"tangent\",pt,-1, set( {},{},0 ) );\n".format(math.cos(theta),math.sin(theta))
        vexcode += "  addvertex(0,pr,pt);\n"
    vexcode += "}\n"
    vexcode += "{}();\n\n".format(vex_func_name)
    return vexcode
shapecode = hou.pwd().inputs()[0].parm('shape_json').eval()
shape = json.loads( shapecode )
outline = shape['outline']
code = drawOutline( outline, "outline" )
flags = shape['flags']
flagcode = ''
for flag in flags.keys():
    flagoutline = flags[flag]['outline']
    funcname = 'flag_{}'.format(flag)
    flagcode += drawOutline( flagoutline, funcname )
code += flagcode
code += drawLine(shape['inputs'],'inputs')
code += drawLine(shape['outputs'],'outputs')
return code

Amazing code man, thx
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
76 posts
Joined: Sept. 2011
Online
Has anyone been able to get custom shapes working?

I've been unable to get the HOUDINI_PATH setup properly. trying something like
HOUDINI_PATH = ${HOME}/houdini16.0/config/NodeShapes;&
It seems like the shapes in $HFS are still taking precedence over the ones in my home dir.

(This is on Linux)
User Avatar
Member
1905 posts
Joined: Nov. 2006
Offline
Houdini is going to look in any config/NodeShapes folders that exists in the HOUDINI_PATH so you shouldn't be pointing your HOUDINI_PATH explicitly to a directory containing those shapes.

Also, if that's where your shapes are then you shouldn't need to set the HOUDINI_PATH at all to have them found since $HOME/houdiniX.Y is going to be in your HOUDINI_PATH already.

Edit:

I've found that attempting to explicitly override the default shape definitions does not work well/at all because it seems that Houdini handles shapes in a last is best manner so if you have your shape named “foo” before a shape named “foo” in $HFS then it will see yours, but then see the HFS one and use that instead
Edited by graham - May 3, 2017 14:28:52
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
76 posts
Joined: Sept. 2011
Online
Thanks for clearing that up for me Graham.

Should custom shapes show up in the list returned by doing:
hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor).nodeShapes()

I have test.json (with “name”: “test” specified) file in the config/NodeShapes/ in my home houdini dir.

'test' doesn't show up in the node shapes list, and trying to set the userData ‘nodeshape’ to ‘test’ seems to just give me the standar ‘rect’ shape.
User Avatar
Member
4 posts
Joined: March 2016
Offline
Since we were also looking for a way to create custom node shapes for our own workflow, we came up with a tool (thanks to the valuable input from this thread) that lets you convert your curves into the required JSON format. The scenefile (along with an explanation of how to use it) can be found here: https://vimeo.com/221182957 [vimeo.com]

If you just quickly want to create the JSON file, download the scenefile and watch the first minute. The rest explains how we set up the file itself.

We hope you find it useful!

Attachments:
twitter-05.jpg (46.6 KB)

User Avatar
Member
4 posts
Joined: March 2016
Offline
To make things even easier, we created an HDA out of the whole setup that even writes the JSON file for you. The setup is pretty straightforward: plugin the curves as shown below (merge the flags using the “Custom Node Shape: Flags” SOP) and hit “Save”.

Download the file here if you like (there's also a walkthrough on how to wire everything in): https://vimeo.com/223222233 [vimeo.com]

Cheers!
Edited by bjs - June 30, 2017 12:00:51

Attachments:
Twitter-HDA-01.jpg (151.4 KB)

User Avatar
Member
4506 posts
Joined: Feb. 2012
Offline
Nice one man. I bet SESI might consider using this instead of their internal tool whatever it might be
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
453 posts
Joined: Feb. 2013
Offline
The tool by bjs is still the best way to do this, amazing work!

Has anyone figured out how to embed custom node shapes in an HDA?

I added the json in the extra files section and am trying the following code in the OnCreated script:
 
node = kwargs['node']

node.setUserData("nodeshape", "opdef:/DS::Sop/my_node::2.0?myShape")

But it seems to be the wrong syntax. It seems to work for something like:

node.setUserData(“nodeshape”, “bulge_down”)
Edited by DASD - Sept. 18, 2020 06:45:00
  • Quick Links