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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-08-01 16:47:49 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-08-01 16:47:49 +0400
commit5fa7d1c1b4e7bde1d173caa60af0e273c86b6f0b (patch)
tree186a794aef722993c7067a657b4d007c62dd669b /source/blender/editors/space_node
parentc34f831757e0985b7523b6e5bbfadd7dd6a2c161 (diff)
2.5: code changes to reduce the usage of G.main and pass it along
or get it from the context instead.
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r--source/blender/editors/space_node/drawnode.c12
-rw-r--r--source/blender/editors/space_node/node_edit.c3
2 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 082f3f97dfd..01992d225c7 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -190,6 +190,7 @@ static void node_buts_normal(uiLayout *layout, bContext *C, PointerRNA *ptr)
#if 0 // not used in 2.5x yet
static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
{
+ Main *bmain= CTX_data_main(C);
bNodeTree *ntree= ntree_v;
bNode *node= node_v;
Tex *tex;
@@ -200,7 +201,7 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
node->id->us--;
node->id= NULL;
}
- tex= BLI_findlink(&G.main->tex, node->menunr-1);
+ tex= BLI_findlink(&bmain->tex, node->menunr-1);
node->id= &tex->id;
id_us_plus(node->id);
@@ -220,6 +221,7 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
#endif
static void node_dynamic_update_cb(bContext *C, void *ntree_v, void *node_v)
{
+ Main *bmain= CTX_data_main(C);
Material *ma;
bNode *node= (bNode *)node_v;
ID *id= node->id;
@@ -229,7 +231,7 @@ static void node_dynamic_update_cb(bContext *C, void *ntree_v, void *node_v)
/* Users only have to press the "update" button in one pynode
* and we also update all others sharing the same script */
- for (ma= G.main->mat.first; ma; ma= ma->id.next) {
+ for (ma= bmain->mat.first; ma; ma= ma->id.next) {
if (ma->nodetree) {
bNode *nd;
for (nd= ma->nodetree->nodes.first; nd; nd= nd->next) {
@@ -277,6 +279,7 @@ static void node_buts_math(uiLayout *layout, bContext *C, PointerRNA *ptr)
static void node_browse_text_cb(bContext *C, void *ntree_v, void *node_v)
{
+ Main *bmain= CTX_data_main(C);
bNodeTree *ntree= ntree_v;
bNode *node= node_v;
ID *oldid;
@@ -287,7 +290,7 @@ static void node_browse_text_cb(bContext *C, void *ntree_v, void *node_v)
node->id->us--;
}
oldid= node->id;
- node->id= BLI_findlink(&G.main->text, node->menunr-1);
+ node->id= BLI_findlink(&bmain->text, node->menunr-1);
id_us_plus(node->id);
BLI_strncpy(node->name, node->id->name+2, 21); /* huh? why 21? */
@@ -368,6 +371,7 @@ static void node_shader_buts_geometry(uiLayout *layout, bContext *C, PointerRNA
static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
+ Main *bmain= CTX_data_main(C);
uiBlock *block= uiLayoutAbsoluteBlock(layout);
bNode *node= ptr->data;
bNodeTree *ntree= ptr->id.data;
@@ -380,7 +384,7 @@ static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA *
/* B_NODE_EXEC is handled in butspace.c do_node_buts */
if(!node->id) {
char *strp;
- IDnames_to_pupstring(&strp, NULL, "", &(G.main->text), NULL, NULL);
+ IDnames_to_pupstring(&strp, NULL, "", &(bmain->text), NULL, NULL);
node->menunr= 0;
bt= uiDefButS(block, MENU, B_NODE_EXEC/*+node->nr*/, strp,
butr->xmin, dy, 19, 19,
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index cea88c33c5b..dcd87b89ea0 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -1852,6 +1852,7 @@ void NODE_OT_links_cut(wmOperatorType *ot)
/* goes over all scenes, reads render layers */
static int node_read_renderlayers_exec(bContext *C, wmOperator *op)
{
+ Main *bmain= CTX_data_main(C);
SpaceNode *snode= CTX_wm_space_node(C);
Scene *curscene= CTX_data_scene(C), *scene;
bNode *node;
@@ -1859,7 +1860,7 @@ static int node_read_renderlayers_exec(bContext *C, wmOperator *op)
ED_preview_kill_jobs(C);
/* first tag scenes unread */
- for(scene= G.main->scene.first; scene; scene= scene->id.next)
+ for(scene= bmain->scene.first; scene; scene= scene->id.next)
scene->id.flag |= LIB_DOIT;
for(node= snode->edittree->nodes.first; node; node= node->next) {