[Bf-blender-cvs] [f8f684e] wiggly-widgets: Graph Editor backgdrop usability changes

Julian Eisel noreply at git.blender.org
Tue Apr 7 20:59:03 CEST 2015


Commit: f8f684e4be6a462a35c9a1c8c1ca67b57b065f9b
Author: Julian Eisel
Date:   Tue Apr 7 20:58:39 2015 +0200
Branches: wiggly-widgets
https://developer.blender.org/rBf8f684e4be6a462a35c9a1c8c1ca67b57b065f9b

Graph Editor backgdrop usability changes

* Opacity setting
* Saving set camera to file
* Own Panel for backdrop settings

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

M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/versioning_270.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/editors/include/BIF_glutil.h
M	source/blender/editors/include/ED_screen.h
M	source/blender/editors/interface/interface_draw.c
M	source/blender/editors/render/render_internal.c
M	source/blender/editors/screen/area.c
M	source/blender/editors/screen/glutil.c
M	source/blender/editors/space_clip/clip_draw.c
M	source/blender/editors/space_graph/graph_buttons.c
M	source/blender/editors/space_graph/space_graph.c
M	source/blender/editors/space_image/image_draw.c
M	source/blender/editors/space_node/drawnode.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 83cd928..77617d4 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5965,6 +5965,7 @@ static void lib_link_screen(FileData *fd, Main *main)
 							ads->source = newlibadr(fd, sc->id.lib, ads->source);
 							ads->filter_grp = newlibadr(fd, sc->id.lib, ads->filter_grp);
 						}
+						sipo->backdrop_camera = newlibadr(fd, sc->id.lib, sipo->backdrop_camera);
 					}
 					else if (sl->spacetype == SPACE_BUTS) {
 						SpaceButs *sbuts = (SpaceButs *)sl;
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 168243a..7b89794 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -840,6 +840,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 						if (sl->spacetype == SPACE_IPO) {
 							SpaceIpo *sipo = (SpaceIpo *)sl;
 							sipo->backdrop_zoom = 1.0f;
+							sipo->backdrop_opacity = 0.6f;
 						}
 					}
 				}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 9c3c6b4..6d79aedc 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2738,7 +2738,10 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
 					
 					writestruct(wd, DATA, "SpaceIpo", 1, sl);
 					if (sipo->ads) writestruct(wd, DATA, "bDopeSheet", 1, sipo->ads);
-					
+
+					if (sipo->backdrop_camera)
+						writestruct(wd, DATA, "Object", 1, sipo->backdrop_camera);
+
 					/* reenable ghost curves */
 					sipo->ghostCurves= tmpGhosts;
 				}
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index 4dc3968..ae253fe 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -155,7 +155,8 @@ void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, int ty
  * only RGBA
  * needs glaDefine2DArea to be set.
  */
-void glaDrawPixelsAuto(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect);
+void glaDrawPixelsAuto(float x, float y, int img_w, int img_h, int format,
+                       int type, int zoomfilter, float alpha, void *rect);
 
 
 void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float scaleX, float scaleY);
@@ -217,12 +218,12 @@ void bgl_get_mats(bglMats *mats);
 /* **** Color management helper functions for GLSL display/transform ***** */
 
 /* Draw imbuf on a screen, preferably using GLSL display transform */
-void glaDrawImBuf_glsl(struct ImBuf *ibuf, float x, float y, int zoomfilter,
+void glaDrawImBuf_glsl(struct ImBuf *ibuf, float x, float y, int zoomfilter, float alpha,
                        struct ColorManagedViewSettings *view_settings,
                        struct ColorManagedDisplaySettings *display_settings);
 
 /* Draw imbuf on a screen, preferably using GLSL display transform */
-void glaDrawImBuf_glsl_ctx(const struct bContext *C, struct ImBuf *ibuf, float x, float y, int zoomfilter);
+void glaDrawImBuf_glsl_ctx(const struct bContext *C, struct ImBuf *ibuf, float x, float y, int zoomfilter, float alpha);
 
 void glaDrawBorderCorners(const struct rcti *border, float zoomx, float zoomy);
 
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index cbb489c..e23f155 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -67,9 +67,9 @@ void    ED_region_header(const struct bContext *C, struct ARegion *ar);
 void    ED_region_toggle_hidden(struct bContext *C, struct ARegion *ar);
 void    ED_region_info_draw(struct ARegion *ar, const char *text, int block, float fill_color[4]);
 void    ED_region_grid_draw(struct ARegion *ar, float zoomx, float zoomy);
-void    ED_region_draw_backdrop_view3d(const struct bContext *C, struct Object *camera, const float width, const float height,
-                                       const float x, const float y, const float zoomx, const float zoomy,
-                                       const bool draw_alpha, const bool draw_border);
+void    ED_region_draw_backdrop_view3d(const struct bContext *C, struct Object *camera, const float alpha,
+                                       const float width, const float height, const float x, const float y,
+                                       const float zoomx, const float zoomy, const bool draw_background);
 float	ED_region_blend_factor(struct ARegion *ar);
 void	ED_region_visible_rect(struct ARegion *ar, struct rcti *rect);
 
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 414903f..f4bf133 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -436,7 +436,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
 		float facy = (float)h / (float)ibuf->y;
 		glPixelZoom(facx, facy);
 	}
-	glaDrawPixelsAuto((float)rect->xmin, (float)rect->ymin, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, ibuf->rect);
+	glaDrawPixelsAuto((float)rect->xmin, (float)rect->ymin, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, 1.0f, ibuf->rect);
 	
 	glPixelZoom(1.0f, 1.0f);
 	
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index f76f7ca..c0f7c52 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -1548,8 +1548,8 @@ void render_view3d_draw(RenderEngine *engine, const bContext *C)
 			glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
 			glPixelZoom(scale_x, scale_y);
 			glaDrawPixelsAuto(xof, yof, rres.rectx, rres.recty,
-			                  GL_RGBA, GL_UNSIGNED_BYTE,
-			                  GL_NEAREST, display_buffer);
+			                  GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST,
+			                  1.0f, display_buffer);
 			glPixelZoom(1.0f, 1.0f);
 			glDisable(GL_BLEND);
 
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 750a436..82a1cca 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -34,6 +34,7 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_object_types.h"
 #include "DNA_userdef_types.h"
 
 #include "BLI_blenlib.h"
@@ -70,6 +71,7 @@
 #include "UI_view2d.h"
 
 #include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
 
 #include "screen_intern.h"
 
@@ -2094,36 +2096,39 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy)
 }
 
 /* uses the viewplane from the given camera and draws it as a backdrop */
-void ED_region_draw_backdrop_view3d(const bContext *C, struct Object *camera, const float width, const float height,
-                                    const float x, const float y, const float zoomx, const float zoomy,
-                                    const bool draw_alpha, const bool draw_border)
+void ED_region_draw_backdrop_view3d(const bContext *C, struct Object *camera, const float alpha,
+                                    const float width, const float height, const float x, const float y,
+                                    const float zoomx, const float zoomy, const bool draw_background)
 {
 	Main *bmain = CTX_data_main(C);
 	Scene *scene = CTX_data_scene(C);
 	char err_out[256] = "unknown";
 	struct ImBuf *ibuf;
-	int filter = GL_LINEAR;
 
 	BKE_scene_update_for_newframe(bmain->eval_ctx, bmain, scene, scene->lay);
-	ibuf = ED_view3d_draw_offscreen_imbuf_simple(scene, camera, width, height, (1 << 0),
-	                                             3, false, false, false, R_ADDSKY, NULL, err_out);
+	ibuf = ED_view3d_draw_offscreen_imbuf_simple(scene, camera, width, height, IB_rect,
+	                                             OB_SOLID, false, false, false,
+	                                             R_ADDSKY, NULL, err_out);
 
 	if (ibuf == NULL)
 		return;
 
 	glEnable(GL_BLEND);
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	glPushMatrix();
 	glScalef(zoomx, zoomy, 0.0f);
 	glTranslatef(x, y, 0.0f);
 
-	if (draw_alpha == true) {
-		fdrawcheckerboard(0.0f, 0.0f, width, height);
-	}
-	if (draw_border == true) {
-		glColor3f(0.1f, 0.1f, 0.1f);
-		fdrawbox(0.0f, 0.0f, width + 0.5f, height + 0.5f);
+	/* draw background */
+	if (draw_background) {
+		char col[4];
+
+		UI_GetThemeColorType4ubv(TH_HIGH_GRAD, SPACE_VIEW3D, col);
+		glColor4ub(UNPACK3(col), alpha * 255);
+		glRectf(0, 0, width, height);
 	}
-	glaDrawImBuf_glsl_ctx(C, ibuf, 0.0f, 0.0f, filter);
+	/* draw the imbuf itself */
+	glaDrawImBuf_glsl_ctx(C, ibuf, 0.0f, 0.0f, GL_NEAREST, alpha);
 
 	glPopMatrix();
 	glDisable(GL_BLEND);
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 6001534..2c97ac3 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -713,10 +713,11 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
 }
 
 /* uses either DrawPixelsSafe or DrawPixelsTex, based on user defined maximum */
-void glaDrawPixelsAuto(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect)
+void glaDrawPixelsAuto(float x, float y, int img_w, int img_h, int format,
+                       int type, int zoomfilter, float alpha, void *rect)
 {
 	if (U.image_draw_method != IMAGE_DRAW_METHOD_DRAWPIXELS) {
-		glColor4f(1.0, 1.0, 1.0, 1.0);
+		glColor4f(1.0, 1.0, 1.0, alpha);
 		glaDrawPixelsTex(x, y, img_w, img_h, format, type, zoomfilter, rect);
 	}
 	else {
@@ -1040,7 +1041,7 @@ void bglFlush(void)
 /* **** Color management helper functions for GLSL display/transform ***** */
 
 /* Draw given image buffer on a screen using GLSL for display transform */
-void glaDrawImBuf_glsl(ImBuf *ibuf, float x, float y, int zoomfilter,
+void glaDrawImBuf_glsl(ImBuf *ibuf, float x, float y, int zoomfilte

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list