Fix/camera selection - #329
Conversation
| nuke.nodePaste("%clipboard%") | ||
| camera_node = nuke.toNode(camera_name) | ||
| camera_node = nuke.nodePaste("%clipboard%") | ||
| if not camera_node: |
There was a problem hiding this comment.
this is technically unrelated, but my ide kept shouting at me that camera_node could be None
| nuke.delete(camera_node) | ||
| nuke.nodePaste("%clipboard%") | ||
| camera_node = nuke.toNode(camera_name) | ||
| camera_node = nuke.nodePaste("%clipboard%") |
There was a problem hiding this comment.
also not directly related to the issue, but given that we're using .selectOnly() earlier, we now know for sure that the return value of nuke.nodePaste will be that exact node.
So I figured that using the return value would be cleaner than looking it up via the name
@jakubjezek001 @moonyuet any chance you may know? Can we have |
|
made a PR for an alternative option, which would be to remove the copy/paste workaround |
@BigRoy |
Changelog Description
fix an issue where updating cameras could cause other nodes to be copied or fail if the depending on the current seleciton
Additional review information
alternative solution: We remove the copy/paste workaround.
I'm not sure what exactly the workaround is for, so I cannot comment on it
Testing notes 1):
A PythonObject is not attached to a node.exeptionExplanation:
the
maintained_selectioncontext stores a list of selected nodes, including the camera node that is being updatedlines 164-167 cuts and pastes the node invalidating the python object referenced in the context manager
ayon-nuke/client/ayon_nuke/plugins/load/load_camera.py
Lines 164 to 167 in fb4ee9b
How this PR fixes it:
maintained_selectionhttps://github.com/straylondon/ayon-nuke/blob/8939f315289acdebe39a9cba50ca01f5eb4bf503/client/ayon_nuke/plugins/load/load_camera.py#L153-L155Testing notes 2):
Peek.2026-07-10.10-53.mp4
Explanation:
ayon-nuke/client/ayon_nuke/plugins/load/load_camera.py
Line 151 in fb4ee9b
nuke.nodeCopy("%clipboard%")copies whatever is currently selectedHow this PR fixes it:
using
node.selectOnly()to ensure the camera is the only object getting copiedhttps://github.com/straylondon/ayon-nuke/blob/8939f315289acdebe39a9cba50ca01f5eb4bf503/client/ayon_nuke/plugins/load/load_camera.py#L168