ikoon Posted May 9, 2017 Share Posted May 9, 2017 Please, I would like to add few hotkeys to speed up my workflow. For example, is it possible to add these? - Set the Render flag (actually it is not possible to set the flag with mouse hovering over the Parameters pane or over the Scene Viewport pane) - Toggle Display Points in the viewport Should I write any custom Python tool and then set hotkey to it? Is there any log of recently executed actions by the user, which will help me to replicate those actions in my script? I am Python newbie so please excuse my noob questions. Quote Link to comment Share on other sites More sharing options...
martinkindl83 Posted May 11, 2017 Share Posted May 11, 2017 as what you already discovered, create new tool, put it onto shelf and assign hotKey to it - note that in H16 you cant easily assign hotkeys with ALT key. if you dont want your tool visible in TAB menu, dont fill any Label. I have whole toolbar only for scripts that im using as hotkeys. 3 Quote Link to comment Share on other sites More sharing options...
Neon Junkyard Posted May 11, 2017 Share Posted May 11, 2017 1 hour ago, martinkindl83 said: if you dont want your tool visible in TAB menu, dont fill any Label. I have whole toolbar only for scripts that im using as hotkeys. I came here literally with this exact issue, thank you Quote Link to comment Share on other sites More sharing options...
ikoon Posted May 16, 2017 Author Share Posted May 16, 2017 Thank you very much for your answers. I am still a newbie, is there any log of performed actions? For example I would like to replicate the "Display Points" button in the Python script and I am lost where to find the right Python command. Where do you search for the right Python commands to replicate these actions? If you would be so kind and direct me also to the "Set Render Flag" command. Quote Link to comment Share on other sites More sharing options...
Ceee Posted May 16, 2017 Share Posted May 16, 2017 The basic idea is to retrieve the selected node and set the render flag. (Just for somebody finding this thread and seeing this for the first time, you would go in a shelf and RMB New Tool...) node = hou.selectedNodes()[0] node.setRenderFlag(True) Strictly speaking that is all you need. Now the render flag is a sop node property, objects don't have it. You could do a try except block to handle those exceptions. The other thing you might want later is to set the display flag. Here is what you can do with nodes in general: http://www.sidefx.com/docs/houdini/hom/hou/Node and with sops in particular: http://www.sidefx.com/docs/houdini/hom/hou/SopNode Just want to leave one last friendly reminder to people starting out with python to drag and drop your nodes on the python console. This will give you a node object to experiment with. 1 Quote Link to comment Share on other sites More sharing options...
ikoon Posted May 16, 2017 Author Share Posted May 16, 2017 Eric thank you very very much, so I made my tool to set the Display and Render Flags and assigned Global Hotkey ... now it works everywhere not just in the Network as the Hotkey Overrides offer. I did not know how and where to start. This is so so great thank you very much. Now, after few clicks I have found many interesting things. Btw that Drag&Drop ... it gives me something like this: hou.node('/obj/rearing_1_fbx/horse_MID1/horse_MID1_deform') ... is this just to speed up typing of the path? Or is there some more functionality? Quote Link to comment Share on other sites More sharing options...
Ceee Posted May 16, 2017 Share Posted May 16, 2017 Yes, you are right, it is really to speed up typing. It is just so convenient What people do is: node = hou.node('/obj/rearing_1_fbx/horse_MID1/horse_MID1_deform') and then you can type next: node. and you will see the node objects methods be offered to you. This is a great way to experiment. When coming from other languages it is sometimes useful to keep in mind that in python you are typically given objects (not values). So if you ask for a parm: node.parm('tx') you are getting the parm itself. If you want the value than you would ask for that. parm = node.parm('tx') parm.eval() Houdini's python support is really awesome and intuitive. Hope you enjoy it too. 1 Quote Link to comment Share on other sites More sharing options...
ikoon Posted May 16, 2017 Author Share Posted May 16, 2017 I will go through it, thank you very much for showing me the path into it! Quote Link to comment Share on other sites More sharing options...
ikoon Posted May 18, 2017 Author Share Posted May 18, 2017 Please I have another noob question. I would like single hotkey to toggle between two states. Is it easier for noob like me to have a "global variable", or to detect the actual state from scene? For example, I would like F12 to toggle "Show Only Selected Geometry" when selecting primitives (to check if I have the right selection on complex models). This Houdini command originally creates just the Visibility SOP, so with one press of F12 I will create the Visibility SOP (and set it right) and with the next press of F12 I will reselect parent and delete the Visibility SOP. Quote Link to comment Share on other sites More sharing options...
Ceee Posted May 18, 2017 Share Posted May 18, 2017 Hi Jiri, You can definitively use a global var strategy. # Set Houdini global: value = str('12') name = 'NEW_GLOBAL' hou.hscript('set -g '+name+' = '+value) # Get the value of a global: hou.expandString('$HIP') You can check this for more details and options: http://www.sidefx.com/docs/houdini15.0/hom/hou/hscript http://www.sidefx.com/docs/houdini/commands/set I would usually refrain from having a global store a state of something that can be obtained dynamically. It is better to just check the state of this thing directly and have your code act accordingly. Just a suggestion, before doing all this I would have a look at a display option to help visualize selections. If that does not work for you, than sure, go ahead. A word of warning: you might have to manage the selections do have made. Display Options>Guides>Selection Fill Selection toggle 1 Quote Link to comment Share on other sites More sharing options...
martinkindl83 Posted May 19, 2017 Share Posted May 19, 2017 9 hours ago, ikoon said: Please I have another noob question. I would like single hotkey to toggle between two states. Is it easier for noob like me to have a "global variable", or to detect the actual state from scene? For example, I would like F12 to toggle "Show Only Selected Geometry" when selecting primitives (to check if I have the right selection on complex models). This Houdini command originally creates just the Visibility SOP, so with one press of F12 I will create the Visibility SOP (and set it right) and with the next press of F12 I will reselect parent and delete the Visibility SOP. I have similar setup, as Houdini is missing isolate selection. I have it as RFE, but as they dont have high priority for it i created one myself. Same idea as what you have. Im using radial menu for it. Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted May 19, 2017 Share Posted May 19, 2017 (edited) 14 hours ago, ikoon said: Please I have another noob question. I would like single hotkey to toggle between two states. Is it easier for noob like me to have a "global variable", or to detect the actual state from scene? For example, I would like F12 to toggle "Show Only Selected Geometry" when selecting primitives (to check if I have the right selection on complex models). This Houdini command originally creates just the Visibility SOP, so with one press of F12 I will create the Visibility SOP (and set it right) and with the next press of F12 I will reselect parent and delete the Visibility SOP. Isolate Selection I wrote this many many years ago, still works Can put it on a hotkey or new radial menu. It's a toggle. When nothing is selected - it shows everything. import os def isolate(): sel = hou.selectedNodes() if not sel: sel_string = "*" else: sel_string = " ".join([n.name() for n in sel]) try: if hou.os.environ['CUR_ISOLATE'] == sel_string: sel_string = "*" except: pass hou.hscript('viewdisplay -G "%s" `run("viewls -n")`' % sel_string) os.environ['CUR_ISOLATE'] = sel_string Edited May 19, 2017 by Stalkerx777 2 Quote Link to comment Share on other sites More sharing options...
ikoon Posted May 19, 2017 Author Share Posted May 19, 2017 Oh Alex thank you very much. Now I see, that this is really beyond my skils probably beyond my life goals ever unfortunately. Please, what exactly does your script do? Originally I wanted to temporarily hide non-selected primitives (when in selection mode). Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted May 20, 2017 Share Posted May 20, 2017 17 hours ago, ikoon said: Originally I wanted to temporarily hide non-selected primitives (when in selection mode). If you open Display Properties you can find there Visible objects field (Optimize Tab). The script above just puts the selected object names into this field with a help of Hscript function. If you want to hide primitives you have to play with visibility sop, there is no way to do that other than in sop context. 1 Quote Link to comment Share on other sites More sharing options...
martinkindl83 Posted May 22, 2017 Share Posted May 22, 2017 If you are on H16 you can use those two scripts. One adds visibility node with blast (as i didnt wanted to render hidden prims) and second finds all visibility nodes with specific names and deletes them. kill isolate.txt isolate after.txt 1 Quote Link to comment Share on other sites More sharing options...
ikoon Posted May 22, 2017 Author Share Posted May 22, 2017 Thank you very very very much! Martin this is exactly what I wanted. Also it helps me to develop more on my own, thank you guys! Quote Link to comment Share on other sites More sharing options...
ikoon Posted May 22, 2017 Author Share Posted May 22, 2017 Somehow I have managed to make Python script to Toggle Display Points Markers in the viewport. I am using it for a while (I have assigned Alt-Shift-W hotkey) and it seems ok, so maybe somebody may find it useful too: Here is the relevant docs url:http://www.sidefx.com/docs/houdini/hom/hou/GeometryViewportDisplaySet # Get a reference to the geometry viewer pane = hou.ui.curDesktop().paneTabOfType(hou.paneTabType.SceneViewer) # Get the display settings settings = pane.curViewport().settings() # Get the GeometryViewportDisplaySet for objects markersDisplayModel = settings.displaySet(hou.displaySetType.DisplayModel) markersSceneObject = settings.displaySet(hou.displaySetType.SceneObject) # Toggle the markers (visible when inside /obj/...) markersDisplayModel.showPointMarkers(not markersDisplayModel.isShowingPointMarkers()) # Unify with the scene (visible when in top level "/obj") markersSceneObject.showPointMarkers(markersDisplayModel.isShowingPointMarkers()) Quote Link to comment Share on other sites More sharing options...
ikoon Posted June 13, 2017 Author Share Posted June 13, 2017 (edited) Everything works fine, except one thing. When I unset Display or Render flag (in sops), it doesn't jump back to its last position. Houdini has some intrinsic logic, sometimes the unset flag "jumps" to the top node upstream, sometimes to the bottom downstream. Please, I would like to save the last Display Flag's position and when unset, make it go there. Do I have to use Python? Or is it somewhere in Preferences? I searched but found nothing. EDIT: BTW, if anyone is interested, I have got optimized my hotkeys nicely. They are global (except textport), so you dont have to hover over Network view: Everything in reach of one hand: insert = display pgup = up node pgdn = dn node ctrl+insert = display and render ctrl+del = bypass (on/off), can run on multiple nodes selected ctrl+shift+insert = template (on/off) ctrl+shift+del = clean all templates (in the viewport) ctrl+pgup/pgdn = left/right node multiple inputs Edited June 13, 2017 by ikoon Quote Link to comment Share on other sites More sharing options...
ikoon Posted August 1, 2017 Author Share Posted August 1, 2017 Please, could anybody give me a hint to solve the issue from my previous post? Quote: "When I unset Display or Render flag (in sops), it doesn't jump back to its last position." Should I use hou.getenv() and hou.putenv() ? Btw: I have put list of my hotkeys here. It is really convenient to browse the nodes pgup/pgdn and hit Insert to view, or ctrl-del to un/bypass multiple nodes.http://lab.ikoon.cz/index.php/2017/07/26/shelf-tools-and-hotkeys/ Quote Link to comment Share on other sites More sharing options...
ikoon Posted February 2, 2018 Author Share Posted February 2, 2018 I have customized the "unflagging", scripted my own. The script is here. Network Editor now remembers the previously flagged node and unflags to it: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.