diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2015-04-17 15:48:31 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2015-04-17 15:48:31 +0300 |
commit | 479b6696932d133078690063508d8447d6dc0a28 (patch) | |
tree | bb4880a909f46e303d05a5305eea401bd38fbe94 /source/blender/editors/space_image | |
parent | 02fba106fad37647ab015c228248ac0ec13a964b (diff) |
Fix T44336: Unable to select cycles-specific passes in UV/image editor
This approach gets rid of iuser->pass for good.
Also, I'm commenting out the pass increase/decrease. This was broken
since multiview. I will fix it later (before 2.75), but I didn't want to
get this patch mangled with that fix.
Thanks Sergey Sharybin for the review and feedbacks.
Reviewers: sergey
Differential Revision: https://developer.blender.org/D1232
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r-- | source/blender/editors/space_image/image_buttons.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 44 |
2 files changed, 18 insertions, 44 deletions
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index ee298a27b25..20da0f33c7f 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -435,7 +435,7 @@ static void ui_imageuser_pass_menu(bContext *UNUSED(C), uiLayout *layout, void * passflag |= rpass->passtype; final: - uiDefButS(block, UI_BTYPE_BUT_MENU, B_NOP, IFACE_(rpass->internal_name), 0, 0, + uiDefButI(block, UI_BTYPE_BUT_MENU, B_NOP, IFACE_(rpass->internal_name), 0, 0, UI_UNIT_X * 5, UI_UNIT_X, &iuser->passtype, (float) rpass->passtype, 0.0, 0, -1, ""); } @@ -545,6 +545,8 @@ static void image_multi_declay_cb(bContext *C, void *rr_v, void *iuser_v) } static void image_multi_incpass_cb(bContext *C, void *rr_v, void *iuser_v) { + /* this wasn't working before multiview, it needs to be fixed, but it wasn't working anyways --dfelinto */ +#if 0 RenderResult *rr = rr_v; ImageUser *iuser = iuser_v; RenderLayer *rl = BLI_findlink(&rr->layers, iuser->layer); @@ -561,9 +563,16 @@ static void image_multi_incpass_cb(bContext *C, void *rr_v, void *iuser_v) WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL); } } +#else + (void)C; + (void)rr_v; + (void)iuser_v; +#endif } static void image_multi_decpass_cb(bContext *C, void *rr_v, void *iuser_v) { + /* this wasn't working before multiview, it needs to be fixed, but it wasn't working anyways --dfelinto */ +#if 0 ImageUser *iuser = iuser_v; if (iuser->pass > 0) { @@ -571,6 +580,11 @@ static void image_multi_decpass_cb(bContext *C, void *rr_v, void *iuser_v) BKE_image_multilayer_index(rr_v, iuser); WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL); } +#else + (void)C; + (void)rr_v; + (void)iuser_v; +#endif } /* 5 view button callbacks... */ @@ -657,7 +671,7 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, Image *image, RenderRes /* pass */ fake_name = ui_imageuser_pass_fake_name(rl); - rpass = (rl ? BLI_findlink(&rl->passes, iuser->pass - (fake_name ? 1 : 0)) : NULL); + rpass = (rl ? RE_pass_find_by_type(rl, iuser->passtype, ((RenderView *)rr->views.first)->name) : NULL); display_name = rpass ? rpass->internal_name : (fake_name ? fake_name : ""); but = uiDefMenuBut(block, ui_imageuser_pass_menu, rnd_pt, display_name, 0, 0, wmenu3, UI_UNIT_Y, TIP_("Select Pass")); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index aa625210464..756f90fe560 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1533,41 +1533,6 @@ static void save_image_options_to_op(SaveImageOptions *simopts, wmOperator *op) RNA_string_set(op->ptr, "filepath", simopts->filepath); } -/* returns the pass index for the view_id */ -static int get_multiview_pass_id(RenderResult *rr, ImageUser *iuser, const int view_id) -{ - RenderLayer *rl; - RenderPass *rpass; - int passtype; - short rl_index = 0, rp_index; - - if (rr == NULL || iuser == NULL) - return 0; - - if (BLI_listbase_count_ex(&rr->views, 2) < 2) - return iuser->pass; - - if (RE_HasFakeLayer(rr)) - rl_index ++; /* fake compo/sequencer layer */ - - rl = BLI_findlink(&rr->layers, rl_index); - if (!rl) return iuser->pass; - - rpass = BLI_findlink(&rl->passes, iuser->pass); - passtype = rpass->passtype; - - rp_index = 0; - for (rpass = rl->passes.first; rpass; rpass = rpass->next, rp_index++) { - if (rpass->passtype == passtype && - rpass->view_id == view_id) - { - return rp_index; - } - } - - return iuser->pass; -} - static void save_image_post(wmOperator *op, ImBuf *ibuf, Image *ima, int ok, int save_copy, const char *relbase, int relative, int do_newpath, const char *filepath) { if (ok) { @@ -1761,13 +1726,10 @@ static bool save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI iuser.view = i; iuser.flag &= ~IMA_SHOW_STEREO; - if (rr) { - iuser.pass = get_multiview_pass_id(rr, &sima->iuser, i); + if (rr) BKE_image_multilayer_index(rr, &iuser); - } - else { + else BKE_image_multiview_index(ima, &iuser); - } ibuf = BKE_image_acquire_ibuf(sima->image, &iuser, &lock); ibuf->planes = planes; @@ -1810,9 +1772,7 @@ static bool save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI if (rr) { int id = BLI_findstringindex(&rr->views, names[i], offsetof(RenderView, name)); - iuser.pass = get_multiview_pass_id(rr, &sima->iuser, id); iuser.view = id; - BKE_image_multilayer_index(rr, &iuser); } else { |