Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/node.cc
| Show First 20 Lines • Show All 3,445 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { | ||||
| if (node->type == type) { | if (node->type == type) { | ||||
| return node; | return node; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| bool ntreeHasTree(const bNodeTree *ntree, const bNodeTree *lookup) | bool ntreeContainsTree(const bNodeTree *parent_tree, const bNodeTree *sub_tree) | ||||
| { | { | ||||
| if (ntree == lookup) { | if (parent_tree == sub_tree) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| for (const bNode *node : ntree->all_nodes()) { | parent_tree->ensure_topology_cache(); | ||||
| if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id) { | for (const bNode *group : parent_tree->group_nodes()) { | ||||
| if (ntreeHasTree((bNodeTree *)node->id, lookup)) { | const bNodeTree *tree = reinterpret_cast<bNodeTree *>(group->id); | ||||
| if (tree && ntreeContainsTree(tree, sub_tree)) { | |||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| return false; | return false; | ||||
| } | } | ||||
| bNodeLink *nodeFindLink(bNodeTree *ntree, const bNodeSocket *from, const bNodeSocket *to) | bNodeLink *nodeFindLink(bNodeTree *ntree, const bNodeSocket *from, const bNodeSocket *to) | ||||
| { | { | ||||
| LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) { | LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) { | ||||
| if (link->fromsock == from && link->tosock == to) { | if (link->fromsock == from && link->tosock == to) { | ||||
| return link; | return link; | ||||
| ▲ Show 20 Lines • Show All 710 Lines • Show Last 20 Lines | |||||