[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33799] trunk/blender/source/blender: fix [#25283] Edge length display difficult to read

Campbell Barton ideasman42 at gmail.com
Mon Dec 20 04:59:28 CET 2010


Revision: 33799
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33799
Author:   campbellbarton
Date:     2010-12-20 04:59:22 +0100 (Mon, 20 Dec 2010)

Log Message:
-----------
fix [#25283] Edge length display difficult to read
- made theme colors for mesh edge len & face angle/area display.
- use %g rather then %f for float display, trims unneeded zeros.
- store cached 2d and 3d text color as bytes rather then floats, compare when drawing to avoid setting the context.
- use unsigned char for more color functions, avoids casting to glColorubv().

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_pointcache.h
    trunk/blender/source/blender/blenkernel/BKE_text.h
    trunk/blender/source/blender/blenkernel/intern/sequencer.c
    trunk/blender/source/blender/blenkernel/intern/text.c
    trunk/blender/source/blender/blenlib/BLI_math_color.h
    trunk/blender/source/blender/blenlib/intern/math_color.c
    trunk/blender/source/blender/editors/animation/anim_channels_defines.c
    trunk/blender/source/blender/editors/include/UI_resources.h
    trunk/blender/source/blender/editors/interface/interface_draw.c
    trunk/blender/source/blender/editors/interface/interface_widgets.c
    trunk/blender/source/blender/editors/interface/resources.c
    trunk/blender/source/blender/editors/interface/view2d.c
    trunk/blender/source/blender/editors/mesh/editmesh_tools.c
    trunk/blender/source/blender/editors/space_action/action_draw.c
    trunk/blender/source/blender/editors/space_console/console_draw.c
    trunk/blender/source/blender/editors/space_graph/graph_draw.c
    trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c
    trunk/blender/source/blender/editors/space_text/text_draw.c
    trunk/blender/source/blender/editors/space_text/text_ops.c
    trunk/blender/source/blender/editors/space_view3d/drawanimviz.c
    trunk/blender/source/blender/editors/space_view3d/drawarmature.c
    trunk/blender/source/blender/editors/space_view3d/drawobject.c
    trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
    trunk/blender/source/blender/editors/space_view3d/view3d_intern.h
    trunk/blender/source/blender/editors/transform/transform.c
    trunk/blender/source/blender/editors/transform/transform_generics.c
    trunk/blender/source/blender/editors/transform/transform_manipulator.c
    trunk/blender/source/blender/editors/transform/transform_snap.c
    trunk/blender/source/blender/editors/uvedit/uvedit_draw.c
    trunk/blender/source/blender/makesdna/DNA_mesh_types.h
    trunk/blender/source/blender/makesdna/DNA_text_types.h
    trunk/blender/source/blender/makesdna/DNA_userdef_types.h
    trunk/blender/source/blender/makesrna/intern/rna_mesh.c
    trunk/blender/source/blender/makesrna/intern/rna_userdef.c

Modified: trunk/blender/source/blender/blenkernel/BKE_pointcache.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_pointcache.h	2010-12-19 20:40:52 UTC (rev 33798)
+++ trunk/blender/source/blender/blenkernel/BKE_pointcache.h	2010-12-20 03:59:22 UTC (rev 33799)
@@ -223,8 +223,8 @@
 
 	int totpoint, totframes, totcached, edited;
 
-	char sel_col[3];
-	char nosel_col[3];
+	unsigned char sel_col[3];
+	unsigned char nosel_col[3];
 } PTCacheEdit;
 
 /* Particle functions */

Modified: trunk/blender/source/blender/blenkernel/BKE_text.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_text.h	2010-12-19 20:40:52 UTC (rev 33798)
+++ trunk/blender/source/blender/blenkernel/BKE_text.h	2010-12-20 03:59:22 UTC (rev 33799)
@@ -94,7 +94,7 @@
 void	uncomment		(struct Text *text);
 int	setcurr_tab_spaces	(struct Text *text, int space);
 
-void	txt_add_marker						(struct Text *text, struct TextLine *line, int start, int end, char color[4], int group, int flags);
+void	txt_add_marker						(struct Text *text, struct TextLine *line, int start, int end, const unsigned char color[4], int group, int flags);
 short	txt_clear_marker_region				(struct Text *text, struct TextLine *line, int start, int end, int group, int flags);
 short	txt_clear_markers					(struct Text *text, int group, int flags);
 struct TextMarker	*txt_find_marker		(struct Text *text, struct TextLine *line, int curs, int group, int flags);

Modified: trunk/blender/source/blender/blenkernel/intern/sequencer.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/sequencer.c	2010-12-19 20:40:52 UTC (rev 33798)
+++ trunk/blender/source/blender/blenkernel/intern/sequencer.c	2010-12-20 03:59:22 UTC (rev 33799)
@@ -1609,7 +1609,7 @@
 	if(seq->sat != 1.0f) {
 		/* inline for now, could become an imbuf function */
 		int i;
-		char *rct= (char *)ibuf->rect;
+		unsigned char *rct= (unsigned char *)ibuf->rect;
 		float *rctf= ibuf->rect_float;
 		const float sat= seq->sat;
 		float hsv[3];

Modified: trunk/blender/source/blender/blenkernel/intern/text.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/text.c	2010-12-19 20:40:52 UTC (rev 33798)
+++ trunk/blender/source/blender/blenkernel/intern/text.c	2010-12-20 03:59:22 UTC (rev 33799)
@@ -2746,7 +2746,7 @@
 /*********************************/
 
 /* Creates and adds a marker to the list maintaining sorted order */
-void txt_add_marker(Text *text, TextLine *line, int start, int end, char color[4], int group, int flags) {
+void txt_add_marker(Text *text, TextLine *line, int start, int end, const unsigned char color[4], int group, int flags) {
 	TextMarker *tmp, *marker;
 
 	marker= MEM_mallocN(sizeof(TextMarker), "text_marker");

Modified: trunk/blender/source/blender/blenlib/BLI_math_color.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_color.h	2010-12-19 20:40:52 UTC (rev 33798)
+++ trunk/blender/source/blender/blenlib/BLI_math_color.h	2010-12-20 03:59:22 UTC (rev 33799)
@@ -89,14 +89,14 @@
 void minmax_rgb(short c[3]);
 
 void rgb_float_set_hue_float_offset(float * rgb, float hue_offset);
-void rgb_byte_set_hue_float_offset(char * rgb, float hue_offset);
+void rgb_byte_set_hue_float_offset(unsigned char * rgb, float hue_offset);
 
 /***************** lift/gamma/gain / ASC-CDL conversion *****************/
 
 void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power);
 
-void rgb_byte_to_float(char *in, float *out);
-void rgb_float_to_byte(float *in, char *out);
+void rgb_byte_to_float(const unsigned char *in, float *out);
+void rgb_float_to_byte(const float *in, unsigned char *out);
 
 #ifdef __cplusplus
 }

Modified: trunk/blender/source/blender/blenlib/intern/math_color.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_color.c	2010-12-19 20:40:52 UTC (rev 33798)
+++ trunk/blender/source/blender/blenlib/intern/math_color.c	2010-12-20 03:59:22 UTC (rev 33799)
@@ -326,14 +326,14 @@
 	*b /= 255.0f;
 }
 
-void rgb_byte_to_float(char *in, float *out)
+void rgb_byte_to_float(const unsigned char *in, float *out)
 {
 	out[0]= ((float)in[0]) / 255.0f;
 	out[1]= ((float)in[1]) / 255.0f;
 	out[2]= ((float)in[2]) / 255.0f;
 }
 
-void rgb_float_to_byte(float *in, char *out)
+void rgb_float_to_byte(const float *in, unsigned char *out)
 {
 	int r, g, b;
 	
@@ -511,7 +511,7 @@
 }
 
 /* Applies an hue offset to a byte rgb color */
-void rgb_byte_set_hue_float_offset(char rgb[3], float hue_offset)
+void rgb_byte_set_hue_float_offset(unsigned char rgb[3], float hue_offset)
 {
 	float rgb_float[3];
 	

Modified: trunk/blender/source/blender/editors/animation/anim_channels_defines.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_channels_defines.c	2010-12-19 20:40:52 UTC (rev 33798)
+++ trunk/blender/source/blender/editors/animation/anim_channels_defines.c	2010-12-20 03:59:22 UTC (rev 33799)
@@ -162,7 +162,7 @@
 	if ( (saction && !(saction->flag & SACTION_NODRAWGCOLORS)) && 
 		 ((grp) && (grp->customCol)) ) 
 	{
-		char cp[3];
+		unsigned char cp[3];
 		
 		if (indent == 2) {
 			VECCOPY(cp, grp->cs.solid);

Modified: trunk/blender/source/blender/editors/include/UI_resources.h
===================================================================
--- trunk/blender/source/blender/editors/include/UI_resources.h	2010-12-19 20:40:52 UTC (rev 33798)
+++ trunk/blender/source/blender/editors/include/UI_resources.h	2010-12-20 03:59:22 UTC (rev 33799)
@@ -232,6 +232,10 @@
 	TH_PREVIEW_BACK,
 	
 	TH_EDGE_CREASE,
+
+	TH_DRAWEXTRA_EDGELEN,
+	TH_DRAWEXTRA_FACEAREA,
+	TH_DRAWEXTRA_FACEANG
 };
 /* XXX WARNING: previous is saved in file, so do not change order! */
 
@@ -270,17 +274,17 @@
 void 	UI_GetThemeColorShade3fv(int colorid, int offset, float *col);
 
 // get the 3 or 4 byte values
-void 	UI_GetThemeColor3ubv(int colorid, char *col);
-void 	UI_GetThemeColor4ubv(int colorid, char *col);
+void 	UI_GetThemeColor3ubv(int colorid, unsigned char col[3]);
+void 	UI_GetThemeColor4ubv(int colorid, unsigned char col[4]);
 
 // get a theme color from specified space type
-void	UI_GetThemeColorType4ubv(int colorid, int spacetype, char *col);
+void	UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4]);
 
 // blends and shades between two color pointers
-void	UI_ColorPtrBlendShade3ubv(char *cp1, char *cp2, float fac, int offset);
+void	UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], float fac, int offset);
 
 // get a 3 byte color, blended and shaded between two other char color pointers
-void	UI_GetColorPtrBlendShade3ubv(char *cp1, char *cp2, char *col, float fac, int offset);
+void	UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset);
 
 // clear the openGL ClearColor using the input colorid
 void	UI_ThemeClearColor(int colorid);
@@ -289,9 +293,8 @@
 void 	UI_SetTheme(int spacetype, int regionid);
 
 /* only for buttons in theme editor! */
-char 	*UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid);
-char 	*UI_ThemeColorsPup(int spacetype);
+const unsigned char 	*UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid);
 
-void UI_make_axis_color(char *src_col, char *dst_col, char axis);
+void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, const char axis);
 
 #endif /*  UI_ICONS_H */

Modified: trunk/blender/source/blender/editors/interface/interface_draw.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_draw.c	2010-12-19 20:40:52 UTC (rev 33798)
+++ trunk/blender/source/blender/editors/interface/interface_draw.c	2010-12-20 03:59:22 UTC (rev 33799)
@@ -1342,7 +1342,7 @@
 	
 }
 
-static void glColor3ubvShade(char *col, int shade)
+static void glColor3ubvShade(unsigned char *col, int shade)
 {
 	glColor3ub(col[0]-shade>0?col[0]-shade:0, 
 			   col[1]-shade>0?col[1]-shade:0,
@@ -1379,7 +1379,7 @@
 	
 	/* backdrop */
 	if(cumap->flag & CUMA_DO_CLIP) {
-		glColor3ubvShade(wcol->inner, -20);
+		glColor3ubvShade((unsigned char *)wcol->inner, -20);
 		glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
 		glColor3ubv((unsigned char*)wcol->inner);
 		glRectf(rect->xmin + zoomx*(cumap->clipr.xmin-offsx),
@@ -1393,13 +1393,13 @@
 	}
 		
 	/* grid, every .25 step */
-	glColor3ubvShade(wcol->inner, -16);
+	glColor3ubvShade((unsigned char *)wcol->inner, -16);
 	ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.25f);
 	/* grid, every 1.0 step */
-	glColor3ubvShade(wcol->inner, -24);
+	glColor3ubvShade((unsigned char *)wcol->inner, -24);
 	ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 1.0f);
 	/* axes */
-	glColor3ubvShade(wcol->inner, -50);
+	glColor3ubvShade((unsigned char *)wcol->inner, -50);
 	glBegin(GL_LINES);
 	glVertex2f(rect->xmin, rect->ymin + zoomy*(-offsy));
 	glVertex2f(rect->xmax, rect->ymin + zoomy*(-offsy));

Modified: trunk/blender/source/blender/editors/interface/interface_widgets.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_widgets.c	2010-12-19 20:40:52 UTC (rev 33798)
+++ trunk/blender/source/blender/editors/interface/interface_widgets.c	2010-12-20 03:59:22 UTC (rev 33799)
@@ -555,7 +555,7 @@
 
 
 /* prepares shade colors */
-static void shadecolors4(char *coltop, char *coldown, char *color, short shadetop, short shadedown)
+static void shadecolors4(char *coltop, char *coldown, const char *color, short shadetop, short shadedown)
 {
 	
 	coltop[0]= CLAMPIS(color[0]+shadetop, 0, 255);
@@ -569,7 +569,7 @@
 	coldown[3]= color[3];	
 }
 
-static void round_box_shade_col4(char *col1, char *col2, float fac)
+static void round_box_shade_col4(const char *col1, const char *col2, float fac)
 {
 	int faci, facm;
 	unsigned char col[4];
@@ -1431,7 +1431,7 @@
 
 /* ************ button callbacks, state ***************** */
 
-static void widget_state_blend(char *cp, char *cpstate, float fac)

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list