Jump to content

Executing hda python script every frame


FlorianEggers

Recommended Posts

Hi there,

I'm in the process of setting up a little viewport comment hda. All it does is changing the vcomment parameter on a selected camera. This works great for static text and variables but I haven't found a clean solution for time-dependent stuff such as $F.

Since the hda python module doesn't execute every frame, I'm using a script SOP inside the hda which calls the phm function that updates the text every frame. The problem is, that this results in the HDA function executing last. So when doing flipbooks for instance, the image will be rendered before the hda function executes, thus the text lags behind by one frame ($F will show "1001" on frame 1002).

Part of the problem is (I think) that the string is being evaluated inside the HDA. So the actual vcomment parm on the camera will already be "1001" instead of "$F" (which would probably evaluate correctly every frame). So if I could prevent the string from evaluating on the HDA, that would probably solve the issue.

I'll try the same thing with a Python SOP instead of on the HDA's python module, but in the meantime, maybe someone has a better solution for this problem.

 

Edited by FlorianEggers
Found solution
Link to comment
Share on other sites

Rather than pushing the values to a parameter on a camera from your HDA, consider setting a Python expression on vcomment something like:

hou.nodeType('your_hda_type').hdaModule().get_comment()

It's not always possible to set it up this way, depending on your requirements, but it's for sure always better to pull values rather than push to parameters. At least you won't have problems with locked nodes and it doesn't change the scene state.

Link to comment
Share on other sites

On 3/11/2020 at 8:00 PM, Stalkerx777 said:

Rather than pushing the values to a parameter on a camera from your HDA, consider setting a Python expression on vcomment something like:


hou.nodeType('your_hda_type').hdaModule().get_comment()

It's not always possible to set it up this way, depending on your requirements, but it's for sure always better to pull values rather than push to parameters. At least you won't have problems with locked nodes and it doesn't change the scene state.

Right, that would be a possibility too. That push / pull argument is a pretty good one. Thanks Alex!

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