Startup scripts environment changes for DCCs

Hi all,

What’s the best way of editing startup script environments for DCCs prior to launch from Shotgun Desktop? For example, if we wanted to update the NUKE_PATH variable with a custom init.py or MAYA_SCRIPT_PATH with a custom userSetup.py - which toolkit hook would be best to do this in?

Many thanks.

1 Like

This would be before_app_launch, configured on tk-multi-launchapp. Note that this is run for all engines, so you would have to switch on the engine name to call the necessary logic.

1 Like

Hi @viktor_petrov!

@mmoshev is correct. I just want to give you something to consider: If you are using a render farm, this forces you to bootstrap SGTK before every rendering. Personally I like the approach where you have some custom batch scripts that setup the environment and than launch the application. You can than simply use the same batch script in the Software Entities and the executable paths of your render farm.

Just my two cents. :slight_smile:

Cheers,
Fabian

1 Like

Thanks you both @mmoshev and @Fabian, this is very good to know.

2 Likes

You could just filter out the shotgun paths from the NUKE_PATH upon farm submission.

Also, if you don’t do any bootstrapping, sgtk will fail to import but the Nuke render will continue just fine, at least on Deadline.

Hi @Ricardo_Musch!

Interesting! I never tested that out for Nuke. Atm we are bootstrapping SGTK on the farm for Nuke and it works fine, but your way is probably easier to setup. Thanks for the tipp.

1 Like

We’re in the same boat as Fabian, since sgtk import throws an error, the job fails, but we’ve never tried ignoring this error and rendering anyway. This could save a bunch of hassle - we’ve considered transforming to normal Write nodes on submit, but it might not even be necessary.

As far as I know it’s not necessary for Nuke.
You can see in the code of the shotgun writenode it checks if nuke hassAtribute _sg_write_node_handler which on the farm, it won’t.

However transforming sgtk-mantra to normal mantra is needed for Houdini, luckily this is really quick in Houdini.