Blender  V2.93
wm_gizmo_intern.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #pragma once
22 
23 struct BLI_Buffer;
24 struct wmGizmoMap;
25 struct wmKeyConfig;
26 
27 #include "wm_gizmo_fn.h"
28 
29 /* -------------------------------------------------------------------- */
30 /* wmGizmo */
31 
33  struct wmGizmoMap *gzmap, struct wmGizmo *gz, bool select, bool use_array, bool use_callback);
34 bool wm_gizmo_select_and_highlight(bContext *C, struct wmGizmoMap *gzmap, struct wmGizmo *gz);
35 
36 void wm_gizmo_calculate_scale(struct wmGizmo *gz, const bContext *C);
37 void wm_gizmo_update(struct wmGizmo *gz, const bContext *C, const bool refresh_map);
38 
39 int wm_gizmo_is_visible(struct wmGizmo *gz);
40 enum {
43 };
44 
45 /* -------------------------------------------------------------------- */
46 /* wmGizmoGroup */
47 
48 enum {
55 };
56 
58  struct wmGizmoGroupType *gzgt);
59 void wm_gizmogroup_free(bContext *C, struct wmGizmoGroup *gzgroup);
60 void wm_gizmogroup_gizmo_register(struct wmGizmoGroup *gzgroup, struct wmGizmo *gz);
62  const struct wmGizmoGroupType *gzgt);
64  const struct wmGizmoGroup *gzgroup,
65  struct bContext *C,
66  const int event_modifier,
67  const int mval[2],
68  int *r_part);
70  const struct wmGizmoGroup *gzgroup,
71  const int event_modifier,
72  struct BLI_Buffer *visible_gizmos);
74  const eWM_GizmoFlagMapDrawStep drawstep);
75 
76 void wm_gizmogrouptype_setup_keymap(struct wmGizmoGroupType *gzgt, struct wmKeyConfig *keyconf);
77 
79 
80 /* -------------------------------------------------------------------- */
81 /* wmGizmoMap */
82 
83 typedef struct wmGizmoMapSelectState {
84  struct wmGizmo **items;
85  int len, len_alloc;
87 
88 struct wmGizmoMap {
89 
91  ListBase groups; /* wmGizmoGroup */
92 
93  /* private, update tagging (enum defined in C source). */
95 
97  bool is_init;
98 
101 
108  struct {
109  /* we redraw the gizmo-map when this changes */
111  /* User has clicked this gizmo and it gets all input. */
112  struct wmGizmo *modal;
113  /* array for all selected gizmos */
115  /* cursor location at point of entering modal (see: WM_GIZMO_MOVE_CURSOR) */
116  int event_xy[2];
118  /* until we have nice cursor push/pop API. */
121 };
122 
132  /* types of gizmo-groups for this gizmo-map type */
134 
135  /* eGizmoMapTypeUpdateFlags */
137 };
138 
139 void wm_gizmomap_select_array_clear(struct wmGizmoMap *gzmap);
140 bool wm_gizmomap_deselect_all(struct wmGizmoMap *gzmap);
141 void wm_gizmomap_select_array_shrink(struct wmGizmoMap *gzmap, int len_subtract);
142 void wm_gizmomap_select_array_push_back(struct wmGizmoMap *gzmap, wmGizmo *gz);
143 void wm_gizmomap_select_array_remove(struct wmGizmoMap *gzmap, wmGizmo *gz);
#define C
Definition: RandGen.cpp:39
eWM_GizmoFlagMapDrawStep
eWM_GizmoFlagMapTypeUpdateFlag
#define WM_GIZMOMAP_DRAWSTEP_MAX
struct wmGizmo ** items
struct wmGizmoMapType * next
eWM_GizmoFlagMapTypeUpdateFlag type_update_flag
ListBase grouptype_refs
struct wmGizmoMapType * prev
char update_flag[WM_GIZMOMAP_DRAWSTEP_MAX]
struct wmGizmoMapType * type
struct wmGizmoMap::@1146 gzmap_context
Gizmo map runtime context.
bool tag_remove_group
ListBase groups
struct wmGizmo * modal
short event_grabcursor
struct wmGizmo * highlight
struct wmGizmoMapSelectState select
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: util_avxb.h:167
bool wm_gizmogroup_is_visible_in_drawstep(const struct wmGizmoGroup *gzgroup, const eWM_GizmoFlagMapDrawStep drawstep)
void wm_gizmogroup_gizmo_register(struct wmGizmoGroup *gzgroup, struct wmGizmo *gz)
bool wm_gizmo_select_set_ex(struct wmGizmoMap *gzmap, struct wmGizmo *gz, bool select, bool use_array, bool use_callback)
Definition: wm_gizmo.c:397
struct wmGizmoGroup * wm_gizmogroup_new_from_type(struct wmGizmoMap *gzmap, struct wmGizmoGroupType *gzgt)
void wm_gizmo_calculate_scale(struct wmGizmo *gz, const bContext *C)
Definition: wm_gizmo.c:480
bool wm_gizmomap_deselect_all(struct wmGizmoMap *gzmap)
Definition: wm_gizmo_map.c:861
wmKeyMap * wm_gizmogroup_tweak_modal_keymap(struct wmKeyConfig *keyconf)
void wm_gizmogroup_free(bContext *C, struct wmGizmoGroup *gzgroup)
int wm_gizmo_is_visible(struct wmGizmo *gz)
Definition: wm_gizmo.c:529
void wm_gizmomap_select_array_shrink(struct wmGizmoMap *gzmap, int len_subtract)
Definition: wm_gizmo_map.c:116
@ TWEAK_MODAL_PRECISION_ON
@ TWEAK_MODAL_SNAP_ON
@ TWEAK_MODAL_PRECISION_OFF
@ TWEAK_MODAL_CONFIRM
@ TWEAK_MODAL_SNAP_OFF
@ TWEAK_MODAL_CANCEL
void wm_gizmogrouptype_setup_keymap(struct wmGizmoGroupType *gzgt, struct wmKeyConfig *keyconf)
void wm_gizmo_update(struct wmGizmo *gz, const bContext *C, const bool refresh_map)
Definition: wm_gizmo.c:521
void wm_gizmomap_select_array_clear(struct wmGizmoMap *gzmap)
Definition: wm_gizmo_map.c:108
bool wm_gizmo_select_and_highlight(bContext *C, struct wmGizmoMap *gzmap, struct wmGizmo *gz)
Definition: wm_gizmo.c:448
struct wmGizmo * wm_gizmogroup_find_intersected_gizmo(wmWindowManager *wm, const struct wmGizmoGroup *gzgroup, struct bContext *C, const int event_modifier, const int mval[2], int *r_part)
struct wmGizmoMapSelectState wmGizmoMapSelectState
@ WM_GIZMO_IS_VISIBLE_DRAW
@ WM_GIZMO_IS_VISIBLE_UPDATE
void wm_gizmomap_select_array_remove(struct wmGizmoMap *gzmap, wmGizmo *gz)
Definition: wm_gizmo_map.c:142
struct wmGizmoGroup * wm_gizmogroup_find_by_type(const struct wmGizmoMap *gzmap, const struct wmGizmoGroupType *gzgt)
void wm_gizmogroup_intersectable_gizmos_to_list(wmWindowManager *wm, const struct wmGizmoGroup *gzgroup, const int event_modifier, struct BLI_Buffer *visible_gizmos)
void wm_gizmomap_select_array_push_back(struct wmGizmoMap *gzmap, wmGizmo *gz)
Definition: wm_gizmo_map.c:131