Blender V4.5
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){};
117
119 {
120 return "Overlay";
121 }
122
123 void init() final;
124 void begin_sync() final;
125 void object_sync(ObjectRef &ob_ref, Manager &manager) final;
126 void end_sync() final;
127 void draw(Manager &manager) final;
128
129 private:
130 bool object_is_selected(const ObjectRef &ob_ref);
131 bool object_is_edit_mode(const Object *object);
132 bool object_is_paint_mode(const Object *object);
133 bool object_is_particle_edit_mode(const ObjectRef &ob_ref);
134 /* Checks for both curve sculpt and regular sculpt mode. */
135 bool object_is_sculpt_mode(const ObjectRef &ob_ref);
136 /* Checks only for sculpt mode. */
137 bool object_is_sculpt_mode(const Object *object);
138 /* Any mode that requires to view the object without distraction. */
139 bool object_is_edit_paint_mode(const ObjectRef &ob_ref,
140 bool in_edit_mode,
141 bool in_paint_mode,
142 bool in_sculpt_mode);
143 bool object_is_in_front(const Object *object, const State &state);
144 bool object_needs_prepass(const ObjectRef &ob_ref, bool in_paint_mode);
145
146 /* Returns true if the object is rendered transparent by the render engine.
147 * Overlays should not rely on the correct depth being available (and do a depth pre-pass). */
148 bool object_is_rendered_transparent(const Object *object, const State &state);
149
150 void draw_node(Manager &manager, View &view);
151 void draw_v2d(Manager &manager, View &view);
152 void draw_v3d(Manager &manager, View &view);
153
154 void ensure_weight_ramp_texture();
155};
156
157} // 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
static ulong state[N]
select::SelectionType SelectionType