[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55409] trunk/blender/source/blender: add BLI_rcti, f_recenter()
Campbell Barton
ideasman42 at gmail.com
Tue Mar 19 11:54:52 CET 2013
Revision: 55409
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55409
Author: campbellbarton
Date: 2013-03-19 10:54:52 +0000 (Tue, 19 Mar 2013)
Log Message:
-----------
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()
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/BLI_rect.h
trunk/blender/source/blender/blenlib/intern/rct.c
trunk/blender/source/blender/editors/interface/view2d.c
trunk/blender/source/blender/python/intern/bpy_rna.c
trunk/blender/source/blender/windowmanager/intern/wm_operators.c
Modified: trunk/blender/source/blender/blenlib/BLI_rect.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_rect.h 2013-03-19 10:42:33 UTC (rev 55408)
+++ trunk/blender/source/blender/blenlib/BLI_rect.h 2013-03-19 10:54:52 UTC (rev 55409)
@@ -54,6 +54,8 @@
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);
Modified: trunk/blender/source/blender/blenlib/intern/rct.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/rct.c 2013-03-19 10:42:33 UTC (rev 55408)
+++ trunk/blender/source/blender/blenlib/intern/rct.c 2013-03-19 10:54:52 UTC (rev 55409)
@@ -296,6 +296,19 @@
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)
{
Modified: trunk/blender/source/blender/editors/interface/view2d.c
===================================================================
--- trunk/blender/source/blender/editors/interface/view2d.c 2013-03-19 10:42:33 UTC (rev 55408)
+++ trunk/blender/source/blender/editors/interface/view2d.c 2013-03-19 10:54:52 UTC (rev 55409)
@@ -2086,13 +2086,8 @@
}
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);
}
Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c 2013-03-19 10:42:33 UTC (rev 55408)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c 2013-03-19 10:54:52 UTC (rev 55409)
@@ -4339,7 +4339,7 @@
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;
}
Modified: trunk/blender/source/blender/windowmanager/intern/wm_operators.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_operators.c 2013-03-19 10:42:33 UTC (rev 55408)
+++ trunk/blender/source/blender/windowmanager/intern/wm_operators.c 2013-03-19 10:54:52 UTC (rev 55409)
@@ -3542,7 +3542,7 @@
{
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);
More information about the Bf-blender-cvs
mailing list