diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_image/image_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 32 | ||||
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 3 |
3 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h index 4d391874f9b..8e556378803 100644 --- a/source/blender/editors/space_image/image_intern.h +++ b/source/blender/editors/space_image/image_intern.h @@ -90,6 +90,8 @@ void IMAGE_OT_curves_point_set(struct wmOperatorType *ot); void IMAGE_OT_change_frame(struct wmOperatorType *ot); +void IMAGE_OT_read_renderlayers(struct wmOperatorType *ot); + /* image_panels.c */ struct ImageUser *ntree_get_active_iuser(struct bNodeTree *ntree); void image_buttons_register(struct ARegionType *art); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index cc769f13b82..7c021cf6645 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2997,3 +2997,35 @@ void IMAGE_OT_change_frame(wmOperatorType *ot) /* rna */ RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME); } + +/* Reload cached render results... */ +/* goes over all scenes, reads render layers */ +static int image_read_renderlayers_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Scene *scene = CTX_data_scene(C); + SpaceImage *sima = CTX_wm_space_image(C); + Image *ima; + + ima = BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result"); + if (sima->image == NULL) { + ED_space_image_set(sima, scene, NULL, ima); + } + + RE_ReadRenderResult(scene, scene); + + WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima); + return OPERATOR_FINISHED; +} + +void IMAGE_OT_read_renderlayers(wmOperatorType *ot) +{ + ot->name = "Read Render Layers"; + ot->idname = "IMAGE_OT_read_renderlayers"; + ot->description = "Read all the current scene's render layers from cache, as needed"; + + ot->poll = space_image_main_area_poll; + ot->exec = image_read_renderlayers_exec; + + /* flags */ + ot->flag = 0; +} diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index d1868951987..0fb93ad27ee 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -255,6 +255,8 @@ static void image_operatortypes(void) WM_operatortype_append(IMAGE_OT_toolshelf); WM_operatortype_append(IMAGE_OT_change_frame); + + WM_operatortype_append(IMAGE_OT_read_renderlayers); } static void image_keymap(struct wmKeyConfig *keyconf) @@ -266,6 +268,7 @@ static void image_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "IMAGE_OT_new", NKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "IMAGE_OT_open", OKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "IMAGE_OT_reload", RKEY, KM_PRESS, KM_ALT, 0); + WM_keymap_add_item(keymap, "IMAGE_OT_read_renderlayers", RKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "IMAGE_OT_save", SKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "IMAGE_OT_save_as", F3KEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "IMAGE_OT_properties", NKEY, KM_PRESS, 0, 0); |