How to add a callback for pyplug button?


#1

Hey there,
Try to create my first pyplug.
I have a filepath, a float attr, and a button, What I want to do is after press the button, it will read file, containing attr var, in filepath and set the float attr. I could not find where to add script for button? Is there something on UI I missed? or I have to do this on pyplug file itself?

Best,

Han


#2

you can have a look at the Card3D and camera pyplug : Camera and Card3D pyplug that import .chan files

I use a callback to import the .chan files, it look like much like what you want to do.
I found that when doing a group it’s a bit different, I used the text editor to register my function, then you have to put the function in a text file next to the pyplug when you export it.

The example in the card pyplug + the Natron documentation should give you enough info on how to do this.

If you still have issue I can look a bit deeper into it.


#3

Thanks a lot! it’s very helpful. I now have the button working nicely.