When deleting a node, links attached to that node are deleted, but if one
of those links was connected to a multi input socket, the indices of the
other links connected to it were not updated. This adds updates both in
the case of a normal delete, as well as after a delete with reconnect.
Details
Diff Detail
- Repository
- rB Blender
Event Timeline
Thanks for working on that. So far it looks good to me. Just a tiny cleanup and a question.
| source/blender/blenkernel/intern/node.cc | ||
|---|---|---|
| 2523 | Only from curiosity. When in the deleting process is this function called when nodeUnlinkNode is not? I just ask because (without knowing the details) it seems that nodeUnlinkNode iterates over all links in the tree. So maybe it's enough to adjust indices there? | |
| source/blender/editors/space_node/node_edit.cc | ||
| 1836 ↗ | (On Diff #38787) | unrelated change? |
| source/blender/blenkernel/intern/node.cc | ||
|---|---|---|
| 2523 | This happens in delete with reconnect (CTRL + X). The nodeInternalRelink function tries to merge a link going into the node to one going out of the node to be deleted. If there is no ingoing link, it deletes the outgoing link, which is why the nodeUnlinkNode function doesn't see that link anymore, and the update has to happen here. I noticed this by accident when pressing ctrl+x instead of x while testing and saw that the update didn't happen. | |
| source/blender/blenkernel/intern/node.cc | ||
|---|---|---|
| 2519 | What does this assert protect against? I wonder if we would loose anything by just not having it. | |
| source/blender/blenkernel/intern/node.cc | ||
|---|---|---|
| 2519 | I think I added that mainly as an insurance that my logic was correct while testing, and just thought that it might be nice to leave it there. But realistically this can only fail if deleted_index <0, which would indicate an error somewhere else in the code, which should not be checked for here. So I think it's fine to just remove it. | |