Fix T101536: missing node tree updates after remapping id

The main problem is that the node tree was not properly updated
after a property in the tree changed. More specifically, the collection
pointer in the Collection Info node was cleared, but the node tree
was not updated after that (usually this is handled by rna updates).

Differential Revision: https://developer.blender.org/D16289
This commit is contained in:
Jacques Lucke
2022-11-15 12:07:38 +01:00
parent 337dbb1ab0
commit 5c42e54f6e
2 changed files with 11 additions and 0 deletions

View File

@@ -27,6 +27,7 @@
#include "BKE_modifier.h"
#include "BKE_multires.h"
#include "BKE_node.h"
#include "BKE_node_tree_update.h"
#include "BKE_object.h"
#include "DEG_depsgraph.h"
@@ -117,6 +118,11 @@ static void foreach_libblock_remap_callback_apply(ID *id_owner,
id_owner,
ID_RECALC_COPY_ON_WRITE | ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
}
if (GS(id_owner->name) == ID_NT) {
/* Make sure that the node tree is updated after a property in it changed. Ideally, we would
* know which nodes property was changed so that only this node is tagged. */
BKE_ntree_update_tag_all((bNodeTree *)id_owner);
}
}
/* Get the new_id pointer. When the mapping is violating never null we should use a NULL
* pointer otherwise the incorrect users are decreased and increased on the same instance. */

View File

@@ -60,6 +60,7 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "ED_node.h"
#include "ED_object.h"
#include "ED_outliner.h"
#include "ED_scene.h"
@@ -2458,6 +2459,8 @@ static int outliner_delete_exec(bContext *C, wmOperator *op)
WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active);
}
ED_node_tree_propagate_change(C, bmain, nullptr);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
@@ -2764,6 +2767,8 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
break;
}
ED_node_tree_propagate_change(C, bmain, nullptr);
/* wrong notifier still... */
WM_event_add_notifier(C, NC_ID | NA_EDITED, nullptr);