Hook in VFX

In my job, I often get asked to customize a tool for a show to do a specific thing that CG, VFX, or dept supes want. These are things like generating some extra data when an artist publishes something or showing additional data in the video player about a take when it is being reviewed.

When this happens, first I assess the request to make sure we do not already have this ‘thing’ they want. Once that is done, one of two things happen. I either need to dig deep into the needed application and make a change to an already complex beast that has been messed with by countless people, or I just write a simple hook to do what they want!

A hook is a small script that ties into a larger application. Based on what it is it can run at the beginning, middle, or end of a process. They are particularly used a lot in VFX work because many applications in this field follow a dataflow design method. This means that a process can be injected anywhere along the dataflow to manipulate the data without messing with the core of the application.

By using hooks in your applications, you save a lot of ramp up time for new programmers working and reduce the chance of introducing bugs into the core of the application. You can also control feature creep since these new features are encapsulated and de-coupled from the main process.

Here are some examples of hooks you may see in the wonder world of movie making.

  • The CG supe wants to see some more information about the assets using in the shot, so a hook can be added to the end of the media creation process to add this data to the final movie’s metadata
  • Some information needs to be validated before an artist can check in a take. The checkin tool has a place to use hooks for validation. A hook at the start of the checkin process checks the data coming in.
  • Send an email when a render job is complete

Building a way to add functionality to your application without the need to modify the core process will greatly expand the maintainability of the process. A configuration file for you application can have references to functions that need to be run along the process so the programmer working on adding functions never even needs to check out the source code.

Why PDB is my favorite thing in python


At visual effects companies we have a lot of code, and a lot of the code is old and complicated. Sometimes is it troublesome to find out why something is behaving the way it is. Where is this value coming from and what is this variables type? There are a few ways you can answer these questions. You could litter your code with print statements or other methods. The one I find the most effective and pleasant to use is pdb, in particular pdb++.

Pdb is a python debugger that lets you step through your code line by line, monkey patch, and find where things are breaking. Out of the box, pdb has some great uses

https://docs.python.org/2/library/pdb.html

But to take this a step farther, there is pdb++ that has added features and a great display in the shell that makes it pleasant to walk through your code.

https://pypi.org/project/pdbpp/

If you find yourself working with a large and complex code base, knowing this tool will save you a bunch of time.