diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-12-17 09:38:50 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-12-17 09:38:50 +0400 |
commit | 18cb2d208c80c9abf884e51c9e7c6f822c811190 (patch) | |
tree | 221cb7d02b64a24eb0725097ec630839736bfb40 /source | |
parent | 9ac713bdb577116f4af0ef5250efddf82f93cf69 (diff) |
code cleanup: use 'const float *' when getting the 3d cursor and not editing it.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_main.h | 4 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 7 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 5 | ||||
-rw-r--r-- | source/blender/editors/object/object_add.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 3 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 3 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 2 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_unwrap_ops.c | 21 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 2 |
11 files changed, 30 insertions, 23 deletions
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index b49c5fda475..da0cba422c3 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -51,7 +51,7 @@ struct Library; typedef struct Main { struct Main *next, *prev; char name[1024]; /* 1024 = FILE_MAX */ - short versionfile, subversionfile; + short versionfile, subversionfile; /* see BLENDER_VERSION, BLENDER_SUBVERSION */ short minversionfile, minsubversionfile; int revision; /* svn revision of binary that saved file */ short recovered; /* indicate the main->name (file) is the recovered one */ @@ -92,6 +92,8 @@ typedef struct Main { char id_tag_update[256]; } Main; +#define MAIN_VERSION_ATLEAST(main, ver, subver) \ + ((main)->versionfile >= (ver) || (main->versionfile == (ver) && (main)->subversionfile >= (subver))) #ifdef __cplusplus } diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index e801d3689e5..ffe58be0139 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -2062,7 +2062,7 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); /* can be NULL */ float cursor_local[3]; - float *cursor = give_cursor(scene, v3d); + const float *cursor = give_cursor(scene, v3d); copy_v3_v3(cursor_local, cursor); @@ -2323,7 +2323,8 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op)) View3D *v3d; bArmature *arm; EditBone *ebone, *newbone, *flipbone; - float *curs, mat[3][3], imat[3][3]; + float mat[3][3], imat[3][3]; + const float *curs; int a, to_root = 0; Object *obedit; Scene *scene; @@ -2418,7 +2419,7 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *e Scene *scene; ARegion *ar; View3D *v3d; - float *fp = NULL, tvec[3], oldcurs[3], mval_f[2]; + float *fp, tvec[3], oldcurs[3], mval_f[2]; int retv; scene = CTX_data_scene(C); diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index e9ca7392752..e4e640eeefc 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -451,7 +451,7 @@ static void gp_strokepoint_convertcoords(bContext *C, bGPDstroke *gps, bGPDspoin copy_v3_v3(p3d, &pt->x); } else { - float *fp = give_cursor(scene, v3d); + const float *fp = give_cursor(scene, v3d); float mvalf[2]; /* get screen coordinate */ diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 8fdca730674..c40312758fc 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -208,7 +208,7 @@ static int gpencil_project_check(tGPsdata *p) static void gp_get_3d_reference(tGPsdata *p, float vec[3]) { View3D *v3d = p->sa->spacedata.first; - float *fp = give_cursor(p->scene, v3d); + const float *fp = give_cursor(p->scene, v3d); /* the reference point used depends on the owner... */ #if 0 /* XXX: disabled for now, since we can't draw relative to the owner yet */ diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index ec9da47c9ac..be51928fef2 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -906,7 +906,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent BM_ELEM_SELECT, min); } else { - float *curs = give_cursor(vc.scene, vc.v3d); + const float *curs = give_cursor(vc.scene, vc.v3d); BMOperator bmop; BMOIter oiter; @@ -2033,7 +2033,8 @@ static int merge_target(BMEditMesh *em, Scene *scene, View3D *v3d, Object *ob, { BMIter iter; BMVert *v; - float *vco = NULL, co[3], cent[3] = {0.0f, 0.0f, 0.0f}; + float co[3], cent[3] = {0.0f, 0.0f, 0.0f}; + const float *vco = NULL; if (target) { vco = give_cursor(scene, v3d); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index b3c0368adfe..ac1dd2464f8 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -146,7 +146,7 @@ void ED_object_location_from_view(bContext *C, float loc[3]) { View3D *v3d = CTX_wm_view3d(C); Scene *scene = CTX_data_scene(C); - float *cursor; + const float *cursor; cursor = give_cursor(scene, v3d); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index cd5770ba940..a1f0bf69497 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -3683,10 +3683,9 @@ static int view3d_cursor3d_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent * ARegion *ar = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); - float *fp = NULL; + float *fp = give_cursor(scene, v3d); float mval_fl[2]; int flip; - fp = give_cursor(scene, v3d); flip = initgrabz(rv3d, fp[0], fp[1], fp[2]); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 6a5904767b7..e85fe005670 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2579,7 +2579,8 @@ int handleEventWarp(TransInfo *t, wmEvent *event) int Warp(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; - float vec[3], circumfac, dist, phi0, co, si, *curs, cursor[3], gcursor[3]; + float vec[3], circumfac, dist, phi0, co, si, cursor[3], gcursor[3]; + const float *curs; int i; char str[50]; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 615bb786071..6d7ddd4e0ed 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1445,7 +1445,7 @@ void calculateCenter2D(TransInfo *t) void calculateCenterCursor(TransInfo *t) { - float *cursor; + const float *cursor; cursor = give_cursor(t->scene, t->view); copy_v3_v3(t->center, cursor); diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index cb54689a3c0..2ca711a4a6a 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -895,16 +895,18 @@ void ED_uvedit_live_unwrap(Scene *scene, Object *obedit) static void uv_map_transform_center(Scene *scene, View3D *v3d, float *result, Object *ob, BMEditMesh *em) { - BMFace *efa; - BMLoop *l; - BMIter iter, liter; - float min[3], max[3], *cursx; int around = (v3d) ? v3d->around : V3D_CENTER; /* only operates on the edit object - this is all that's needed now */ switch (around) { case V3D_CENTER: /* bounding box center */ + { + BMFace *efa; + BMLoop *l; + BMIter iter, liter; + float min[3], max[3]; + INIT_MINMAX(min, max); BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { @@ -916,17 +918,18 @@ static void uv_map_transform_center(Scene *scene, View3D *v3d, float *result, } mid_v3_v3v3(result, min, max); break; - + } case V3D_CURSOR: /* cursor center */ - cursx = give_cursor(scene, v3d); + { + const float *curs = give_cursor(scene, v3d); /* shift to objects world */ - sub_v3_v3v3(result, cursx, ob->obmat[3]); + sub_v3_v3v3(result, curs, ob->obmat[3]); break; - + } case V3D_LOCAL: /* object center */ case V3D_CENTROID: /* multiple objects centers, only one object here*/ default: - result[0] = result[1] = result[2] = 0.0; + zero_v3(result); break; } } diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index a59cfc46c37..f7475151e9d 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -321,7 +321,7 @@ static void rna_View3D_CursorLocation_get(PointerRNA *ptr, float *values) View3D *v3d = (View3D *)(ptr->data); bScreen *sc = (bScreen *)ptr->id.data; Scene *scene = (Scene *)sc->scene; - float *loc = give_cursor(scene, v3d); + const float *loc = give_cursor(scene, v3d); copy_v3_v3(values, loc); } |