Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-12-20 06:59:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-20 06:59:22 +0300
commit3bed4cbf2b4c09dcb62197b8a8c4ec4224abc8b7 (patch)
treefc800fc89f29db4ac9d951ff148b8424c8cb7c73 /source
parent17f37dceccb99d7eb58f7c29908eeb2bd87cd7ff (diff)
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().
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_pointcache.h4
-rw-r--r--source/blender/blenkernel/BKE_text.h2
-rw-r--r--source/blender/blenkernel/intern/sequencer.c2
-rw-r--r--source/blender/blenkernel/intern/text.c2
-rw-r--r--source/blender/blenlib/BLI_math_color.h6
-rw-r--r--source/blender/blenlib/intern/math_color.c6
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c2
-rw-r--r--source/blender/editors/include/UI_resources.h19
-rw-r--r--source/blender/editors/interface/interface_draw.c10
-rw-r--r--source/blender/editors/interface/interface_widgets.c14
-rw-r--r--source/blender/editors/interface/resources.c79
-rw-r--r--source/blender/editors/interface/view2d.c15
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c4
-rw-r--r--source/blender/editors/space_action/action_draw.c6
-rw-r--r--source/blender/editors/space_console/console_draw.c10
-rw-r--r--source/blender/editors/space_graph/graph_draw.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c22
-rw-r--r--source/blender/editors/space_text/text_draw.c7
-rw-r--r--source/blender/editors/space_text/text_ops.c2
-rw-r--r--source/blender/editors/space_view3d/drawanimviz.c17
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c36
-rw-r--r--source/blender/editors/space_view3d/drawobject.c158
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c28
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h2
-rw-r--r--source/blender/editors/transform/transform.c10
-rw-r--r--source/blender/editors/transform/transform_generics.c4
-rw-r--r--source/blender/editors/transform/transform_manipulator.c19
-rw-r--r--source/blender/editors/transform/transform_snap.c5
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c2
-rw-r--r--source/blender/makesdna/DNA_mesh_types.h6
-rw-r--r--source/blender/makesdna/DNA_text_types.h2
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h8
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c6
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c15
34 files changed, 302 insertions, 230 deletions
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h
index e19258cdf1f..a7ad95b8ffc 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -223,8 +223,8 @@ typedef struct PTCacheEdit {
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 */
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h
index f98d5842eb5..5f55f8b351e 100644
--- a/source/blender/blenkernel/BKE_text.h
+++ b/source/blender/blenkernel/BKE_text.h
@@ -94,7 +94,7 @@ void indent (struct Text *text);
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);
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 17d63fa2349..d35fee2addc 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -1609,7 +1609,7 @@ static ImBuf * input_preprocess(
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];
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 6e0289e907b..bbdc188d580 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -2746,7 +2746,7 @@ int setcurr_tab_spaces (Text *text, int space)
/*********************************/
/* 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");
diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h
index 2095c40b5aa..0d88ef46104 100644
--- a/source/blender/blenlib/BLI_math_color.h
+++ b/source/blender/blenlib/BLI_math_color.h
@@ -89,14 +89,14 @@ int constrain_rgb(float *r, float *g, float *b);
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
}
diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c
index 09a419b0e04..cf7a122e1bf 100644
--- a/source/blender/blenlib/intern/math_color.c
+++ b/source/blender/blenlib/intern/math_color.c
@@ -326,14 +326,14 @@ void cpack_to_rgb(unsigned int col, float *r, float *g, float *b)
*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 @@ void rgb_float_set_hue_float_offset(float rgb[3], float hue_offset)
}
/* 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];
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index fa488e8ba98..8cc159b486e 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -162,7 +162,7 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa
if ( (saction && !(saction->flag & SACTION_NODRAWGCOLORS)) &&
((grp) && (grp->customCol)) )
{
- char cp[3];
+ unsigned char cp[3];
if (indent == 2) {
VECCOPY(cp, grp->cs.solid);
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index e3c83291089..5c97da4ebc9 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -232,6 +232,10 @@ enum {
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_GetThemeColor3fv(int colorid, float *col);
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_ThemeClearColor(int colorid);
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 */
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index d06fe5efcf0..65261371329 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1342,7 +1342,7 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o
}
-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 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
/* 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 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
}
/* 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));
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 319d51cdf75..1d49735d63a 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -555,7 +555,7 @@ static void widget_check_trias(uiWidgetTrias *tria, rcti *rect)
/* 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 @@ static void shadecolors4(char *coltop, char *coldown, char *color, short shadeto
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 @@ void ui_widget_color_init(ThemeUI *tui)
/* ************ button callbacks, state ***************** */
-static void widget_state_blend(char *cp, char *cpstate, float fac)
+static void widget_state_blend(char *cp, const char *cpstate, const float fac)
{
if(fac != 0.0f) {
cp[0]= (int)((1.0f-fac)*cp[0] + fac*cpstate[0]);
@@ -1523,9 +1523,9 @@ static void widget_state_label(uiWidgetType *wt, int state)
widget_state(wt, state);
if(state & UI_SELECT)
- UI_GetThemeColor4ubv(TH_TEXT_HI, wt->wcol.text);
+ UI_GetThemeColor4ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text);
else
- UI_GetThemeColor4ubv(TH_TEXT, wt->wcol.text);
+ UI_GetThemeColor4ubv(TH_TEXT, (unsigned char *)wt->wcol.text);
}
@@ -2594,7 +2594,7 @@ static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state),
static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType *wt, rcti *rect)
{
uiWidgetBase wtb;
- char col[4];
+ unsigned char col[4];
/* state copy! */
wt->wcol= *(wt->wcol_theme);
@@ -2607,7 +2607,7 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType *
/* make mask to draw over image */
UI_GetThemeColor3ubv(TH_BACK, col);
- glColor3ubv((unsigned char*)col);
+ glColor3ubv(col);
round_box__edges(&wtb, 15, rect, 0.0f, 4.0);
widgetbase_outline(&wtb);
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 2bc72d717c0..fa36eed5911 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -81,14 +81,14 @@ void ui_resources_free(void)
/* THEMES */
/* ******************************************************** */
-char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
+const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
{
ThemeSpace *ts= NULL;
static char error[4]={240, 0, 240, 255};
static char alert[4]={240, 60, 60, 255};
static char headerdesel[4]={0,0,0,255};
- char *cp= error;
+ const char *cp= error;
if(btheme) {
@@ -285,6 +285,12 @@ char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
cp= ts->face_dot; break;
case TH_FACEDOT_SIZE:
cp= &ts->facedot_size; break;
+ case TH_DRAWEXTRA_EDGELEN:
+ cp= ts->extra_edge_len; break;
+ case TH_DRAWEXTRA_FACEAREA:
+ cp= ts->extra_face_area; break;
+ case TH_DRAWEXTRA_FACEANG:
+ cp= ts->extra_face_angle; break;
case TH_NORMAL:
cp= ts->normal; break;
case TH_VNORMAL:
@@ -402,7 +408,7 @@ char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
}
}
- return cp;
+ return (unsigned char *)cp;
}
#define SETCOLTEST(col, r, g, b, a) if(col[3]==0) {col[0]=r; col[1]=g; col[2]= b; col[3]= a;}
@@ -515,6 +521,11 @@ void ui_theme_init_default(void)
SETCOL(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255);
SETCOL(btheme->tv3d.face_dot, 255, 133, 0, 255);
btheme->tv3d.facedot_size= 4;
+
+ SETCOL(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
+ SETCOL(btheme->tv3d.extra_face_area, 0, 32, 0, 255);
+ SETCOL(btheme->tv3d.extra_face_angle, 0, 0, 128, 255);
+
SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
SETCOL(btheme->tv3d.nurb_uline, 0x90, 0x90, 0x00, 255);
@@ -709,20 +720,20 @@ void UI_SetTheme(int spacetype, int regionid)
// for space windows only
void UI_ThemeColor(int colorid)
{
- char *cp;
+ const unsigned char *cp;
cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
- glColor3ub(cp[0], cp[1], cp[2]);
+ glColor3ubv(cp);
}
// plus alpha
void UI_ThemeColor4(int colorid)
{
- char *cp;
+ const unsigned char *cp;
cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
- glColor4ub(cp[0], cp[1], cp[2], cp[3]);
+ glColor4ubv(cp);
}
@@ -730,7 +741,7 @@ void UI_ThemeColor4(int colorid)
void UI_ThemeColorShade(int colorid, int offset)
{
int r, g, b;
- char *cp;
+ const unsigned char *cp;
cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
r= offset + (int) cp[0];
@@ -745,7 +756,7 @@ void UI_ThemeColorShade(int colorid, int offset)
void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
{
int r, g, b, a;
- char *cp;
+ const unsigned char *cp;
cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
r= coloffset + (int) cp[0];
@@ -763,7 +774,7 @@ void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
void UI_ThemeColorBlend(int colorid1, int colorid2, float fac)
{
int r, g, b;
- char *cp1, *cp2;
+ const unsigned char *cp1, *cp2;
cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
@@ -780,7 +791,7 @@ void UI_ThemeColorBlend(int colorid1, int colorid2, float fac)
void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset)
{
int r, g, b;
- char *cp1, *cp2;
+ const unsigned char *cp1, *cp2;
cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
@@ -801,7 +812,7 @@ void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset)
void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int offset, int alphaoffset)
{
int r, g, b, a;
- char *cp1, *cp2;
+ const unsigned char *cp1, *cp2;
cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
@@ -824,7 +835,7 @@ void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int off
// get individual values, not scaled
float UI_GetThemeValuef(int colorid)
{
- char *cp;
+ const unsigned char *cp;
cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
return ((float)cp[0]);
@@ -834,7 +845,7 @@ float UI_GetThemeValuef(int colorid)
// get individual values, not scaled
int UI_GetThemeValue(int colorid)
{
- char *cp;
+ const unsigned char *cp;
cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
return ((int) cp[0]);
@@ -845,7 +856,7 @@ int UI_GetThemeValue(int colorid)
// get the color, range 0.0-1.0
void UI_GetThemeColor3fv(int colorid, float *col)
{
- char *cp;
+ const unsigned char *cp;
cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
col[0]= ((float)cp[0])/255.0;
@@ -857,7 +868,7 @@ void UI_GetThemeColor3fv(int colorid, float *col)
void UI_GetThemeColorShade3fv(int colorid, int offset, float *col)
{
int r, g, b;
- char *cp;
+ const unsigned char *cp;
cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
@@ -874,9 +885,9 @@ void UI_GetThemeColorShade3fv(int colorid, int offset, float *col)
}
// get the color, in char pointer
-void UI_GetThemeColor3ubv(int colorid, char *col)
+void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
{
- char *cp;
+ const unsigned char *cp;
cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
col[0]= cp[0];
@@ -885,9 +896,9 @@ void UI_GetThemeColor3ubv(int colorid, char *col)
}
// get the color, in char pointer
-void UI_GetThemeColor4ubv(int colorid, char *col)
+void UI_GetThemeColor4ubv(int colorid, unsigned char col[4])
{
- char *cp;
+ const unsigned char *cp;
cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
col[0]= cp[0];
@@ -896,9 +907,9 @@ void UI_GetThemeColor4ubv(int colorid, char *col)
col[3]= cp[3];
}
-void UI_GetThemeColorType4ubv(int colorid, int spacetype, char *col)
+void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4])
{
- char *cp;
+ const unsigned char *cp;
cp= UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
col[0]= cp[0];
@@ -908,7 +919,7 @@ void UI_GetThemeColorType4ubv(int colorid, int spacetype, char *col)
}
// blends and shades between two char 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)
{
int r, g, b;
@@ -925,7 +936,7 @@ void UI_ColorPtrBlendShade3ubv(char *cp1, char *cp2, 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)
{
int r, g, b;
@@ -951,24 +962,27 @@ void UI_ThemeClearColor(int colorid)
glClearColor(col[0], col[1], col[2], 0.0);
}
-void UI_make_axis_color(char *src_col, char *dst_col, char axis)
+void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], const char axis)
{
switch(axis)
{
- case 'x':
+ case 'X':
dst_col[0]= src_col[0]>219?255:src_col[0]+36;
dst_col[1]= src_col[1]<26?0:src_col[1]-26;
dst_col[2]= src_col[2]<26?0:src_col[2]-26;
break;
- case 'y':
+ case 'Y':
dst_col[0]= src_col[0]<46?0:src_col[0]-36;
dst_col[1]= src_col[1]>189?255:src_col[1]+66;
dst_col[2]= src_col[2]<46?0:src_col[2]-36;
break;
- default:
+ case 'Z':
dst_col[0]= src_col[0]<26?0:src_col[0]-26;
dst_col[1]= src_col[1]<26?0:src_col[1]-26;
dst_col[2]= src_col[2]>209?255:src_col[2]+46;
+ break;
+ default:
+ BKE_assert(!"invalid axis arg");
}
}
@@ -1488,6 +1502,15 @@ void init_userdef_do_versions(void)
btheme->tui.wcol_progress= wcol_progress;
}
}
+
+ if (bmain->versionfile < 255 || (bmain->versionfile == 255 && bmain->subversionfile < 2)) {
+ bTheme *btheme;
+ for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ SETCOL(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
+ SETCOL(btheme->tv3d.extra_face_angle, 0, 32, 0, 255);
+ SETCOL(btheme->tv3d.extra_face_area, 0, 0, 128, 255);
+ }
+ }
/* GL Texture Garbage Collection (variable abused above!) */
if (U.textimeout == 0) {
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 21146dc8cec..13dca032a6c 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -2006,7 +2006,10 @@ static ListBase strings= {NULL, NULL};
typedef struct View2DString {
struct View2DString *next, *prev;
- GLbyte col[4];
+ union {
+ unsigned char ub[4];
+ int pack;
+ } col;
short mval[2];
rcti rect;
} View2DString;
@@ -2026,9 +2029,9 @@ void UI_view2d_text_cache_add(View2D *v2d, float x, float y, const char *str, co
memcpy(v2s_str, str, len);
BLI_addtail(&strings, v2s);
+ v2s->col.pack= *((int *)col);
v2s->mval[0]= mval[0];
v2s->mval[1]= mval[1];
- QUATCOPY(v2s->col, col);
}
}
@@ -2043,17 +2046,18 @@ void UI_view2d_text_cache_rectf(View2D *v2d, rctf *rect, const char *str, const
UI_view2d_to_region_no_clip(v2d, rect->xmin, rect->ymin, &v2s->rect.xmin, &v2s->rect.ymin);
UI_view2d_to_region_no_clip(v2d, rect->xmax, rect->ymax, &v2s->rect.xmax, &v2s->rect.ymax);
+ v2s->col.pack= *((int *)col);
v2s->mval[0]= v2s->rect.xmin;
v2s->mval[1]= v2s->rect.ymin;
BLI_addtail(&strings, v2s);
- QUATCOPY(v2s->col, col);
}
void UI_view2d_text_cache_draw(ARegion *ar)
{
View2DString *v2s;
+ int col_pack_prev= 0;
// glMatrixMode(GL_PROJECTION);
// glPushMatrix();
@@ -2068,7 +2072,10 @@ void UI_view2d_text_cache_draw(ARegion *ar)
yofs= ceil( 0.5f*(v2s->rect.ymax - v2s->rect.ymin - BLF_height_default("28")));
if(yofs<1) yofs= 1;
- glColor3bv(v2s->col);
+ if(col_pack_prev != v2s->col.pack) {
+ glColor3ubv(v2s->col.ub);
+ col_pack_prev= v2s->col.pack;
+ }
if(v2s->rect.xmin >= v2s->rect.xmax)
BLF_draw_default((float)v2s->mval[0]+xofs, (float)v2s->mval[1]+yofs, 0.0, str, 65535);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index dbcc897e6d7..aebcde9749b 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -4204,7 +4204,7 @@ useless:
return 0;
}
- if(me->drawflag & ME_DRAW_EDGELEN) {
+ if(me->drawflag & ME_DRAWEXTRA_EDGELEN) {
if(!(tempsv->up->f & SELECT)) {
tempsv->up->f |= SELECT;
tempsv->up->f2 |= 16;
@@ -4657,7 +4657,7 @@ useless:
}
- if(me->drawflag & ME_DRAW_EDGELEN) {
+ if(me->drawflag & ME_DRAWEXTRA_EDGELEN) {
look = vertlist;
while(look) {
tempsv = BLI_ghash_lookup(vertgh,(EditVert*)look->link);
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index c1a5453abfe..cf515a25020 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -162,9 +162,9 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
float act_start, act_end, y;
int height, items;
- char col1[3], col2[3];
- char col1a[3], col2a[3];
- char col1b[3], col2b[3];
+ unsigned char col1[3], col2[3];
+ unsigned char col1a[3], col2a[3];
+ unsigned char col1b[3], col2b[3];
/* get theme colors */
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index d4d1429530c..0bb0d78a497 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -59,16 +59,16 @@ static void console_line_color(unsigned char fg[3], int type)
{
switch(type) {
case CONSOLE_LINE_OUTPUT:
- UI_GetThemeColor3ubv(TH_CONSOLE_OUTPUT, (char *)fg);
+ UI_GetThemeColor3ubv(TH_CONSOLE_OUTPUT, fg);
break;
case CONSOLE_LINE_INPUT:
- UI_GetThemeColor3ubv(TH_CONSOLE_INPUT, (char *)fg);
+ UI_GetThemeColor3ubv(TH_CONSOLE_INPUT, fg);
break;
case CONSOLE_LINE_INFO:
- UI_GetThemeColor3ubv(TH_CONSOLE_INFO, (char *)fg);
+ UI_GetThemeColor3ubv(TH_CONSOLE_INFO, fg);
break;
case CONSOLE_LINE_ERROR:
- UI_GetThemeColor3ubv(TH_CONSOLE_ERROR, (char *)fg);
+ UI_GetThemeColor3ubv(TH_CONSOLE_ERROR, fg);
break;
}
}
@@ -171,7 +171,7 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha
}
/* cursor */
- UI_GetThemeColor3ubv(TH_CONSOLE_CURSOR, (char *)fg);
+ UI_GetThemeColor3ubv(TH_CONSOLE_CURSOR, fg);
glColor3ubv(fg);
glRecti( (xy[0] + pen[0]) - 1,
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index d875aaafd33..08e3870f8a2 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -346,7 +346,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu)
BezTriple *bezt=fcu->bezt, *prevbezt=NULL;
int basecol= (sel)? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE;
float *fp;
- char col[4];
+ unsigned char col[4];
/* if only selected keyframes have handles shown, skip the first round */
if ((sel == 0) && (sipo->flag & SIPO_SELVHANDLESONLY))
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 087b0b7dcd7..3cf747a0779 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -71,11 +71,11 @@
/* Note, Dont use WHILE_SEQ while drawing! - it messes up transform, - Campbell */
int no_rightbox=0, no_leftbox= 0;
-static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float x2, float y2);
+static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, float y1, float x2, float y2);
-static void get_seq_color3ubv(Scene *curscene, Sequence *seq, char *col)
+static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[3])
{
- char blendcol[3];
+ unsigned char blendcol[3];
SolidColorVars *colvars = (SolidColorVars *)seq->effectdata;
switch(seq->type) {
@@ -212,7 +212,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
/* Note, this used to use WHILE_SEQ, but it messes up the seq->depth value, (needed by transform when doing overlap checks)
* so for now, just use the meta's immediate children, could be fixed but its only drawing - Campbell */
Sequence *seq;
- char col[4];
+ unsigned char col[4];
int chan_min= MAXSEQ;
int chan_max= 0;
@@ -248,7 +248,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
get_seq_color3ubv(scene, seq, col);
- glColor4ubv((GLubyte *)col);
+ glColor4ubv(col);
/* clamp within parent sequence strip bounds */
if(x1_chan < x1) x1_chan= x1;
@@ -260,7 +260,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
glRectf(x1_chan, y1_chan, x2_chan, y2_chan);
UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -30);
- glColor4ubv((GLubyte *)col);
+ glColor4ubv(col);
fdrawbox(x1_chan, y1_chan, x2_chan, y2_chan);
if((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
@@ -360,7 +360,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short dire
static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
{
float x1, x2, y1, y2, pixely, a;
- char col[3], blendcol[3];
+ unsigned char col[3], blendcol[3];
View2D *v2d= &ar->v2d;
if(seq->type >= SEQ_EFFECT) return;
@@ -462,7 +462,7 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
}
/* draw info text on a sequence strip */
-static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float y1, float y2, char *background_col)
+static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float y1, float y2, const unsigned char background_col[3])
{
rctf rect;
char str[32 + FILE_MAXDIR+FILE_MAXFILE];
@@ -528,7 +528,7 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
}
/* draws a shaded strip, made from gradient + flat color + gradient */
-static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float x2, float y2)
+static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, float y1, float x2, float y2)
{
float ymid1, ymid2;
@@ -546,7 +546,7 @@ static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float
if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -50);
else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 0);
- glColor3ubv((GLubyte *)col);
+ glColor3ubv(col);
glVertex2f(x1,y1);
glVertex2f(x2,y1);
@@ -592,7 +592,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
{
View2D *v2d= &ar->v2d;
float x1, x2, y1, y2;
- char col[3], background_col[3], is_single_image;
+ unsigned char col[3], background_col[3], is_single_image;
/* we need to know if this is a single image/color or not for drawing */
is_single_image = (char)seq_single_check(seq);
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 93581056c98..4307945129b 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -1173,7 +1173,7 @@ static void draw_textscroll(SpaceText *st, rcti *scroll)
{
bTheme *btheme= U.themes.first;
uiWidgetColors wcol= btheme->tui.wcol_scroll;
- char col[3];
+ unsigned char col[4];
float rad;
uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT)?UI_SCROLL_PRESSED:0);
@@ -1181,7 +1181,8 @@ static void draw_textscroll(SpaceText *st, rcti *scroll)
uiSetRoundBox(15);
rad= 0.4f*MIN2(st->txtscroll.xmax - st->txtscroll.xmin, st->txtscroll.ymax - st->txtscroll.ymin);
UI_GetThemeColor3ubv(TH_HILITE, col);
- glColor4ub(col[0], col[1], col[2], 48);
+ col[3]= 48;
+ glColor4ubv(col);
glEnable(GL_BLEND);
uiRoundBox(st->txtscroll.xmin+1, st->txtscroll.ymin, st->txtscroll.xmax-1, st->txtscroll.ymax, rad);
glDisable(GL_BLEND);
@@ -1228,7 +1229,7 @@ static void draw_markers(SpaceText *st, ARegion *ar)
/* invisible part of line (before top, after last visible line) */
if(y2 < 0 || y1 > st->top+st->viewlines) continue;
- glColor3ub(marker->color[0], marker->color[1], marker->color[2]);
+ glColor3ubv(marker->color);
x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
y= ar->winy-3;
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index bcfcfd09fed..062cbc72e43 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -2688,7 +2688,7 @@ static int find_and_replace(bContext *C, wmOperator *op, short mode)
text_drawcache_tag_update(CTX_wm_space_text(C), 1);
}
else if(mode==TEXT_MARK_ALL) {
- char color[4];
+ unsigned char color[4];
UI_GetThemeColor4ubv(TH_SHADE2, color);
if(txt_find_marker(text, text->curl, text->selc, TMARK_GRP_FINDALL, 0)) {
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c
index 7035006ea70..7c07f99b8ea 100644
--- a/source/blender/editors/space_view3d/drawanimviz.c
+++ b/source/blender/editors/space_view3d/drawanimviz.c
@@ -206,6 +206,10 @@ void draw_motion_path_instance(Scene *scene,
/* Draw frame numbers at each framestep value */
if (avs->path_viewflag & MOTIONPATH_VIEW_FNUMS) {
+ unsigned char col[4];
+ UI_GetThemeColor3ubv(TH_TEXT_HI, col);
+ col[3]= 255;
+
for (i=0, mpv=mpv_start; i < len; i+=stepsize, mpv+=stepsize) {
char str[32];
float co[3];
@@ -214,7 +218,7 @@ void draw_motion_path_instance(Scene *scene,
if (i == 0) {
sprintf(str, "%d", (i+sfra));
mul_v3_m4v3(co, ob->imat, mpv->co);
- view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII);
+ view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, col);
}
else if ((i > stepsize) && (i < len-stepsize)) {
bMotionPathVert *mpvP = (mpv - stepsize);
@@ -223,7 +227,7 @@ void draw_motion_path_instance(Scene *scene,
if ((equals_v3v3(mpv->co, mpvP->co)==0) || (equals_v3v3(mpv->co, mpvN->co)==0)) {
sprintf(str, "%d", (sfra+i));
mul_v3_m4v3(co, ob->imat, mpv->co);
- view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII);
+ view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, col);
}
}
}
@@ -231,6 +235,8 @@ void draw_motion_path_instance(Scene *scene,
/* Keyframes - dots and numbers */
if (avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) {
+ unsigned char col[4];
+
AnimData *adt= BKE_animdata_from_id(&ob->id);
DLRBT_Tree keys;
@@ -256,8 +262,11 @@ void draw_motion_path_instance(Scene *scene,
}
/* Draw slightly-larger yellow dots at each keyframe */
- UI_ThemeColor(TH_VERTEX_SELECT);
+ UI_GetThemeColor3ubv(TH_VERTEX_SELECT, col);
+ col[3]= 255;
+
glPointSize(4.0f); // XXX perhaps a bit too big
+ glColor3ubv(col);
glBegin(GL_POINTS);
for (i=0, mpv=mpv_start; i < len; i++, mpv++) {
@@ -281,7 +290,7 @@ void draw_motion_path_instance(Scene *scene,
sprintf(str, "%d", (sfra+i));
mul_v3_m4v3(co, ob->imat, mpv->co);
- view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII);
+ view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, col);
}
}
}
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 89da66e269a..27cb305f78f 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -1886,6 +1886,12 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
/* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
if ((G.f & G_PICKSEL) == 0) {
float vec[3];
+
+ unsigned char col[4];
+ float col_f[3];
+ glGetFloatv(GL_CURRENT_COLOR, col_f); /* incase this is not set below */
+ rgb_float_to_byte(col_f, col);
+ col[3]= 255;
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
@@ -1894,17 +1900,16 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
if (pchan->bone->layer & arm->layer) {
if (arm->flag & (ARM_EDITMODE|ARM_POSEMODE)) {
bone= pchan->bone;
-
- if (bone->flag & BONE_SELECTED) UI_ThemeColor(TH_TEXT_HI);
- else UI_ThemeColor(TH_TEXT);
+ UI_GetThemeColor3ubv((bone->flag & BONE_SELECTED) ? TH_TEXT_HI : TH_TEXT, col);
}
- else if (dt > OB_WIRE)
- UI_ThemeColor(TH_TEXT);
-
+ else if (dt > OB_WIRE) {
+ UI_GetThemeColor3ubv(TH_TEXT, col);
+ }
+
/* Draw names of bone */
if (arm->flag & ARM_DRAWNAMES) {
mid_v3_v3v3(vec, pchan->pose_head, pchan->pose_tail);
- view3d_cached_text_draw_add(vec, pchan->name, 10, 0);
+ view3d_cached_text_draw_add(vec, pchan->name, 10, 0, col);
}
/* Draw additional axes on the bone tail */
@@ -1913,7 +1918,8 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
copy_m4_m4(bmat, pchan->pose_mat);
bone_matrix_translate_y(bmat, pchan->bone->length);
glMultMatrixf(bmat);
-
+
+ glColor3ubv(col);
drawaxes(pchan->bone->length*0.25f, OB_ARROWS);
glPopMatrix();
@@ -2088,21 +2094,22 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
// patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing
if ((G.f & G_PICKSEL) == 0) {
float vec[3];
+ unsigned char col[4];
+ col[3]= 255;
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
for (eBone=arm->edbo->first; eBone; eBone=eBone->next) {
if(eBone->layer & arm->layer) {
if ((eBone->flag & BONE_HIDDEN_A)==0) {
-
- if (eBone->flag & BONE_SELECTED) UI_ThemeColor(TH_TEXT_HI);
- else UI_ThemeColor(TH_TEXT);
-
+
+ UI_GetThemeColor3ubv((eBone->flag & BONE_SELECTED) ? TH_TEXT_HI : TH_TEXT, col);
+
/* Draw name */
if (arm->flag & ARM_DRAWNAMES) {
mid_v3_v3v3(vec, eBone->head, eBone->tail);
glRasterPos3fv(vec);
- view3d_cached_text_draw_add(vec, eBone->name, 10, 0);
+ view3d_cached_text_draw_add(vec, eBone->name, 10, 0, col);
}
/* Draw additional axes */
if (arm->flag & ARM_DRAWAXES) {
@@ -2110,7 +2117,8 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
get_matrix_editbone(eBone, bmat);
bone_matrix_translate_y(bmat, eBone->length);
glMultMatrixf(bmat);
-
+
+ glColor3ubv(col);
drawaxes(eBone->length*0.25f, OB_ARROWS);
glPopMatrix();
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 055a12348c9..556095d2f1c 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -561,7 +561,11 @@ static int CachedTextLevel= 0;
typedef struct ViewCachedString {
struct ViewCachedString *next, *prev;
- float vec[3], col[4];
+ float vec[3];
+ union {
+ unsigned char ub[4];
+ int pack;
+ } col;
short mval[2];
short xoffs;
short flag;
@@ -575,7 +579,7 @@ void view3d_cached_text_draw_begin()
CachedTextLevel++;
}
-void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag)
+void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag, const unsigned char col[4])
{
int alloc_len= strlen(str) + 1;
ListBase *strings= &CachedText[CachedTextLevel-1];
@@ -583,7 +587,7 @@ void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs
BLI_addtail(strings, vos);
copy_v3_v3(vos->vec, co);
- glGetFloatv(GL_CURRENT_COLOR, vos->col);
+ vos->col.pack= *((int *)col);
vos->xoffs= xoffs;
vos->flag= flag;
@@ -608,6 +612,8 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
}
if(tot) {
+ int col_pack_prev= 0;
+
#if 0
bglMats mats; /* ZBuffer depth vars */
double ux, uy, uz;
@@ -643,7 +649,11 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
#endif
if(vos->mval[0]!=IS_CLIPPED) {
const char *str= (char *)(vos+1);
- glColor3fv(vos->col);
+
+ if(col_pack_prev != vos->col.pack) {
+ glColor3ubv(vos->col.ub);
+ col_pack_prev= vos->col.pack;
+ }
if(vos->flag & V3D_CACHE_TEXT_ASCII) {
BLF_draw_default_ascii((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, 65535); /* XXX, use real length */
}
@@ -908,7 +918,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
float vec[3], lvec[3], vvec[3], circrad, x,y,z;
float lampsize;
float imat[4][4], curcol[4];
- char col[4];
+ unsigned char col[4];
int drawcone= (dt>OB_WIRE && !(G.f & G_PICKSEL) && la->type == LA_SPOT && (la->mode & LA_SHOW_CONE));
/* cone can't be drawn for duplicated lamps, because duplilist would be freed to */
@@ -1166,7 +1176,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
}
UI_GetThemeColor4ubv(TH_LAMP, col);
- glColor4ub(col[0], col[1], col[2], col[3]);
+ glColor4ubv(col);
glEnable(GL_BLEND);
@@ -1987,7 +1997,7 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, Deriv
if(v3d->zbuf) glDepthMask(0); // disable write in zbuffer, zbuf select
for (sel=0; sel<2; sel++) {
- char col[4], fcol[4];
+ unsigned char col[4], fcol[4];
int pass;
UI_GetThemeColor3ubv(sel?TH_VERTEX_SELECT:TH_VERTEX, col);
@@ -2015,13 +2025,13 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, Deriv
if(ts->selectmode & SCE_SELECT_VERTEX) {
glPointSize(size);
- glColor4ubv((GLubyte *)col);
+ glColor4ubv(col);
draw_dm_verts(cageDM, sel, eve_act);
}
if(check_ob_drawface_dot(scene, v3d, obedit->dt)) {
glPointSize(fsize);
- glColor4ubv((GLubyte *)fcol);
+ glColor4ubv(fcol);
draw_dm_face_centers(cageDM, sel);
}
@@ -2043,9 +2053,9 @@ static void draw_em_fancy_edges(Scene *scene, View3D *v3d, Mesh *me, DerivedMesh
unsigned char wireCol[4], selCol[4], actCol[4];
/* since this function does transparant... */
- UI_GetThemeColor4ubv(TH_EDGE_SELECT, (char *)selCol);
- UI_GetThemeColor4ubv(TH_WIRE, (char *)wireCol);
- UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, (char *)actCol);
+ UI_GetThemeColor4ubv(TH_EDGE_SELECT, selCol);
+ UI_GetThemeColor4ubv(TH_WIRE, wireCol);
+ UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, actCol);
/* when sel only is used, dont render wire, only selected, this is used for
* textured draw mode when the 'edges' option is disabled */
@@ -2102,42 +2112,30 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
float v1[3], v2[3], v3[3], v4[3], vmid[3];
float fvec[3];
char val[32]; /* Stores the measurement display text here */
- char conv_float[5]; /* Use a float conversion matching the grid size */
- float area, col[3]; /* area of the face, color of the text to draw */
+ const char *conv_float; /* Use a float conversion matching the grid size */
+ unsigned char col[3]; /* color of the text to draw */
+ float area; /* area of the face */
float grid= unit->system ? unit->scale_length : v3d->grid;
const int do_split= unit->flag & USER_UNIT_OPT_SPLIT;
const int do_global= v3d->flag & V3D_GLOBAL_STATS;
const int do_moving= G.moving;
- if(v3d->flag2 & V3D_RENDER_OVERRIDE)
- return;
-
/* make the precision of the pronted value proportionate to the gridsize */
- if (grid < 0.01f)
- strcpy(conv_float, "%.6f");
- else if (grid < 0.1f)
- strcpy(conv_float, "%.5f");
- else if (grid < 1.0f)
- strcpy(conv_float, "%.4f");
- else if (grid < 10.0f)
- strcpy(conv_float, "%.3f");
- else
- strcpy(conv_float, "%.2f");
-
-
+ if (grid < 0.01f) conv_float= "%.6g";
+ else if (grid < 0.1f) conv_float= "%.5g";
+ else if (grid < 1.0f) conv_float= "%.4g";
+ else if (grid < 10.0f) conv_float= "%.3g";
+ else conv_float= "%.2g";
+
if(v3d->zbuf && (v3d->flag & V3D_ZBUF_SELECT)==0)
glDisable(GL_DEPTH_TEST);
if(v3d->zbuf) bglPolygonOffset(rv3d->dist, 5.0f);
- if(me->drawflag & ME_DRAW_EDGELEN) {
- UI_GetThemeColor3fv(TH_TEXT, col);
- /* make color a bit more red */
- if(col[0]> 0.5f) {col[1]*=0.7f; col[2]*= 0.7f;}
- else col[0]= col[0]*0.7f + 0.3f;
- glColor3fv(col);
-
+ if(me->drawflag & ME_DRAWEXTRA_EDGELEN) {
+ UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGELEN, col);
+
for(eed= em->edges.first; eed; eed= eed->next) {
/* draw non fgon edges, or selected edges, or edges next to selected verts while draging */
if((eed->h != EM_FGON) && ((eed->f & SELECT) || (do_moving && ((eed->v1->f & SELECT) || (eed->v2->f & SELECT)) ))) {
@@ -2155,19 +2153,14 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
else
sprintf(val, conv_float, len_v3v3(v1, v2));
- view3d_cached_text_draw_add(vmid, val, 0, V3D_CACHE_TEXT_ASCII);
+ view3d_cached_text_draw_add(vmid, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
}
}
- if(me->drawflag & ME_DRAW_FACEAREA) {
+ if(me->drawflag & ME_DRAWEXTRA_FACEAREA) {
// XXX extern int faceselectedOR(EditFace *efa, int flag); // editmesh.h shouldn't be in this file... ok for now?
-
- UI_GetThemeColor3fv(TH_TEXT, col);
- /* make color a bit more green */
- if(col[1]> 0.5f) {col[0]*=0.7f; col[2]*= 0.7f;}
- else col[1]= col[1]*0.7f + 0.3f;
- glColor3fv(col);
+ UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
for(efa= em->faces.first; efa; efa= efa->next) {
if((efa->f & SELECT)) { // XXX || (do_moving && faceselectedOR(efa, SELECT)) ) {
@@ -2194,20 +2187,14 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
else
sprintf(val, conv_float, area);
- view3d_cached_text_draw_add(efa->cent, val, 0, V3D_CACHE_TEXT_ASCII);
+ view3d_cached_text_draw_add(efa->cent, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
}
}
- if(me->drawflag & ME_DRAW_EDGEANG) {
+ if(me->drawflag & ME_DRAWEXTRA_FACEANG) {
EditEdge *e1, *e2, *e3, *e4;
-
- UI_GetThemeColor3fv(TH_TEXT, col);
- /* make color a bit more blue */
- if(col[2]> 0.5f) {col[0]*=0.7f; col[1]*= 0.7f;}
- else col[2]= col[2]*0.7f + 0.3f;
- glColor3fv(col);
-
+ UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
for(efa= em->faces.first; efa; efa= efa->next) {
copy_v3_v3(v1, efa->v1->co);
copy_v3_v3(v2, efa->v2->co);
@@ -2234,31 +2221,31 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
if( (e4->f & e1->f & SELECT) || (do_moving && (efa->v1->f & SELECT)) ) {
/* Vec 1 */
- sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v4, v1, v2)));
+ sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v4, v1, v2)));
interp_v3_v3v3(fvec, efa->cent, efa->v1->co, 0.8f);
- view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII);
+ view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
if( (e1->f & e2->f & SELECT) || (do_moving && (efa->v2->f & SELECT)) ) {
/* Vec 2 */
- sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v1, v2, v3)));
+ sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v1, v2, v3)));
interp_v3_v3v3(fvec, efa->cent, efa->v2->co, 0.8f);
- view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII);
+ view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
if( (e2->f & e3->f & SELECT) || (do_moving && (efa->v3->f & SELECT)) ) {
/* Vec 3 */
if(efa->v4)
- sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v2, v3, v4)));
+ sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v2, v3, v4)));
else
- sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v2, v3, v1)));
+ sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v2, v3, v1)));
interp_v3_v3v3(fvec, efa->cent, efa->v3->co, 0.8f);
- view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII);
+ view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
/* Vec 4 */
if(efa->v4) {
if( (e3->f & e4->f & SELECT) || (do_moving && (efa->v4->f & SELECT)) ) {
- sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v3, v4, v1)));
+ sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v3, v4, v1)));
interp_v3_v3v3(fvec, efa->cent, efa->v4->co, 0.8f);
- view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII);
+ view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
}
}
@@ -2355,9 +2342,9 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
if(me->drawflag & ME_DRAWFACES) { /* transp faces */
unsigned char col1[4], col2[4], col3[4];
- UI_GetThemeColor4ubv(TH_FACE, (char *)col1);
- UI_GetThemeColor4ubv(TH_FACE_SELECT, (char *)col2);
- UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, (char *)col3);
+ UI_GetThemeColor4ubv(TH_FACE, col1);
+ UI_GetThemeColor4ubv(TH_FACE_SELECT, col2);
+ UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, col3);
glEnable(GL_BLEND);
glDepthMask(0); // disable write in zbuffer, needed for nice transp
@@ -2376,7 +2363,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
* */
unsigned char col1[4], col2[4], col3[4];
col1[3] = col2[3] = 0; /* dont draw */
- UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, (char *)col3);
+ UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, col3);
glEnable(GL_BLEND);
glDepthMask(0); // disable write in zbuffer, needed for nice transp
@@ -2439,7 +2426,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
draw_dm_vert_normals(scene, cageDM);
}
- if(me->drawflag & (ME_DRAW_EDGELEN|ME_DRAW_FACEAREA|ME_DRAW_EDGEANG))
+ if(me->drawflag & (ME_DRAWEXTRA_EDGELEN|ME_DRAWEXTRA_FACEAREA|ME_DRAWEXTRA_FACEANG) && !((v3d->flag2 & V3D_RENDER_OVERRIDE)))
draw_em_measure_stats(v3d, rv3d, ob, em, &scene->unit);
}
@@ -3474,6 +3461,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
int select=ob->flag&SELECT, create_cdata=0, need_v=0;
GLint polygonmode[2];
char val[32];
+ unsigned char tcol[4]= {0, 0, 0, 255};
/* 1. */
if(psys==0)
@@ -3531,14 +3519,14 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
if(v3d->zbuf) glDepthMask(1);
if((ma) && (part->draw&PART_DRAW_MAT_COL)) {
- glColor3f(ma->r,ma->g,ma->b);
+ rgb_float_to_byte(&(ma->r), tcol);
ma_r = ma->r;
ma_g = ma->g;
ma_b = ma->b;
}
- else
- cpack(0);
+
+ glColor3ubv(tcol);
timestep= psys_get_timestep(&sim);
@@ -3889,7 +3877,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
/* in path drawing state.co is the end point */
/* use worldspace beause object matrix is already applied */
mul_v3_m4v3(vec_txt, ob->imat, state.co);
- view3d_cached_text_draw_add(vec_txt, val, 10, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII);
+ view3d_cached_text_draw_add(vec_txt, val, 10, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, tcol);
}
}
}
@@ -3981,7 +3969,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
sprintf(val, "%i", a);
/* use worldspace beause object matrix is already applied */
mul_v3_m4v3(vec_txt, ob->imat, cache[a]->co);
- view3d_cached_text_draw_add(vec_txt, val, 10, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII);
+ view3d_cached_text_draw_add(vec_txt, val, 10, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, tcol);
}
}
}
@@ -5561,6 +5549,13 @@ void drawRBpivot(bRigidBodyJointConstraint *data)
int axis;
float mat[4][4];
+ /* color */
+ float curcol[4];
+ unsigned char tcol[4];
+ glGetFloatv(GL_CURRENT_COLOR, curcol);
+ rgb_float_to_byte(curcol, tcol);
+ tcol[3]= 255;
+
eul_to_mat4(mat,&data->axX);
glLineWidth (4.0f);
setlinestyle(2);
@@ -5578,11 +5573,11 @@ void drawRBpivot(bRigidBodyJointConstraint *data)
glVertex3fv(v);
glEnd();
if (axis==0)
- view3d_cached_text_draw_add(v, "px", 0, V3D_CACHE_TEXT_ASCII);
+ view3d_cached_text_draw_add(v, "px", 0, V3D_CACHE_TEXT_ASCII, tcol);
else if (axis==1)
- view3d_cached_text_draw_add(v, "py", 0, V3D_CACHE_TEXT_ASCII);
+ view3d_cached_text_draw_add(v, "py", 0, V3D_CACHE_TEXT_ASCII, tcol);
else
- view3d_cached_text_draw_add(v, "pz", 0, V3D_CACHE_TEXT_ASCII);
+ view3d_cached_text_draw_add(v, "pz", 0, V3D_CACHE_TEXT_ASCII, tcol);
}
glLineWidth (1.0f);
setlinestyle(0);
@@ -6212,7 +6207,12 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
/* but, we also dont draw names for sets or duplicators */
if(flag == 0) {
float zero[3]= {0,0,0};
- view3d_cached_text_draw_add(zero, ob->id.name+2, 10, 0);
+ float curcol[4];
+ unsigned char tcol[4];
+ glGetFloatv(GL_CURRENT_COLOR, curcol);
+ rgb_float_to_byte(curcol, tcol);
+ tcol[3]= 255;
+ view3d_cached_text_draw_add(zero, ob->id.name+2, 10, 0, tcol);
}
}
/*if(dtx & OB_DRAWIMAGE) drawDispListwire(&ob->disp);*/
@@ -6297,11 +6297,11 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if (list) {
bConstraint *curcon;
bConstraintOb *cob;
- char col1[4], col2[4];
+ unsigned char col1[4], col2[4];
UI_GetThemeColor3ubv(TH_GRID, col1);
- UI_make_axis_color(col1, col2, 'z');
- glColor3ubv((GLubyte *)col2);
+ UI_make_axis_color(col1, col2, 'Z');
+ glColor3ubv(col2);
cob= constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 6bf87e1964b..35ea3f10d48 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -249,7 +249,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
RegionView3D *rv3d= ar->regiondata;
float wx, wy, x, y, fw, fx, fy, dx;
float vec4[4];
- char col[3], col2[3];
+ unsigned char col[3], col2[3];
vec4[0]=vec4[1]=vec4[2]=0.0;
vec4[3]= 1.0;
@@ -398,16 +398,16 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
/* center cross */
if( ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
- UI_make_axis_color(col, col2, 'y');
- else UI_make_axis_color(col, col2, 'x');
- glColor3ubv((GLubyte *)col2);
+ UI_make_axis_color(col, col2, 'Y');
+ else UI_make_axis_color(col, col2, 'Z');
+ glColor3ubv(col2);
fdrawline(0.0, y, (float)ar->winx, y);
if( ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
- UI_make_axis_color(col, col2, 'y');
- else UI_make_axis_color(col, col2, 'z');
- glColor3ubv((GLubyte *)col2);
+ UI_make_axis_color(col, col2, 'Y');
+ else UI_make_axis_color(col, col2, 'Z');
+ glColor3ubv(col2);
fdrawline(x, 0.0, x, (float)ar->winy);
@@ -419,7 +419,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
{
float vert[3], grid, grid_scale;
int a, gridlines, emphasise;
- char col[3], col2[3];
+ unsigned char col[3], col2[3];
short draw_line = 0;
vert[2]= 0.0;
@@ -462,8 +462,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
if(a==0) {
/* check for the 'show Y axis' preference */
if (v3d->gridflag & V3D_SHOW_Y) {
- UI_make_axis_color(col, col2, 'y');
- glColor3ubv((GLubyte *)col2);
+ UI_make_axis_color(col, col2, 'Y');
+ glColor3ubv(col2);
draw_line = 1;
} else if (v3d->gridflag & V3D_SHOW_FLOOR) {
@@ -501,8 +501,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
if(a==0) {
/* check for the 'show X axis' preference */
if (v3d->gridflag & V3D_SHOW_X) {
- UI_make_axis_color(col, col2, 'x');
- glColor3ubv((GLubyte *)col2);
+ UI_make_axis_color(col, col2, 'X');
+ glColor3ubv(col2);
draw_line = 1;
} else if (v3d->gridflag & V3D_SHOW_FLOOR) {
@@ -538,8 +538,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
/* draw the Z axis line */
/* check for the 'show Z axis' preference */
if (v3d->gridflag & V3D_SHOW_Z) {
- UI_make_axis_color(col, col2, 'z');
- glColor3ubv((GLubyte *)col2);
+ UI_make_axis_color(col, col2, 'Z');
+ glColor3ubv(col2);
glBegin(GL_LINE_STRIP);
vert[0]= 0;
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 83ef57cfd0f..06d457778b2 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -114,7 +114,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, struc
void drawaxes(float size, char drawtype);
void view3d_cached_text_draw_begin(void);
-void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag);
+void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag, const unsigned char col[4]);
void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, float mat[][4]);
#define V3D_CACHE_TEXT_ZBUF (1<<0)
#define V3D_CACHE_TEXT_WORLDSPACE (1<<1)
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 4b6079001ff..a775315f0af 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1333,20 +1333,20 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
}
case HLP_TRACKBALL:
{
- char col[3], col2[3];
+ unsigned char col[3], col2[3];
UI_GetThemeColor3ubv(TH_GRID, col);
glTranslatef(mval[0], mval[1], 0);
glLineWidth(3.0);
- UI_make_axis_color(col, col2, 'x');
+ UI_make_axis_color(col, col2, 'X');
glColor3ubv((GLubyte *)col2);
drawArrow(RIGHT, 5, 10, 5);
drawArrow(LEFT, 5, 10, 5);
- UI_make_axis_color(col, col2, 'y');
+ UI_make_axis_color(col, col2, 'Y');
glColor3ubv((GLubyte *)col2);
drawArrow(UP, 5, 10, 5);
@@ -4525,7 +4525,7 @@ static int createSlideVerts(TransInfo *t)
return 0;
}
- if(me->drawflag & ME_DRAW_EDGELEN) {
+ if(me->drawflag & ME_DRAWEXTRA_EDGELEN) {
if(!(tempsv->up->f & SELECT)) {
tempsv->up->f |= SELECT;
tempsv->up->f2 |= 16;
@@ -4739,7 +4739,7 @@ void freeSlideVerts(TransInfo *t)
Mesh *me = t->obedit->data;
int uvlay_idx;
- if(me->drawflag & ME_DRAW_EDGELEN) {
+ if(me->drawflag & ME_DRAWEXTRA_EDGELEN) {
TransDataSlideVert *tempsv;
LinkNode *look = sld->vertlist;
GHash *vertgh = sld->vhash;
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 7dbc0b9c633..83b85ce257c 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -836,7 +836,7 @@ void recalcData(TransInfo *t)
void drawLine(TransInfo *t, float *center, float *dir, char axis, short options)
{
float v1[3], v2[3], v3[3];
- char col[3], col2[3];
+ unsigned char col[3], col2[3];
if (t->spacetype == SPACE_VIEW3D)
{
@@ -860,7 +860,7 @@ void drawLine(TransInfo *t, float *center, float *dir, char axis, short options)
UI_GetThemeColor3ubv(TH_GRID, col);
}
UI_make_axis_color(col, col2, axis);
- glColor3ubv((GLubyte *)col2);
+ glColor3ubv(col2);
setlinestyle(0);
glBegin(GL_LINE_STRIP);
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index ce8a484eb88..238f53cbb87 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -695,16 +695,16 @@ static char axisBlendAngle(float angle)
moving: in transform theme color
else the red/green/blue
*/
-static void manipulator_setcolor(View3D *v3d, char axis, int colcode, char alpha)
+static void manipulator_setcolor(View3D *v3d, char axis, int colcode, unsigned char alpha)
{
- char col[4];
+ unsigned char col[4]= {0};
+ col[3]= alpha;
if(colcode==MAN_GHOST) {
- glColor4ub(0, 0, 0, 70);
+ col[3]= 70;
}
else if(colcode==MAN_MOVECOL) {
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
- glColor4ub(col[0], col[1], col[2], alpha);
}
else {
switch(axis) {
@@ -720,19 +720,22 @@ static void manipulator_setcolor(View3D *v3d, char axis, int colcode, char alpha
col[1]= col[1]<55?0:col[1]-55;
col[2]= col[2]<55?0:col[2]-55;
}
- glColor4ub(col[0], col[1], col[2], alpha);
break;
case 'x':
- glColor4ub(220, 0, 0, alpha);
+ col[0]= 220;
break;
case 'y':
- glColor4ub(0, 220, 0, alpha);
+ col[1]= 220;
break;
case 'z':
- glColor4ub(30, 30, 220, alpha);
+ col[0]= 30;
+ col[1]= 30;
+ col[2]= 220;
break;
}
}
+
+ glColor4ubv(col);
}
/* viewmatrix should have been set OK, also no shademode! */
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 3cc50109778..0828ceeaa52 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -133,9 +133,10 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
if (validSnap(t) && activeSnap(t))
{
- char col[4] = {1, 0, 1};
+ unsigned char col[4];
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
- glColor4ub(col[0], col[1], col[2], 128);
+ col[3]= 128;
+ glColor4ubv(col);
if (t->spacetype == SPACE_VIEW3D) {
TransSnapPoint *p;
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index 64ce31f2ac2..209b1d7e066 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -423,7 +423,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
EditFace *efa, *efa_act;
MTFace *tf, *activetf = NULL;
DerivedMesh *finaldm, *cagedm;
- char col1[4], col2[4];
+ unsigned char col1[4], col2[4];
float pointsize;
int drawfaces, interpedges, lastsel, sel;
Image *ima= sima->image;
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index 4e41309cff4..853c123e5d7 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -153,9 +153,9 @@ typedef struct TFace {
#define ME_DRAWSHARP (1 << 8)
#define ME_DRAWBWEIGHTS (1 << 9)
-#define ME_DRAW_EDGELEN (1 << 10)
-#define ME_DRAW_FACEAREA (1 << 11)
-#define ME_DRAW_EDGEANG (1 << 12)
+#define ME_DRAWEXTRA_EDGELEN (1 << 10)
+#define ME_DRAWEXTRA_FACEAREA (1 << 11)
+#define ME_DRAWEXTRA_FACEANG (1 << 12)
/* old global flags:
#define G_DRAWEDGES (1 << 18)
diff --git a/source/blender/makesdna/DNA_text_types.h b/source/blender/makesdna/DNA_text_types.h
index d89d15fa302..82de3fc1833 100644
--- a/source/blender/makesdna/DNA_text_types.h
+++ b/source/blender/makesdna/DNA_text_types.h
@@ -48,7 +48,7 @@ typedef struct TextMarker {
int lineno, start, end, pad1; /* line number and start/end character indices */
int group, flags; /* see BKE_text.h for flag defines */
- char color[4], pad[4]; /* draw color of the marker */
+ unsigned char color[4], pad[4]; /* draw color of the marker */
} TextMarker;
typedef struct Text {
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 5290a353580..f9ba1c2a471 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -88,6 +88,7 @@ typedef struct uiFontStyle {
/* this is fed to the layout engine and widget code */
+
typedef struct uiStyle {
struct uiStyle *next, *prev;
@@ -158,13 +159,13 @@ typedef struct ThemeSpace {
/* main window colors */
char back[4];
char title[4];
- char text[4];
+ char text[4];
char text_hi[4];
/* header colors */
char header[4];
char header_title[4];
- char header_text[4];
+ char header_text[4];
char header_text_hi[4];
/* button/tool regions */
@@ -176,7 +177,7 @@ typedef struct ThemeSpace {
/* listview regions */
char list[4];
char list_title[4];
- char list_text[4];
+ char list_text[4];
char list_text_hi[4];
/* float panel */
@@ -199,6 +200,7 @@ typedef struct ThemeSpace {
char edge_seam[4], edge_sharp[4], edge_facesel[4], edge_crease[4];
char face[4], face_select[4]; // solid faces
char face_dot[4]; // selected color
+ char extra_edge_len[4], extra_face_angle[4], extra_face_area[4], pad3[4];
char normal[4];
char vertex_normal[4];
char bone_solid[4], bone_pose[4];
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index d9f6e0886bd..c9a11753154 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -1978,17 +1978,17 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop= RNA_def_property(srna, "show_extra_edge_length", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_EDGELEN);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_EDGELEN);
RNA_def_property_ui_text(prop, "Edge Length", "Displays selected edge lengths, Using global values when set in the transform panel");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop= RNA_def_property(srna, "show_extra_edge_angle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_EDGEANG);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEANG);
RNA_def_property_ui_text(prop, "Edge Angles", "Displays the angles in the selected edges in degrees, Using global values when set in the transform panel");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop= RNA_def_property(srna, "show_extra_face_area", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_FACEAREA);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEAREA);
RNA_def_property_ui_text(prop, "Face Area", "Displays the area of selected faces, Using global values when set in the transform panel");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 7900c2a5994..536d30d0958 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -921,6 +921,21 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
rna_def_userdef_theme_spaces_face(srna);
rna_def_userdef_theme_spaces_curves(srna, 1);
+ prop= RNA_def_property(srna, "extra_edge_len", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Edge Length Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "extra_face_angle", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Face Angle Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "extra_face_area", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Face Area Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
prop= RNA_def_property(srna, "editmesh_active", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Active Vert/Edge/Face", "");