[Bf-blender-cvs] [4f0f84f] multiview: Removing XXX MV: implement touch/overwrite for multiview

Dalai Felinto noreply at git.blender.org
Thu Apr 2 20:11:49 CEST 2015


Commit: 4f0f84fb05e91a123c827ccb8bef3f158b7ffce5
Author: Dalai Felinto
Date:   Thu Apr 2 15:11:05 2015 -0300
Branches: multiview
https://developer.blender.org/rB4f0f84fb05e91a123c827ccb8bef3f158b7ffce5

Removing XXX MV: implement touch/overwrite for multiview

===================================================================

M	source/blender/blenkernel/BKE_scene.h
M	source/blender/blenkernel/intern/scene.c
M	source/blender/render/intern/source/pipeline.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index bb3144d..79778d5 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -155,6 +155,7 @@ size_t      BKE_scene_multiview_num_views_get(const struct RenderData *rd);
 struct SceneRenderView *BKE_scene_multiview_render_view_findindex(const struct RenderData *rd, const int view_id);
 const char *BKE_scene_multiview_render_view_name_get(const struct RenderData *rd, const int view_id);
 size_t      BKE_scene_multiview_view_id_get(const struct RenderData *rd, const char *viewname);
+void        BKE_scene_multiview_filepath_get(struct SceneRenderView *srv, const char *filepath, char *r_filepath);
 void        BKE_scene_multiview_view_filepath_get(const struct RenderData *rd, const char *filepath, const char *view, char *r_filepath);
 const char *BKE_scene_multiview_view_suffix_get(const struct RenderData *rd, const char *viewname);
 const char *BKE_scene_multiview_view_id_suffix_get(const struct RenderData *rd, const size_t view_id);
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 278e725..cabe148 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -2289,6 +2289,14 @@ size_t BKE_scene_multiview_view_id_get(const RenderData *rd, const char *viewnam
 	return 0;
 }
 
+void BKE_scene_multiview_filepath_get(
+        SceneRenderView *srv, const char *filepath,
+        char *r_filepath)
+{
+	BLI_strncpy(r_filepath, filepath, FILE_MAX);
+	BLI_path_suffix(r_filepath, FILE_MAX, srv->suffix, "");
+}
+
 /**
  * When multiview is not used the filepath is as usual (e.g., ``Image.jpg``).
  * When multiview is on, even if only one view is enabled the view is incorporated
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 0c2d05e..e755acc 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -3395,6 +3395,8 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
 	int nfra, totrendered = 0, totskipped = 0;
 	const size_t totvideos = BKE_scene_multiview_num_videos_get(&rd);
 	const bool is_movie = BKE_imtype_is_movie(scene->r.im_format.imtype);
+	const bool is_multiview_name = ((scene->r.scemode & R_MULTIVIEW) != 0 &&
+	                                (scene->r.im_format.views_format == R_IMF_VIEWS_INDIVIDUAL));
 
 	BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_INIT);
 
@@ -3500,17 +3502,61 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
 					        name, scene->r.pic, bmain->name, scene->r.cfra,
 					        &scene->r.im_format, (scene->r.scemode & R_EXTENSION) != 0, true, NULL);
 
-				if (scene->r.mode & R_NO_OVERWRITE && BLI_exists(name)) {
-					printf("skipping existing frame \"%s\"\n", name);
-					totskipped++;
-					continue;
+				if (scene->r.mode & R_NO_OVERWRITE) {
+					if (!is_multiview_name) {
+						if (BLI_exists(name)) {
+							printf("skipping existing frame \"%s\"\n", name);
+							totskipped++;
+							continue;
+						}
+					}
+					else {
+						SceneRenderView *srv;
+						bool is_skip = false;
+						char filepath[FILE_MAX];
+
+						for (srv = scene->r.views.first; srv; srv = srv->next) {
+							if (!BKE_scene_multiview_is_render_view_active(&scene->r, srv))
+								continue;
+
+							BKE_scene_multiview_filepath_get(srv, name, filepath);
+
+							if (BLI_exists(filepath)) {
+								is_skip = true;
+								printf("skipping existing frame \"%s\" for view \"%s\"\n", filepath, srv->name);
+							}
+						}
+
+						if (is_skip) {
+							totskipped++;
+							continue;
+						}
+					}
 				}
 
-				/* XXX MV MOV we should create/touch the multiview file or at least remove
-				 * this dummy touched file after we are done creating the stereo pairs */
-				if (scene->r.mode & R_TOUCH && !BLI_exists(name)) {
-					BLI_make_existing_file(name); /* makes the dir if its not there */
-					BLI_file_touch(name);
+				if (scene->r.mode & R_TOUCH) {
+					if (!is_multiview_name) {
+						if (!BLI_exists(name)) {
+							BLI_make_existing_file(name); /* makes the dir if its not there */
+							BLI_file_touch(name);
+						}
+					}
+					else {
+						SceneRenderView *srv;
+						char filepath[FILE_MAX];
+
+						for (srv = scene->r.views.first; srv; srv = srv->next) {
+							if (!BKE_scene_multiview_is_render_view_active(&scene->r, srv))
+								continue;
+
+							BKE_scene_multiview_filepath_get(srv, name, filepath);
+
+							if (!BLI_exists(filepath)) {
+								BLI_make_existing_file(filepath); /* makes the dir if its not there */
+								BLI_file_touch(filepath);
+							}
+						}
+					}
 				}
 			}
 
@@ -3534,9 +3580,29 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
 			if (G.is_break == true) {
 				/* remove touched file */
 				if (is_movie == false) {
-					if ((scene->r.mode & R_TOUCH) && (BLI_file_size(name) == 0)) {
-						/* BLI_exists(name) is implicit */
-						BLI_delete(name, false, false);
+					if ((scene->r.mode & R_TOUCH)) {
+						if (!is_multiview_name) {
+							if ((BLI_file_size(name) == 0)) {
+								/* BLI_exists(name) is implicit */
+								BLI_delete(name, false, false);
+							}
+						}
+						else {
+							SceneRenderView *srv;
+							char filepath[FILE_MAX];
+
+							for (srv = scene->r.views.first; srv; srv = srv->next) {
+								if (!BKE_scene_multiview_is_render_view_active(&scene->r, srv))
+									continue;
+
+								BKE_scene_multiview_filepath_get(srv, name, filepath);
+
+								if ((BLI_file_size(filepath) == 0)) {
+									/* BLI_exists(filepath) is implicit */
+									BLI_delete(filepath, false, false);
+								}
+							}
+						}
 					}
 				}




More information about the Bf-blender-cvs mailing list