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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-02-12 17:34:08 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-02-12 17:34:08 +0300
commit6ff18830940fbf863f8561759e0ccc14dc794f85 (patch)
tree1615061a53b08ef9534d26f527434c61d1cc3070 /source/blender/editors/interface/interface.c
parent081c1205a31cb12ef632565b8d0c3fce024aa339 (diff)
fix use of uninitialized vars with the color wheel.
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r--source/blender/editors/interface/interface.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 7b4aff31bea..d6357f392b5 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1189,6 +1189,12 @@ void ui_get_but_vectorf(uiBut *but, float *vec)
float *fp= (float *)but->poin;
VECCOPY(vec, fp);
}
+ else {
+ if (but->editvec==NULL) {
+ fprintf(stderr, "ui_get_but_vectorf: can't get color, should never happen\n");
+ vec[0]= vec[1]= vec[2]= 0.0f;
+ }
+ }
}
/* for buttons pointing to color for example */
@@ -2096,6 +2102,15 @@ void ui_check_but(uiBut *but)
strncpy(but->drawstr+2, but->str, UI_MAX_DRAW_STR-2);
}
break;
+
+ case HSVCUBE:
+ case HSVCIRCLE:
+ {
+ float rgb[3];
+ ui_get_but_vectorf(but, rgb);
+ rgb_to_hsv(rgb[0], rgb[1], rgb[2], but->hsv, but->hsv+1, but->hsv+2);
+ }
+ break;
default:
strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
@@ -2361,13 +2376,6 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, char *str, short
}
}
}
-
- if(ELEM(but->type, HSVCUBE, HSVCIRCLE)) { /* hsv buttons temp storage */
- float rgb[3];
- ui_get_but_vectorf(but, rgb);
-
- rgb_to_hsv(rgb[0], rgb[1], rgb[2], but->hsv, but->hsv+1, but->hsv+2);
- }
if((block->flag & UI_BLOCK_LOOP) || ELEM7(but->type, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM, SEARCH_MENU))
but->flag |= (UI_TEXT_LEFT|UI_ICON_LEFT);