- 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().
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 */
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);
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];
/*********************************/
/* 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");
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
}
*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;
}
/* 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];
if ( (saction && !(saction->flag & SACTION_NODRAWGCOLORS)) &&
((grp) && (grp->customCol)) )
{
- char cp[3];
+ unsigned char cp[3];
if (indent == 2) {
VECCOPY(cp, grp->cs.solid);
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! */
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);
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 */
}
-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,
/* 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),
}
/* 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));
/* 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);
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];
/* ************ 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]);
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);
}
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);
/* 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);
/* 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) {
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:
}
}
- 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;}
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);
// 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);
}
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];
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];
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);
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);
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);
// 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]);
// 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]);
// 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;
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);
}
// 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];
}
// 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];
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];
}
// 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;
}
// 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;
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");
}
}
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) {
typedef struct View2DString {
struct View2DString *next, *prev;
- GLbyte col[4];
+ union {
+ unsigned char ub[4];
+ int pack;
+ } col;
short mval[2];
rcti rect;
} View2DString;
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);
}
}
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();
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);
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;
}
- if(me->drawflag & ME_DRAW_EDGELEN) {
+ if(me->drawflag & ME_DRAWEXTRA_EDGELEN) {
look = vertlist;
while(look) {
tempsv = BLI_ghash_lookup(vertgh,(EditVert*)look->link);
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 */
{
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;
}
}
}
/* cursor */
- UI_GetThemeColor3ubv(TH_CONSOLE_CURSOR, (char *)fg);
+ UI_GetThemeColor3ubv(TH_CONSOLE_CURSOR, fg);
glColor3ubv(fg);
glRecti( (xy[0] + pen[0]) - 1,
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))
/* 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) {
/* 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;
get_seq_color3ubv(scene, seq, col);
- glColor4ubv((GLubyte *)col);
+ glColor4ubv(col);
/* clamp within parent sequence strip bounds */
if(x1_chan < x1) x1_chan= x1;
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))
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;
}
/* 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];
}
/* 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;
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);
{
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);
{
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);
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);
/* 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;
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)) {
/* 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];
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);
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);
}
}
}
/* 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;
}
/* 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++) {
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);
}
}
}
/* 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);
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 */
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();
// 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) {
get_matrix_editbone(eBone, bmat);
bone_matrix_translate_y(bmat, eBone->length);
glMultMatrixf(bmat);
-
+
+ glColor3ubv(col);
drawaxes(eBone->length*0.25f, OB_ARROWS);
glPopMatrix();
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;
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];
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;
}
if(tot) {
+ int col_pack_prev= 0;
+
#if 0
bglMats mats; /* ZBuffer depth vars */
double ux, uy, uz;
#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 */
}
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 */
}
UI_GetThemeColor4ubv(TH_LAMP, col);
- glColor4ub(col[0], col[1], col[2], col[3]);
+ glColor4ubv(col);
glEnable(GL_BLEND);
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);
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);
}
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 */
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)) ))) {
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)) ) {
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);
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);
}
}
}
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
* */
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
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);
}
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)
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);
/* 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);
}
}
}
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);
}
}
}
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);
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);
/* 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);*/
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);
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;
/* 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);
{
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;
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) {
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) {
/* 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;
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)
}
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);
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;
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;
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)
{
UI_GetThemeColor3ubv(TH_GRID, col);
}
UI_make_axis_color(col, col2, axis);
- glColor3ubv((GLubyte *)col2);
+ glColor3ubv(col2);
setlinestyle(0);
glBegin(GL_LINE_STRIP);
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) {
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! */
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;
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;
#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)
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 {
/* this is fed to the layout engine and widget code */
+
typedef struct uiStyle {
struct uiStyle *next, *prev;
/* 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 */
/* listview regions */
char list[4];
char list_title[4];
- char list_text[4];
+ char list_text[4];
char list_text_hi[4];
/* float panel */
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];
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");
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", "");