Hello,
Does any have a script or a shortcut to create a new Null Node and connect it to the currently selected node? Would be really handy.
Cheers
Add Null Node shortcut/script?
9083 15 5- sessionbeer
- Member
- 39 posts
- Joined: 7月 2014
- Offline
- Dean_19
- Member
- 319 posts
- Joined:
- Offline
- sessionbeer
- Member
- 39 posts
- Joined: 7月 2014
- Offline
- sessionbeer
- Member
- 39 posts
- Joined: 7月 2014
- Offline
- Dean_19
- Member
- 319 posts
- Joined:
- Offline
- Dean_19
- Member
- 319 posts
- Joined:
- Offline
- sessionbeer
- Member
- 39 posts
- Joined: 7月 2014
- Offline
- MrReedSmith
- Member
- 49 posts
- Joined: 9月 2013
- Offline
Hey sessionbeer,
just saw your post and this is something I had been working on a long while ago and following is the scriot i came up with:
node = hou.pwd()
for i in hou.selectedNodes():
if hou.nodeTypeCategories().keys():
### Above function lets you call this function on any context ###
dir = i.parent().path() + ‘/’
selNodeName = i.name()
nodeinfo = i.type().name()
otherName = hou.ui.readInput('Name the null', buttons'OK', ‘CANCEL’), initial_contents='_')
nullnode = hou.node('/%s'%dir).createNode('null', ‘OUTPUT%s’%otherName)
selNodePos = i.position()
nullnode.setColor(hou.Color( ))
### Setting node position ###
nullnode.setPosition(hou.Vector2(selNodePos,selNodePos-1))
nullnode.setInput(0,i)
i.setSelected(False)
nullnode.setSelected(True)
### Setting render and display flags for respective contexts ###
try:
nullnode.setDisplayFlag(True)
nullnode.setRenderFlag(True)
except:
nullnode.setDisplayFlag(True)
This will let you create nulls with the default name set to OUTPUT, and you can drop down nulls in any context you wish to, like sops, vops, cops, chops, etc except shops and selected as many nodes as you want at once to drop down nulls
but this a littlte fancy as it brings a liitle ui dialogue box where you can enter the name you want for the node.
Hope this helps!
Cheers!
-Yash
just saw your post and this is something I had been working on a long while ago and following is the scriot i came up with:
node = hou.pwd()
for i in hou.selectedNodes():
if hou.nodeTypeCategories().keys():
### Above function lets you call this function on any context ###
dir = i.parent().path() + ‘/’
selNodeName = i.name()
nodeinfo = i.type().name()
otherName = hou.ui.readInput('Name the null', buttons'OK', ‘CANCEL’), initial_contents='_')
nullnode = hou.node('/%s'%dir).createNode('null', ‘OUTPUT%s’%otherName)
selNodePos = i.position()
nullnode.setColor(hou.Color( ))
### Setting node position ###
nullnode.setPosition(hou.Vector2(selNodePos,selNodePos-1))
nullnode.setInput(0,i)
i.setSelected(False)
nullnode.setSelected(True)
### Setting render and display flags for respective contexts ###
try:
nullnode.setDisplayFlag(True)
nullnode.setRenderFlag(True)
except:
nullnode.setDisplayFlag(True)
This will let you create nulls with the default name set to OUTPUT, and you can drop down nulls in any context you wish to, like sops, vops, cops, chops, etc except shops and selected as many nodes as you want at once to drop down nulls
but this a littlte fancy as it brings a liitle ui dialogue box where you can enter the name you want for the node.
Hope this helps!
Cheers!
-Yash
- MrReedSmith
- Member
- 49 posts
- Joined: 9月 2013
- Offline
Sorry i forgot to mention, if you want a quicker shortcut comapred to selecting the node and then pressing the shelf tool button,
in the shelf tool where you have this script, right click on the tool>edit tool>hotkeys>global>edit
here you can assign any shortcut you want for executing the script for eg: mine is Ctrl+Enter, you can type in whatever you are comfortable with
So now when you assign the hotkey, just select the node or nodes you want to create nulls for and hit the hotkey, it will execute the script as coded!!
Cheers!
-Yash
in the shelf tool where you have this script, right click on the tool>edit tool>hotkeys>global>edit
here you can assign any shortcut you want for executing the script for eg: mine is Ctrl+Enter, you can type in whatever you are comfortable with
So now when you assign the hotkey, just select the node or nodes you want to create nulls for and hit the hotkey, it will execute the script as coded!!
Cheers!
-Yash
- CYTE
- Member
- 708 posts
- Joined: 2月 2017
- Offline
- mtucker
- スタッフ
- 4517 posts
- Joined: 7月 2005
- Offline
- jsmack
- Member
- 8037 posts
- Joined: 9月 2011
- Offline
MrReedSmithnode = hou.pwd() for i in hou.selectedNodes(): if hou.nodeTypeCategories().keys(): ### Above function lets you call this function on any context ### dir = i.parent().path() + '/' selNodeName = i.name() nodeinfo = i.type().name() otherName = hou.ui.readInput('Name the null', buttons=('OK', 'CANCEL'), initial_contents='_') nullnode = hou.node('/%s'%dir).createNode('null', 'OUTPUT%s'%otherName[1]) selNodePos = i.position() nullnode.setColor(hou.Color( [0,0,0] )) ### Setting node position ### nullnode.setPosition(hou.Vector2(selNodePos[0],selNodePos[1]-1)) nullnode.setInput(0,i) i.setSelected(False) nullnode.setSelected(True) ### Setting render and display flags for respective contexts ### try: nullnode.setDisplayFlag(True) nullnode.setRenderFlag(True) except: nullnode.setDisplayFlag(True)
- CYTE
- Member
- 708 posts
- Joined: 2月 2017
- Offline
- Houdini Obsession
- Member
- 58 posts
- Joined: 11月 2014
- Offline
jsmackMrReedSmith
hey if we need the default node color how can we get that.
i used ain place ofc =hou.Color() c.setHSV([205,20,87])ornullnode.setColor(hou.Color([0,0,0]))
by deleting that code we are getting default code
instead of that how can we get a default color of that/null node, got basics of python but I need to study and know the houdni python.
in advance thank you so much for your time and consideration for help
Edited by Houdini Obsession - 2019年4月3日 06:08:05
Houdini Fx Artist (Build)
- Thomas_FX
- Member
- 12 posts
- Joined: 2月 2018
- Offline
Hello,
Guys thank you for that wonderfull piece of python.
However I don't know much about python and I would like to make some more shortcuts but I can't find their names anywhere
Would you mind telling me by what I should replace “nullnode” in your python to get the equivalent on a “Transform SOP”, “copy to points SOP”, “Attribute Wrangle”, “Color SOP”, “Filecache”, “Object Merge” ??
I love how it is in Nuke to press M for merge, C for colorcorrect, K for Copy, T for transform, R for Read, W for Write etc. and I'm really used to it, so I would love to have an equivalent in Houdini because it's so frustrating when you hit T and nothing happens xD
I did it for the “Merge” by replacing “nullnode” by “mergenode” but yeah I'm stuck for all the others pretty much and I have no idea where I can find that answer
Guys thank you for that wonderfull piece of python.
However I don't know much about python and I would like to make some more shortcuts but I can't find their names anywhere
Would you mind telling me by what I should replace “nullnode” in your python to get the equivalent on a “Transform SOP”, “copy to points SOP”, “Attribute Wrangle”, “Color SOP”, “Filecache”, “Object Merge” ??
I love how it is in Nuke to press M for merge, C for colorcorrect, K for Copy, T for transform, R for Read, W for Write etc. and I'm really used to it, so I would love to have an equivalent in Houdini because it's so frustrating when you hit T and nothing happens xD
I did it for the “Merge” by replacing “nullnode” by “mergenode” but yeah I'm stuck for all the others pretty much and I have no idea where I can find that answer
- krueger
- Member
- 191 posts
- Joined: 10月 2018
- Offline
This is modified from what MrReedSmith posted and works on the first selected node if any are selected. You can modify it and put it in a for loop if you want it to work on all the selected nodes though. Just like was said earlier, put it in a shelf tool and assign it a hotkey.
You can find out what the type of each node is by dragging the node from the network pane to a python shell and write “.type().name()” after it like this:
>>> hou.node('/obj/geo1/null1').type().name()
'null'
>>> hou.node('/obj/geo1/transform1').type().name()
'xform'
>>> hou.node('/obj/geo1/merge1').type().name()
'merge'
Then you just need to modify this line and change ‘xform’ to any other node type.
selection = hou.selectedNodes() if len(selection) != 0: selected = selection[0] parent = selected.parent().path() + '/' selNodeName = selected.name() selNodePos = selected.position() node = hou.node('/%s' %parent).createNode('xform') ### Setting node position ### node.setPosition(hou.Vector2(selNodePos[0], selNodePos[1]-1)) node.setInput(0, selected) selected.setSelected(False) node.setSelected(True) ### Setting render and display flags for respective contexts ### try: node.setDisplayFlag(True) node.setRenderFlag(True) except: node.setDisplayFlag(True)
You can find out what the type of each node is by dragging the node from the network pane to a python shell and write “.type().name()” after it like this:
>>> hou.node('/obj/geo1/null1').type().name()
'null'
>>> hou.node('/obj/geo1/transform1').type().name()
'xform'
>>> hou.node('/obj/geo1/merge1').type().name()
'merge'
Then you just need to modify this line and change ‘xform’ to any other node type.
node = hou.node('/%s' %parent).createNode('xform')
-
- Quick Links