Blender V5.3
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
14#include "overlay_armature.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"
29#include "overlay_grid.hh"
30#include "overlay_gsplat.hh"
31#include "overlay_lattice.hh"
32#include "overlay_light.hh"
33#include "overlay_lightprobe.hh"
34#include "overlay_mesh.hh"
35#include "overlay_metaball.hh"
38#include "overlay_name.hh"
39#include "overlay_origin.hh"
40#include "overlay_outline.hh"
41#include "overlay_paint.hh"
42#include "overlay_particle.hh"
43#include "overlay_pointcloud.hh"
44#include "overlay_prepass.hh"
45#include "overlay_relation.hh"
46#include "overlay_sculpt.hh"
47#include "overlay_speaker.hh"
48#include "overlay_text.hh"
49#include "overlay_wireframe.hh"
50#include "overlay_xray_fade.hh"
51
52namespace blender::draw::overlay {
53
58class Instance : public DrawEngine {
59 const SelectionType selection_type_;
60 bool clipping_enabled_;
61
62 public:
64
66 Resources resources = {selection_type_, shapes};
68
72 Origins origins = {selection_type_};
76
111
115
116 Instance() : selection_type_(select::SelectionType::DISABLED) {};
117 Instance(const SelectionType selection_type) : selection_type_(selection_type) {};
118 ~Instance() override
119 {
121 }
122
124 {
125 return "Overlay";
126 }
127
128 void init() final;
129 void begin_sync() final;
130 void object_sync(ObjectRef &ob_ref, Manager &manager) final;
131 void end_sync() final;
132 void draw(Manager &manager) final;
133
134 private:
135 bool object_is_selected(const ObjectRef &ob_ref);
136 bool object_is_edit_mode(const Object *object);
137 bool object_is_paint_mode(const Object *object);
138 bool object_is_particle_edit_mode(const ObjectRef &ob_ref);
139 /* Checks for both curve sculpt and regular sculpt mode. */
140 bool object_is_sculpt_mode(const ObjectRef &ob_ref);
141 /* Checks only for sculpt mode. */
142 bool object_is_sculpt_mode(const Object *object);
143 /* Any mode that requires to view the object without distraction. */
144 bool object_is_edit_paint_mode(const ObjectRef &ob_ref,
145 bool in_edit_mode,
146 bool in_paint_mode,
147 bool in_sculpt_mode);
148 bool object_is_in_front(const Object *object, const State &state);
149 bool object_needs_prepass(const ObjectRef &ob_ref, bool in_paint_mode);
150
151 /* Returns true if the object is rendered transparent by the render engine.
152 * Overlays should not rely on the correct depth being available (and do a depth pre-pass). */
153 bool object_is_rendered_transparent(const Object *object, const State &state);
154
155 void draw_node(Manager &manager, View &view);
156 void draw_v2d(Manager &manager, View &view);
157 void draw_v3d(Manager &manager, View &view);
158
159 void draw_text(Framebuffer &framebuffer);
160
161 void ensure_weight_ramp_texture();
162};
163
164} // namespace blender::draw::overlay
#define final(a, b, c)
Definition BLI_hash_c.hh:21
struct blender::draw::overlay::Instance::OverlayLayer selection_type_
Instance(const SelectionType selection_type)
void object_sync(ObjectRef &ob_ref, Manager &manager) final
const int state
select::SelectionType SelectionType
void DRW_text_cache_destroy(DRWTextStore *dt)
TokenType select(char char_value, char char_class, bool cond)
Definition lexit.cc:418