Blender V5.0
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_lattice.hh"
31#include "overlay_light.hh"
32#include "overlay_lightprobe.hh"
33#include "overlay_mesh.hh"
34#include "overlay_metaball.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
51namespace blender::draw::overlay {
52
57class Instance : public DrawEngine {
58 const SelectionType selection_type_;
59 bool clipping_enabled_;
60
61 public:
63
65 Resources resources = {selection_type_, shapes};
67
71 Origins origins = {selection_type_};
75
109
111
114
115 Instance() : selection_type_(select::SelectionType::DISABLED) {};
116 Instance(const SelectionType selection_type) : selection_type_(selection_type) {};
118 {
120 }
121
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
#define final(a, b, c)
Definition BLI_hash.h:19
static AppView * view
struct blender::draw::overlay::Instance::OverlayLayer selection_type_
Instance(const SelectionType selection_type)
void object_sync(ObjectRef &ob_ref, Manager &manager) final
blender::StringRefNull name_get() final
void DRW_text_cache_destroy(DRWTextStore *dt)
static ulong state[N]
select::SelectionType SelectionType