Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/node_tree_update.cc
| Show All 18 Lines | |||||
| #include "BKE_node_runtime.hh" | #include "BKE_node_runtime.hh" | ||||
| #include "BKE_node_tree_update.h" | #include "BKE_node_tree_update.h" | ||||
| #include "MOD_nodes.h" | #include "MOD_nodes.h" | ||||
| #include "NOD_node_declaration.hh" | #include "NOD_node_declaration.hh" | ||||
| #include "NOD_texture.h" | #include "NOD_texture.h" | ||||
| #include "DEG_depsgraph_build.h" | |||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| using namespace blender::nodes; | using namespace blender::nodes; | ||||
| /** | /** | ||||
| * These flags are used by the `changed_flag` field in #bNodeTree, #bNode and #bNodeSocket. | * These flags are used by the `changed_flag` field in #bNodeTree, #bNode and #bNodeSocket. | ||||
| * This enum is not part of the public api. It should be used through the `BKE_ntree_update_tag_*` | * This enum is not part of the public api. It should be used through the `BKE_ntree_update_tag_*` | ||||
| * api. | * api. | ||||
| ▲ Show 20 Lines • Show All 1,039 Lines • ▼ Show 20 Lines | private: | ||||
| { | { | ||||
| if (ntree.runtime->changed_flag & NTREE_CHANGED_ANY) { | if (ntree.runtime->changed_flag & NTREE_CHANGED_ANY) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| if (node.runtime->changed_flag & NTREE_CHANGED_NODE_PROPERTY) { | if (node.runtime->changed_flag & NTREE_CHANGED_NODE_PROPERTY) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| if (ntree.runtime->changed_flag & NTREE_CHANGED_LINK) { | if (ntree.runtime->changed_flag & NTREE_CHANGED_LINK) { | ||||
| DEG_relations_tag_update(bmain_); | |||||
HooglyBoogly: I don't think tagging an update for depsgraph relations every time a link is changed is the… | |||||
ModerAuthorUnsubmitted Not Done Inline ActionsI have an idea of a more general way of doing such updates. But so far I haven't done it. It looks like an oversized system for the sake of 2-3 nodes. Since basically such dependencies are delegated to sockets. There are not so many nodes that have such dependencies. But I'll try. Moder: I have an idea of a more general way of doing such updates. But so far I haven't done it. It… | |||||
| ntree.ensure_topology_cache(); | ntree.ensure_topology_cache(); | ||||
| /* Node groups currently always rebuilt their sockets when they are updated. | /* Node groups currently always rebuilt their sockets when they are updated. | ||||
| * So avoid calling the update method when no new link was added to it. */ | * So avoid calling the update method when no new link was added to it. */ | ||||
| if (node.type == NODE_GROUP_INPUT) { | if (node.type == NODE_GROUP_INPUT) { | ||||
| if (node.output_sockets().last()->is_directly_linked()) { | if (node.output_sockets().last()->is_directly_linked()) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 685 Lines • Show Last 20 Lines | |||||
I don't think tagging an update for depsgraph relations every time a link is changed is the right solution. It's fast for simple scenes but it can be slow for complex files.