Run python command on frame changed


I wish update some widgets when the time is changes in RV. So when the user goes from one video to another in an RV session it will update the information of the shot in the custom ui I have made. Is this possible? Ideally in Python.

Thanks very much


You’ll want to bind your package to the frame-changed event. But note that this can quickly deteriorate into performance problems if you aren’t efficient with your code, since you are running something in Python (and therefore taking the GIL) each frame.

More info on events here:

One thing that might be useful for you is to use: extra_commands.sequenceBoundaries to know when you are going to go from one item to the next. You can get creative on caching that and invalidating your cache when your graph changes.

Unfortunately, unless something I missed for years or it is new, I don’t think there’s an event to describe that sources are about to change (though that’d be nice). Boy how I’d like to have missed that.

If you are curious about what events fire when, also try running RV with the switch -debug events and you’ll get a bunch of event info out on your commandline.

1 Like

Thanks very much Michael. The bind command is just what I was after. Thanks.

Check out the tag rv-plugin for lots of examples I wrote while I was at Autodesk, pretty-much all of them create a binding within the package rather than an explicit bind. That might help you get started.

1 Like