Autodesk Flame - Launch from SG Desktop - Overriding Flame's custom hooks

Flame presents its users with the ability to modify the application behavior by writing custom code and inserting into various hooks. For example, to modify Flame’s export behavior, you can edit this file here:

/opt/Autodesk/flame_2024.2.1/python/export_hook.py

When Flame is launched from within the SG Desktop application, the tk-flame engine overrides this behavior with its own custom hooks. These are available in the tk-flame engine code here.

The only problem is - I can’t figure out a way to control that override behavior - nothing visible in the info.yml file as a configurable parameter. So, my only option here is to edit the engine code directly, which I am loathe to do.

This behavior does not happen if I launch Flame outside of SG Desktop and SG is integrated with Flame in the old-fashioned way - by running Flame’s Setup application and setting ShotGrid to “Enabled”.

Perhaps this might be better sent to support, but has anyone come across this and found a workaround?

Ooh, yes I see what you mean.
They should instead refactor this so that the flame_hooks call out to an actual SG engine hook instead.

I guess flame_hooks is a folder that flame will look at on startup that needs to be there.
But the code inside it should just call out to the engine and run an actual hookable hook from there.

Along these lines, tk-flame-export also registers callback hooks that override batch render behavior - before batch renders start, and after they finish. I’m looking at the app code and I don’t see any way, typically with an environment variable, to turn this behavior off. For now, I’m just gonna disable the app entirely in the engine YML config file.

1 Like

Have you tried setting the DL_PYTHON_HOOK_PATH environment variable prior to launching SG Desktop? The tk-flame engine is just appending to that environment variable prior to launching Flame, so can maybe try setting its initial value to /opt/Autodesk/flame_2024.2.1/python.

export DL_PYTHON_HOOK_PATH=/opt/Autodesk/flame_2024.2.1/python
Shotgun
1 Like

Brett I believe tk-flame is overriding that environment variable when it starts up, which is in the engine code.

That environment variable works like PATH so it can be set to multiple folders. tk-flame does set it if it doesn’t exist which does act like an override, but it appends to the existing value if it already exists. So you can still set the value to any folder(s) ahead of time. If the initial value is /path/to/custom_folder, then after launching flame through tk-flame, the value will look like this: /path/to/custom_folder:/path/to/tk-flame/flame_hooks

1 Like