Fix: Viewer node crashes when the editor is pinned and has no Object ID #107737

Merged
Lukas Tönne merged 3 commits from LukasTonne/blender:fix_viewer_node_in_pinned_editor into main 2023-05-08 14:52:14 +02:00

3 Commits

Author SHA1 Message Date
Lukas Tönne 5df7ba1ba2 Early exit from viewer search if the node space context has no object. 2023-05-08 14:25:47 +02:00
Lukas Tönne 6e11fe3da1 Check node space context object before trying to construct viewer path. 2023-05-08 13:50:44 +02:00
Lukas Tönne ad2ef73160 Fix: Viewer node crashes when the editor is pinned and has no Object ID.
This case was not properly handled by the previous fix in #107621.

The viewer node path function still assumes that the node editor space
has a valid ID pointer (`snode.id`) and that it is an `Object`.
The ID pointer can be null when setting a pinned node tree through the
python API, like so:
```
space.pin = True
space.node_tree = some_other_node_tree
```

In this case the `ED_node_tree_start` function is called without and ID
pointer, which is allowed! The viewer node path function needs to handle
this case.
2023-05-08 13:09:24 +02:00