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

wm_gizmo_wmapi.h « gizmo « windowmanager « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0612ba97db00a3c1394ebb0a635d015153b65fbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * The Original Code is Copyright (C) 2016 Blender Foundation.
 * All rights reserved.
 */

/** \file
 * \ingroup wm
 *
 * \name Gizmos Window Manager API
 * API for usage in window manager code only. It should contain all functionality
 * needed to hook up the gizmo system with Blender's window manager. It's
 * mostly the event system that needs to communicate with gizmo code.
 *
 * Only included in wm.h and lower level files.
 */

#pragma once

struct wmEventHandler_Gizmo;
struct wmEventHandler_Op;
struct wmGizmoMap;
struct wmOperatorType;

#ifdef __cplusplus
extern "C" {
#endif

/* -------------------------------------------------------------------- */
/** \name #wmGizmo
 * \{ */

/* wm_gizmo_type.c, for init/exit */

void wm_gizmotype_free(void);
/**
 * Called on initialize #WM_init().
 */
void wm_gizmotype_init(void);

/* wm_gizmogroup_type.c, for init/exit */

void wm_gizmogrouptype_free(void);
/**
 * Called on initialize #WM_init().
 */
void wm_gizmogrouptype_init(void);

/** \} */

/* -------------------------------------------------------------------- */
/** \name #wmGizmoGroup
 * \{ */

void GIZMOGROUP_OT_gizmo_select(struct wmOperatorType *ot);
void GIZMOGROUP_OT_gizmo_tweak(struct wmOperatorType *ot);

bool wm_gizmogroup_is_any_selected(const struct wmGizmoGroup *gzgroup);

/** \} */

/* -------------------------------------------------------------------- */
/** \name #wmGizmoMap
 * \{ */

void wm_gizmomap_remove(struct wmGizmoMap *gzmap);

/**
 * Initialize key-maps for all existing gizmo-groups
 */
void wm_gizmos_keymap(struct wmKeyConfig *keyconf);

void wm_gizmomaps_handled_modal_update(bContext *C,
                                       struct wmEvent *event,
                                       struct wmEventHandler_Op *handler);
/**
 * Prepare context for gizmo handling (but only if area/region is
 * part of screen). Version of #wm_handler_op_context for gizmos.
 */
void wm_gizmomap_handler_context_op(bContext *C, struct wmEventHandler_Op *handler);
void wm_gizmomap_handler_context_gizmo(bContext *C, struct wmEventHandler_Gizmo *handler);

/**
 * Try to find a gizmo under the mouse position. 2D intersections have priority over
 * 3D ones (could check for smallest screen-space distance but not needed right now).
 */
struct wmGizmo *wm_gizmomap_highlight_find(struct wmGizmoMap *gzmap,
                                           bContext *C,
                                           const struct wmEvent *event,
                                           int *r_part);
bool wm_gizmomap_highlight_set(struct wmGizmoMap *gzmap,
                               const bContext *C,
                               struct wmGizmo *gz,
                               int part);
struct wmGizmo *wm_gizmomap_highlight_get(struct wmGizmoMap *gzmap);
/**
 * Caller should call exit when (enable == False).
 */
void wm_gizmomap_modal_set(struct wmGizmoMap *gzmap,
                           bContext *C,
                           struct wmGizmo *gz,
                           const struct wmEvent *event,
                           bool enable);

struct wmGizmo *wm_gizmomap_modal_get(struct wmGizmoMap *gzmap);
struct wmGizmo **wm_gizmomap_selected_get(wmGizmoMap *gzmap, int *r_selected_len);
struct ListBase *wm_gizmomap_groups_get(wmGizmoMap *gzmap);

/** \} */

/* -------------------------------------------------------------------- */
/** \name #wmGizmoMapType
 * \{ */

void wm_gizmomaptypes_free(void);

/** \} */

#ifdef __cplusplus
}
#endif