[Bf-blender-cvs] [92a1b76] multiview: Multiview Base Commit 1/10: Image

Dalai Felinto noreply at git.blender.org
Sat May 10 20:18:05 CEST 2014


Commit: 92a1b76e29b566ad65bf902069cafea0e9e13a6e
Author: Dalai Felinto
Date:   Sat May 10 14:57:25 2014 -0300
https://developer.blender.org/rB92a1b76e29b566ad65bf902069cafea0e9e13a6e

Multiview Base Commit 1/10: Image

This is part of the multiview rebase from a github to git.blender.org
repository. The rebase was made based on file areas, so build is likely
broken in some of those parts, but it bulds fine in the end.

The documentation and sample files were removed and now live in:
https://github.com/dfelinto/multiview-samples

The original git history can be found in:
https://github.com/dfelinto/blender/tree/multiview-pre-b3d

Code contributors of the original branch in github:
* Alexey Akishin
* Gabriel Caraballo

Original design made in contribution with Francesco Siddi
Original branch and design partially reviewed by Brecht Van Lommel

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

M	source/blender/blenkernel/BKE_image.h
M	source/blender/blenkernel/intern/image.c
M	source/blender/editors/space_image/image_buttons.c
M	source/blender/editors/space_image/image_draw.c
M	source/blender/editors/space_image/image_ops.c
M	source/blender/makesdna/DNA_image_types.h
M	source/blender/makesrna/intern/rna_image.c

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

diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index db052f5..b2ac64b 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -62,9 +62,9 @@ int     BKE_imbuf_write_stamp(struct Scene *scene, struct Object *camera, struct
 int     BKE_imbuf_write(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
 int     BKE_imbuf_write_as(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf, const bool is_copy);
 void    BKE_makepicstring(char *string, const char *base, const char *relbase, int frame,
-                          const struct ImageFormatData *im_format, const bool use_ext, const bool use_frames);
+                          const struct ImageFormatData *im_format, const bool use_ext, const bool use_frames, const char *view);
 void    BKE_makepicstring_from_type(char *string, const char *base, const char *relbase, int frame,
-                                    const char imtype, const bool use_ext, const bool use_frames);
+                                    const char imtype, const bool use_ext, const bool use_frames, const char *view);
 int     BKE_add_image_extension(char *string, const struct ImageFormatData *im_format);
 int     BKE_add_image_extension_from_type(char *string, const char imtype);
 char    BKE_ftype_to_imtype(const int ftype);
@@ -191,6 +191,9 @@ void BKE_image_update_frame(const struct Main *bmain, int cfra);
 /* sets index offset for multilayer files */
 struct RenderPass *BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser);
 
+/* sets index offset for multiview files */
+struct RenderPass *BKE_image_multiview_index(struct RenderResult *rr, struct ImageUser *iuser);
+
 /* for multilayer images as well as for render-viewer */
 struct RenderResult *BKE_image_acquire_renderresult(struct Scene *scene, struct Image *ima);
 void BKE_image_release_renderresult(struct Scene *scene, struct Image *ima);
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 440320e..1545d66 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1048,7 +1048,7 @@ int BKE_imtype_to_ftype(const char imtype)
 	else if (imtype == R_IMF_IMTYPE_TIFF)
 		return TIF;
 #endif
-	else if (imtype == R_IMF_IMTYPE_OPENEXR || imtype == R_IMF_IMTYPE_MULTILAYER)
+	else if (ELEM3(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER, R_IMF_IMTYPE_MULTIVIEW))
 		return OPENEXR;
 #ifdef WITH_CINEON
 	else if (imtype == R_IMF_IMTYPE_CINEON)
@@ -1127,7 +1127,7 @@ int BKE_imtype_supports_zbuf(const char imtype)
 {
 	switch (imtype) {
 		case R_IMF_IMTYPE_IRIZ:
-		case R_IMF_IMTYPE_OPENEXR: /* but not R_IMF_IMTYPE_MULTILAYER */
+		case R_IMF_IMTYPE_OPENEXR: /* but not R_IMF_IMTYPE_MULTILAYER or R_IMF_IMTYPE_MULTIVIEW */
 			return 1;
 	}
 	return 0;
@@ -1161,6 +1161,7 @@ int BKE_imtype_requires_linear_float(const char imtype)
 		case R_IMF_IMTYPE_RADHDR:
 		case R_IMF_IMTYPE_OPENEXR:
 		case R_IMF_IMTYPE_MULTILAYER:
+		case R_IMF_IMTYPE_MULTIVIEW:
 			return true;
 	}
 	return 0;
@@ -1182,6 +1183,7 @@ char BKE_imtype_valid_channels(const char imtype, bool write_file)
 		case R_IMF_IMTYPE_TIFF:
 		case R_IMF_IMTYPE_OPENEXR:
 		case R_IMF_IMTYPE_MULTILAYER:
+		case R_IMF_IMTYPE_MULTIVIEW:
 		case R_IMF_IMTYPE_DDS:
 		case R_IMF_IMTYPE_JP2:
 		case R_IMF_IMTYPE_QUICKTIME:
@@ -1215,6 +1217,7 @@ char BKE_imtype_valid_depths(const char imtype)
 		case R_IMF_IMTYPE_OPENEXR:
 			return R_IMF_CHAN_DEPTH_16 | R_IMF_CHAN_DEPTH_32;
 		case R_IMF_IMTYPE_MULTILAYER:
+		case R_IMF_IMTYPE_MULTIVIEW:
 			return R_IMF_CHAN_DEPTH_32;
 		/* eeh, cineon does some strange 10bits per channel */
 		case R_IMF_IMTYPE_DPX:
@@ -1258,6 +1261,7 @@ char BKE_imtype_from_arg(const char *imtype_arg)
 #ifdef WITH_OPENEXR
 	else if (!strcmp(imtype_arg, "EXR")) return R_IMF_IMTYPE_OPENEXR;
 	else if (!strcmp(imtype_arg, "MULTILAYER")) return R_IMF_IMTYPE_MULTILAYER;
+	else if (!strcmp(imtype_arg, "MULTIVIEW")) return R_IMF_IMTYPE_MULTIVIEW;
 #endif
 	else if (!strcmp(imtype_arg, "MPEG")) return R_IMF_IMTYPE_FFMPEG;
 	else if (!strcmp(imtype_arg, "FRAMESERVER")) return R_IMF_IMTYPE_FRAMESERVER;
@@ -1323,7 +1327,7 @@ static bool do_add_image_extension(char *string, const char imtype, const ImageF
 	}
 #endif
 #ifdef WITH_OPENEXR
-	else if (ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
+	else if (ELEM3(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER, R_IMF_IMTYPE_MULTIVIEW)) {
 		if (!BLI_testextensie(string, extension_test = ".exr"))
 			extension = extension_test;
 	}
@@ -1962,7 +1966,7 @@ int BKE_imbuf_write(ImBuf *ibuf, const char *name, ImageFormatData *imf)
 	}
 #endif
 #ifdef WITH_OPENEXR
-	else if (imtype == R_IMF_IMTYPE_OPENEXR || imtype == R_IMF_IMTYPE_MULTILAYER) {
+	else if (ELEM3(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER, R_IMF_IMTYPE_MULTIVIEW)) {
 		ibuf->ftype = OPENEXR;
 		if (imf->depth == R_IMF_CHAN_DEPTH_16)
 			ibuf->ftype |= OPENEXR_HALF;
@@ -2090,7 +2094,7 @@ int BKE_imbuf_write_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, cons
 
 
 static void do_makepicstring(char *string, const char *base, const char *relbase, int frame, const char imtype,
-                             const ImageFormatData *im_format, const short use_ext, const short use_frames)
+                             const ImageFormatData *im_format, const short use_ext, const short use_frames, const char *view)
 {
 	if (string == NULL) return;
 	BLI_strncpy(string, base, FILE_MAX - 10);   /* weak assumption */
@@ -2099,20 +2103,22 @@ static void do_makepicstring(char *string, const char *base, const char *relbase
 	if (use_frames)
 		BLI_path_frame(string, frame, 4);
 
+	BLI_path_view(string, view);
+
 	if (use_ext)
 		do_add_image_extension(string, imtype, im_format);
 }
 
 void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame,
-                       const ImageFormatData *im_format, const bool use_ext, const bool use_frames)
+                       const ImageFormatData *im_format, const bool use_ext, const bool use_frames, const char *view)
 {
-	do_makepicstring(string, base, relbase, frame, im_format->imtype, im_format, use_ext, use_frames);
+	do_makepicstring(string, base, relbase, frame, im_format->imtype, im_format, use_ext, use_frames, view);
 }
 
 void BKE_makepicstring_from_type(char *string, const char *base, const char *relbase, int frame,
-                                 const char imtype, const bool use_ext, const bool use_frames)
+                                 const char imtype, const bool use_ext, const bool use_frames, const char *view)
 {
-	do_makepicstring(string, base, relbase, frame, imtype, NULL, use_ext, use_frames);
+	do_makepicstring(string, base, relbase, frame, imtype, NULL, use_ext, use_frames, view);
 }
 
 /* used by sequencer too */
@@ -2759,6 +2765,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
 	int channels, layer, pass;
 	ImBuf *ibuf;
 	int from_render = (ima->render_slot == ima->last_render_slot);
+	int actview;
 	bool byte_buffer_in_display_space = false;
 
 	if (!(iuser && iuser->scene))
@@ -2773,13 +2780,22 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
 	channels = 4;
 	layer = iuser->layer;
 	pass = iuser->pass;
+	actview = iuser->view;
+
+	if (iuser->flag & IMA_STEREO3D) {
+		/* view == 0 shows stereo */
+		if (actview == 0)
+			actview = iuser->eye;
+		else
+			actview = actview - 1;
+	}
 
 	if (from_render) {
-		RE_AcquireResultImage(re, &rres);
+		RE_AcquireResultImage(re, &rres, actview);
 	}
 	else if (ima->renders[ima->render_slot]) {
 		rres = *(ima->renders[ima->render_slot]);
-		rres.have_combined = rres.rectf != NULL;
+		rres.have_combined = RE_RenderViewGetRectf(&rres, actview) != NULL;
 	}
 	else
 		memset(&rres, 0, sizeof(RenderResult));
@@ -2819,24 +2835,13 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
 		if (rl) {
 			RenderPass *rpass;
 
-			/* there's no combined pass, is in renderlayer itself */
-			if (pass == 0) {
-				rectf = rl->rectf;
-				if (rectf == NULL) {
-					/* Happens when Save Buffers is enabled.
-					 * Use display buffer stored in the render layer.
-					 */
-					rect = (unsigned int *) rl->display_buffer;
-					byte_buffer_in_display_space = true;
-				}
-			}
-			else {
-				rpass = BLI_findlink(&rl->passes, pass - 1);
-				if (rpass) {
-					channels = rpass->channels;
-					rectf = rpass->rect;
-					dither = 0.0f; /* don't dither passes */
-				}
+			/* "there's no combined pass, is in renderlayer itself" */
+			/* -Now it does, no need to do pass - 1 (dfelinto) */
+			rpass = BLI_findlink(&rl->passes, pass);
+			if (rpass) {
+				channels = rpass->channels;
+				rectf = rpass->rect;
+				dither = 0.0f; /* don't dither passes */
 			}
 
 			for (rpass = rl->passes.first; rpass; rpass = rpass->next)
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index c2b9d92..1a4619c 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -305,10 +305,10 @@ static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void *
 
 static const char *ui_imageuser_layer_fake_name(RenderResult *rr)
 {
-	if (rr->rectf) {
+	if (RE_RenderViewGetRectf(rr, 0)){
 		return IFACE_("Composite");
 	}
-	else if (rr->rect32) {
+	else if (RE_RenderViewGetRect32(rr, 0)) {
 		return IFACE_("Sequence");
 	}
 	else {
@@ -359,7 +359,7 @@ final:
 
 static const char *ui_imageuser_pass_fake_name(RenderLayer *rl)
 {
-	if (rl == NULL || rl->rectf) {
+	if (rl == NULL) {
 		return IFACE_("Combined");
 	}
 	else {
@@ -379,6 +379,7 @@ static void ui_imageuser_pass_menu(bContext *UNUSED(C), uiLayout *layout, void *
 	RenderPass *rpass;
 	const char *fake_name;
 	int nr;
+	int passflag = 0;
 
 	uiBlockSetCurLayout(block, layout);
 	uiLayoutColumn(layout, false);
@@ -392,14 +393,21 @@ static void ui_imageuser_pass_menu(bContext *UNUSED(C), uiLayout *layout, void *
 	fake_name = ui_imageuser_pass_fake_name(rl);
 
 	if (fake

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list