McNistor Posted October 16, 2018 Share Posted October 16, 2018 Hi guys, I need a bit of help from someone python knowledgeable and willing, with a custom shelf tool that when clicked or called via a hotkey does the following: creates two fuse SOP nodes from the current selection, the 1st one set on "snap" and the other on "consolidate". Other settings also modified, but unimportant right now. I'd do it myself, but this is way too simple for my guru level of python and I don't have the time Cheers! Quote Link to comment Share on other sites More sharing options...
kiryha Posted October 16, 2018 Share Posted October 16, 2018 If you will finally decide to do it by yourself, this Python tool creation tutorial may help you Quote Link to comment Share on other sites More sharing options...
McNistor Posted October 16, 2018 Author Share Posted October 16, 2018 (edited) Will definitely check it out, hopefully soon enough. Thanks! edit: but right now I still need help :) Edited October 16, 2018 by McNistor Quote Link to comment Share on other sites More sharing options...
kiryha Posted October 16, 2018 Share Posted October 16, 2018 (edited) This is the best opportunity to start doing coding when you have a small particular task! Very different from following abstract programming tutorials. Try to begin with creating of node — one Fuse SOP, then it would be easy to create 2, set their parameters and connections. Then you will wrap it in the shelf tool. This code will create a Geometry node in scene root and then create a Fuse SOP inside Geometry node: import hou OBJ = hou.node('/obj/') geometry = OBJ.createNode('geo') fuse = geometry.createNode('fuse') Edited October 16, 2018 by kiryha Quote Link to comment Share on other sites More sharing options...
McNistor Posted October 16, 2018 Author Share Posted October 16, 2018 The opportunity to start doing coding (or anything else for that matter) is indeed by trying to complete a very small project. However there's one constant - time. Apart from the fact that I need this custom tool right now, there's the matter, in my case at least of resource management. See, I'm on a quest since a few yrs to become a very good creature/character artist (via sculpting as well as Sub-D), but I have roots in generalist 3d which I cannot cut loose apparently. The thing with knowledge in general is that if you don't use it, you lose it. At one point in my life, I was half-decent in c++, but almost everything about its syntax, quirks, tips, etc. went away because I stopped using it. Right now, I figured that learning Python would be a too big investment with possibly a too small ROI. Besides, right now I'm slowly but surely dipping myself in VEX. And I don't know lots of sculptors that can't sleep at night because they don't know VEX so adding python too right about now is a bit much for me I'm laying down all this info, just in case someone's willing to help but is being put off by my apparent unwillingness to learn, which is and should be off-putting if no justified reasons are given. Cheers! Quote Link to comment Share on other sites More sharing options...
kiryha Posted October 16, 2018 Share Posted October 16, 2018 (edited) Create a Grid from the shelf, dive inside, select Grid SOP, run from Python Source Editor: import hou sel = hou.selectedNodes()[0] parent = sel.parent() fuse_snap = parent.createNode('fuse', 'snap') fuse_snap.moveToGoodPosition() snap = fuse_snap.parm('switcher1') snap.set(2) fuse_consolidate = parent.createNode('fuse', 'consolidate') fuse_consolidate.moveToGoodPosition() fuse_snap.setInput(0, sel) fuse_consolidate.setInput(0, sel) Edited October 16, 2018 by kiryha 1 Quote Link to comment Share on other sites More sharing options...
McNistor Posted October 17, 2018 Author Share Posted October 17, 2018 (edited) @kiryha It's not exactly what I need, but you've given me a good starting point. I guess it's time to dip my tows in Python and modify it to fit my needs. Don't know where I'll get this time from, but I'll try to squeeze it in somewhere. Thanks. Edit: no block comments in Python? Ay ayay, LOL Edited October 17, 2018 by McNistor Quote Link to comment Share on other sites More sharing options...
3dome Posted October 17, 2018 Share Posted October 17, 2018 (edited) create a shelf tool with following python code then click it, select the points and hit enter or select the points and then click it import toolutils def fuse_consolidate(): selection = toolutils selection = selection.sceneViewer().selectGeometry() node = selection.nodes()[0] selection = selection.selectionStrings() selection = list(selection) string = " ".join(selection) #create fuse SOPs parent = node.parent() snap = parent.createNode('fuse', 'snap') snap.setParms({'group': string, 'switcher1': 2, 'tol3d': 10}) snap.setInput(0, node) fuse = parent.createNode('fuse', 'consolidate') fuse.parm('group').set(string) fuse.setInput(0, snap) snap.moveToGoodPosition() fuse.moveToGoodPosition() #set flags fuse.setSelected(1) fuse.setDisplayFlag(1) fuse.setRenderFlag(1) fuse_consolidate() Edited October 17, 2018 by 3dome 2 Quote Link to comment Share on other sites More sharing options...
McNistor Posted October 17, 2018 Author Share Posted October 17, 2018 @3dome That's exactly waht I was looking for. Thanks buddy! 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.