Jump to content
Sign in to follow this  
gemini

Set Script to Existing Button

Recommended Posts

Hi,

Can We create or modify a callback script of an existing button ?

Thx, G

Share this post


Link to post
Share on other sites

Thanks,

I can see the data (script) stored on parm , but sadly I could not figure out how to set the callback to other than what is stored. 

I tried: 

t.setTags({"script_callback":"print 222"})

But not worked. :(

G

Share this post


Link to post
Share on other sites

Right, here is a working solution:

n = hou.node('/obj/geo1')
ptg = n.parmTemplateGroup()

pt = ptg.find('myParm')
pt.setScriptCallback('print 123')
pt.setScriptCallbackLanguage(hou.scriptLanguage.Python)
ptg.replace('myParm', pt)

n.setParmTemplateGroup(ptg)

 

  • Like 1

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
Sign in to follow this  

×