diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-11 16:40:37 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-11 16:40:37 +0300 |
commit | 78a8d3685bd3487eb0b5dd55793f94fe7235e377 (patch) | |
tree | 77f9ba0ddd9613eb7e9dbb8e0402f977548a281f /source/blender/editors/space_node/node_view.c | |
parent | b763c34e80d3b20f9a7f0a592e479e5fa7ab295f (diff) |
Cleanup: remove moar ugly G.main usages...
BKE_image was an ugly nest, could fix all but the ones from compositor,
so moved ugly G.main there, at least we know where the Evil is that way ;)
Diffstat (limited to 'source/blender/editors/space_node/node_view.c')
-rw-r--r-- | source/blender/editors/space_node/node_view.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c index d52a6a89413..00eab0c69c1 100644 --- a/source/blender/editors/space_node/node_view.c +++ b/source/blender/editors/space_node/node_view.c @@ -36,8 +36,9 @@ #include "BKE_context.h" #include "BKE_image.h" -#include "BKE_screen.h" +#include "BKE_main.h" #include "BKE_node.h" +#include "BKE_screen.h" #include "ED_node.h" /* own include */ #include "ED_screen.h" @@ -238,6 +239,7 @@ static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *e static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event) { + Main *bmain = CTX_data_main(C); SpaceNode *snode = CTX_wm_space_node(C); ARegion *ar = CTX_wm_region(C); NodeViewMove *nvm; @@ -247,7 +249,7 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent * void *lock; - ima = BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node"); + ima = BKE_image_verify_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node"); ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); if (ibuf == NULL) { @@ -331,6 +333,7 @@ void NODE_OT_backimage_zoom(wmOperatorType *ot) static int backimage_fit_exec(bContext *C, wmOperator *UNUSED(op)) { + Main *bmain = CTX_data_main(C); SpaceNode *snode = CTX_wm_space_node(C); ARegion *ar = CTX_wm_region(C); @@ -343,7 +346,7 @@ static int backimage_fit_exec(bContext *C, wmOperator *UNUSED(op)) float facx, facy; - ima = BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node"); + ima = BKE_image_verify_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node"); ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); if ((ibuf == NULL) || (ibuf->x == 0) || (ibuf->y == 0)) { @@ -421,7 +424,7 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info) /* Returns color in linear space, matching ED_space_image_color_sample(). * And here we've got recursion in the comments tips... */ -bool ED_space_node_color_sample(SpaceNode *snode, ARegion *ar, int mval[2], float r_col[3]) +bool ED_space_node_color_sample(Main *bmain, SpaceNode *snode, ARegion *ar, int mval[2], float r_col[3]) { void *lock; Image *ima; @@ -436,7 +439,7 @@ bool ED_space_node_color_sample(SpaceNode *snode, ARegion *ar, int mval[2], floa return false; } - ima = BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node"); + ima = BKE_image_verify_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node"); ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); if (!ibuf) { return false; @@ -477,6 +480,7 @@ bool ED_space_node_color_sample(SpaceNode *snode, ARegion *ar, int mval[2], floa static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event) { + Main *bmain = CTX_data_main(C); SpaceNode *snode = CTX_wm_space_node(C); ARegion *ar = CTX_wm_region(C); ImageSampleInfo *info = op->customdata; @@ -485,7 +489,7 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event) ImBuf *ibuf; float fx, fy, bufx, bufy; - ima = BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node"); + ima = BKE_image_verify_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node"); ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); if (!ibuf) { info->draw = 0; |