Jump to content

attach script to default node buttons


mProv

Recommended Posts

Hi,
I'd need to customize the behaviour of the default buttons of some nodes, e.g. - display a custom message when I press "Save to Disk" on a rop_alembic.
Also, I want the script to run for all the users in my studio. Maybe should I create a preset from this and save it in the shared HOUDINI_PATH?
Beyond the fact I'm not sure how to do it on a custom buttom I may create in the parameter interface, all the default parameters are locked.
Can someone help me?

thanks

Link to comment
Share on other sites

it seems you have to edit built-in otl to achieve the function,i'm not sure it's safe for houdini built-in nodes,so not recommended,
but you can custom buttons or otls, here are basic steps for custom otl,
1) create a .py file in $HOUDINI_USER_PREF_DIR/pythonX.7libs, code it like this:

import hou
def onButtonPress():
    #print("you pressed the button")
    hou.ui.displayMessage("hello,button pressed")

2) create arbitrary otl,add a button parameter

3) edit otl contents:
    edit operator type properties->scripts->event handler "python module"
    add codes like this,
   

 def press():
	import button_press
	button_press.onButtonPress()


    then,on parameters tab set "callback script" to "hou.phm().press()", done.

and you can ref these sections,

callback

Modules on disk

Link to comment
Share on other sites

Hi Benyee,
thank you for the reply. Well actually my problem is in fact that people is not using the custom HDA and pipeline tool, that's why I'd like to edit the built-in stuff. For some ROPs I was thinking about using the pre-render script, and then block the parameter in order to prevent anyone to edit it again. But obviously if there is any better idea I'm happy to hear it.
I really don't know how to handle flipbook tho... Basically I want people to use them just to see stuff on the fly, but if they want to save out images on the server they have to use the pipeline tool. Unfortunately everyone is basically ignoring it and saving out the image sequences by hand, resulting in wrong paths, names...

 

Link to comment
Share on other sites

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