Changeset View
Changeset View
Standalone View
Standalone View
source/blender/render/intern/source/pipeline.c
| Show All 30 Lines | |||||
| #include <math.h> | #include <math.h> | ||||
| #include <limits.h> | #include <limits.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <stddef.h> | #include <stddef.h> | ||||
| #include <errno.h> | #include <errno.h> | ||||
| #include "CLG_log.h" | |||||
| #include "DNA_anim_types.h" | #include "DNA_anim_types.h" | ||||
| #include "DNA_collection_types.h" | #include "DNA_collection_types.h" | ||||
| #include "DNA_image_types.h" | #include "DNA_image_types.h" | ||||
| #include "DNA_node_types.h" | #include "DNA_node_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_particle_types.h" | #include "DNA_particle_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_sequence_types.h" | #include "DNA_sequence_types.h" | ||||
| ▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | |||||
| * 5) Image Files | * 5) Image Files | ||||
| * - save file or append in movie | * - save file or append in movie | ||||
| * | * | ||||
| */ | */ | ||||
| /* ********* globals ******** */ | /* ********* globals ******** */ | ||||
| static CLG_LogRef LOG = {"render.pipeline"}; | |||||
| /* here we store all renders */ | /* here we store all renders */ | ||||
| static struct { | static struct { | ||||
| ListBase renderlist; | ListBase renderlist; | ||||
| } RenderGlobal = {{NULL, NULL}}; | } RenderGlobal = {{NULL, NULL}}; | ||||
| /* ********* alloc and free ******** */ | /* ********* alloc and free ******** */ | ||||
| static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovieHandle *mh, const int totvideos, const char *name_override); | static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovieHandle *mh, const int totvideos, const char *name_override); | ||||
| ▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | static void stats_background(void *UNUSED(arg), RenderStats *rs) | ||||
| fflush(stdout); | fflush(stdout); | ||||
| } | } | ||||
| static void render_print_save_message( | static void render_print_save_message( | ||||
| ReportList *reports, const char *name, int ok, int err) | ReportList *reports, const char *name, int ok, int err) | ||||
| { | { | ||||
| if (ok) { | if (ok) { | ||||
| /* no need to report, just some helpful console info */ | /* no need to report, just some helpful console info */ | ||||
| printf("Saved: '%s'\n", name); | CLOG_INFO(&LOG, 1, "Saved: '%s'", name); | ||||
| } | } | ||||
| else { | else { | ||||
| /* report on error since users will want to know what failed */ | /* report on error since users will want to know what failed */ | ||||
| BKE_reportf(reports, RPT_ERROR, "Render error (%s) cannot save: '%s'", strerror(err), name); | BKE_reportf(reports, RPT_ERROR, "Render error (%s) cannot save: '%s'", strerror(err), name); | ||||
| } | } | ||||
| } | } | ||||
| static int render_imbuf_write_stamp_test( | static int render_imbuf_write_stamp_test( | ||||
| ▲ Show 20 Lines • Show All 1,771 Lines • ▼ Show 20 Lines | if (render_initialize_from_main(re, &scene->r, bmain, scene, single_layer, | ||||
| BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_PRE); | BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_PRE); | ||||
| do_render_all_options(re); | do_render_all_options(re); | ||||
| if (write_still && !G.is_break) { | if (write_still && !G.is_break) { | ||||
| if (BKE_imtype_is_movie(scene->r.im_format.imtype)) { | if (BKE_imtype_is_movie(scene->r.im_format.imtype)) { | ||||
| /* operator checks this but in case its called from elsewhere */ | /* operator checks this but in case its called from elsewhere */ | ||||
| printf("Error: cant write single images with a movie format!\n"); | CLOG_ERROR(&LOG, "can't write single images with a movie format!"); | ||||
| } | } | ||||
| else { | else { | ||||
| char name[FILE_MAX]; | char name[FILE_MAX]; | ||||
| BKE_image_path_from_imformat( | BKE_image_path_from_imformat( | ||||
| name, scene->r.pic, BKE_main_blendfile_path(bmain), scene->r.cfra, | name, scene->r.pic, BKE_main_blendfile_path(bmain), scene->r.cfra, | ||||
| &scene->r.im_format, (scene->r.scemode & R_EXTENSION) != 0, false, NULL); | &scene->r.im_format, (scene->r.scemode & R_EXTENSION) != 0, false, NULL); | ||||
| /* reports only used for Movie */ | /* reports only used for Movie */ | ||||
| ▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | for (view_id = 0, rv = rr->views.first; rv; rv = rv->next, view_id++) { | ||||
| IMB_freeImBuf(ibuf); | IMB_freeImBuf(ibuf); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else { /* R_IMF_VIEWS_STEREO_3D */ | else { /* R_IMF_VIEWS_STEREO_3D */ | ||||
| BLI_assert(scene->r.im_format.views_format == R_IMF_VIEWS_STEREO_3D); | BLI_assert(scene->r.im_format.views_format == R_IMF_VIEWS_STEREO_3D); | ||||
| if (rd->im_format.imtype == R_IMF_IMTYPE_MULTILAYER) { | if (rd->im_format.imtype == R_IMF_IMTYPE_MULTILAYER) { | ||||
| printf("Stereo 3D not supported for MultiLayer image: %s\n", name); | CLOG_ERROR(&LOG, "Stereo 3D not supported for MultiLayer image: %s", name); | ||||
| } | } | ||||
| else { | else { | ||||
| ImBuf *ibuf_arr[3] = {NULL}; | ImBuf *ibuf_arr[3] = {NULL}; | ||||
| const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME}; | const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME}; | ||||
| int i; | int i; | ||||
| for (i = 0; i < 2; i++) { | for (i = 0; i < 2; i++) { | ||||
| int view_id = BLI_findstringindex(&rr->views, names[i], offsetof(RenderView, name)); | int view_id = BLI_findstringindex(&rr->views, names[i], offsetof(RenderView, name)); | ||||
| ▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | for (view_id = 0; view_id < totvideos; view_id++) { | ||||
| &scene->display_settings, &scene->r.im_format); | &scene->display_settings, &scene->r.im_format); | ||||
| ok &= mh->append_movie(movie_ctx_arr[view_id], rd, preview ? scene->r.psfra : scene->r.sfra, scene->r.cfra, | ok &= mh->append_movie(movie_ctx_arr[view_id], rd, preview ? scene->r.psfra : scene->r.sfra, scene->r.cfra, | ||||
| (int *) ibuf->rect, ibuf->x, ibuf->y, suffix, reports); | (int *) ibuf->rect, ibuf->x, ibuf->y, suffix, reports); | ||||
| /* imbuf knows which rects are not part of ibuf */ | /* imbuf knows which rects are not part of ibuf */ | ||||
| IMB_freeImBuf(ibuf); | IMB_freeImBuf(ibuf); | ||||
| } | } | ||||
| printf("Append frame %d\n", scene->r.cfra); | CLOG_INFO(&LOG, 1, "Append frame %d", scene->r.cfra); | ||||
| } | } | ||||
| else { /* R_IMF_VIEWS_STEREO_3D */ | else { /* R_IMF_VIEWS_STEREO_3D */ | ||||
| const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME}; | const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME}; | ||||
| ImBuf *ibuf_arr[3] = {NULL}; | ImBuf *ibuf_arr[3] = {NULL}; | ||||
| int i; | int i; | ||||
| BLI_assert((totvideos == 1) && (scene->r.im_format.views_format == R_IMF_VIEWS_STEREO_3D)); | BLI_assert((totvideos == 1) && (scene->r.im_format.views_format == R_IMF_VIEWS_STEREO_3D)); | ||||
| ▲ Show 20 Lines • Show All 219 Lines • ▼ Show 20 Lines | for (nfra = sfra, scene->r.cfra = sfra; scene->r.cfra <= efra; scene->r.cfra++) { | ||||
| if (scene->r.mode & (R_NO_OVERWRITE | R_TOUCH)) | if (scene->r.mode & (R_NO_OVERWRITE | R_TOUCH)) | ||||
| BKE_image_path_from_imformat( | BKE_image_path_from_imformat( | ||||
| name, scene->r.pic, BKE_main_blendfile_path(bmain), scene->r.cfra, | name, scene->r.pic, BKE_main_blendfile_path(bmain), scene->r.cfra, | ||||
| &scene->r.im_format, (scene->r.scemode & R_EXTENSION) != 0, true, NULL); | &scene->r.im_format, (scene->r.scemode & R_EXTENSION) != 0, true, NULL); | ||||
| if (scene->r.mode & R_NO_OVERWRITE) { | if (scene->r.mode & R_NO_OVERWRITE) { | ||||
| if (!is_multiview_name) { | if (!is_multiview_name) { | ||||
| if (BLI_exists(name)) { | if (BLI_exists(name)) { | ||||
| printf("skipping existing frame \"%s\"\n", name); | CLOG_INFO(&LOG, 1, "skipping existing frame \"%s\"", name); | ||||
| totskipped++; | totskipped++; | ||||
| continue; | continue; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| SceneRenderView *srv; | SceneRenderView *srv; | ||||
| bool is_skip = false; | bool is_skip = false; | ||||
| char filepath[FILE_MAX]; | char filepath[FILE_MAX]; | ||||
| for (srv = scene->r.views.first; srv; srv = srv->next) { | for (srv = scene->r.views.first; srv; srv = srv->next) { | ||||
| if (!BKE_scene_multiview_is_render_view_active(&scene->r, srv)) | if (!BKE_scene_multiview_is_render_view_active(&scene->r, srv)) | ||||
| continue; | continue; | ||||
| BKE_scene_multiview_filepath_get(srv, name, filepath); | BKE_scene_multiview_filepath_get(srv, name, filepath); | ||||
| if (BLI_exists(filepath)) { | if (BLI_exists(filepath)) { | ||||
| is_skip = true; | is_skip = true; | ||||
| printf("skipping existing frame \"%s\" for view \"%s\"\n", filepath, srv->name); | CLOG_INFO(&LOG, 1, "skipping existing frame \"%s\" for view \"%s\"", filepath, srv->name); | ||||
| } | } | ||||
| } | } | ||||
| if (is_skip) { | if (is_skip) { | ||||
| totskipped++; | totskipped++; | ||||
| continue; | continue; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 342 Lines • Show Last 20 Lines | |||||