Jump to content
Drughi

Fill Selection

Recommended Posts

Hi!
In Cinema there is a feature called fill selection (see gif). I really miss it in Houdini and would like to recreate it using Python. I know some Python, but I've never used it for geometry related stuff. Since I don't know the functions I'm not sure on how to find the corresponding primitives. Can someone help me getting started? How would you approach it?

Any help is much appreciated!

ezgif-5-3017a8ee6528.gif

Share this post


Link to post
Share on other sites
Posted (edited)

I solved it myself. Did it the "easy way" and created the logic in sops.

Would still be interesting to do it all in Python, but this way i could easily solve it and its "more procedural".

If you are interested in the script - here you go:

import toolutils
selection = toolutils
viewer = selection.sceneViewer()
viewer.setPickGeometryType(hou.geometryType.Edges)
selection = selection.sceneViewer().selectGeometry()
node = selection.nodes()[0]

id = node.createOutputNode("attribwrangle", "point_id", 1)
id.parm("class").set("point")
id.parm("snippet").set("i@point_id = i@ptnum;")
id_pos = id.position()

blast = id.createOutputNode("blast", "edge_blast")
blast.parm("group").set(str(selection))
blast_pos = id_pos + hou.Vector2((2,-1))
blast.setPosition(blast_pos)

connectivity = blast.createOutputNode("connectivity", "connectivity", 1)
connectivity.parm("attribname").set("split_id")

copy = id.createOutputNode("attribcopy", "attribcopy", 1)
copy_pos = id_pos + hou.Vector2((0,-3))
copy.setPosition(copy_pos)
copy.setInput(1, connectivity, 0)
copy.parm("attribname").set("split_id")
copy.parm("matchbyattribute").set(1)
copy.parm("attributetomatch").set("point_id")

promote = copy.createOutputNode("attribpromote", "attribpromote", 1)
promote.parm("inname").set("split_id")
promote.parm("outclass").set(1)
promote.parm("method").set(0)
promote.setSelected(1, 1)
promote.setDisplayFlag(1)
promote.setRenderFlag(1)

viewer.setCurrentState("select")
viewer.setPickGeometryType(hou.geometryType.Primitives)
viewer.setGroupPicking(1)
viewer.setGroupListType(hou.groupListType.Primitives)
viewer.setGroupListMask("@split_id *")
viewer.setGroupListColoringGeometry(1)

 

ezgif-5-200cb08e2215.gif

Edited by Drughi
  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×