Blender  V3.3
WM_gizmo_types.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2016 Blender Foundation. All rights reserved. */
3 
13 #pragma once
14 
15 #include "BLI_compiler_attrs.h"
16 #include "BLI_utildefines.h"
17 
18 struct wmGizmo;
19 struct wmGizmoGroup;
20 struct wmGizmoGroupType;
21 struct wmGizmoMapType;
22 struct wmGizmoProperty;
23 struct wmKeyConfig;
24 
25 #include "DNA_listBase.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 /* -------------------------------------------------------------------- */
32 /* Enum Typedef's */
33 
37 typedef enum eWM_GizmoFlagState {
44 
49 typedef enum eWM_GizmoFlag {
51  WM_GIZMO_DRAW_HOVER = (1 << 0),
53  WM_GIZMO_DRAW_MODAL = (1 << 1),
55  WM_GIZMO_DRAW_VALUE = (1 << 2),
56  WM_GIZMO_HIDDEN = (1 << 3),
75 
78 
82 
84  WM_GIZMO_NO_TOOLTIP = (1 << 12),
86 
88 
110 
113 
125 
133 
144 
152 
154 
163 
172 
177 
178 /* -------------------------------------------------------------------- */
179 /* wmGizmo */
180 
187 typedef enum {
188  /* Drag with extra precision (Shift). */
190  /* Drag with snap enabled (Ctrl). */
193 
194 #include "wm_gizmo_fn.h"
195 
196 typedef struct wmGizmoOpElem {
201 
202  bool is_redo;
204 
205 /* gizmos are set per region by registering them on gizmo-maps */
206 struct wmGizmo {
207  struct wmGizmo *next, *prev;
208 
210  const struct wmGizmoType *type;
211 
215 
218 
220  struct wmKeyMap *keymap;
221 
222  void *py_instance;
223 
225  struct PointerRNA *ptr;
226 
231 
235 
241 
244  float select_bias;
245 
257  float matrix_space[4][4];
259  float matrix_basis[4][4];
261  float matrix_offset[4][4];
263  float scale_final;
265  float scale_basis;
267  float line_width;
269  float color[4], color_hi[4];
270 
273 
278 
280 
282  bool do_draw;
283 
285  union {
286  float f;
287  } temp;
288 
289  /* over alloc target_properties after 'wmGizmoType.struct_size' */
290 };
291 
293 typedef struct wmGizmoProperty {
294  const struct wmGizmoPropertyType *type;
295 
298  int index;
299 
300  /* Optional functions for converting to/from RNA. */
301  struct {
306  void *user_data;
309 
310 typedef struct wmGizmoPropertyType {
315 
316  /* index within 'wmGizmoType' */
318 
320  char idname[0];
322 
326 typedef struct wmGizmoWrapper {
327  struct wmGizmo *gizmo;
329 
331  short spaceid;
332  short regionid;
333 };
334 
335 typedef struct wmGizmoType {
336 
337  const char *idname; /* MAX_NAME */
338 
342 
345 
348 
351 
355 
358 
361 
369 
377 
380 
383 
385 
388 
391 
393  struct StructRNA *srna;
394 
397 
400 
402 
403 /* -------------------------------------------------------------------- */
404 /* wmGizmoGroup */
405 
407 typedef struct wmGizmoGroupTypeRef {
411 
412 /* factory class for a gizmo-group type, gets called every time a new area is spawned */
413 typedef struct wmGizmoGroupType {
414  const char *idname; /* MAX_NAME */
416  const char *name;
417  char owner_id[64]; /* MAX_NAME */
418 
429 
433 
438 
440  struct wmKeyMap *keymap;
443 
444  /* NOTE: currently gizmo-group instances don't store properties,
445  * they're kept in the tool properties. */
446 
448  struct StructRNA *srna;
449 
452 
454 
457 
460 
465  int users;
466 
468 
469 typedef struct wmGizmoGroup {
470  struct wmGizmoGroup *next, *prev;
471 
474 
476 
478  void *py_instance;
481 
483  union {
485  struct {
487  };
490  } hide;
491 
493 
494  void *customdata;
496  void (*customdata_free)(void *);
499 
500 /* -------------------------------------------------------------------- */
501 /* wmGizmoMap */
502 
512 #define WM_GIZMOMAP_DRAWSTEP_MAX 2
513 
514 #ifdef __cplusplus
515 }
516 #endif
unsigned int uint
Definition: BLI_sys_types.h:67
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. Bit-flag 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
ENUM_OPERATORS(eWM_GizmoFlag, WM_GIZMO_NO_TOOLTIP)
eWM_GizmoFlagGroupTypeFlag
@ WM_GIZMOGROUPTYPE_VR_REDRAWS
@ WM_GIZMOGROUPTYPE_DRAW_MODAL_EXCLUDE
@ 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
SyclQueue void void size_t num_bytes void
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
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
union wmGizmoGroup::@1186 hide
uint delay_refresh_for_tweak
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
wmGizmoPropertyFnFree free_fn
const struct wmGizmoPropertyType * type
struct wmGizmoProperty::@1185 custom_func
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
union wmGizmo::@1184 temp
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
const struct wmGizmoType * type
struct IDProperty * properties
void(* wmGizmoFnMatrixBasisGet)(const struct wmGizmo *, float[4][4])
Definition: wm_gizmo_fn.h:47
void(* wmGizmoPropertyFnRangeGet)(const struct wmGizmo *, struct wmGizmoProperty *, void *range)
Definition: wm_gizmo_fn.h:66
int(* wmGizmoFnInvoke)(struct bContext *, struct wmGizmo *, const struct wmEvent *)
Definition: wm_gizmo_fn.h:48
void(* wmGizmoFnSetup)(struct wmGizmo *)
Definition: wm_gizmo_fn.h:38
struct wmKeyMap *(* wmGizmoGroupFnSetupKeymap)(const struct wmGizmoGroupType *, struct wmKeyConfig *) ATTR_WARN_UNUSED_RESULT
Definition: wm_gizmo_fn.h:29
void(* wmGizmoFnSelectRefresh)(struct wmGizmo *)
Definition: wm_gizmo_fn.h:54
bool(* wmGizmoGroupFnPoll)(const struct bContext *, struct wmGizmoGroupType *) ATTR_WARN_UNUSED_RESULT
Definition: wm_gizmo_fn.h:20
void(* wmGizmoGroupFnDrawPrepare)(const struct bContext *, struct wmGizmoGroup *)
Definition: wm_gizmo_fn.h:24
int(* wmGizmoFnCursorGet)(struct wmGizmo *)
Definition: wm_gizmo_fn.h:50
void(* wmGizmoFnPropertyUpdate)(struct wmGizmo *, struct wmGizmoProperty *)
Definition: wm_gizmo_fn.h:46
int(* wmGizmoFnModal)(struct bContext *, struct wmGizmo *, const struct wmEvent *, eWM_GizmoFlagTweak)
Definition: wm_gizmo_fn.h:42
void(* wmGizmoPropertyFnFree)(const struct wmGizmo *, struct wmGizmoProperty *)
Definition: wm_gizmo_fn.h:70
bool(* wmGizmoFnScreenBoundsGet)(struct bContext *, struct wmGizmo *, rcti *r_bounding_box) ATTR_WARN_UNUSED_RESULT
Definition: wm_gizmo_fn.h:51
void(* wmGizmoFnDrawSelect)(const struct bContext *, struct wmGizmo *, int)
Definition: wm_gizmo_fn.h:40
void(* wmGizmoGroupFnMsgBusSubscribe)(const struct bContext *, struct wmGizmoGroup *, struct wmMsgBus *)
Definition: wm_gizmo_fn.h:31
void(* wmGizmoGroupFnRefresh)(const struct bContext *, struct wmGizmoGroup *)
Definition: wm_gizmo_fn.h:23
void(* wmGizmoPropertyFnSet)(const struct wmGizmo *, struct wmGizmoProperty *, const void *value)
Definition: wm_gizmo_fn.h:62
void(* wmGizmoFnFree)(struct wmGizmo *)
Definition: wm_gizmo_fn.h:55
void(* wmGizmoGroupFnInvokePrepare)(const struct bContext *, struct wmGizmoGroup *, struct wmGizmo *, const struct wmEvent *)
Definition: wm_gizmo_fn.h:25
void(* wmGizmoFnExit)(struct bContext *, struct wmGizmo *, const bool)
Definition: wm_gizmo_fn.h:49
void(* wmGizmoFnDraw)(const struct bContext *, struct wmGizmo *)
Definition: wm_gizmo_fn.h:39
int(* wmGizmoFnTestSelect)(struct bContext *, struct wmGizmo *, const int mval[2])
Definition: wm_gizmo_fn.h:41
void(* wmGizmoPropertyFnGet)(const struct wmGizmo *, struct wmGizmoProperty *, void *value)
Definition: wm_gizmo_fn.h:58
void(* wmGizmoGroupFnInit)(const struct bContext *, struct wmGizmoGroup *)
Definition: wm_gizmo_fn.h:22