Jump to content
wateryfield

delete the interface parameter by python

Recommended Posts

Hi. Guys.

I got a huge work to do, there is a fbx file export form max,when i import it to houdini, it include too much parameters on Geo interface form max. So i want delete it all since it was useless. 

I make a sketch show what i want to do.

post-9982-0-72514400-1455006640_thumb.pn

I just want to remove the ss parameter form interface, not just delete the keyframes or expression.

If there was something like hou.parm().destory() modules can do this.

Thanks.

 

Share this post


Link to post
Share on other sites


ptg = your_node.parmTemplateGroup()

ptg.remove(ptg.find("your_parm_name"))

your_node.setParmTemplateGroup(ptg)

  • Like 1

Share this post


Link to post
Share on other sites
ptg = your_node.parmTemplateGroup()
ptg.remove(ptg.find("your_parm_name"))
your_node.setParmTemplateGroup(ptg)

Thanks! Master

The script works great.

:)

 And if you get time,  do you mind let me ask a basic python question again.

So i have a geo1 in /obj lelvel, now i want get the geo1 name,then delete it, at last create a geo node  named geo1 again.

node = hou.node('/obj/geo1')
name = node.name
place = hou.node('/obj')
place.createNode('geo')

But the name variable was been remove before createNode, anyway to save the name variable.

Thanks.

Share this post


Link to post
Share on other sites

Hey,

n.name is not a value, but a method of the node class. That means you are storing a reference to the method of the ObjNode class in your name variable. Naturally this method will be gone when you destroy the node.

To get the name you have to call this method via node.name() which will return the name of the node as a string value.

 

cheers,

Dennis

Edited by dennis.albus
  • Like 1

Share this post


Link to post
Share on other sites

Hey,

n.name is not a value, but a method of the node class. That means you are storing a reference to the method of the ObjNode class in your name variable. Naturally this method will be gone when you destroy the node.

To get the name you have to call this method via node.name() which will return the name of the node as a string value.

 

cheers,

Dennis

Thanks, Dennis.

I try to follow your idea, this was my code

def name(node):
    return(node.name())


node = hou.node('/obj/geo2')
name = name(node)

node.destroy()

geo = hou.node('/obj')
geo.createNode("geo",name)

It works.

But is it right? I not good at code at all.

Share this post


Link to post
Share on other sites

Yes that works. However there is no need to define a function just to return the name of the node.

Maybe my explanation was not very clear. The method name() is already defined for nodes and can simply be called as soon as you have a node object.

node = hou.node('/obj/geo2')
name = node.name()

node.destroy()

geo = hou.node('/obj')
geo.createNode("geo",name)
  • Like 1

Share this post


Link to post
Share on other sites

Yes that works. However there is no need to define a function just to return the name of the node.

Maybe my explanation was not very clear. The method name() is already defined for nodes and can simply be called as soon as you have a node object.

node = hou.node('/obj/geo2')
name = node.name()

node.destroy()

geo = hou.node('/obj')
geo.createNode("geo",name)

Thanks! Dennis.

Now i have a better understood of if.  :)

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

×