Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/render/render_internal.cc
| Show All 19 Lines | |||||
| #include "PIL_time.h" | #include "PIL_time.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_userdef_types.h" | #include "DNA_userdef_types.h" | ||||
| #include "DNA_video_edit_types.h" | |||||
| #include "DNA_view3d_types.h" | #include "DNA_view3d_types.h" | ||||
| #include "BKE_colortools.h" | #include "BKE_colortools.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_image.h" | #include "BKE_image.h" | ||||
| #include "BKE_image_format.h" | #include "BKE_image_format.h" | ||||
| #include "BKE_layer.h" | #include "BKE_layer.h" | ||||
| ▲ Show 20 Lines • Show All 261 Lines • ▼ Show 20 Lines | else if (((*scene)->r.scemode & R_SINGLE_LAYER) && active_layer) { | ||||
| *single_layer = active_layer; | *single_layer = active_layer; | ||||
| } | } | ||||
| } | } | ||||
| /* executes blocking render */ | /* executes blocking render */ | ||||
| static int screen_render_exec(bContext *C, wmOperator *op) | static int screen_render_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| VideoEdit *video_edit = CTX_data_video_edit(C); | |||||
| RenderEngineType *re_type = RE_engines_find(scene->r.engine); | RenderEngineType *re_type = RE_engines_find(scene->r.engine); | ||||
| ViewLayer *active_layer = CTX_data_view_layer(C); | ViewLayer *active_layer = CTX_data_view_layer(C); | ||||
| ViewLayer *single_layer = nullptr; | ViewLayer *single_layer = nullptr; | ||||
| Render *re; | Render *re; | ||||
| Image *ima; | Image *ima; | ||||
| View3D *v3d = CTX_wm_view3d(C); | View3D *v3d = CTX_wm_view3d(C); | ||||
| Main *mainp = CTX_data_main(C); | Main *mainp = CTX_data_main(C); | ||||
| const bool is_animation = RNA_boolean_get(op->ptr, "animation"); | const bool is_animation = RNA_boolean_get(op->ptr, "animation"); | ||||
| Show All 24 Lines | static int screen_render_exec(bContext *C, wmOperator *op) | ||||
| ima = BKE_image_ensure_viewer(mainp, IMA_TYPE_R_RESULT, "Render Result"); | ima = BKE_image_ensure_viewer(mainp, IMA_TYPE_R_RESULT, "Render Result"); | ||||
| BKE_image_signal(mainp, ima, nullptr, IMA_SIGNAL_FREE); | BKE_image_signal(mainp, ima, nullptr, IMA_SIGNAL_FREE); | ||||
| BKE_image_backup_render(scene, ima, true); | BKE_image_backup_render(scene, ima, true); | ||||
| /* cleanup sequencer caches before starting user triggered render. | /* cleanup sequencer caches before starting user triggered render. | ||||
| * otherwise, invalidated cache entries can make their way into | * otherwise, invalidated cache entries can make their way into | ||||
| * the output rendering. We can't put that into RE_RenderFrame, | * the output rendering. We can't put that into RE_RenderFrame, | ||||
| * since sequence rendering can call that recursively... (peter) */ | * since sequence rendering can call that recursively... (peter) */ | ||||
| SEQ_cache_cleanup(scene); | SEQ_cache_cleanup(video_edit); | ||||
| RE_SetReports(re, op->reports); | RE_SetReports(re, op->reports); | ||||
| if (is_animation) { | if (is_animation) { | ||||
| RE_RenderAnim(re, | RE_RenderAnim(re, | ||||
| mainp, | mainp, | ||||
| scene, | scene, | ||||
| single_layer, | single_layer, | ||||
| ▲ Show 20 Lines • Show All 546 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /* using context, starts job */ | /* using context, starts job */ | ||||
| static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *event) | static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| { | { | ||||
| /* new render clears all callbacks */ | /* new render clears all callbacks */ | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| VideoEdit *video_edit = CTX_data_video_edit(C); | |||||
| ViewLayer *active_layer = CTX_data_view_layer(C); | ViewLayer *active_layer = CTX_data_view_layer(C); | ||||
| ViewLayer *single_layer = nullptr; | ViewLayer *single_layer = nullptr; | ||||
| RenderEngineType *re_type = RE_engines_find(scene->r.engine); | RenderEngineType *re_type = RE_engines_find(scene->r.engine); | ||||
| Render *re; | Render *re; | ||||
| wmJob *wm_job; | wmJob *wm_job; | ||||
| RenderJob *rj; | RenderJob *rj; | ||||
| Image *ima; | Image *ima; | ||||
| const bool is_animation = RNA_boolean_get(op->ptr, "animation"); | const bool is_animation = RNA_boolean_get(op->ptr, "animation"); | ||||
| Show All 22 Lines | static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| } | } | ||||
| if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) { | if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) { | ||||
| BKE_report( | BKE_report( | ||||
| op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected"); | op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected"); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| #if 0 | |||||
| /* Reports are done inside check function, and it will return false if there are other strips to | /* Reports are done inside check function, and it will return false if there are other strips to | ||||
| * render. */ | * render. */ | ||||
| if ((scene->r.scemode & R_DOSEQ) && SEQ_relations_check_scene_recursion(scene, op->reports)) { | if ((scene->r.scemode & R_DOSEQ) && SEQ_relations_check_scene_recursion(scene, op->reports)) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| #endif | |||||
| /* stop all running jobs, except screen one. currently previews frustrate Render */ | /* stop all running jobs, except screen one. currently previews frustrate Render */ | ||||
| WM_jobs_kill_all_except(CTX_wm_manager(C), CTX_wm_screen(C)); | WM_jobs_kill_all_except(CTX_wm_manager(C), CTX_wm_screen(C)); | ||||
| /* cancel animation playback */ | /* cancel animation playback */ | ||||
| if (ED_screen_animation_playing(CTX_wm_manager(C))) { | if (ED_screen_animation_playing(CTX_wm_manager(C))) { | ||||
| ED_screen_animation_play(C, 0, 0); | ED_screen_animation_play(C, 0, 0); | ||||
| } | } | ||||
| /* handle UI stuff */ | /* handle UI stuff */ | ||||
| WM_cursor_wait(true); | WM_cursor_wait(true); | ||||
| /* flush sculpt and editmode changes */ | /* flush sculpt and editmode changes */ | ||||
| ED_editors_flush_edits_ex(bmain, true, false); | ED_editors_flush_edits_ex(bmain, true, false); | ||||
| /* cleanup sequencer caches before starting user triggered render. | /* cleanup sequencer caches before starting user triggered render. | ||||
| * otherwise, invalidated cache entries can make their way into | * otherwise, invalidated cache entries can make their way into | ||||
| * the output rendering. We can't put that into RE_RenderFrame, | * the output rendering. We can't put that into RE_RenderFrame, | ||||
| * since sequence rendering can call that recursively... (peter) */ | * since sequence rendering can call that recursively... (peter) */ | ||||
| SEQ_cache_cleanup(scene); | SEQ_cache_cleanup(video_edit); | ||||
| /* store spare | /* store spare | ||||
| * get view3d layer, local layer, make this nice api call to render | * get view3d layer, local layer, make this nice api call to render | ||||
| * store spare */ | * store spare */ | ||||
| /* ensure at least 1 area shows result */ | /* ensure at least 1 area shows result */ | ||||
| area = render_view_open(C, event->xy[0], event->xy[1], op->reports); | area = render_view_open(C, event->xy[0], event->xy[1], op->reports); | ||||
| ▲ Show 20 Lines • Show All 234 Lines • Show Last 20 Lines | |||||