Jump to content

Placing edge cusp as last node on all objects


Tom

Recommended Posts

I have imported FBX from Maya, where I have hundreds of objects, I would like to know, how I can place edge cusp automaticly in all geometrys as last node, without manually going in all nodes and placing them by hand.

Seems, I need to start learn python faster :D

thanks in advance, Tom

Edited by Tom
Link to comment
Share on other sites

Can't you just object merge them all into a new geo network (/obj/fbxnet/*/OUT, something like that) and stick a cusp at the bottom of that.

Connectivity and Partition SOPs to seperate everything out into groups if you don't already have them.

I don't use FBX, so not sure how it structures it, but that's how I'd do it if you get a node per object (which is what we get with a proprietary file format).

Alternatively use Alembic ;)

C

Link to comment
Share on other sites

here is quick code for doing that on multiple objects

put it to your Python Source Editor window and apply

def cuspByAngle(angle = 60):

    name = "cusp_by_angle"

    for obj in hou.selectedNodes():
        lastSop = obj.displayNode()
        if lastSop.name() == name:
            lastSop = lastSop.inputs()[0]
            obj.displayNode().destroy()

        facet = lastSop.createOutputNode("facet", name )
        facet.parm("cusp").set( 1 )
        facet.parm("angle").set( angle )
        facet.setDisplayFlag(1)
        facet.setRenderFlag(1)

then select all object nodes you want to cusp edges for and write this to Python Shell

 hou.session.cuspByAngle()

or if you want different cusp angle just put it in brackets, like

 hou.session.cuspByAngle(40)

it will put facet node with cusping by angle enabled at the end of every object sop network

if you run it more times on the same objects, it will first check and delete if the previous node named "cusp_by_angle" is present as displayed sop, so they will not accumulate

  • Like 1
Link to comment
Share on other sites

@ ChristianW, I had same idea, but I like to group objects and manipulate them in maya, the thing is, when I import fbx in Houdini, there is subnets in subnets... so I have to manualy ungroup all grouped objects in maya or in houdini.

Zing! Oh, maybe its easer to extract all subnets with script? And then I can merge them and apply edge cusp.

@anim thanks for script, but I did all as you said and I got this error in py console

File "<console>", line 1
 hou.session.cuspByAngle(60)
^ 
IndentationErrorL unexpected indent

Edited by Tom
Link to comment
Share on other sites

@ ChristianW, I had same idea, but I like to group objects and manipulate them in maya, the thing is, when I import fbx in Houdini, there is subnets in subnets... so I have to manualy ungroup all grouped objects in maya or in houdini.

Lil´trick just in case it can help with manual ungrouping: have in mind that wildcards in an Object merge can do wonders to organize multiple subnets. (object merging obj/yourSubnet*/*/* will automagically bring all of those geos to one node).

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...