Jump to content

chops execute python


Recommended Posts

how can I get my chop network to execute a python script from the hda module whenever a trigger is passed.

Try placing your HDA python script on an expression chop inside of your chopnet. ( Don't forget to change the expression chop node to read python instead of Hscript.)

Link to comment
Share on other sites

Try placing your HDA python script on an expression chop inside of your chopnet. ( Don't forget to change the expression chop node to read python instead of Hscript.)

hi thanks for the reply. could you give me an example of how you would format the expression. I keep getting an error. i don't know how to get the expression chop to execute a direct command like a print function.

Link to comment
Share on other sites

just check with realtime python script all your trigger channels for current sample values and maybe previous sample values and trigger your HDA script for all channels that passed the test

expression CHOP will not help you since CHOPs are precomputed, it would process all the channels just one time, that means it will trigger all your scripts and then it will do nothing when you play the animation

Link to comment
Share on other sites

just check with realtime python script all your trigger channels for current sample values and maybe previous sample values and trigger your HDA script for all channels that passed the test

expression CHOP will not help you since CHOPs are precomputed, it would process all the channels just one time, that means it will trigger all your scripts and then it will do nothing when you play the animation

so how do I get it to be in real time. how do I get A node to cook on every frame so that I can query my trigger values?

Link to comment
Share on other sites

use it in spare parameter

you can make your check function named for example getTriggers() in hou.session (Windows/Python Source Editor)

then just call it from the parameter

parameter expression will look like:

hou.session.getTriggers()

if it's not refreshing each frame, you can help it by

hou.session.getTriggers()
return hou.frame()

Link to comment
Share on other sites

on second thought it may be safer to use ParmTupleChanged event callback for node with time dependent param ($F)

or if the parm is on HDA, simple parm callback is probably the best way

I tried using a parrm callback. it wouldn't work using a chop expression in the parameter to fetch the trigger values from chops. the callback script is only executed when you directlly change the parameter. I need a script to be executed automaticlly every time the trigger value hits 1. I noticed that the "logic" chop has the ability to execute hscript. I tried playing around with it, but I couldn't get it to execute anything. Does anybody have any expereice with the logic chop?

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