diff options
-rw-r--r-- | source/blender/blenlib/BLI_rect.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/rct.c | 13 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d.c | 7 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 2 |
5 files changed, 18 insertions, 8 deletions
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h index 9ce75de5ea8..ac0ae22c656 100644 --- a/source/blender/blenlib/BLI_rect.h +++ b/source/blender/blenlib/BLI_rect.h @@ -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_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_rctf_resize(struct rctf *rect, float x, float y); void BLI_rcti_scale(rcti *rect, const float scale); diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index 127855161c0..91fcb5a5b83 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -296,6 +296,19 @@ void BLI_rctf_translate(rctf *rect, float x, float 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 */ void BLI_rcti_resize(rcti *rect, int x, int y) { diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 013b6d3c606..a66169d54ae 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -2086,13 +2086,8 @@ void UI_view2d_getcenter(struct View2D *v2d, float *x, float *y) } void UI_view2d_setcenter(struct View2D *v2d, float x, float y) { - /* get delta from current center */ - float dx = x - BLI_rctf_cent_x(&v2d->cur); - float dy = y - BLI_rctf_cent_y(&v2d->cur); + BLI_rctf_recenter(&v2d->cur, x, y); - /* 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 */ UI_view2d_curRect_validate(v2d); } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index ebd38e672da..f165ef878a6 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -4339,7 +4339,7 @@ static int foreach_parse_args(BPy_PropertyRNA *self, PyObject *args, if (!PySequence_Check(*seq) && PyObject_CheckBuffer(*seq)) { PyErr_Format(PyExc_TypeError, "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; } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 530d3bd90c1..f2a044afe3a 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3542,7 +3542,7 @@ static int radial_control_get_properties(bContext *C, wmOperator *op) { RadialControl *rc = op->customdata; PointerRNA ctx_ptr, use_secondary_ptr; - PropertyRNA *use_secondary_prop; + PropertyRNA *use_secondary_prop = NULL; const char *data_path; RNA_pointer_create(NULL, &RNA_Context, C, &ctx_ptr); |