diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-06-29 16:22:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-06-29 16:22:54 +0300 |
commit | 903cb13bb8dfe5c3e093aeb76b245f17b1400f70 (patch) | |
tree | 85b20b1e84d662a13410fd4e7f9505d3c1433e40 /source/blender/editors | |
parent | 0971749f4cdc6c5263b91f652c1d78c97e30b973 (diff) |
Cleanup: use const
Diffstat (limited to 'source/blender/editors')
4 files changed, 30 insertions, 25 deletions
diff --git a/source/blender/editors/include/ED_transform_snap_object_context.h b/source/blender/editors/include/ED_transform_snap_object_context.h index baf4ed574cf..7944b434057 100644 --- a/source/blender/editors/include/ED_transform_snap_object_context.h +++ b/source/blender/editors/include/ED_transform_snap_object_context.h @@ -75,7 +75,7 @@ SnapObjectContext *ED_transform_snap_object_context_create( SnapObjectContext *ED_transform_snap_object_context_create_view3d( struct Main *bmain, struct Scene *scene, int flag, /* extra args for view3d */ - struct ARegion *ar, struct View3D *v3d); + const struct ARegion *ar, const struct View3D *v3d); void ED_transform_snap_object_context_destroy(SnapObjectContext *sctx); /* callbacks to filter how snap works */ diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index baab6b6100d..b09284aa759 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -208,10 +208,12 @@ eV3DProjStatus ED_view3d_project_float_global(const struct ARegion *ar, const fl eV3DProjStatus ED_view3d_project_float_object(const struct ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag); float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3], bool *r_flip); -bool ED_view3d_win_to_ray(const struct ARegion *ar, struct View3D *v3d, const float mval[2], - float ray_start[3], float ray_normal[3], const bool do_clip); -bool ED_view3d_win_to_ray_ex(const struct ARegion *ar, struct View3D *v3d, const float mval[2], - float r_ray_co[3], float r_ray_normal[3], float r_ray_start[3], bool do_clip); +bool ED_view3d_win_to_ray( + const struct ARegion *ar, const struct View3D *v3d, const float mval[2], + float ray_start[3], float ray_normal[3], const bool do_clip); +bool ED_view3d_win_to_ray_ex( + const struct ARegion *ar, const struct View3D *v3d, const float mval[2], + float r_ray_co[3], float r_ray_normal[3], float r_ray_start[3], bool do_clip); void ED_view3d_global_to_vector(const struct RegionView3D *rv3d, const float coord[3], float vec[3]); void ED_view3d_win_to_3d(const struct ARegion *ar, const float depth_pt[3], const float mval[2], float out[3]); void ED_view3d_win_to_3d_int(const struct ARegion *ar, const float depth_pt[3], const int mval[2], float out[3]); diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c index 797d97586c7..ac05853e6d0 100644 --- a/source/blender/editors/space_view3d/view3d_project.c +++ b/source/blender/editors/space_view3d/view3d_project.c @@ -302,8 +302,9 @@ float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3], bool *r_f return zfac; } -static void view3d_win_to_ray_segment(const ARegion *ar, View3D *v3d, const float mval[2], - float r_ray_co[3], float r_ray_dir[3], float r_ray_start[3], float r_ray_end[3]) +static void view3d_win_to_ray_segment( + const ARegion *ar, const View3D *v3d, const float mval[2], + float r_ray_co[3], float r_ray_dir[3], float r_ray_start[3], float r_ray_end[3]) { RegionView3D *rv3d = ar->regiondata; float _ray_co[3], _ray_dir[3], start_offset, end_offset; @@ -346,7 +347,7 @@ static void view3d_win_to_ray_segment(const ARegion *ar, View3D *v3d, const floa } } -BLI_INLINE bool view3d_clip_segment(RegionView3D *rv3d, float ray_start[3], float ray_end[3]) +BLI_INLINE bool view3d_clip_segment(const RegionView3D *rv3d, float ray_start[3], float ray_end[3]) { if ((rv3d->rflag & RV3D_CLIPPING) && (clip_segment_v3_plane_n(ray_start, ray_end, rv3d->clip, 6, @@ -373,8 +374,9 @@ BLI_INLINE bool view3d_clip_segment(RegionView3D *rv3d, float ray_start[3], floa * \param do_clip Optionally clip the start of the ray by the view clipping planes. * \return success, false if the ray is totally clipped. */ -bool ED_view3d_win_to_ray_ex(const ARegion *ar, View3D *v3d, const float mval[2], - float r_ray_co[3], float r_ray_normal[3], float r_ray_start[3], bool do_clip) +bool ED_view3d_win_to_ray_ex( + const ARegion *ar, const View3D *v3d, const float mval[2], + float r_ray_co[3], float r_ray_normal[3], float r_ray_start[3], bool do_clip) { float ray_end[3]; @@ -382,7 +384,7 @@ bool ED_view3d_win_to_ray_ex(const ARegion *ar, View3D *v3d, const float mval[2] /* bounds clipping */ if (do_clip) { - return view3d_clip_segment((RegionView3D *)ar->regiondata, r_ray_start, ray_end); + return view3d_clip_segment(ar->regiondata, r_ray_start, ray_end); } return true; @@ -401,8 +403,9 @@ bool ED_view3d_win_to_ray_ex(const ARegion *ar, View3D *v3d, const float mval[2] * \param do_clip Optionally clip the start of the ray by the view clipping planes. * \return success, false if the ray is totally clipped. */ -bool ED_view3d_win_to_ray(const ARegion *ar, View3D *v3d, const float mval[2], - float r_ray_start[3], float r_ray_normal[3], const bool do_clip) +bool ED_view3d_win_to_ray( + const ARegion *ar, const View3D *v3d, const float mval[2], + float r_ray_start[3], float r_ray_normal[3], const bool do_clip) { return ED_view3d_win_to_ray_ex(ar, v3d, mval, NULL, r_ray_normal, r_ray_start, do_clip); } diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 897b6609721..0e1a65e073f 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -87,8 +87,8 @@ struct SnapObjectContext { * otherwise this doesn't take viewport into account. */ bool use_v3d; struct { - struct View3D *v3d; - struct ARegion *ar; + const struct View3D *v3d; + const struct ARegion *ar; } v3d_data; @@ -222,7 +222,7 @@ static void raycast_all_cb(void *userdata, int index, const BVHTreeRay *ray, BVH * \{ */ static bool snapEdge( - ARegion *ar, const float v1co[3], const short v1no[3], const float v2co[3], const short v2no[3], + const ARegion *ar, const float v1co[3], const short v1no[3], const float v2co[3], const short v2no[3], float obmat[4][4], float timat[3][3], const float mval_fl[2], float *dist_px, const float ray_start[3], const float ray_start_local[3], const float ray_normal_local[3], float *ray_depth, float r_loc[3], float r_no[3]) @@ -312,7 +312,7 @@ static bool snapEdge( } static bool snapVertex( - ARegion *ar, const float vco[3], const float vno[3], + const ARegion *ar, const float vco[3], const float vno[3], float obmat[4][4], float timat[3][3], const float mval_fl[2], float *dist_px, const float ray_start[3], const float ray_start_local[3], const float ray_normal_local[3], float *ray_depth, float r_loc[3], float r_no[3]) @@ -362,7 +362,7 @@ static bool snapVertex( } static bool snapArmature( - ARegion *ar, Object *ob, bArmature *arm, float obmat[4][4], + const ARegion *ar, Object *ob, bArmature *arm, float obmat[4][4], const float mval[2], float *dist_px, const short snap_to, const float ray_start[3], const float ray_normal[3], float *ray_depth, float r_loc[3], float *UNUSED(r_no)) @@ -444,7 +444,7 @@ static bool snapArmature( } static bool snapCurve( - ARegion *ar, Object *ob, Curve *cu, float obmat[4][4], + const ARegion *ar, Object *ob, Curve *cu, float obmat[4][4], const float mval[2], float *dist_px, const short snap_to, const float ray_start[3], const float ray_normal[3], float *ray_depth, float r_loc[3], float *UNUSED(r_no)) @@ -542,7 +542,7 @@ static bool snapCurve( /* may extend later (for now just snaps to empty center) */ static bool snapEmpty( - ARegion *ar, Object *ob, float obmat[4][4], + const ARegion *ar, Object *ob, float obmat[4][4], const float mval[2], float *dist_px, const short snap_to, const float ray_start[3], const float ray_normal[3], float *ray_depth, float r_loc[3], float *UNUSED(r_no)) @@ -582,7 +582,7 @@ static bool snapEmpty( } static bool snapCamera( - ARegion *ar, Scene *scene, Object *object, float obmat[4][4], + const ARegion *ar, Scene *scene, Object *object, float obmat[4][4], const float mval[2], float *dist_px, const short snap_to, const float ray_start[3], const float ray_normal[3], float *ray_depth, float r_loc[3], float *UNUSED(r_no)) @@ -683,7 +683,7 @@ static bool snapDerivedMesh( float r_loc[3], float r_no[3], int *r_index, ListBase *r_hit_list) { - ARegion *ar = sctx->v3d_data.ar; + const ARegion *ar = sctx->v3d_data.ar; bool retval = false; if (snap_to == SCE_SNAP_MODE_FACE) { @@ -965,7 +965,7 @@ static bool snapEditMesh( float r_loc[3], float r_no[3], int *r_index, ListBase *r_hit_list) { - ARegion *ar = sctx->v3d_data.ar; + const ARegion *ar = sctx->v3d_data.ar; bool retval = false; if (snap_to == SCE_SNAP_MODE_FACE) { @@ -1242,7 +1242,7 @@ static bool snapObject( Object **r_ob, float r_obmat[4][4], ListBase *r_hit_list) { - ARegion *ar = sctx->v3d_data.ar; + const ARegion *ar = sctx->v3d_data.ar; bool retval = false; if (ob->type == OB_MESH) { @@ -1419,7 +1419,7 @@ SnapObjectContext *ED_transform_snap_object_context_create( SnapObjectContext *ED_transform_snap_object_context_create_view3d( Main *bmain, Scene *scene, int flag, /* extra args for view3d */ - ARegion *ar, View3D *v3d) + const ARegion *ar, const View3D *v3d) { SnapObjectContext *sctx = ED_transform_snap_object_context_create(bmain, scene, flag); |