diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2020-05-27 06:14:11 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2020-05-27 06:14:11 +0300 |
commit | 2e73e1390e3a87d16fc4016d629253c1228af255 (patch) | |
tree | 3df4857e735ea7bb8bacbf918eaf540e497d8b50 /source/blender/editors/include/ED_gizmo_library.h | |
parent | 7ed7901c00867a951bd2bb0e179d7b087cd68d9d (diff) |
Gizmo Library: New Snap Gizmo
Generic snap gizmo to be used for different tools.
The Gizmo can be configured initially by the following properties:
- `"snap_elements_force"`, `"prev_point"`
The following properties can be read as return:
- `"location"`, `"normal"`, `"snap_elem_index"`
This property can be linked to another (tool_setting.snap_elements):
- `"snap_elements"`
And this 3 extra utilities have been added:
- `ED_gizmotypes_snap_3d_draw_util`,
- `ED_gizmotypes_snap_3d_context_get`,
- `ED_gizmotypes_snap_3d_update`.
Differential Revision: https://developer.blender.org/D7071
Diffstat (limited to 'source/blender/editors/include/ED_gizmo_library.h')
-rw-r--r-- | source/blender/editors/include/ED_gizmo_library.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/source/blender/editors/include/ED_gizmo_library.h b/source/blender/editors/include/ED_gizmo_library.h index 07eade23506..47ecbd73c9a 100644 --- a/source/blender/editors/include/ED_gizmo_library.h +++ b/source/blender/editors/include/ED_gizmo_library.h @@ -40,9 +40,15 @@ void ED_gizmotypes_facemap_3d(void); void ED_gizmotypes_preselect_3d(void); void ED_gizmotypes_primitive_3d(void); void ED_gizmotypes_blank_3d(void); +void ED_gizmotypes_snap_3d(void); -struct Object; +struct ARegion; struct bContext; +struct Depsgraph; +struct Object; +struct SnapObjectContext; +struct wmWindowManager; +struct View3D; struct wmGizmo; /* -------------------------------------------------------------------- */ @@ -223,8 +229,9 @@ enum { }; /* -------------------------------------------------------------------- */ -/* Gizmo Drawing Functions */ +/* Specific gizmos utils */ +/* dial3d_gizmo.c */ struct Dial3dParams { int draw_options; float angle_ofs; @@ -241,6 +248,25 @@ void ED_gizmotypes_dial_3d_draw_util(const float matrix_basis[4][4], const bool select, struct Dial3dParams *params); +/* snap3d_gizmo.c */ +#define USE_SNAP_DETECT_FROM_KEYMAP_HACK +void ED_gizmotypes_snap_3d_draw_util(struct RegionView3D *rv3d, + const float loc_prev[3], + const float loc_curr[3], + const float normal[3], + const uchar color_line[4], + const uchar color_point[4], + const short snap_elem_type); +struct SnapObjectContext *ED_gizmotypes_snap_3d_context_get(struct wmGizmo *gz); +short ED_gizmotypes_snap_3d_update(struct wmGizmo *gz, + struct Depsgraph *depsgraph, + const struct ARegion *region, + const struct View3D *v3d, + const struct wmWindowManager *wm, + const float mval_fl[2], + float r_loc[3], + float r_nor[3]); + #ifdef __cplusplus } #endif |