[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51091] trunk/blender/source/blender: code cleanup: use functions to initialize selection user data structs, use radius-squared for circle select comparisons.
Campbell Barton
ideasman42 at gmail.com
Fri Oct 5 17:44:12 CEST 2012
Revision: 51091
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51091
Author: campbellbarton
Date: 2012-10-05 15:44:11 +0000 (Fri, 05 Oct 2012)
Log Message:
-----------
code cleanup: use functions to initialize selection user data structs, use radius-squared for circle select comparisons.
edge_fully_inside_rect() & edge_inside_rect() args were shorts when all callers were passing ints.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/BLI_lasso.h
trunk/blender/source/blender/blenlib/intern/lasso.c
trunk/blender/source/blender/editors/include/ED_mesh.h
trunk/blender/source/blender/editors/include/ED_particle.h
trunk/blender/source/blender/editors/include/ED_view3d.h
trunk/blender/source/blender/editors/mask/mask_select.c
trunk/blender/source/blender/editors/mesh/editmesh_select.c
trunk/blender/source/blender/editors/object/object_constraint.c
trunk/blender/source/blender/editors/physics/particle_edit.c
trunk/blender/source/blender/editors/space_clip/tracking_select.c
trunk/blender/source/blender/editors/space_node/node_select.c
trunk/blender/source/blender/editors/space_view3d/view3d_select.c
trunk/blender/source/blender/editors/transform/transform.c
trunk/blender/source/blender/editors/uvedit/uvedit_ops.c
trunk/blender/source/blender/windowmanager/WM_api.h
trunk/blender/source/blender/windowmanager/intern/wm_operators.c
Modified: trunk/blender/source/blender/blenlib/BLI_lasso.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_lasso.h 2012-10-05 15:34:31 UTC (rev 51090)
+++ trunk/blender/source/blender/blenlib/BLI_lasso.h 2012-10-05 15:44:11 UTC (rev 51091)
@@ -34,8 +34,8 @@
struct rcti;
-void BLI_lasso_boundbox(struct rcti *rect, int mcords[][2], short moves);
-int BLI_lasso_is_point_inside(int mcords[][2], short moves, const int sx, const int sy, const int error_value);
-int BLI_lasso_is_edge_inside(int mcords[][2], short moves, int x0, int y0, int x1, int y1, const int error_value);
+void BLI_lasso_boundbox(struct rcti *rect, const int mcords[][2], const short moves);
+int BLI_lasso_is_point_inside(const int mcords[][2], const short moves, const int sx, const int sy, const int error_value);
+int BLI_lasso_is_edge_inside(const int mcords[][2], const short moves, int x0, int y0, int x1, int y1, const int error_value);
#endif
Modified: trunk/blender/source/blender/blenlib/intern/lasso.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/lasso.c 2012-10-05 15:34:31 UTC (rev 51090)
+++ trunk/blender/source/blender/blenlib/intern/lasso.c 2012-10-05 15:44:11 UTC (rev 51091)
@@ -37,7 +37,7 @@
#include "BLI_lasso.h" /* own include */
-void BLI_lasso_boundbox(rcti *rect, int mcords[][2], short moves)
+void BLI_lasso_boundbox(rcti *rect, const int mcords[][2], const short moves)
{
short a;
@@ -53,14 +53,14 @@
}
-int BLI_lasso_is_point_inside(int mcords[][2], short moves,
+int BLI_lasso_is_point_inside(const int mcords[][2], const short moves,
const int sx, const int sy,
const int error_value)
{
/* we do the angle rule, define that all added angles should be about zero or (2 * PI) */
float angletot = 0.0, dot, ang, cross, fp1[2], fp2[2];
int a;
- int *p1, *p2;
+ const int *p1, *p2;
if (sx == error_value) {
return 0;
@@ -100,7 +100,7 @@
}
/* edge version for lasso select. we assume boundbox check was done */
-int BLI_lasso_is_edge_inside(int mcords[][2], short moves,
+int BLI_lasso_is_edge_inside(const int mcords[][2], const short moves,
int x0, int y0, int x1, int y1,
const int error_value)
{
Modified: trunk/blender/source/blender/editors/include/ED_mesh.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_mesh.h 2012-10-05 15:34:31 UTC (rev 51090)
+++ trunk/blender/source/blender/editors/include/ED_mesh.h 2012-10-05 15:44:11 UTC (rev 51091)
@@ -138,7 +138,7 @@
int EDBM_backbuf_check(unsigned int index);
void EDBM_backbuf_free(void);
-int EDBM_backbuf_border_mask_init(struct ViewContext *vc, int mcords[][2], short tot,
+int EDBM_backbuf_border_mask_init(struct ViewContext *vc, const int mcords[][2], short tot,
short xmin, short ymin, short xmax, short ymax);
int EDBM_backbuf_circle_init(struct ViewContext *vc, short xs, short ys, short rads);
Modified: trunk/blender/source/blender/editors/include/ED_particle.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_particle.h 2012-10-05 15:34:31 UTC (rev 51090)
+++ trunk/blender/source/blender/editors/include/ED_particle.h 2012-10-05 15:44:11 UTC (rev 51091)
@@ -61,7 +61,7 @@
int PE_mouse_particles(struct bContext *C, const int mval[2], int extend, int deselect, int toggle);
int PE_border_select(struct bContext *C, struct rcti *rect, int select, int extend);
int PE_circle_select(struct bContext *C, int selecting, const int mval[2], float rad);
-int PE_lasso_select(struct bContext *C, int mcords[][2], short moves, short extend, short select);
+int PE_lasso_select(struct bContext *C, const int mcords[][2], const short moves, short extend, short select);
void PE_deselect_all_visible(struct PTCacheEdit *edit);
/* undo */
Modified: trunk/blender/source/blender/editors/include/ED_view3d.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_view3d.h 2012-10-05 15:34:31 UTC (rev 51090)
+++ trunk/blender/source/blender/editors/include/ED_view3d.h 2012-10-05 15:44:11 UTC (rev 51091)
@@ -40,6 +40,7 @@
struct BezTriple;
struct BezTriple;
struct BoundBox;
+struct EditBone;
struct ImBuf;
struct MVert;
struct Main;
@@ -170,7 +171,9 @@
void mesh_foreachScreenFace(struct ViewContext *vc, void (*func)(void *userData, struct BMFace *efa, int x, int y, int index), void *userData);
void nurbs_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct Nurb *nu, struct BPoint *bp, struct BezTriple *bezt, int beztindex, int x, int y), void *userData);
void lattice_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BPoint *bp, int x, int y), void *userData);
+void armature_foreachScreenBone(struct ViewContext *vc, void (*func)(void *userData, struct EditBone *ebone, int x0, int y0, int x1, int y1), void *userData);
+
void ED_view3d_clipping_calc(struct BoundBox *bb, float planes[4][4], struct bglMats *mats, const struct rcti *rect);
void ED_view3d_clipping_local(struct RegionView3D *rv3d, float mat[][4]);
int ED_view3d_clipping_test(struct RegionView3D *rv3d, const float vec[3], const int is_local);
Modified: trunk/blender/source/blender/editors/mask/mask_select.c
===================================================================
--- trunk/blender/source/blender/editors/mask/mask_select.c 2012-10-05 15:34:31 UTC (rev 51090)
+++ trunk/blender/source/blender/editors/mask/mask_select.c 2012-10-05 15:44:11 UTC (rev 51091)
@@ -485,7 +485,7 @@
WM_operator_properties_gesture_border(ot, TRUE);
}
-static int do_lasso_select_mask(bContext *C, int mcords[][2], short moves, short select)
+static int do_lasso_select_mask(bContext *C, const int mcords[][2], short moves, short select)
{
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
@@ -549,7 +549,7 @@
static int clip_lasso_select_exec(bContext *C, wmOperator *op)
{
int mcords_tot;
- int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot);
+ const int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot);
if (mcords) {
short select;
Modified: trunk/blender/source/blender/editors/mesh/editmesh_select.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_select.c 2012-10-05 15:34:31 UTC (rev 51090)
+++ trunk/blender/source/blender/editors/mesh/editmesh_select.c 2012-10-05 15:44:11 UTC (rev 51091)
@@ -131,7 +131,7 @@
static char *selbuf = NULL;
/* opengl doesn't support concave... */
-static void draw_triangulated(int mcords[][2], short tot)
+static void draw_triangulated(const int mcords[][2], const short tot)
{
ListBase lb = {NULL, NULL};
DispList *dl;
@@ -227,7 +227,7 @@
* - grab again and compare
* returns 'OK'
*/
-int EDBM_backbuf_border_mask_init(ViewContext *vc, int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax)
+int EDBM_backbuf_border_mask_init(ViewContext *vc, const int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax)
{
unsigned int *dr, *drm;
struct ImBuf *buf, *bufmask;
Modified: trunk/blender/source/blender/editors/object/object_constraint.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_constraint.c 2012-10-05 15:34:31 UTC (rev 51090)
+++ trunk/blender/source/blender/editors/object/object_constraint.c 2012-10-05 15:44:11 UTC (rev 51091)
@@ -982,7 +982,7 @@
return OPERATOR_FINISHED;
}
-static int followpath_path_animate_invoke(bContext *C, wmOperator *op, wmEvent *evt)
+static int followpath_path_animate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
/* hook up invoke properties for figuring out which constraint we're dealing with */
if (edit_constraint_invoke_properties(C, op)) {
Modified: trunk/blender/source/blender/editors/physics/particle_edit.c
===================================================================
--- trunk/blender/source/blender/editors/physics/particle_edit.c 2012-10-05 15:34:31 UTC (rev 51090)
+++ trunk/blender/source/blender/editors/physics/particle_edit.c 2012-10-05 15:44:11 UTC (rev 51091)
@@ -1633,7 +1633,7 @@
/************************ lasso select operator ************************/
-int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, short select)
+int PE_lasso_select(bContext *C, const int mcords[][2], const short moves, short extend, short select)
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
Modified: trunk/blender/source/blender/editors/space_clip/tracking_select.c
===================================================================
--- trunk/blender/source/blender/editors/space_clip/tracking_select.c 2012-10-05 15:34:31 UTC (rev 51090)
+++ trunk/blender/source/blender/editors/space_clip/tracking_select.c 2012-10-05 15:44:11 UTC (rev 51091)
@@ -413,7 +413,7 @@
/********************** lasso select operator *********************/
-static int do_lasso_select_marker(bContext *C, int mcords[][2], short moves, short select)
+static int do_lasso_select_marker(bContext *C, const int mcords[][2], const short moves, short select)
{
SpaceClip *sc = CTX_wm_space_clip(C);
ARegion *ar = CTX_wm_region(C);
@@ -469,7 +469,7 @@
static int clip_lasso_select_exec(bContext *C, wmOperator *op)
{
int mcords_tot;
- int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot);
+ const int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot);
if (mcords) {
short select;
Modified: trunk/blender/source/blender/editors/space_node/node_select.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_select.c 2012-10-05 15:34:31 UTC (rev 51090)
+++ trunk/blender/source/blender/editors/space_node/node_select.c 2012-10-05 15:44:11 UTC (rev 51091)
@@ -539,7 +539,7 @@
/* ****** Lasso Select ****** */
-static int do_lasso_select_node(bContext *C, int mcords[][2], short moves, short select)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list