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:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-05-07 19:28:42 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-05-07 19:28:42 +0400
commit5455928262c7b2e99c8eb9be13665d819c4089d5 (patch)
tree3b6d913321ad02f392e55a4983227b1348884671 /source/blender/editors
parentc31ec62d2f5b33c46d54ddc982c0aed305c56a29 (diff)
Fix #35122: Blenderplayer crashes when loading level
Issue was caused by ntreeUpdateTree calling for a ntree which is not in G.main. This lead to issues in ntreeVerifyNodes (which is called from ntreeUpdateTree). Made is so ntreeUpdateTree now accepts main as an argument. Will work for the release, later we could either solve the TODO mentioned in ntreeUpdateTree which will eliminate need in main there or make it so context's main is used from all over where ntreeUpdateTree is called (currently there're still some usages of G.main).
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_node/node_add.c4
-rw-r--r--source/blender/editors/space_node/node_edit.c22
-rw-r--r--source/blender/editors/space_node/node_group.c14
-rw-r--r--source/blender/editors/space_node/node_relationships.c19
-rw-r--r--source/blender/editors/space_node/node_templates.c9
5 files changed, 36 insertions, 32 deletions
diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c
index 0425ec58f83..61fbde32f7a 100644
--- a/source/blender/editors/space_node/node_add.c
+++ b/source/blender/editors/space_node/node_add.c
@@ -93,7 +93,7 @@ bNode *node_add_node(const bContext *C, const char *idname, int type, float locx
node->locx = locx;
node->locy = locy + 60.0f;
- ntreeUpdateTree(snode->edittree);
+ ntreeUpdateTree(bmain, snode->edittree);
ED_node_set_active(bmain, snode->edittree, node);
if (snode->nodetree->type == NTREE_COMPOSIT) {
@@ -285,7 +285,7 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
BLI_freelistN(&input_links);
/* always last */
- ntreeUpdateTree(ntree);
+ ntreeUpdateTree(CTX_data_main(C), ntree);
snode_notify(C, snode);
snode_dag_update(C, snode);
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index b3e24a9d6ed..6c7ccf6264b 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -474,7 +474,7 @@ void ED_node_shader_default(const bContext *C, ID *id)
}
}
- ntreeUpdateTree(ntree);
+ ntreeUpdateTree(CTX_data_main(C), ntree);
}
/* assumes nothing being done in ntree yet, sets the default in/out node */
@@ -513,7 +513,7 @@ void ED_node_composit_default(const bContext *C, struct Scene *sce)
tosock = out->inputs.first;
nodeAddLink(sce->nodetree, in, fromsock, out, tosock);
- ntreeUpdateTree(sce->nodetree);
+ ntreeUpdateTree(CTX_data_main(C), sce->nodetree);
// XXX ntreeCompositForceHidden(sce->nodetree);
}
@@ -545,7 +545,7 @@ void ED_node_texture_default(const bContext *C, Tex *tx)
tosock = out->inputs.first;
nodeAddLink(tx->nodetree, in, fromsock, out, tosock);
- ntreeUpdateTree(tx->nodetree);
+ ntreeUpdateTree(CTX_data_main(C), tx->nodetree);
}
/* Here we set the active tree(s), even called for each redraw now, so keep it fast :) */
@@ -1222,7 +1222,7 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
break;
}
- ntreeUpdateTree(snode->edittree);
+ ntreeUpdateTree(CTX_data_main(C), snode->edittree);
snode_notify(C, snode);
snode_dag_update(C, snode);
@@ -1557,7 +1557,7 @@ static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op))
}
}
- ntreeUpdateTree(snode->edittree);
+ ntreeUpdateTree(CTX_data_main(C), snode->edittree);
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
@@ -1636,7 +1636,7 @@ static int node_delete_exec(bContext *C, wmOperator *UNUSED(op))
}
}
- ntreeUpdateTree(snode->edittree);
+ ntreeUpdateTree(CTX_data_main(C), snode->edittree);
snode_notify(C, snode);
snode_dag_update(C, snode);
@@ -1679,7 +1679,7 @@ static int node_delete_reconnect_exec(bContext *C, wmOperator *UNUSED(op))
}
}
- ntreeUpdateTree(snode->edittree);
+ ntreeUpdateTree(CTX_data_main(C), snode->edittree);
snode_notify(C, snode);
snode_dag_update(C, snode);
@@ -2071,7 +2071,7 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op)
link->tonode->new_node, link->tosock->new_sock);
}
- ntreeUpdateTree(snode->edittree);
+ ntreeUpdateTree(CTX_data_main(C), snode->edittree);
snode_notify(C, snode);
snode_dag_update(C, snode);
@@ -2156,7 +2156,7 @@ static int ntree_socket_add_exec(bContext *C, wmOperator *op)
/* make the new socket active */
sock->flag |= SELECT;
- ntreeUpdateTree(ntree);
+ ntreeUpdateTree(CTX_data_main(C), ntree);
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
@@ -2202,7 +2202,7 @@ static int ntree_socket_remove_exec(bContext *C, wmOperator *UNUSED(op))
if (active_sock)
active_sock->flag |= SELECT;
- ntreeUpdateTree(ntree);
+ ntreeUpdateTree(CTX_data_main(C), ntree);
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
@@ -2270,7 +2270,7 @@ static int ntree_socket_move_exec(bContext *C, wmOperator *op)
}
}
- ntreeUpdateTree(ntree);
+ ntreeUpdateTree(CTX_data_main(C), ntree);
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c
index 64117627be4..9b445cfc82c 100644
--- a/source/blender/editors/space_node/node_group.c
+++ b/source/blender/editors/space_node/node_group.c
@@ -363,7 +363,7 @@ static int node_group_ungroup_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
if (gnode->id && node_group_ungroup(snode->edittree, gnode)) {
- ntreeUpdateTree(snode->nodetree);
+ ntreeUpdateTree(CTX_data_main(C), snode->nodetree);
}
else {
BKE_report(op->reports, RPT_WARNING, "Cannot ungroup");
@@ -556,7 +556,7 @@ static int node_group_separate_exec(bContext *C, wmOperator *op)
/* switch to parent tree */
ED_node_tree_pop(snode);
- ntreeUpdateTree(snode->nodetree);
+ ntreeUpdateTree(CTX_data_main(C), snode->nodetree);
snode_notify(C, snode);
snode_dag_update(C, snode);
@@ -917,6 +917,7 @@ static int node_group_make_exec(bContext *C, wmOperator *op)
const char *node_idname = group_node_idname(C);
bNodeTree *ngroup;
bNode *gnode;
+ Main *bmain = CTX_data_main(C);
ED_preview_kill_jobs(C);
@@ -931,11 +932,11 @@ static int node_group_make_exec(bContext *C, wmOperator *op)
nodeSetActive(ntree, gnode);
if (ngroup) {
ED_node_tree_push(snode, ngroup, gnode);
- ntreeUpdateTree(ngroup);
+ ntreeUpdateTree(bmain, ngroup);
}
}
- ntreeUpdateTree(ntree);
+ ntreeUpdateTree(bmain, ntree);
snode_notify(C, snode);
snode_dag_update(C, snode);
@@ -967,6 +968,7 @@ static int node_group_insert_exec(bContext *C, wmOperator *op)
bNodeTree *ngroup;
const char *node_idname = group_node_idname(C);
bNode *gnode;
+ Main *bmain = CTX_data_main(C);
ED_preview_kill_jobs(C);
@@ -983,9 +985,9 @@ static int node_group_insert_exec(bContext *C, wmOperator *op)
nodeSetActive(ntree, gnode);
ED_node_tree_push(snode, ngroup, gnode);
- ntreeUpdateTree(ngroup);
+ ntreeUpdateTree(bmain, ngroup);
- ntreeUpdateTree(ntree);
+ ntreeUpdateTree(bmain, ntree);
snode_notify(C, snode);
snode_dag_update(C, snode);
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index 71989f3ee04..30f85c07e65 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BKE_context.h"
+#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_node.h"
@@ -173,7 +174,7 @@ static int snode_autoconnect_input(SpaceNode *snode, bNode *node_fr, bNodeSocket
link = nodeAddLink(ntree, node_fr, sock_fr, node_to, sock_to);
/* validate the new link */
- ntreeUpdateTree(ntree);
+ ntreeUpdateTree(G.main, ntree);
if (!(link->flag & NODE_LINK_VALID)) {
nodeRemLink(ntree, link);
return 0;
@@ -256,7 +257,7 @@ static void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace)
}
if (numlinks > 0) {
- ntreeUpdateTree(ntree);
+ ntreeUpdateTree(G.main, ntree);
}
BLI_freelistN(nodelist);
@@ -347,7 +348,7 @@ static int node_link_viewer(const bContext *C, bNode *tonode)
/* make sure the dependency sorting is updated */
snode->edittree->update |= NTREE_UPDATE_LINKS;
}
- ntreeUpdateTree(snode->edittree);
+ ntreeUpdateTree(CTX_data_main(C), snode->edittree);
snode_update(snode, node);
}
@@ -532,7 +533,7 @@ static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event)
nodeRemLink(ntree, link);
}
- ntreeUpdateTree(ntree);
+ ntreeUpdateTree(CTX_data_main(C), ntree);
snode_notify(C, snode);
snode_dag_update(C, snode);
@@ -714,7 +715,7 @@ static int node_make_link_exec(bContext *C, wmOperator *op)
node_deselect_all_input_sockets(snode, 0);
node_deselect_all_output_sockets(snode, 0);
- ntreeUpdateTree(snode->edittree);
+ ntreeUpdateTree(CTX_data_main(C), snode->edittree);
snode_notify(C, snode);
snode_dag_update(C, snode);
@@ -797,7 +798,7 @@ static int cut_links_exec(bContext *C, wmOperator *op)
}
if (found) {
- ntreeUpdateTree(snode->edittree);
+ ntreeUpdateTree(CTX_data_main(C), snode->edittree);
snode_notify(C, snode);
snode_dag_update(C, snode);
@@ -852,7 +853,7 @@ static int detach_links_exec(bContext *C, wmOperator *UNUSED(op))
}
}
- ntreeUpdateTree(ntree);
+ ntreeUpdateTree(CTX_data_main(C), ntree);
snode_notify(C, snode);
snode_dag_update(C, snode);
@@ -881,7 +882,7 @@ static int node_show_cycles_exec(bContext *C, wmOperator *UNUSED(op))
SpaceNode *snode = CTX_wm_space_node(C);
/* this is just a wrapper around this call... */
- ntreeUpdateTree(snode->nodetree);
+ ntreeUpdateTree(CTX_data_main(C), snode->nodetree);
snode_notify(C, snode);
return OPERATOR_FINISHED;
@@ -1361,7 +1362,7 @@ void ED_node_link_insert(ScrArea *sa)
nodeAddLink(snode->edittree, select, best_output, node, sockto);
- ntreeUpdateTree(snode->edittree); /* needed for pointers */
+ ntreeUpdateTree(G.main, snode->edittree); /* needed for pointers */
snode_update(snode, select);
ED_node_tag_update_id(snode->id);
}
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index bac7791af2a..eaafb2b05d2 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -38,6 +38,7 @@
#include "BLF_translation.h"
#include "BKE_context.h"
+#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_scene.h"
@@ -85,7 +86,7 @@ static void node_link_item_apply(bNode *node, NodeLinkItem *item)
{
if (node->type == NODE_GROUP) {
node->id = (ID *)item->ngroup;
- ntreeUpdateTree(item->ngroup);
+ ntreeUpdateTree(G.main, item->ngroup);
}
else {
/* nothing to do for now */
@@ -166,7 +167,7 @@ static void node_socket_disconnect(Main *bmain, bNodeTree *ntree, bNode *node_to
sock_to->flag |= SOCK_COLLAPSED;
nodeUpdate(ntree, node_to);
- ntreeUpdateTree(ntree);
+ ntreeUpdateTree(bmain, ntree);
ED_node_tag_update_nodetree(bmain, ntree);
}
@@ -181,7 +182,7 @@ static void node_socket_remove(Main *bmain, bNodeTree *ntree, bNode *node_to, bN
sock_to->flag |= SOCK_COLLAPSED;
nodeUpdate(ntree, node_to);
- ntreeUpdateTree(ntree);
+ ntreeUpdateTree(bmain, ntree);
ED_node_tag_update_nodetree(bmain, ntree);
}
@@ -267,7 +268,7 @@ static void node_socket_add_replace(const bContext *C, bNodeTree *ntree, bNode *
nodeUpdate(ntree, node_from);
nodeUpdate(ntree, node_to);
- ntreeUpdateTree(ntree);
+ ntreeUpdateTree(CTX_data_main(C), ntree);
ED_node_tag_update_nodetree(CTX_data_main(C), ntree);
}