fix UI jump in normal buttons for buttons which didnt start out normalized.
This commit is contained in:
@@ -1211,7 +1211,7 @@ void ui_delete_linkline(uiLinkLine *line, uiBut *but)
|
|||||||
* an edit override pointer while dragging for example */
|
* an edit override pointer while dragging for example */
|
||||||
|
|
||||||
/* for buttons pointing to color for example */
|
/* for buttons pointing to color for example */
|
||||||
void ui_get_but_vectorf(uiBut *but, float *vec)
|
void ui_get_but_vectorf(uiBut *but, float vec[3])
|
||||||
{
|
{
|
||||||
PropertyRNA *prop;
|
PropertyRNA *prop;
|
||||||
int a, tot;
|
int a, tot;
|
||||||
@@ -1249,16 +1249,20 @@ void ui_get_but_vectorf(uiBut *but, float *vec)
|
|||||||
vec[0]= vec[1]= vec[2]= 0.0f;
|
vec[0]= vec[1]= vec[2]= 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (but->type == BUT_NORMAL) {
|
||||||
|
normalize_v3(vec);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for buttons pointing to color for example */
|
/* for buttons pointing to color for example */
|
||||||
void ui_set_but_vectorf(uiBut *but, float *vec)
|
void ui_set_but_vectorf(uiBut *but, const float vec[3])
|
||||||
{
|
{
|
||||||
PropertyRNA *prop;
|
PropertyRNA *prop;
|
||||||
int a, tot;
|
int a, tot;
|
||||||
|
|
||||||
if(but->editvec) {
|
if(but->editvec) {
|
||||||
VECCOPY(but->editvec, vec);
|
copy_v3_v3(but->editvec, vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(but->rnaprop) {
|
if(but->rnaprop) {
|
||||||
@@ -1280,7 +1284,7 @@ void ui_set_but_vectorf(uiBut *but, float *vec)
|
|||||||
}
|
}
|
||||||
else if(but->pointype == FLO) {
|
else if(but->pointype == FLO) {
|
||||||
float *fp= (float *)but->poin;
|
float *fp= (float *)but->poin;
|
||||||
VECCOPY(fp, vec);
|
copy_v3_v3(fp, vec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1966,8 +1966,6 @@ static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, u
|
|||||||
|
|
||||||
static void ui_numedit_begin(uiBut *but, uiHandleButtonData *data)
|
static void ui_numedit_begin(uiBut *but, uiHandleButtonData *data)
|
||||||
{
|
{
|
||||||
float softrange, softmin, softmax;
|
|
||||||
|
|
||||||
if(but->type == BUT_CURVE) {
|
if(but->type == BUT_CURVE) {
|
||||||
but->editcumap= (CurveMapping*)but->poin;
|
but->editcumap= (CurveMapping*)but->poin;
|
||||||
}
|
}
|
||||||
@@ -1977,10 +1975,12 @@ static void ui_numedit_begin(uiBut *but, uiHandleButtonData *data)
|
|||||||
}
|
}
|
||||||
else if(ELEM3(but->type, BUT_NORMAL, HSVCUBE, HSVCIRCLE)) {
|
else if(ELEM3(but->type, BUT_NORMAL, HSVCUBE, HSVCIRCLE)) {
|
||||||
ui_get_but_vectorf(but, data->origvec);
|
ui_get_but_vectorf(but, data->origvec);
|
||||||
VECCOPY(data->vec, data->origvec);
|
copy_v3_v3(data->vec, data->origvec);
|
||||||
but->editvec= data->vec;
|
but->editvec= data->vec;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
float softrange, softmin, softmax;
|
||||||
|
|
||||||
data->startvalue= ui_get_but_val(but);
|
data->startvalue= ui_get_but_val(but);
|
||||||
data->origvalue= data->startvalue;
|
data->origvalue= data->startvalue;
|
||||||
data->value= data->origvalue;
|
data->value= data->origvalue;
|
||||||
@@ -3004,6 +3004,9 @@ static int ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, int mx, i
|
|||||||
/* button is presumed square */
|
/* button is presumed square */
|
||||||
/* if mouse moves outside of sphere, it does negative normal */
|
/* if mouse moves outside of sphere, it does negative normal */
|
||||||
|
|
||||||
|
/* note that both data->vec and data->origvec should be normalized
|
||||||
|
* else we'll get a hamrless but annoying jump when first clicking */
|
||||||
|
|
||||||
fp= data->origvec;
|
fp= data->origvec;
|
||||||
rad= (but->x2 - but->x1);
|
rad= (but->x2 - but->x1);
|
||||||
radsq= rad*rad;
|
radsq= rad*rad;
|
||||||
|
|||||||
@@ -350,8 +350,8 @@ extern void ui_window_to_region(const ARegion *ar, int *x, int *y);
|
|||||||
extern double ui_get_but_val(uiBut *but);
|
extern double ui_get_but_val(uiBut *but);
|
||||||
extern void ui_set_but_val(uiBut *but, double value);
|
extern void ui_set_but_val(uiBut *but, double value);
|
||||||
extern void ui_set_but_hsv(uiBut *but);
|
extern void ui_set_but_hsv(uiBut *but);
|
||||||
extern void ui_get_but_vectorf(uiBut *but, float *vec);
|
extern void ui_get_but_vectorf(uiBut *but, float vec[3]);
|
||||||
extern void ui_set_but_vectorf(uiBut *but, float *vec);
|
extern void ui_set_but_vectorf(uiBut *but, const float vec[3]);
|
||||||
|
|
||||||
extern void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float mx, float my);
|
extern void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float mx, float my);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user