Jump to content
Tom

Placing edge cusp as last node on all objects

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

yes, sorry about that, delete first space in that line, so it will be:

hou.session.cuspByAngle(60)

Share this post


Link to post
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).

Share this post


Link to post
Share on other sites

you can uncheck Import Null Nodes as Subnets in FBX import settings to get flat hierarchy of objects instead of nested Subnets

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

×