Jump to content

Return the PrimType on selected nodes ?


Recommended Posts

Can someone tell me how to return the primType on any selected node in Python? I saw the hou.primType() in the docs but not sure how to use it on selection.

What I want is for example to select some curves or geometry and the script to return what is the  prim type  of each selected node (NURBS, Bezier,Polygon ,Mesh,NURBSSurface, etc)

Thank you!

 

,

Link to comment
Share on other sites

Anyway I think I figured it out .If there is another way I will be happy to see it.

def primType():
  sel = hou.selectedNodes()
  nodes = []
  types = []
  for node in sel:
    nodes.append(node.name())
    prim = node.geometry().prims()
    for i in prim:
      types.append(i.type().name())
  return dict(zip(nodes,types))

Cheers

Edited by T.I.M.
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...