Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano Cavalcante <germano.costa@ig.com.br>2016-06-03 09:54:58 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-06-03 09:56:16 +0300
commite370806b38388bb501ab99f9eb65fe2ff10d9133 (patch)
tree3e2ac56c81e0073ea9e62e528268ec02717c0f47 /source/blender/editors/include
parente9363483caad3a038237489eea52443b20587bfd (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')
-rw-r--r--source/blender/editors/include/ED_transform.h13
-rw-r--r--source/blender/editors/include/ED_transform_snap_object_context.h19
2 files changed, 18 insertions, 14 deletions
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index 933f480a554..ebd2a3dcb7a 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -45,6 +45,7 @@ struct wmKeyMap;
struct wmOperatorType;
struct Main;
struct SnapObjectContext;
+struct SnapObjectParams;
void transform_keymap_for_space(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int spaceid);
void transform_operatortypes(void);
@@ -161,25 +162,27 @@ void BIF_draw_manipulator(const struct bContext *C);
typedef enum SnapSelect {
SNAP_ALL = 0,
SNAP_NOT_SELECTED = 1,
- SNAP_NOT_OBEDIT = 2
+ SNAP_NOT_ACTIVE = 2,
} SnapSelect;
#define SNAP_MIN_DISTANCE 30
bool peelObjectsTransform(
- struct TransInfo *t, const float mval[2],
- SnapSelect snap_select, bool use_peel_object,
+ struct TransInfo *t,
+ const float mval[2],
+ const bool use_peel_object,
/* return args */
float r_loc[3], float r_no[3], float *r_thickness);
bool peelObjectsSnapContext(
struct SnapObjectContext *sctx,
const float mval[2],
- SnapSelect snap_select, bool use_peel_object,
+ const struct SnapObjectParams *params,
+ const bool use_peel_object,
/* return args */
float r_loc[3], float r_no[3], float *r_thickness);
bool snapObjectsTransform(
- struct TransInfo *t, const float mval[2], SnapSelect snap_select,
+ struct TransInfo *t, const float mval[2],
float *dist_px,
/* return args */
float r_loc[3], float r_no[3]);
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,