diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2016-06-03 09:54:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-06-03 09:56:16 +0300 |
commit | e370806b38388bb501ab99f9eb65fe2ff10d9133 (patch) | |
tree | 3e2ac56c81e0073ea9e62e528268ec02717c0f47 /source/blender/editors/include/ED_transform_snap_object_context.h | |
parent | e9363483caad3a038237489eea52443b20587bfd (diff) |
Cleanup & simplify snapping functions
- the name of the enumerator `SNAP_NOT_OBEDIT` was changed to `SNAP_NOT_ACTIVE`.
- the parameter `snap_to_flag` was moved to outside `SnapObjectParams`.
- the member `use_object_edit` was renamed to `use_object_edit_cage`.
- added the arg `params` in `ED_transform_snap_object_project_ray`.
- simplifications in the loop of the function `snapObjectsRay`.
Diffstat (limited to 'source/blender/editors/include/ED_transform_snap_object_context.h')
-rw-r--r-- | source/blender/editors/include/ED_transform_snap_object_context.h | 19 |
1 files changed, 10 insertions, 9 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 900b7593f2e..baf4ed574cf 100644 --- a/source/blender/editors/include/ED_transform_snap_object_context.h +++ b/source/blender/editors/include/ED_transform_snap_object_context.h @@ -57,17 +57,12 @@ struct SnapObjectHitDepth { unsigned int ob_uuid; }; +/** parameters that define which objects will be used to snap. */ struct SnapObjectParams { - int snap_select; /* SnapSelect */ - union { - unsigned int snap_to : 4; - /* snap_target_flag: Snap to vert/edge/face. */ - unsigned int snap_to_flag : 4; - }; + /* special context sensitive handling for the active or selected object */ + char snap_select; /* use editmode cage */ - unsigned int use_object_edit : 1; - /* special context sensitive handling for the active object */ - unsigned int use_object_active : 1; + unsigned int use_object_edit_cage : 1; }; enum { @@ -93,6 +88,7 @@ void ED_transform_snap_object_context_set_editmesh_callbacks( bool ED_transform_snap_object_project_ray_ex( struct SnapObjectContext *sctx, + const unsigned short snap_to, const struct SnapObjectParams *params, const float ray_start[3], const float ray_normal[3], float *ray_depth, /* return args */ @@ -100,11 +96,13 @@ bool ED_transform_snap_object_project_ray_ex( struct Object **r_ob, float r_obmat[4][4]); bool ED_transform_snap_object_project_ray( SnapObjectContext *sctx, + const struct SnapObjectParams *params, const float ray_origin[3], const float ray_direction[3], float *ray_depth, float r_co[3], float r_no[3]); bool ED_transform_snap_object_project_ray_all( SnapObjectContext *sctx, + const unsigned short snap_to, const struct SnapObjectParams *params, const float ray_start[3], const float ray_normal[3], float ray_depth, bool sort, @@ -112,12 +110,14 @@ bool ED_transform_snap_object_project_ray_all( bool ED_transform_snap_object_project_view3d_ex( struct SnapObjectContext *sctx, + const unsigned short snap_to, const struct SnapObjectParams *params, const float mval[2], float *dist_px, float *ray_depth, float r_loc[3], float r_no[3], int *r_index); bool ED_transform_snap_object_project_view3d( struct SnapObjectContext *sctx, + const unsigned short snap_to, const struct SnapObjectParams *params, const float mval[2], float *dist_px, float *ray_depth, @@ -125,6 +125,7 @@ bool ED_transform_snap_object_project_view3d( float r_loc[3], float r_no[3]); bool ED_transform_snap_object_project_view3d_mixed( SnapObjectContext *sctx, + const unsigned short snap_to_flag, const struct SnapObjectParams *params, const float mval_fl[2], float *dist_px, bool use_depth, |