This patch adds pre-validation of selected nodes by the insert operator to the group to not allow the group to be inserted into itself.
Details
Diff Detail
Event Timeline
| source/blender/editors/space_node/node_group.cc | ||
|---|---|---|
| 681 | Is this redundant with the check below? | |
| source/blender/editors/space_node/node_group.cc | ||
|---|---|---|
| 681 | This is for a separate, slightly different bug report. | |
But, if necessary, I planned to move node_group_make_node_tree_is_contains function to ED_node for the python api in the future. In such a case, this function could generate a text version of the message about how the groups overlap. For example Can not insert group Group.005 in Group.001 becouse Group.001->Group.002->Group.003->Group.004->Group.005
No need to make this more complex now. Generally seems good. Will test tomorrow. The function names could probably be improved.
I wanted to make sure that there is no unnecessary check, but I didn’t even think about reusing node_group_make_node.
I will need to remember reinterpret_cast so I don't run into problems (tried to use static cast at first but didn't work)
Still, I think it's better to agree with your naming / commenting option. At least in the formulation of an understandable comment, I'm definitely weak
- Merge master
- This is a slightly specific operation. In the new approach to the insert test, it is more logical to raise this check to an insert statement, since the extra call to create a new group is redundant.
One comment inline, other than that this looks good, thanks.
| source/blender/editors/space_node/node_group.cc | ||
|---|---|---|
| 1191–1198 | IMO it's a bit clearer if there's just a if (node->is_group() && node->id) { check inside this look, that saves creating the temporary set (and having to come up with a name for it, and having to use brackets to make a separate scope for it). | |
| source/blender/editors/space_node/node_group.cc | ||
|---|---|---|
| 1187 | This if statement seems weird to me. It looks like it's checking "if the node isn't a group node or it doesn't have a data-block" which doesn't sound right. I'd think this should check "if the node is a group node and it has a data-block, which is the check I posted in my previous comment. Am I missing something? | |
| source/blender/editors/space_node/node_group.cc | ||
|---|---|---|
| 1187 | Oops, I misread this! | |