Skip to content

Conversation

@RicardoMusch
Copy link
Contributor

This PR solves the following issue with the current tk-nuke implementation.

Common situation (example)

  • Path to Nuke Workfile usually includes the Shot, Step, filename but NOT the Task name/id.
  • Nuke Users prefer to load recent files from the File --> Recent Files menu.
  • tk-nuke attempts to create the current context from the opened Nuke script file which usually results in an incomplete context (usually missing Task).

Result: Current context is set to Shot --> Step but not Shot --> Step --> Task.

Solution (this PR):

  • During the onScriptSave callback of the tk-nuke engine we ensure that a tab exists on the Root node called sgtk and a string knob exists called sgtk_context.
  • During onScriptSave we serialize the current context (which likely includes the Task) and set this on the sgtk_context knob.
  • During sgtk_on_load_callback we attempt to read a serialized context string from the sgtk_context knob on the root node sgtk tab.
  • If found, we deserialize the context and refresh the engine with this context.
  • Should we fail to gain a context this way the engine will fall back to it's current implementation (context_from_path).

All of the above gracefully handles the tab or knob not being present or empty.

The behaviour in this PR is entirely nuke-native and also how other software products, such as Deadline for example, save script based properties.

I can not think of any reason this PR would break anyone's current workflow, it simply solves and annoying "shortfall" of the tk-nuke engine.

…n the script. This is better than getting the context from the path as the path usually doesn't include the Task name/id.
@codecov
Copy link

codecov bot commented Nov 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 20.14%. Comparing base (e270632) to head (c1ca408).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #127      +/-   ##
==========================================
+ Coverage   19.04%   20.14%   +1.09%     
==========================================
  Files           6        6              
  Lines         546      546              
==========================================
+ Hits          104      110       +6     
+ Misses        442      436       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant