Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_nodes.cc
| Show All 10 Lines | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "BLI_array.hh" | #include "BLI_array.hh" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_math_vec_types.hh" | #include "BLI_math_vec_types.hh" | ||||
| #include "BLI_multi_value_map.hh" | #include "BLI_multi_value_map.hh" | ||||
| #include "BLI_set.hh" | #include "BLI_set.hh" | ||||
| #include "BLI_stack.hh" | |||||
| #include "BLI_string.h" | #include "BLI_string.h" | ||||
| #include "BLI_string_search.h" | #include "BLI_string_search.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "DNA_collection_types.h" | #include "DNA_collection_types.h" | ||||
| #include "DNA_curves_types.h" | #include "DNA_curves_types.h" | ||||
| #include "DNA_defaults.h" | #include "DNA_defaults.h" | ||||
| #include "DNA_material_types.h" | #include "DNA_material_types.h" | ||||
| ▲ Show 20 Lines • Show All 303 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static bool check_tree_for_time_node(const bNodeTree &tree, | static bool check_tree_for_time_node(const bNodeTree &tree, | ||||
| Set<const bNodeTree *> &r_checked_trees) | Set<const bNodeTree *> &r_checked_trees) | ||||
| { | { | ||||
| if (!r_checked_trees.add(&tree)) { | if (!r_checked_trees.add(&tree)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| LISTBASE_FOREACH (const bNode *, node, &tree.nodes) { | |||||
| if (node->type == GEO_NODE_INPUT_SCENE_TIME) { | tree.ensure_topology_cache(); | ||||
| Stack<const bNode *> forward_nodes; | |||||
HooglyBoogly: Just a more standard variable name for this | |||||
| if (const bNode *output = tree.group_output_node()) { | |||||
| forward_nodes.push(output); | |||||
| } | |||||
| else { | |||||
| return false; | |||||
| } | |||||
HooglyBooglyUnsubmitted Done Inline Actionselse after return is unnecessary HooglyBoogly: else after return is unnecessary | |||||
ModerAuthorUnsubmitted Done Inline ActionsThis return is needed if there is no group exit, but if there is one, everything below should be executed. Moder: This return is needed if there is no group exit, but if there is one, everything below should… | |||||
HooglyBooglyUnsubmitted Done Inline ActionsOops, of course, sorry. I was skimming that too quickly HooglyBoogly: Oops, of course, sorry. I was skimming that too quickly | |||||
| while (!forward_nodes.is_empty()) { | |||||
| const bNode &node = *forward_nodes.pop(); | |||||
| if (node.type == GEO_NODE_INPUT_SCENE_TIME) { | |||||
| return true; | return true; | ||||
| } | } | ||||
| if (node->type == NODE_GROUP) { | |||||
| const bNodeTree *sub_tree = reinterpret_cast<const bNodeTree *>(node->id); | for (const bNodeSocket *input : node.input_sockets()) { | ||||
| for (const bNodeSocket *socket : input->directly_linked_sockets()) { | |||||
| const bNode &tnode = socket->owner_node(); | |||||
| if (tnode.type == GEO_NODE_INPUT_SCENE_TIME) { | |||||
| return true; | |||||
| } | |||||
| if (tnode.type == NODE_GROUP) { | |||||
| const bNodeTree *sub_tree = reinterpret_cast<const bNodeTree *>(tnode.id); | |||||
| if (sub_tree && check_tree_for_time_node(*sub_tree, r_checked_trees)) { | if (sub_tree && check_tree_for_time_node(*sub_tree, r_checked_trees)) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| forward_nodes.push(&tnode); | |||||
| } | |||||
| } | } | ||||
| } | |||||
| return false; | return false; | ||||
| } | } | ||||
| static bool dependsOnTime(struct Scene * /*scene*/, ModifierData *md) | static bool dependsOnTime(struct Scene * /*scene*/, ModifierData *md) | ||||
| { | { | ||||
| const NodesModifierData *nmd = reinterpret_cast<NodesModifierData *>(md); | const NodesModifierData *nmd = reinterpret_cast<NodesModifierData *>(md); | ||||
| const bNodeTree *tree = nmd->node_group; | const bNodeTree *tree = nmd->node_group; | ||||
| if (tree == nullptr) { | if (tree == nullptr) { | ||||
| ▲ Show 20 Lines • Show All 1,557 Lines • Show Last 20 Lines | |||||
Just a more standard variable name for this