Jump to content


Placing edge cusp as last node on all objects


  • Please log in to reply
6 replies to this topic

#1 Tom

Tom

    Peon

  • Members
  • Pip
  • 96 posts
  • Joined: 18-June 11
  • Location:Latvia
  • Name:Toms Seglins

Posted 17 July 2012 - 09:18 AM

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, 17 July 2012 - 09:21 AM.


#2 ChristianW

ChristianW

    Illusionist

  • Members
  • PipPipPip
  • 340 posts
  • Joined: 10-November 10
  • Location:London
  • Name:Christian Waite

Posted 17 July 2012 - 11:29 AM

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

#3 anim

anim

    Houdini Master

  • Members
  • PipPipPipPip
  • 910 posts
  • Joined: 23-August 07
  • Location:Slovakia, Bratislava
  • Name:Tomas Slancik

Posted 17 July 2012 - 11:33 AM

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
Tomas Slancik
Generalist
Slovakia

#4 Tom

Tom

    Peon

  • Members
  • Pip
  • 96 posts
  • Joined: 18-June 11
  • Location:Latvia
  • Name:Toms Seglins

Posted 17 July 2012 - 12:07 PM

@ 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, 17 July 2012 - 12:07 PM.


#5 anim

anim

    Houdini Master

  • Members
  • PipPipPipPip
  • 910 posts
  • Joined: 23-August 07
  • Location:Slovakia, Bratislava
  • Name:Tomas Slancik

Posted 17 July 2012 - 12:21 PM

yes, sorry about that, delete first space in that line, so it will be:
hou.session.cuspByAngle(60)

Tomas Slancik
Generalist
Slovakia

#6 pencha

pencha

    Peon

  • Members
  • Pip
  • 52 posts
  • Joined: 27-June 06
  • Location:Buenos Aires
  • Name:Pablo Pencha

Posted 18 July 2012 - 06:04 PM

View PostTom, on 17 July 2012 - 12:07 PM, said:

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

#7 anim

anim

    Houdini Master

  • Members
  • PipPipPipPip
  • 910 posts
  • Joined: 23-August 07
  • Location:Slovakia, Bratislava
  • Name:Tomas Slancik

Posted 18 July 2012 - 06:42 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users