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/space_node.cc')
-rw-r--r--source/blender/editors/space_node/space_node.cc23
1 files changed, 21 insertions, 2 deletions
diff --git a/source/blender/editors/space_node/space_node.cc b/source/blender/editors/space_node/space_node.cc
index f794a8ce294..4d0c88a5343 100644
--- a/source/blender/editors/space_node/space_node.cc
+++ b/source/blender/editors/space_node/space_node.cc
@@ -31,6 +31,7 @@
#include "BKE_context.h"
#include "BKE_lib_id.h"
+#include "BKE_lib_remap.h"
#include "BKE_node.h"
#include "BKE_screen.h"
@@ -896,9 +897,9 @@ static void node_widgets()
WM_gizmogrouptype_append_and_link(gzmap_type, NODE_GGT_backdrop_corner_pin);
}
-static void node_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, ID *old_id, ID *new_id)
+static void node_id_remap_cb(ID *old_id, ID *new_id, void *user_data)
{
- SpaceNode *snode = (SpaceNode *)slink;
+ SpaceNode *snode = static_cast<SpaceNode *>(user_data);
if (snode->id == old_id) {
/* nasty DNA logic for SpaceNode:
@@ -964,6 +965,24 @@ static void node_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, ID *old_id, I
}
}
+static void node_id_remap(ScrArea *UNUSED(area),
+ SpaceLink *slink,
+ const struct IDRemapper *mappings)
+{
+ /* Although we should be able to perform all the mappings in a single go this lead to issues when
+ * running the python test cases. Somehow the nodetree/edittree weren't updated to the new
+ * pointers that generated a SEGFAULT.
+ *
+ * To move forward we should perhaps remove snode->edittree and snode->nodetree as they are just
+ * copies of pointers. All usages should be calling a function that will receive the appropriate
+ * instance.
+ *
+ * We could also move a remap address at a time to use the IDRemapper as that should get closer
+ * to cleaner code. See {D13615} for more information about this topic.
+ */
+ BKE_id_remapper_iter(mappings, node_id_remap_cb, slink);
+}
+
static int node_space_subtype_get(ScrArea *area)
{
SpaceNode *snode = (SpaceNode *)area->spacedata.first;