Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_node/node_relationships.c')
-rw-r--r--source/blender/editors/space_node/node_relationships.c57
1 files changed, 42 insertions, 15 deletions
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index 5f592431558..70f7553cf41 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -31,12 +31,14 @@
#include "MEM_guardedalloc.h"
+#include "DNA_anim_types.h"
#include "DNA_node_types.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_easing.h"
+#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_library.h"
@@ -63,6 +65,15 @@
/* ****************** Relations helpers *********************** */
+static bool ntree_has_drivers(bNodeTree *ntree)
+{
+ AnimData *adt = BKE_animdata_from_id(&ntree->id);
+ if (adt == NULL) {
+ return false;
+ }
+ return !BLI_listbase_is_empty(&adt->drivers);
+}
+
static bool ntree_check_nodes_connected_dfs(bNodeTree *ntree,
bNode *from,
bNode *to)
@@ -134,6 +145,14 @@ static bool node_group_has_output(bNode *node)
bool node_connected_to_output(bNodeTree *ntree, bNode *node)
{
+ /* Special case for drivers: if node tree has any drivers we assume it is
+ * always to be tagged for update when node changes. Otherwise we will be
+ * doomed to do some deep and nasty deep search of indirect dependencies,
+ * which will be too complicated without real benefit.
+ */
+ if (ntree_has_drivers(ntree)) {
+ return true;
+ }
for (bNode *current_node = ntree->nodes.first;
current_node != NULL;
current_node = current_node->next)
@@ -144,11 +163,17 @@ bool node_connected_to_output(bNodeTree *ntree, bNode *node)
* We could make check more grained here by taking which socket the node
* is connected to and so eventually.
*/
- if (current_node->type == NODE_GROUP &&
- ntree_check_nodes_connected(ntree, node, current_node) &&
- node_group_has_output(current_node))
- {
- return true;
+ if (current_node->type == NODE_GROUP) {
+ if (current_node->id != NULL &&
+ ntree_has_drivers((bNodeTree *)current_node->id))
+ {
+ return true;
+ }
+ if (ntree_check_nodes_connected(ntree, node, current_node) &&
+ node_group_has_output(current_node))
+ {
+ return true;
+ }
}
if (current_node->flag & NODE_DO_OUTPUT) {
if (ntree_check_nodes_connected(ntree, node, current_node)) {
@@ -567,7 +592,13 @@ static void node_link_exit(bContext *C, wmOperator *op, bool apply_links)
ntree->is_updating = true;
for (linkdata = nldrag->links.first; linkdata; linkdata = linkdata->next) {
bNodeLink *link = linkdata->data;
-
+
+ /* See note below, but basically TEST flag means that the link
+ * was connected to output (or to a node which affects the
+ * output).
+ */
+ do_tag_update |= (link->flag & NODE_LINK_TEST) != 0;
+
if (apply_links && link->tosock && link->fromsock) {
/* before actually adding the link,
* let nodes perform special link insertion handling
@@ -593,11 +624,6 @@ static void node_link_exit(bContext *C, wmOperator *op, bool apply_links)
}
}
else {
- /* See note below, but basically TEST flag means that the link
- * was connected to output (or to a node which affects the
- * output).
- */
- do_tag_update |= (link->flag & NODE_LINK_TEST) != 0;
nodeRemLink(ntree, link);
}
}
@@ -1006,8 +1032,6 @@ static int cut_links_exec(bContext *C, wmOperator *op)
void NODE_OT_links_cut(wmOperatorType *ot)
{
- PropertyRNA *prop;
-
ot->name = "Cut Links";
ot->idname = "NODE_OT_links_cut";
ot->description = "Use the mouse to cut (remove) some links";
@@ -1022,8 +1046,11 @@ void NODE_OT_links_cut(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
+ /* properties */
+ PropertyRNA *prop;
+ prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
+ RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+
/* internal */
RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX);
}