Blender
V2.93
source
blender
editors
util
gizmo_utils.c
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
23
#include <string.h>
24
25
#include "
BLI_utildefines.h
"
26
27
#include "
BKE_context.h
"
28
29
#include "
DNA_workspace_types.h
"
30
31
#include "
WM_api.h
"
32
#include "
WM_toolsystem.h
"
33
#include "
WM_types.h
"
34
35
#include "
ED_gizmo_utils.h
"
36
37
bool
ED_gizmo_poll_or_unlink_delayed_from_operator
(
const
bContext
*
C
,
38
wmGizmoGroupType
*gzgt,
39
const
char
*idname)
40
{
41
#if 0
42
/* Causes selection to continue showing the last gizmo. */
43
wmOperator
*op =
WM_operator_last_redo
(
C
);
44
#else
45
wmWindowManager
*wm =
CTX_wm_manager
(
C
);
46
wmOperator
*op = wm->
operators
.
last
;
47
#endif
48
49
if
(op ==
NULL
|| !
STREQ
(op->
type
->
idname
, idname)) {
50
WM_gizmo_group_type_unlink_delayed_ptr
(gzgt);
51
return
false
;
52
}
53
return
true
;
54
}
55
56
bool
ED_gizmo_poll_or_unlink_delayed_from_tool_ex
(
const
bContext
*
C
,
57
wmGizmoGroupType
*gzgt,
58
const
char
*gzgt_idname)
59
{
60
bToolRef_Runtime
*tref_rt =
WM_toolsystem_runtime_from_context
((
bContext
*)
C
);
61
if
((tref_rt ==
NULL
) || !
STREQ
(gzgt_idname, tref_rt->
gizmo_group
)) {
62
ScrArea
*
area
=
CTX_wm_area
(
C
);
63
wmGizmoMapType
*gzmap_type =
WM_gizmomaptype_ensure
(&gzgt->
gzmap_params
);
64
WM_gizmo_group_unlink_delayed_ptr_from_space
(gzgt, gzmap_type,
area
);
65
if
(gzgt->
users
== 0) {
66
WM_gizmo_group_type_unlink_delayed_ptr
(gzgt);
67
}
68
return
false
;
69
}
70
return
true
;
71
}
72
74
bool
ED_gizmo_poll_or_unlink_delayed_from_tool
(
const
bContext
*
C
,
wmGizmoGroupType
*gzgt)
75
{
76
return
ED_gizmo_poll_or_unlink_delayed_from_tool_ex
(
C
, gzgt, gzgt->
idname
);
77
}
BKE_context.h
CTX_wm_area
struct ScrArea * CTX_wm_area(const bContext *C)
Definition:
context.c:714
CTX_wm_manager
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition:
context.c:689
BLI_utildefines.h
STREQ
#define STREQ(a, b)
Definition:
BLI_utildefines.h:666
DNA_workspace_types.h
ED_gizmo_utils.h
C
#define C
Definition:
RandGen.cpp:39
WM_api.h
WM_toolsystem.h
WM_types.h
NULL
return NULL
Definition:
bmesh_operator_api_inline.h:224
ED_gizmo_poll_or_unlink_delayed_from_tool
bool ED_gizmo_poll_or_unlink_delayed_from_tool(const bContext *C, wmGizmoGroupType *gzgt)
Definition:
gizmo_utils.c:74
ED_gizmo_poll_or_unlink_delayed_from_operator
bool ED_gizmo_poll_or_unlink_delayed_from_operator(const bContext *C, wmGizmoGroupType *gzgt, const char *idname)
Definition:
gizmo_utils.c:37
ED_gizmo_poll_or_unlink_delayed_from_tool_ex
bool ED_gizmo_poll_or_unlink_delayed_from_tool_ex(const bContext *C, wmGizmoGroupType *gzgt, const char *gzgt_idname)
Definition:
gizmo_utils.c:56
blender::compositor::area
static void area(int d1, int d2, int e1, int e2, float weights[2])
Definition:
COM_SMAAOperation.cc:123
ListBase::last
void * last
Definition:
DNA_listBase.h:47
ScrArea
Definition:
DNA_screen_types.h:360
bContext
Definition:
context.c:69
bToolRef_Runtime
Definition:
DNA_workspace_types.h:33
bToolRef_Runtime::gizmo_group
char gizmo_group[64]
Definition:
DNA_workspace_types.h:38
wmGizmoGroupType
Definition:
WM_gizmo_types.h:417
wmGizmoGroupType::users
int users
Definition:
WM_gizmo_types.h:469
wmGizmoGroupType::idname
const char * idname
Definition:
WM_gizmo_types.h:418
wmGizmoGroupType::gzmap_params
struct wmGizmoMapType_Params gzmap_params
Definition:
WM_gizmo_types.h:463
wmGizmoMapType
Definition:
wm_gizmo_intern.h:129
wmOperatorType::idname
const char * idname
Definition:
WM_types.h:723
wmOperator
Definition:
DNA_windowmanager_types.h:512
wmOperator::type
struct wmOperatorType * type
Definition:
DNA_windowmanager_types.h:523
wmWindowManager
Definition:
DNA_windowmanager_types.h:137
wmWindowManager::operators
ListBase operators
Definition:
DNA_windowmanager_types.h:155
WM_gizmo_group_type_unlink_delayed_ptr
void WM_gizmo_group_type_unlink_delayed_ptr(wmGizmoGroupType *gzgt)
Definition:
wm_gizmo_group.c:1111
WM_gizmo_group_unlink_delayed_ptr_from_space
void WM_gizmo_group_unlink_delayed_ptr_from_space(wmGizmoGroupType *gzgt, wmGizmoMapType *gzmap_type, ScrArea *area)
Definition:
wm_gizmo_group.c:1124
WM_gizmomaptype_ensure
wmGizmoMapType * WM_gizmomaptype_ensure(const struct wmGizmoMapType_Params *gzmap_params)
Definition:
wm_gizmo_map.c:1217
WM_operator_last_redo
wmOperator * WM_operator_last_redo(const bContext *C)
Definition:
wm_operators.c:1184
WM_toolsystem_runtime_from_context
struct bToolRef_Runtime * WM_toolsystem_runtime_from_context(struct bContext *C)
Definition:
wm_toolsystem.c:91
Generated on Tue Jan 31 2023 14:37:24 for Blender by
doxygen
1.9.1