Hi Mois –
First just a sanity check: I’m guessing it’s a transcription error, and your actual code is correct, but you’ve got:
if operation == "prepare_new":
Beyond that, we’re still trying to make sense of the exact order of things, and why things would behave differently from engine to engine, but I ran this by @Ehsan on the engineering team this morning, and he had a great idea for a workaround that might suit your needs.
The idea here is that you’d use the
context_change core hook to run setframerange, but it would rely on the presence of a marker of saved state, which you’d set in the
prepare_new block in the
That way, although the logic would be in the
context_change hook, it would only run in cases where the context was changed at
New File time.
Here’s the code, again, with big thanks to @Ehsan. Note the caveat below:
elif operation == "prepare_new":
from sgtk.platform import current_engine
engine = current_engine()
if engine.name == "tk-nuke":
So it IS possible, but the
set_cache_item method has this warning in its docstring:
Internal Use Only - We provide no guarantees that this method
will be backwards compatible.
Hope that helps! Let us know how it goes.