Restore Context of opened Nuke Script properly #127
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR solves the following issue with the current
tk-nukeimplementation.Common situation (example)
File --> Recent Filesmenu.tk-nukeattempts 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 --> Stepbut notShot --> Step --> Task.Solution (this PR):
onScriptSavecallback of thetk-nukeengine we ensure that a tab exists on the Root node calledsgtkand a string knob exists calledsgtk_context.onScriptSavewe serialize the current context (which likely includes the Task) and set this on thesgtk_contextknob.sgtk_on_load_callbackwe attempt to read a serialized context string from thesgtk_contextknob on the root nodesgtktab.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-nukeengine.