Blender  V2.93
WM_gizmo_types.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  * The Original Code is Copyright (C) 2016 Blender Foundation.
17  * All rights reserved.
18  */
19 
29 #pragma once
30 
31 #include "BLI_compiler_attrs.h"
32 
33 struct wmGizmo;
34 struct wmGizmoGroup;
35 struct wmGizmoGroupType;
36 struct wmGizmoMapType;
37 struct wmGizmoProperty;
38 struct wmKeyConfig;
39 
40 #include "DNA_listBase.h"
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /* -------------------------------------------------------------------- */
47 /* Enum Typedef's */
48 
52 typedef enum eWM_GizmoFlagState {
59 
64 typedef enum eWM_GizmoFlag {
66  WM_GIZMO_DRAW_HOVER = (1 << 0),
68  WM_GIZMO_DRAW_MODAL = (1 << 1),
70  WM_GIZMO_DRAW_VALUE = (1 << 2),
71  WM_GIZMO_HIDDEN = (1 << 3),
90 
93 
97 
99  WM_GIZMO_NO_TOOLTIP = (1 << 12),
101 
131 
139 
150 
158 
167 
176 
181 
182 /* -------------------------------------------------------------------- */
183 /* wmGizmo */
184 
191 typedef enum {
192  /* Drag with extra precision (Shift). */
194  /* Drag with snap enabled (Ctrl). */
197 
198 #include "wm_gizmo_fn.h"
199 
200 typedef struct wmGizmoOpElem {
205 
206  bool is_redo;
208 
209 /* gizmos are set per region by registering them on gizmo-maps */
210 struct wmGizmo {
211  struct wmGizmo *next, *prev;
212 
214  const struct wmGizmoType *type;
215 
219 
222 
224  struct wmKeyMap *keymap;
225 
226  void *py_instance;
227 
229  struct PointerRNA *ptr;
230 
235 
239 
245 
248  float select_bias;
249 
261  float matrix_space[4][4];
263  float matrix_basis[4][4];
265  float matrix_offset[4][4];
267  float scale_final;
269  float scale_basis;
271  float line_width;
273  float color[4], color_hi[4];
274 
277 
282 
284 
286  bool do_draw;
287 
289  union {
290  float f;
291  } temp;
292 
293  /* over alloc target_properties after 'wmGizmoType.struct_size' */
294 };
295 
297 typedef struct wmGizmoProperty {
298  const struct wmGizmoPropertyType *type;
299 
302  int index;
303 
304  /* Optional functions for converting to/from RNA */
305  struct {
310  void *user_data;
313 
314 typedef struct wmGizmoPropertyType {
319 
320  /* index within 'wmGizmoType' */
322 
324  char idname[0];
326 
330 typedef struct wmGizmoWrapper {
331  struct wmGizmo *gizmo;
333 
335  short spaceid;
336  short regionid;
337 };
338 
339 typedef struct wmGizmoType {
340 
341  const char *idname; /* MAX_NAME */
342 
346 
349 
352 
355 
359 
362 
365 
373 
381 
384 
387 
389 
392 
395 
397  struct StructRNA *srna;
398 
401 
404 
406 
407 /* -------------------------------------------------------------------- */
408 /* wmGizmoGroup */
409 
411 typedef struct wmGizmoGroupTypeRef {
415 
416 /* factory class for a gizmo-group type, gets called every time a new area is spawned */
417 typedef struct wmGizmoGroupType {
418  const char *idname; /* MAX_NAME */
420  const char *name;
421  char owner_id[64]; /* MAX_NAME */
422 
433 
437 
442 
444  struct wmKeyMap *keymap;
447 
448  /* Note: currently gizmo-group instances don't store properties,
449  * they're kept in the tool properties. */
450 
452  struct StructRNA *srna;
453 
456 
458 
461 
464 
469  int users;
470 
472 
473 typedef struct wmGizmoGroup {
474  struct wmGizmoGroup *next, *prev;
475 
478 
480 
482  void *py_instance;
485 
487  union {
489  struct {
491  };
494  } hide;
495 
497 
499 
500  void *customdata;
502  void (*customdata_free)(void *);
505 
506 /* -------------------------------------------------------------------- */
507 /* wmGizmoMap */
508 
518 #define WM_GIZMOMAP_DRAWSTEP_MAX 2
519 
520 #ifdef __cplusplus
521 }
522 #endif
unsigned int uint
Definition: BLI_sys_types.h:83
These structs are the foundation for all linked lists in the library system.
eWM_GizmoFlagMapDrawStep
@ WM_GIZMOMAP_DRAWSTEP_3D
@ WM_GIZMOMAP_DRAWSTEP_2D
struct wmGizmoOpElem wmGizmoOpElem
eWM_GizmoFlagTweak
Gizmo tweak flag. Bitflag passed to gizmo while tweaking.
@ WM_GIZMO_TWEAK_PRECISE
@ WM_GIZMO_TWEAK_SNAP
struct wmGizmoType wmGizmoType
eWM_GizmoFlagMapTypeUpdateFlag
@ WM_GIZMOMAPTYPE_UPDATE_REMOVE
@ WM_GIZMOMAPTYPE_KEYMAP_INIT
@ WM_GIZMOMAPTYPE_UPDATE_INIT
eWM_GizmoFlagGroupInitFlag
@ WM_GIZMOGROUP_INIT_REFRESH
@ WM_GIZMOGROUP_INIT_SETUP
struct wmGizmoGroupTypeRef wmGizmoGroupTypeRef
eWM_GizmoFlag
@ WM_GIZMO_DRAW_NO_SCALE
@ WM_GIZMO_HIDDEN
@ WM_GIZMO_HIDDEN_KEYMAP
@ WM_GIZMO_EVENT_HANDLE_ALL
@ WM_GIZMO_OPERATOR_TOOL_INIT
@ WM_GIZMO_DRAW_VALUE
@ WM_GIZMO_MOVE_CURSOR
@ WM_GIZMO_DRAW_MODAL
@ WM_GIZMO_DRAW_HOVER
@ WM_GIZMO_DRAW_OFFSET_SCALE
@ WM_GIZMO_SELECT_BACKGROUND
@ WM_GIZMO_HIDDEN_SELECT
@ WM_GIZMO_NO_TOOLTIP
eWM_GizmoFlagGroupTypeFlag
@ WM_GIZMOGROUPTYPE_VR_REDRAWS
@ WM_GIZMOGROUPTYPE_SCALE
@ WM_GIZMOGROUPTYPE_TOOL_INIT
@ WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP
@ WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK
@ WM_GIZMOGROUPTYPE_DEPTH_3D
@ WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL
@ WM_GIZMOGROUPTYPE_3D
@ WM_GIZMOGROUPTYPE_PERSISTENT
@ WM_GIZMOGROUPTYPE_SELECT
struct wmGizmoPropertyType wmGizmoPropertyType
struct wmGizmoGroupType wmGizmoGroupType
struct wmGizmoGroup wmGizmoGroup
eWM_GizmoFlagState
@ WM_GIZMO_STATE_HIGHLIGHT
@ WM_GIZMO_STATE_MODAL
@ WM_GIZMO_STATE_SELECT
struct wmGizmoWrapper wmGizmoWrapper
struct wmGizmoProperty wmGizmoProperty
struct wmGizmoGroupTypeRef * next
struct wmGizmoGroupTypeRef * prev
struct wmGizmoGroupType * type
wmGizmoGroupFnSetupKeymap setup_keymap
struct wmKeyConfig * keyconf
wmGizmoGroupFnMsgBusSubscribe message_subscribe
wmGizmoGroupFnRefresh refresh
wmGizmoGroupFnInit setup
const char * idname
wmGizmoGroupFnInvokePrepare invoke_prepare
eWM_GizmoFlagGroupTypeFlag flag
struct wmKeyMap * keymap
eWM_GizmoFlagMapTypeUpdateFlag type_update_flag
ExtensionRNA rna_ext
wmGizmoGroupFnPoll poll
struct StructRNA * srna
struct wmGizmoMapType_Params gzmap_params
const char * name
wmGizmoGroupFnDrawPrepare draw_prepare
struct wmGizmoGroup * next
union wmGizmoGroup::@1150 hide
ListBase gizmos
struct wmGizmoGroupType * type
eWM_GizmoFlagGroupInitFlag init_flag
struct wmGizmoGroup * prev
void * py_instance
void(* customdata_free)(void *)
struct wmGizmoMap * parent_gzmap
struct ReportList * reports
uint delay_refresh_for_tweak
bool use_fallback_keymap
PointerRNA ptr
struct wmOperatorType * type
struct wmGizmoPropertyType * prev
struct wmGizmoPropertyType * next
wmGizmoPropertyFnRangeGet range_get_fn
PropertyRNA * prop
wmGizmoPropertyFnGet value_get_fn
wmGizmoPropertyFnSet value_set_fn
struct wmGizmoProperty::@1149 custom_func
wmGizmoPropertyFnFree free_fn
const struct wmGizmoPropertyType * type
wmGizmoFnSelectRefresh select_refresh
wmGizmoFnDraw draw
ExtensionRNA rna_ext
wmGizmoFnModal modal
wmGizmoFnScreenBoundsGet screen_bounds_get
ListBase target_property_defs
wmGizmoFnSetup setup
int target_property_defs_len
wmGizmoFnMatrixBasisGet matrix_basis_get
const char * idname
wmGizmoFnTestSelect test_select
wmGizmoFnExit exit
wmGizmoFnCursorGet cursor_get
struct StructRNA * srna
wmGizmoFnInvoke invoke
wmGizmoFnFree free
wmGizmoFnDrawSelect draw_select
wmGizmoFnPropertyUpdate property_update
struct wmGizmo * gizmo
bool do_draw
void * interaction_data
eWM_GizmoFlagState state
struct wmGizmoGroup * parent_gzgroup
int highlight_part
float matrix_basis[4][4]
void * py_instance
float select_bias
float matrix_offset[4][4]
struct wmGizmo * next
wmGizmoOpElem * op_data
float color_hi[4]
float scale_final
int op_data_len
struct wmKeyMap * keymap
float color[4]
struct PointerRNA * ptr
float scale_basis
struct wmGizmo * prev
float matrix_space[4][4]
float line_width
eWM_GizmoFlag flag
wmGizmoFnModal custom_modal
union wmGizmo::@1148 temp
const struct wmGizmoType * type
struct IDProperty * properties
void(* wmGizmoFnMatrixBasisGet)(const struct wmGizmo *, float[4][4])
Definition: wm_gizmo_fn.h:61
void(* wmGizmoPropertyFnRangeGet)(const struct wmGizmo *, struct wmGizmoProperty *, void *range)
Definition: wm_gizmo_fn.h:80
int(* wmGizmoFnInvoke)(struct bContext *, struct wmGizmo *, const struct wmEvent *)
Definition: wm_gizmo_fn.h:62
void(* wmGizmoFnSetup)(struct wmGizmo *)
Definition: wm_gizmo_fn.h:52
struct wmKeyMap *(* wmGizmoGroupFnSetupKeymap)(const struct wmGizmoGroupType *, struct wmKeyConfig *) ATTR_WARN_UNUSED_RESULT
Definition: wm_gizmo_fn.h:43
void(* wmGizmoFnSelectRefresh)(struct wmGizmo *)
Definition: wm_gizmo_fn.h:68
bool(* wmGizmoGroupFnPoll)(const struct bContext *, struct wmGizmoGroupType *) ATTR_WARN_UNUSED_RESULT
Definition: wm_gizmo_fn.h:34
void(* wmGizmoGroupFnDrawPrepare)(const struct bContext *, struct wmGizmoGroup *)
Definition: wm_gizmo_fn.h:38
int(* wmGizmoFnCursorGet)(struct wmGizmo *)
Definition: wm_gizmo_fn.h:64
void(* wmGizmoFnPropertyUpdate)(struct wmGizmo *, struct wmGizmoProperty *)
Definition: wm_gizmo_fn.h:60
int(* wmGizmoFnModal)(struct bContext *, struct wmGizmo *, const struct wmEvent *, eWM_GizmoFlagTweak)
Definition: wm_gizmo_fn.h:56
void(* wmGizmoPropertyFnFree)(const struct wmGizmo *, struct wmGizmoProperty *)
Definition: wm_gizmo_fn.h:84
bool(* wmGizmoFnScreenBoundsGet)(struct bContext *, struct wmGizmo *, rcti *r_bounding_box) ATTR_WARN_UNUSED_RESULT
Definition: wm_gizmo_fn.h:65
void(* wmGizmoFnDrawSelect)(const struct bContext *, struct wmGizmo *, int)
Definition: wm_gizmo_fn.h:54
void(* wmGizmoGroupFnMsgBusSubscribe)(const struct bContext *, struct wmGizmoGroup *, struct wmMsgBus *)
Definition: wm_gizmo_fn.h:45
void(* wmGizmoGroupFnRefresh)(const struct bContext *, struct wmGizmoGroup *)
Definition: wm_gizmo_fn.h:37
void(* wmGizmoPropertyFnSet)(const struct wmGizmo *, struct wmGizmoProperty *, const void *value)
Definition: wm_gizmo_fn.h:76
void(* wmGizmoFnFree)(struct wmGizmo *)
Definition: wm_gizmo_fn.h:69
void(* wmGizmoGroupFnInvokePrepare)(const struct bContext *, struct wmGizmoGroup *, struct wmGizmo *, const struct wmEvent *)
Definition: wm_gizmo_fn.h:39
void(* wmGizmoFnExit)(struct bContext *, struct wmGizmo *, const bool)
Definition: wm_gizmo_fn.h:63
void(* wmGizmoFnDraw)(const struct bContext *, struct wmGizmo *)
Definition: wm_gizmo_fn.h:53
int(* wmGizmoFnTestSelect)(struct bContext *, struct wmGizmo *, const int mval[2])
Definition: wm_gizmo_fn.h:55
void(* wmGizmoPropertyFnGet)(const struct wmGizmo *, struct wmGizmoProperty *, void *value)
Definition: wm_gizmo_fn.h:72
void(* wmGizmoGroupFnInit)(const struct bContext *, struct wmGizmoGroup *)
Definition: wm_gizmo_fn.h:36