Jump to content

delete the interface parameter by python


wateryfield

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.

 

Link to comment
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.

Link to comment
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
Link to comment
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.

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

Link to comment
Share on other sites

  • 5 years later...

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