Blender
V5.0
source
blender
draw
engines
overlay
overlay_instance.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2023 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9
#pragma once
10
11
#include "
overlay_private.hh
"
12
13
#include "
overlay_antialiasing.hh
"
14
#include "
overlay_armature.hh
"
15
#include "
overlay_attribute_text.hh
"
16
#include "
overlay_attribute_viewer.hh
"
17
#include "
overlay_axes.hh
"
18
#include "
overlay_background.hh
"
19
#include "
overlay_bounds.hh
"
20
#include "
overlay_camera.hh
"
21
#include "
overlay_cursor.hh
"
22
#include "
overlay_curve.hh
"
23
#include "
overlay_empty.hh
"
24
#include "
overlay_facing.hh
"
25
#include "
overlay_fade.hh
"
26
#include "
overlay_fluid.hh
"
27
#include "
overlay_force_field.hh
"
28
#include "
overlay_grease_pencil.hh
"
29
#include "
overlay_grid.hh
"
30
#include "
overlay_lattice.hh
"
31
#include "
overlay_light.hh
"
32
#include "
overlay_lightprobe.hh
"
33
#include "
overlay_mesh.hh
"
34
#include "
overlay_metaball.hh
"
35
#include "
overlay_mode_transfer.hh
"
36
#include "
overlay_motion_path.hh
"
37
#include "
overlay_name.hh
"
38
#include "
overlay_origin.hh
"
39
#include "
overlay_outline.hh
"
40
#include "
overlay_paint.hh
"
41
#include "
overlay_particle.hh
"
42
#include "
overlay_pointcloud.hh
"
43
#include "
overlay_prepass.hh
"
44
#include "
overlay_relation.hh
"
45
#include "
overlay_sculpt.hh
"
46
#include "
overlay_speaker.hh
"
47
#include "
overlay_text.hh
"
48
#include "
overlay_wireframe.hh
"
49
#include "
overlay_xray_fade.hh
"
50
51
namespace
blender::draw::overlay
{
52
57
class
Instance
:
public
DrawEngine
{
58
const
SelectionType
selection_type_;
59
bool
clipping_enabled_;
60
61
public
:
62
ShapeCache
shapes
;
63
65
Resources
resources
= {selection_type_,
shapes
};
66
State
state
;
67
69
Background
background
;
70
ImagePrepass
image_prepass
;
71
Origins
origins
= {selection_type_};
72
Outline
outline
;
73
MotionPath
motion_paths
;
74
Cursor
cursor
;
75
76
struct
OverlayLayer
{
77
const
SelectionType
selection_type_
;
78
Armatures
armatures
= {
selection_type_
};
79
AttributeViewer
attribute_viewer
;
80
AttributeTexts
attribute_texts
;
81
Axes
axes
= {
selection_type_
};
82
Bounds
bounds
= {
selection_type_
};
83
Cameras
cameras
= {
selection_type_
};
84
Curves
curves
;
85
Text
text
= {
selection_type_
};
86
Empties
empties
= {
selection_type_
};
87
Facing
facing
;
88
Fade
fade
;
89
Fluids
fluids
= {
selection_type_
};
90
ForceFields
force_fields
= {
selection_type_
};
91
GreasePencil
grease_pencil
;
92
Lattices
lattices
;
93
Lights
lights
= {
selection_type_
};
94
LightProbes
light_probes
= {
selection_type_
};
95
Meshes
meshes
;
96
MeshUVs
mesh_uvs
;
97
Metaballs
metaballs
= {
selection_type_
};
98
ModeTransfer
mode_transfer
;
99
Names
names
;
100
Paints
paints
;
101
Particles
particles
;
102
PointClouds
pointclouds
;
103
Prepass
prepass
;
104
Relations
relations
= {
selection_type_
};
105
Sculpts
sculpts
;
106
Speakers
speakers
= {
selection_type_
};
107
Wireframe
wireframe
;
108
} regular{
selection_type_
}, infront{
selection_type_
};
109
110
Grid
grid
;
111
112
AntiAliasing
anti_aliasing
;
113
XrayFade
xray_fade
;
114
115
Instance
() : selection_type_(
select
::
SelectionType
::DISABLED) {};
116
Instance
(
const
SelectionType
selection_type) : selection_type_(selection_type) {};
117
~Instance
()
118
{
119
DRW_text_cache_destroy
(
state
.dt);
120
}
121
122
blender::StringRefNull
name_get
()
final
123
{
124
return
"Overlay"
;
125
}
126
127
void
init
()
final
;
128
void
begin_sync
()
final
;
129
void
object_sync
(
ObjectRef
&ob_ref,
Manager
&manager)
final
;
130
void
end_sync
()
final
;
131
void
draw
(
Manager
&manager)
final
;
132
133
private:
134
bool
object_is_selected(const
ObjectRef
&ob_ref);
135
bool
object_is_edit_mode(const
Object
*
object
);
136
bool
object_is_paint_mode(const
Object
*
object
);
137
bool
object_is_particle_edit_mode(const
ObjectRef
&ob_ref);
138
/* Checks for both curve sculpt and regular sculpt mode. */
139
bool
object_is_sculpt_mode(const
ObjectRef
&ob_ref);
140
/* Checks only for sculpt mode. */
141
bool
object_is_sculpt_mode(const
Object
*
object
);
142
/* Any mode that requires to view the object without distraction. */
143
bool
object_is_edit_paint_mode(const
ObjectRef
&ob_ref,
144
bool
in_edit_mode,
145
bool
in_paint_mode,
146
bool
in_sculpt_mode);
147
bool
object_is_in_front(const
Object
*
object
, const
State
&
state
);
148
bool
object_needs_prepass(const
ObjectRef
&ob_ref,
bool
in_paint_mode);
149
150
/* Returns true if the object is rendered transparent by the render engine.
151
* Overlays should not rely on the correct depth being available (and do a depth pre-pass). */
152
bool
object_is_rendered_transparent(const
Object
*
object
, const
State
&
state
);
153
154
void
draw_node(
Manager
&manager,
View
&
view
);
155
void
draw_v2d(
Manager
&manager,
View
&
view
);
156
void
draw_v3d(
Manager
&manager,
View
&
view
);
157
158
void
draw_text(
Framebuffer
&framebuffer);
159
160
void
ensure_weight_ramp_texture();
161
};
162
163
}
// namespace blender::draw::overlay
final
#define final(a, b, c)
Definition
BLI_hash.h:19
view
static AppView * view
Definition
FRS_freestyle.cpp:59
blender::StringRefNull
Definition
BLI_string_ref.hh:132
blender::draw::Framebuffer
Definition
DRW_gpu_wrapper.hh:1202
blender::draw::Manager
Definition
draw_manager.hh:45
blender::draw::ObjectRef
Definition
draw_handle.hh:207
blender::draw::View
Definition
draw_view.hh:37
blender::draw::overlay::AntiAliasing
Definition
overlay_antialiasing.hh:51
blender::draw::overlay::Armatures
Definition
overlay_armature.hh:33
blender::draw::overlay::AttributeTexts
Definition
overlay_attribute_text.hh:41
blender::draw::overlay::AttributeViewer
Definition
overlay_attribute_viewer.hh:26
blender::draw::overlay::Axes
Definition
overlay_axes.hh:22
blender::draw::overlay::Background
Definition
overlay_background.hh:22
blender::draw::overlay::Cameras
Definition
overlay_camera.hh:56
blender::draw::overlay::Cursor
Definition
overlay_cursor.hh:28
blender::draw::overlay::Curves
Definition
overlay_curve.hh:27
blender::draw::overlay::Empties
Definition
overlay_empty.hh:20
blender::draw::overlay::Facing
Definition
overlay_facing.hh:23
blender::draw::overlay::Fade
Definition
overlay_fade.hh:23
blender::draw::overlay::Fluids
Definition
overlay_fluid.hh:23
blender::draw::overlay::ForceFields
Definition
overlay_force_field.hh:25
blender::draw::overlay::GreasePencil
Definition
overlay_grease_pencil.hh:35
blender::draw::overlay::Grid
Definition
overlay_grid.hh:29
blender::draw::overlay::ImagePrepass
Definition
overlay_prepass.hh:26
blender::draw::overlay::Instance::resources
Resources resources
Definition
overlay_instance.hh:65
blender::draw::overlay::Instance::selection_type_
struct blender::draw::overlay::Instance::OverlayLayer selection_type_
blender::draw::overlay::Instance::motion_paths
MotionPath motion_paths
Definition
overlay_instance.hh:73
blender::draw::overlay::Instance::~Instance
~Instance()
Definition
overlay_instance.hh:117
blender::draw::overlay::Instance::Instance
Instance(const SelectionType selection_type)
Definition
overlay_instance.hh:116
blender::draw::overlay::Instance::outline
Outline outline
Definition
overlay_instance.hh:72
blender::draw::overlay::Instance::end_sync
void end_sync() final
Definition
overlay_instance.cc:653
blender::draw::overlay::Instance::Instance
Instance()
Definition
overlay_instance.hh:115
blender::draw::overlay::Instance::begin_sync
void begin_sync() final
Definition
overlay_instance.cc:430
blender::draw::overlay::Instance::state
State state
Definition
overlay_instance.hh:66
blender::draw::overlay::Instance::object_sync
void object_sync(ObjectRef &ob_ref, Manager &manager) final
Definition
overlay_instance.cc:490
blender::draw::overlay::Instance::name_get
blender::StringRefNull name_get() final
Definition
overlay_instance.hh:122
blender::draw::overlay::Instance::image_prepass
ImagePrepass image_prepass
Definition
overlay_instance.hh:70
blender::draw::overlay::Instance::init
void init() final
Definition
overlay_instance.cc:21
blender::draw::overlay::Instance::origins
Origins origins
Definition
overlay_instance.hh:71
blender::draw::overlay::Instance::xray_fade
XrayFade xray_fade
Definition
overlay_instance.hh:113
blender::draw::overlay::Instance::anti_aliasing
AntiAliasing anti_aliasing
Definition
overlay_instance.hh:112
blender::draw::overlay::Instance::cursor
Cursor cursor
Definition
overlay_instance.hh:74
blender::draw::overlay::Instance::grid
Grid grid
Definition
overlay_instance.hh:110
blender::draw::overlay::Instance::background
Background background
Definition
overlay_instance.hh:69
blender::draw::overlay::Instance::shapes
ShapeCache shapes
Definition
overlay_instance.hh:62
blender::draw::overlay::Lattices
Definition
overlay_lattice.hh:21
blender::draw::overlay::LightProbes
Definition
overlay_lightprobe.hh:20
blender::draw::overlay::Lights
Definition
overlay_light.hh:19
blender::draw::overlay::MeshUVs
Definition
overlay_mesh.hh:484
blender::draw::overlay::Meshes
Definition
overlay_mesh.hh:45
blender::draw::overlay::Metaballs
Definition
overlay_metaball.hh:22
blender::draw::overlay::ModeTransfer
Definition
overlay_mode_transfer.hh:26
blender::draw::overlay::MotionPath
Definition
overlay_motion_path.hh:26
blender::draw::overlay::Names
Definition
overlay_name.hh:21
blender::draw::overlay::Origins
Definition
overlay_origin.hh:21
blender::draw::overlay::Outline
Definition
overlay_outline.hh:24
blender::draw::overlay::Paints
Definition
overlay_paint.hh:28
blender::draw::overlay::Particles
Definition
overlay_particle.hh:28
blender::draw::overlay::PointClouds
Definition
overlay_pointcloud.hh:21
blender::draw::overlay::Prepass
Definition
overlay_prepass.hh:61
blender::draw::overlay::Relations
Definition
overlay_relation.hh:26
blender::draw::overlay::Sculpts
Definition
overlay_sculpt.hh:34
blender::draw::overlay::ShapeCache
Definition
overlay_private.hh:327
blender::draw::overlay::Speakers
Definition
overlay_speaker.hh:20
blender::draw::overlay::Text
Definition
overlay_text.hh:24
blender::draw::overlay::Wireframe
Definition
overlay_wireframe.hh:32
blender::draw::overlay::XrayFade
Definition
overlay_xray_fade.hh:20
DRW_text_cache_destroy
void DRW_text_cache_destroy(DRWTextStore *dt)
Definition
draw_manager_text.cc:82
state
static ulong state[N]
Definition
mathutils_noise.cc:56
blender::draw::overlay
Definition
overlay_antialiasing.hh:49
blender::draw::overlay::SelectionType
select::SelectionType SelectionType
Definition
overlay_private.hh:117
blender::draw::select
Definition
select_engine.hh:36
blender::draw
Definition
DRW_engine.hh:179
overlay_antialiasing.hh
overlay_armature.hh
overlay_attribute_text.hh
overlay_attribute_viewer.hh
overlay_axes.hh
overlay_background.hh
overlay_bounds.hh
overlay_camera.hh
overlay_cursor.hh
overlay_curve.hh
overlay_empty.hh
overlay_facing.hh
overlay_fade.hh
overlay_fluid.hh
overlay_force_field.hh
overlay_grease_pencil.hh
overlay_grid.hh
overlay_lattice.hh
overlay_light.hh
overlay_lightprobe.hh
overlay_mesh.hh
overlay_metaball.hh
overlay_mode_transfer.hh
overlay_motion_path.hh
overlay_name.hh
overlay_origin.hh
overlay_outline.hh
overlay_paint.hh
overlay_particle.hh
overlay_pointcloud.hh
overlay_prepass.hh
overlay_private.hh
overlay_relation.hh
overlay_sculpt.hh
overlay_speaker.hh
overlay_text.hh
overlay_wireframe.hh
overlay_xray_fade.hh
DrawEngine
Definition
DRW_render.hh:69
Object
Definition
DNA_object_types.h:191
blender::Bounds
Definition
BLI_bounds_types.hh:13
blender::draw::overlay::Instance::OverlayLayer
Definition
overlay_instance.hh:76
blender::draw::overlay::Instance::OverlayLayer::names
Names names
Definition
overlay_instance.hh:99
blender::draw::overlay::Instance::OverlayLayer::axes
Axes axes
Definition
overlay_instance.hh:81
blender::draw::overlay::Instance::OverlayLayer::fade
Fade fade
Definition
overlay_instance.hh:88
blender::draw::overlay::Instance::OverlayLayer::armatures
Armatures armatures
Definition
overlay_instance.hh:78
blender::draw::overlay::Instance::OverlayLayer::mesh_uvs
MeshUVs mesh_uvs
Definition
overlay_instance.hh:96
blender::draw::overlay::Instance::OverlayLayer::metaballs
Metaballs metaballs
Definition
overlay_instance.hh:97
blender::draw::overlay::Instance::OverlayLayer::attribute_texts
AttributeTexts attribute_texts
Definition
overlay_instance.hh:80
blender::draw::overlay::Instance::OverlayLayer::mode_transfer
ModeTransfer mode_transfer
Definition
overlay_instance.hh:98
blender::draw::overlay::Instance::OverlayLayer::speakers
Speakers speakers
Definition
overlay_instance.hh:106
blender::draw::overlay::Instance::OverlayLayer::prepass
Prepass prepass
Definition
overlay_instance.hh:103
blender::draw::overlay::Instance::OverlayLayer::curves
Curves curves
Definition
overlay_instance.hh:84
blender::draw::overlay::Instance::OverlayLayer::empties
Empties empties
Definition
overlay_instance.hh:86
blender::draw::overlay::Instance::OverlayLayer::attribute_viewer
AttributeViewer attribute_viewer
Definition
overlay_instance.hh:79
blender::draw::overlay::Instance::OverlayLayer::selection_type_
const SelectionType selection_type_
Definition
overlay_instance.hh:77
blender::draw::overlay::Instance::OverlayLayer::relations
Relations relations
Definition
overlay_instance.hh:104
blender::draw::overlay::Instance::OverlayLayer::cameras
Cameras cameras
Definition
overlay_instance.hh:83
blender::draw::overlay::Instance::OverlayLayer::sculpts
Sculpts sculpts
Definition
overlay_instance.hh:105
blender::draw::overlay::Instance::OverlayLayer::lattices
Lattices lattices
Definition
overlay_instance.hh:92
blender::draw::overlay::Instance::OverlayLayer::wireframe
Wireframe wireframe
Definition
overlay_instance.hh:107
blender::draw::overlay::Instance::OverlayLayer::particles
Particles particles
Definition
overlay_instance.hh:101
blender::draw::overlay::Instance::OverlayLayer::facing
Facing facing
Definition
overlay_instance.hh:87
blender::draw::overlay::Instance::OverlayLayer::paints
Paints paints
Definition
overlay_instance.hh:100
blender::draw::overlay::Instance::OverlayLayer::light_probes
LightProbes light_probes
Definition
overlay_instance.hh:94
blender::draw::overlay::Instance::OverlayLayer::meshes
Meshes meshes
Definition
overlay_instance.hh:95
blender::draw::overlay::Instance::OverlayLayer::pointclouds
PointClouds pointclouds
Definition
overlay_instance.hh:102
blender::draw::overlay::Instance::OverlayLayer::force_fields
ForceFields force_fields
Definition
overlay_instance.hh:90
blender::draw::overlay::Instance::OverlayLayer::grease_pencil
GreasePencil grease_pencil
Definition
overlay_instance.hh:91
blender::draw::overlay::Instance::OverlayLayer::fluids
Fluids fluids
Definition
overlay_instance.hh:89
blender::draw::overlay::Instance::OverlayLayer::bounds
Bounds bounds
Definition
overlay_instance.hh:82
blender::draw::overlay::Instance::OverlayLayer::lights
Lights lights
Definition
overlay_instance.hh:93
blender::draw::overlay::Instance::OverlayLayer::text
Text text
Definition
overlay_instance.hh:85
blender::draw::overlay::Resources
Definition
overlay_private.hh:588
blender::draw::overlay::State
Definition
overlay_private.hh:125
Generated on
for Blender by
doxygen
1.16.1