add BLI_rcti,f_recenter()
fix for uninitialized variable use in radial_control_get_properties() and bad cast in bpy api's foreach_parse_args()
This commit is contained in:
@@ -54,6 +54,8 @@ void BLI_rctf_do_minmax_v(struct rctf *rect, const float xy[2]);
|
|||||||
|
|
||||||
void BLI_rctf_translate(struct rctf *rect, float x, float y);
|
void BLI_rctf_translate(struct rctf *rect, float x, float y);
|
||||||
void BLI_rcti_translate(struct rcti *rect, int x, int y);
|
void BLI_rcti_translate(struct rcti *rect, int x, int y);
|
||||||
|
void BLI_rcti_recenter(struct rcti *rect, int x, int y);
|
||||||
|
void BLI_rctf_recenter(struct rctf *rect, float x, float y);
|
||||||
void BLI_rcti_resize(struct rcti *rect, int x, int y);
|
void BLI_rcti_resize(struct rcti *rect, int x, int y);
|
||||||
void BLI_rctf_resize(struct rctf *rect, float x, float y);
|
void BLI_rctf_resize(struct rctf *rect, float x, float y);
|
||||||
void BLI_rcti_scale(rcti *rect, const float scale);
|
void BLI_rcti_scale(rcti *rect, const float scale);
|
||||||
|
@@ -296,6 +296,19 @@ void BLI_rctf_translate(rctf *rect, float x, float y)
|
|||||||
rect->ymax += y;
|
rect->ymax += y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BLI_rcti_recenter(rcti *rect, int x, int y)
|
||||||
|
{
|
||||||
|
const int dx = x - BLI_rcti_cent_x(rect);
|
||||||
|
const int dy = y - BLI_rcti_cent_y(rect);
|
||||||
|
BLI_rcti_translate(rect, dx, dy);
|
||||||
|
}
|
||||||
|
void BLI_rctf_recenter(rctf *rect, float x, float y)
|
||||||
|
{
|
||||||
|
const float dx = x - BLI_rctf_cent_x(rect);
|
||||||
|
const float dy = y - BLI_rctf_cent_y(rect);
|
||||||
|
BLI_rctf_translate(rect, dx, dy);
|
||||||
|
}
|
||||||
|
|
||||||
/* change width & height around the central location */
|
/* change width & height around the central location */
|
||||||
void BLI_rcti_resize(rcti *rect, int x, int y)
|
void BLI_rcti_resize(rcti *rect, int x, int y)
|
||||||
{
|
{
|
||||||
|
@@ -2086,12 +2086,7 @@ void UI_view2d_getcenter(struct View2D *v2d, float *x, float *y)
|
|||||||
}
|
}
|
||||||
void UI_view2d_setcenter(struct View2D *v2d, float x, float y)
|
void UI_view2d_setcenter(struct View2D *v2d, float x, float y)
|
||||||
{
|
{
|
||||||
/* get delta from current center */
|
BLI_rctf_recenter(&v2d->cur, x, y);
|
||||||
float dx = x - BLI_rctf_cent_x(&v2d->cur);
|
|
||||||
float dy = y - BLI_rctf_cent_y(&v2d->cur);
|
|
||||||
|
|
||||||
/* add to cur */
|
|
||||||
BLI_rctf_translate(&v2d->cur, dx, dy);
|
|
||||||
|
|
||||||
/* make sure that 'cur' rect is in a valid state as a result of these changes */
|
/* make sure that 'cur' rect is in a valid state as a result of these changes */
|
||||||
UI_view2d_curRect_validate(v2d);
|
UI_view2d_curRect_validate(v2d);
|
||||||
|
@@ -4339,7 +4339,7 @@ static int foreach_parse_args(BPy_PropertyRNA *self, PyObject *args,
|
|||||||
if (!PySequence_Check(*seq) && PyObject_CheckBuffer(*seq)) {
|
if (!PySequence_Check(*seq) && PyObject_CheckBuffer(*seq)) {
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
"foreach_get/set expected second argument to be a sequence or buffer, not a %.200s",
|
"foreach_get/set expected second argument to be a sequence or buffer, not a %.200s",
|
||||||
Py_TYPE(seq)->tp_name);
|
Py_TYPE(*seq)->tp_name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3542,7 +3542,7 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
|
|||||||
{
|
{
|
||||||
RadialControl *rc = op->customdata;
|
RadialControl *rc = op->customdata;
|
||||||
PointerRNA ctx_ptr, use_secondary_ptr;
|
PointerRNA ctx_ptr, use_secondary_ptr;
|
||||||
PropertyRNA *use_secondary_prop;
|
PropertyRNA *use_secondary_prop = NULL;
|
||||||
const char *data_path;
|
const char *data_path;
|
||||||
|
|
||||||
RNA_pointer_create(NULL, &RNA_Context, C, &ctx_ptr);
|
RNA_pointer_create(NULL, &RNA_Context, C, &ctx_ptr);
|
||||||
|
Reference in New Issue
Block a user