Blender
V5.3
source
blender
draw
engines
overlay
overlay_name.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2024 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9
#pragma once
10
11
#include "
draw_manager_text.hh
"
12
13
#include "
overlay_base.hh
"
14
15
namespace
blender::draw::overlay
{
16
21
class
Names
:
Overlay
{
22
public
:
23
void
begin_sync
(
Resources
&res,
const
State
&
state
)
final
24
{
25
enabled_
=
state
.is_space_v3d() && !res.is_selection();
26
enabled_
&=
state
.show_text;
27
28
if
(!
enabled_
) {
29
return
;
30
}
31
}
32
33
void
object_sync
(
Manager
&
/*manager*/
,
34
const
ObjectRef
&ob_ref,
35
Resources
&res,
36
const
State
&
state
)
final
37
{
38
if
(!
enabled_
) {
39
return
;
40
}
41
42
Object
*ob = ob_ref.object;
43
44
if
(is_from_dupli_or_set(ob)) {
45
return
;
46
}
47
48
if
((ob->
dtx
&
OB_DRAWNAME
) == 0) {
49
return
;
50
}
51
52
ThemeColorID
theme_id = res.object_wire_theme_id(ob_ref,
state
);
53
54
uchar
color
[4];
55
/* Color Management: Exception here as texts are drawn in sRGB space directly. */
56
ui::theme::get_color_4ubv
(theme_id,
color
);
57
58
DRW_text_cache_add
(
state
.dt,
59
ob->object_to_world().location(),
60
ob->
id
.
name
+ 2,
61
strlen(ob->
id
.
name
+ 2),
62
10,
63
0,
64
DRW_TEXT_CACHE_GLOBALSPACE
|
DRW_TEXT_CACHE_STRING_PTR
,
65
color
);
66
}
67
};
68
69
}
// namespace blender::draw::overlay
blender::draw::Manager
Definition
draw_manager.hh:56
blender::draw::ObjectRef
Definition
draw_handle.hh:222
blender::draw::overlay::Names
Definition
overlay_name.hh:21
blender::draw::overlay::Names::object_sync
void object_sync(Manager &, const ObjectRef &ob_ref, Resources &res, const State &state) final
Definition
overlay_name.hh:33
blender::draw::overlay::Names::begin_sync
void begin_sync(Resources &res, const State &state) final
Definition
overlay_name.hh:23
draw_manager_text.hh
state
const int state
Definition
kernel/device/gpu/kernel.h:140
blender::color
Definition
BLI_color.hh:32
blender::draw::overlay
Definition
overlay_antialiasing.hh:49
blender::ui::theme::get_color_4ubv
void get_color_4ubv(int colorid, unsigned char col[4])
Definition
resources.cc:1427
blender::DRW_TEXT_CACHE_GLOBALSPACE
@ DRW_TEXT_CACHE_GLOBALSPACE
Definition
draw_manager_text.hh:48
blender::DRW_TEXT_CACHE_STRING_PTR
@ DRW_TEXT_CACHE_STRING_PTR
Definition
draw_manager_text.hh:51
blender::ThemeColorID
ThemeColorID
Definition
UI_resources.hh:43
blender::uchar
unsigned char uchar
Definition
BKE_text.h:58
blender::DRW_text_cache_add
void DRW_text_cache_add(DRWTextStore *dt, const float co[3], const char *str, const int str_len, short xoffs, short yoffs, short flag, const uchar col[4], const bool shadow, const bool align_center)
Definition
draw_manager_text.cc:87
blender::OB_DRAWNAME
@ OB_DRAWNAME
Definition
DNA_object_types.h:182
overlay_base.hh
blender::ID::name
char name[258]
Definition
DNA_ID.h:433
blender::Object
Definition
DNA_object_types.h:466
blender::Object::dtx
eObject_DrawExtraFlag dtx
Definition
DNA_object_types.h:593
blender::Object::id
ID id
Definition
DNA_object_types.h:473
blender::draw::overlay::Overlay
Definition
overlay_base.hh:22
blender::draw::overlay::Overlay::enabled_
bool enabled_
Definition
overlay_base.hh:29
blender::draw::overlay::Resources
Definition
overlay_private.hh:601
blender::draw::overlay::State
Definition
overlay_private.hh:128
Generated on
for Blender by
doxygen
1.18.0