[Bf-blender-cvs] [4dd894d] multiview: Support for painting of stereo images (no real depth painting yet)

Dalai Felinto noreply at git.blender.org
Sun Sep 7 01:17:46 CEST 2014


Commit: 4dd894d1f5ea624102ce6d9fc0878478d085d911
Author: Dalai Felinto
Date:   Fri Sep 5 15:49:29 2014 +0200
Branches: multiview
https://developer.blender.org/rB4dd894d1f5ea624102ce6d9fc0878478d085d911

Support for painting of stereo images (no real depth painting yet)

Idea poll:
When in stereo mode you paint we paint to both buffers at the same time,
however the brush should get an offset parameter (pixel separation) that would
allow the user to paint in depth.

The brush 'icon' (the circle thing) could also be drawn with this
offset.

Bonus: make grease pencil (View mode) do the same thing. Basicaly we can
add a 'viewoffset' property to each line and use it at drawing time (no
idea of GPencil code, just speculating).

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

M	source/blender/blenkernel/intern/image.c
M	source/blender/editors/sculpt_paint/paint_image.c
M	source/blender/gpu/GPU_draw.h
M	source/blender/gpu/intern/gpu_draw.c

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

diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 972c7d3..f8dfdc3 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -2689,7 +2689,11 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
 	for (i = 0; i < totfiles; i++) {
 		ImageUser iuser_t;
 
-		iuser_t = *iuser;
+		if (iuser)
+			iuser_t = *iuser;
+		else
+			iuser_t.framenr = ima->lastframe;
+
 		iuser_t.view = i;
 
 		/* get the correct filepath */
@@ -2867,7 +2871,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
 	struct ImBuf **ibuf;
 	struct ImBuf *r_ibuf;
 	char **str;
-	bool assign = false;
+		bool assign = false;
 	int flag;
 	const bool is_multiview = (ima->flag & IMA_IS_MULTIVIEW) != 0;
 	const size_t totfiles = image_num_files(ima);
@@ -2908,7 +2912,11 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
 		for (i = 0; i < totfiles; i++) {
 			ImageUser iuser_t;
 
-			iuser_t = *iuser;
+			if (iuser)
+				iuser_t = *iuser;
+			else
+				iuser_t.framenr = ima->lastframe;
+
 			iuser_t.view = i;
 
 			BKE_image_user_file_path(&iuser_t, ima, str[i]);
@@ -3226,7 +3234,7 @@ static size_t image_get_multiview_index(Image *ima, ImageUser *iuser)
 		}
 	}
 	else if ((ima->flag & IMA_IS_MULTIVIEW)) {
-		return iuser ? iuser->multi_index : IMA_NO_INDEX;
+		return iuser ? iuser->multi_index : 0;
 	}
 
 	return IMA_NO_INDEX;
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index ebfb17d..8fdf0f1 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -505,7 +505,7 @@ void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, short te
 		int w = imapaintpartial.x2 - imapaintpartial.x1;
 		int h = imapaintpartial.y2 - imapaintpartial.y1;
 		/* Testing with partial update in uv editor too */
-		GPU_paint_update_image(image, imapaintpartial.x1, imapaintpartial.y1, w, h); //!texpaint);
+		GPU_paint_update_image(image, (sima ? &sima->iuser : NULL), imapaintpartial.x1, imapaintpartial.y1, w, h); //!texpaint);
 	}
 }
 
diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h
index 3ddec15..cb1e6c5 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -123,7 +123,7 @@ void GPU_set_gpu_mipmapping(int gpu_mipmap);
 /* Image updates and free
  * - these deal with images bound as opengl textures */
 
-void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h);
+void GPU_paint_update_image(struct Image *ima, ImageUser *iuser, int x, int y, int w, int h);
 void GPU_update_images_framechange(void);
 int GPU_update_image_time(struct Image *ima, double time);
 int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, bool compare, bool mipmap, bool is_data);
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 7295f02..942ad22 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -1022,11 +1022,11 @@ static bool GPU_check_scaled_image(ImBuf *ibuf, Image *ima, float *frect, int x,
 	return false;
 }
 
-void GPU_paint_update_image(Image *ima, int x, int y, int w, int h)
+void GPU_paint_update_image(Image *ima, ImageUser *iuser, int x, int y, int w, int h)
 {
 	ImBuf *ibuf;
 	
-	ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
+	ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL);
 	
 	if (ima->repbind || (GPU_get_mipmap() && !GTS.gpu_mipmap) || !ima->bindcode || !ibuf ||
 		(w == 0) || (h == 0))




More information about the Bf-blender-cvs mailing list