Blender V5.3
overlay_grease_pencil.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 "BLI_bounds.hh"
12#include "BLI_math_matrix.hh"
13#include "BLI_math_matrix_c.hh"
14
15#include "BKE_curves.hh"
16#include "BKE_grease_pencil.hh"
17#include "BKE_material.hh"
18#include "BKE_object.hh"
19
20#include "DNA_material_types.h"
21
22#include "ED_grease_pencil.hh"
23
24#include "draw_cache.hh"
25#include "draw_manager_text.hh"
26
27#include "overlay_base.hh"
28
29namespace blender::draw::overlay {
30
36 private:
37 PassSimple edit_grease_pencil_ps_ = {"GPencil Edit"};
38 PassSimple::Sub *edit_handles_ = nullptr;
39 PassSimple::Sub *edit_points_ = nullptr;
40 PassSimple::Sub *edit_lines_ = nullptr;
41
42 PassSimple grid_ps_ = {"GPencil Grid"};
43
44 bool show_handles_ = false;
45 bool show_points_ = false;
46 bool show_lines_ = false;
47 bool show_grid_ = false;
48 bool show_weight_ = false;
49 bool show_material_name_ = false;
50 bool skip_unselected_ = false;
51
52 /* TODO(fclem): This is quite wasteful and expensive, prefer in shader Z modification like the
53 * retopology offset. */
54 View view_edit_cage_ = {"view_edit_cage"};
55 View::OffsetData offset_data_;
56
57 public:
58 void begin_sync(Resources &res, const State &state) final
59 {
60 enabled_ = state.is_space_v3d();
61
62 res.depth_planes.clear();
63 res.depth_planes_count = 0;
64
65 if (!enabled_) {
66 return;
67 }
68
69 offset_data_ = state.offset_data_get();
70
71 const View3D *v3d = state.v3d;
72 const ToolSettings *ts = state.scene->toolsettings;
73
74 show_material_name_ = (v3d->gp_flag & V3D_GP_SHOW_MATERIAL_NAME) && state.show_text;
75 const bool show_lines = (v3d->gp_flag & V3D_GP_SHOW_EDIT_LINES);
76 const bool show_direction = (v3d->gp_flag & V3D_GP_SHOW_STROKE_DIRECTION);
77
78 show_handles_ = show_points_ = show_lines_ = show_weight_ = false;
79
80 switch (state.object_mode) {
82 /* In Draw Mode, show selected strokes when a selection tool is active. */
83 if (state.active_tool && (STREQ(state.active_tool->idname, "builtin.select_lasso") ||
84 STREQ(state.active_tool->idname, "builtin.select_circle") ||
85 STREQ(state.active_tool->idname, "builtin.select") ||
86 STREQ(state.active_tool->idname, "builtin.select_box")))
87 {
88 show_lines_ = true;
89 skip_unselected_ = true;
90 }
91 break;
93 /* Vertex paint mode. */
94 show_points_ = ts->gpencil_selectmode_vertex &
96 show_lines_ = show_lines && ts->gpencil_selectmode_vertex;
97 break;
98 case OB_MODE_EDIT:
99 /* Edit mode. */
100 show_points_ = ELEM(
102 show_lines_ = show_lines;
103 show_handles_ = show_points_;
104 break;
106 /* Weight paint mode. */
107 show_points_ = true;
108 show_lines_ = show_lines;
109 show_weight_ = true;
110 break;
112 /* Sculpt mode. */
113 show_points_ = ts->gpencil_selectmode_sculpt &
115 show_lines_ = show_lines && ts->gpencil_selectmode_sculpt;
116 break;
117 default:
118 /* Not a Grease Pencil mode. */
119 break;
120 }
121
122 edit_handles_ = nullptr;
123 edit_points_ = nullptr;
124 edit_lines_ = nullptr;
125
126 {
127 auto &pass = edit_grease_pencil_ps_;
128 pass.init();
129 pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
130 pass.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
133 state.clipping_plane_count);
134
135 const int handle_display = show_handles_ ? int(state.overlay.handle_display) :
137
138 if (show_lines_) {
139 auto &sub = pass.sub("Lines");
140 sub.shader_set(res.shaders->curve_edit_line.get());
141 sub.bind_texture("weight_tx", &res.weight_ramp_tx);
142 sub.push_constant("use_weight", show_weight_);
143 sub.push_constant("use_grease_pencil", true);
144 sub.push_constant("skip_unselected", skip_unselected_);
145 edit_lines_ = ⊂
146 }
147
148 if (show_handles_) {
149 auto &sub = pass.sub("Handles");
150 sub.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
151 sub.shader_set(res.shaders->curve_edit_handles.get());
152 sub.push_constant("show_curve_handles", handle_display != int(CURVE_HANDLE_NONE));
153 sub.push_constant("curve_handle_display", handle_display);
154 edit_handles_ = ⊂
155 }
156
157 if (show_points_) {
158 auto &sub = pass.sub("Points");
159 sub.shader_set(res.shaders->curve_edit_points.get());
160 sub.bind_texture("weight_tx", &res.weight_ramp_tx);
161 sub.push_constant("use_weight", show_weight_);
162 sub.push_constant("use_grease_pencil", true);
163 sub.push_constant("do_stroke_endpoints", show_direction);
164 sub.push_constant("curve_handle_display", handle_display);
165 edit_points_ = ⊂
166 }
167 }
168
169 const bool is_depth_projection_mode = ts->gpencil_v3d_align &
171 show_grid_ = (v3d->gp_flag & V3D_GP_SHOW_GRID) && !is_depth_projection_mode;
172
173 {
174 const bool grid_xray = (v3d->gp_flag & V3D_GP_SHOW_GRID_XRAY);
175 DRWState depth_write_state = (grid_xray) ? DRW_STATE_DEPTH_ALWAYS :
177 auto &pass = grid_ps_;
178 pass.init();
179 pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA | depth_write_state,
180 state.clipping_plane_count);
181 if (show_grid_) {
182 const float4 col_grid(float3(state.overlay.gpencil_grid_color),
183 state.overlay.gpencil_grid_opacity);
184 pass.shader_set(res.shaders->grid_grease_pencil.get());
185 pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
186 pass.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
187 pass.push_constant("color", col_grid);
188 }
189 }
190 }
191
193 const ObjectRef &ob_ref,
194 Resources &res,
195 const State &state) final
196 {
197 if (!enabled_) {
198 return;
199 }
200
201 Object *ob = ob_ref.object;
202
203 if (show_lines_) {
204 gpu::Batch *geom = show_weight_ ? DRW_cache_grease_pencil_weight_lines_get(state.scene, ob) :
206 if (geom) {
207 edit_lines_->draw(geom, manager.unique_handle(ob_ref));
208 }
209 }
210 if (show_handles_) {
211 gpu::Batch *geom = DRW_cache_grease_pencil_edit_handles_get(state.scene, ob);
212 if (geom) {
213 edit_handles_->draw_expand(geom, GPU_PRIM_TRIS, 8, 1, manager.unique_handle(ob_ref));
214 }
215 }
216 if (show_points_) {
217 gpu::Batch *geom = show_weight_ ?
220 if (geom) {
221 edit_points_->draw(geom, manager.unique_handle(ob_ref));
222 }
223 }
224
225 if (show_material_name_) {
226 draw_material_names(ob_ref, state, res);
227 }
228 }
229
231 const ObjectRef &ob_ref,
232 Resources &res,
233 const State &state)
234 {
235 /* Reuse same logic as edit mode. */
236 edit_object_sync(manager, ob_ref, res, state);
237 }
238
240 const ObjectRef &ob_ref,
241 Resources &res,
242 const State &state)
243 {
244 /* Reuse same logic as edit mode. */
245 edit_object_sync(manager, ob_ref, res, state);
246 }
247
248 void object_sync(Manager & /*manager*/,
249 const ObjectRef &ob_ref,
250 Resources & /*res*/,
251 const State &state) final
252 {
253 if (!enabled_) {
254 return;
255 }
256
257 if (ob_ref.object != state.object_active) {
258 /* Only display for the active object. */
259 return;
260 }
261
262 if (show_grid_) {
263 const int grid_lines = state.v3d->overlay.gpencil_grid_subdivisions;
264 const int line_count = grid_lines * 4 + 2;
265
266 const float3 grid_offset = float3(float2(state.v3d->overlay.gpencil_grid_offset), 0.0f);
267 const float3 grid_scale = float3(float2(state.v3d->overlay.gpencil_grid_scale), 0.0f);
268 const float4x4 transform_mat = math::from_loc_scale<float4x4>(grid_offset, grid_scale);
269
270 const float4x4 grid_mat = grid_matrix_get(*ob_ref.object, state.scene) * transform_mat;
271
272 grid_ps_.push_constant("axis_x", grid_mat.x_axis());
273 grid_ps_.push_constant("axis_y", grid_mat.y_axis());
274 grid_ps_.push_constant("origin", grid_mat.location());
275 grid_ps_.push_constant("half_line_count", line_count / 2);
276 grid_ps_.draw_procedural(GPU_PRIM_LINES, 1, line_count * 2);
277 }
278 }
279
280 static void compute_depth_planes(Manager &manager,
281 View &view,
282 Resources &res,
283 const State & /*state*/)
284 {
285 for (auto i : IndexRange(res.depth_planes_count)) {
286 GreasePencilDepthPlane &plane = res.depth_planes[i];
287 const float4x4 &object_to_world =
288 manager.matrix_buf.current().get_or_resize(plane.handle.index()).model;
289 plane.plane = GreasePencil::depth_plane_get(object_to_world, plane.bounds, view);
290 }
291 }
292
293 void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
294 {
295 if (!enabled_) {
296 return;
297 }
298
299 GPU_framebuffer_bind(framebuffer);
300 manager.submit(grid_ps_, view);
301 }
302
303 void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view) final
304 {
305 if (!enabled_) {
306 return;
307 }
308
309 view_edit_cage_.sync(view.viewmat(), offset_data_.winmat_polygon_offset(view.winmat(), 0.5f));
310
311 GPU_framebuffer_bind(framebuffer);
312 manager.submit(edit_grease_pencil_ps_, view_edit_cage_);
313 }
314
316 PassMain::Sub &pass,
317 const Scene *scene,
318 Object *ob,
319 ResourceHandleRange res_handle,
321 {
322 using namespace blender::ed::greasepencil;
324 *ob);
325
326 const bool is_stroke_order_3d = (grease_pencil.flag & GREASE_PENCIL_STROKE_ORDER_3D) != 0;
327
328 if (is_stroke_order_3d) {
329 pass.push_constant("gp_depth_plane", float4(0.0f));
330 }
331 else {
332 int64_t index = res.depth_planes.append_and_get_index({});
333 res.depth_planes_count++;
334
336 plane.bounds = BKE_object_boundbox_get(ob).value_or(blender::Bounds(float3(0)));
337 plane.handle = res_handle;
338
339 pass.push_constant("gp_depth_plane", &plane.plane);
340 }
341
342 int t_offset = 0;
343 const Vector<DrawingInfo> drawings = retrieve_visible_drawings(*scene, grease_pencil, true);
344 for (const DrawingInfo info : drawings) {
345
348
349 pass.push_constant("gp_stroke_order3d", is_stroke_order_3d);
350 pass.bind_texture("gp_pos_tx", position_tx);
351 pass.bind_texture("gp_col_tx", color_tx);
352
353 const bke::CurvesGeometry &curves = info.drawing.strokes();
354 const OffsetIndices<int> points_by_curve = curves.evaluated_points_by_curve();
355 const bke::AttributeAccessor attributes = curves.attributes();
356 const std::optional<GroupedSpan<int3>> triangles = info.drawing.triangles();
357 const VArray<int> stroke_materials = *attributes.lookup_or_default<int>(
358 "material_index", bke::AttrDomain::Curve, 0);
359 const VArray<bool> cyclic = *attributes.lookup_or_default<bool>(
360 "cyclic", bke::AttrDomain::Curve, false);
361
362 const VArray<bool> hide_stroke = *attributes.lookup_or_default<bool>(
363 "hide_stroke", bke::AttrDomain::Curve, false);
364 const VArray<int> fill_ids = *attributes.lookup_or_default<int>(
365 "fill_id", bke::AttrDomain::Curve, 0);
366
367 IndexMaskMemory memory;
369 *ob, info.drawing, memory);
370 const std::optional<GroupedSpan<int>> fills = info.drawing.fills();
371
372 const bool hide_onion = info.onion_id != 0;
373
374 int fill_index = 0;
375
376 Array<int> fill_index_by_curves(curves.curves_num(), -1);
377 Array<int> first_curves(curves.curves_num());
379
380 for (const int curve_i : curves.curves_range()) {
381 const bool is_filled = fill_ids[curve_i] != 0;
382 const bool active_filled = is_filled && (fill_index_by_curves[curve_i] == -1);
383
384 /* Keep track of already rendered fills. */
385 if (active_filled) {
386 const Span<int> fill = (*fills)[fill_index];
387 const int first_curve = fill.first();
388 for (const int pos : fill.index_range()) {
389 const int curve_i = fill[pos];
390 fill_index_by_curves[curve_i] = fill_index;
391 first_curves[curve_i] = first_curve;
392 }
393
394 fill_index++;
395 }
396 }
397
398 visible_strokes.foreach_index([&](const int curve_i) {
399 /* Will be `-1` if not a fill. */
400 const int fill_index = fill_index_by_curves[curve_i];
401
402 const bool is_filled = fill_index != -1;
403 const bool active_filled = is_filled && (first_curves[curve_i] == curve_i);
404
405 const int material_index = stroke_materials[curve_i];
406 MaterialGPencilStyle *gp_style = BKE_gpencil_material_settings(ob, material_index + 1);
407
408 const bool hide_material = (gp_style->flag & GP_MATERIAL_HIDE) != 0;
409
410 const int num_stroke_triangles = (active_filled && triangles.has_value()) ?
411 (*triangles)[fill_index].size() :
412 0;
413
414 const IndexRange points = points_by_curve[curve_i];
415 const int num_stroke_vertices = (points.size() +
416 int(cyclic[curve_i] && (points.size() >= 3)));
417
418 if (hide_material || hide_onion) {
419 t_offset += num_stroke_triangles;
420 t_offset += num_stroke_vertices * 2;
421 return;
422 }
423
424 gpu::Batch *geom = draw::DRW_cache_grease_pencil_get(scene, ob);
425
426 const bool show_stroke = !hide_stroke[curve_i];
427 const bool show_fill = (num_stroke_triangles != 0) && active_filled;
428
429 if (show_fill) {
430 const int v_first = t_offset * 3;
431 const int v_count = num_stroke_triangles * 3;
432 pass.draw(geom, 1, v_count, v_first, res_handle, select_id.get());
433 }
434
435 if (active_filled) {
436 t_offset += num_stroke_triangles;
437 }
438
439 if (show_stroke) {
440 const int v_first = t_offset * 3;
441 const int v_count = num_stroke_vertices * 2 * 3;
442 pass.draw(geom, 1, v_count, v_first, res_handle, select_id.get());
443 }
444 t_offset += num_stroke_vertices * 2;
445 });
446 }
447 }
448
449 private:
450 /* Returns the normal plane in NDC space. */
451 static float4 depth_plane_get(const float4x4 &object_to_world,
453 const View &view)
454 {
455 using namespace blender::math;
456
457 /* Find the normal most likely to represent the grease pencil object. */
458 /* TODO: This does not work quite well if you use
459 * strokes not aligned with the object axes. Maybe we could try to
460 * compute the minimum axis of all strokes. But this would be more
461 * computationally heavy and should go into the GPData evaluation. */
462 float3 center = bounds.center();
463 float3 size = bounds.size();
464 /* Avoid division by 0.0 later. */
465 size += 1e-8f;
466
467 /* Convert Bbox unit space to object space. */
468 float4x4 bbox_to_object = from_loc_scale<float4x4>(center, size * 0.5f);
469 float4x4 bbox_to_world = object_to_world * bbox_to_object;
470
471 float3 bbox_center = bbox_to_world.location();
472 float3 view_vector = (view.is_persp()) ? (view.location() - bbox_center) : view.forward();
473
474 float3x3 world_to_bbox = invert(float3x3(bbox_to_world));
475
476 /* Normalize the vector in BBox space. */
477 float3 local_plane_direction = normalize(transform_direction(world_to_bbox, view_vector));
478 /* `bbox_to_world_normal` is a "normal" matrix. It transforms BBox space normals to world. */
479 float3x3 bbox_to_world_normal = transpose(world_to_bbox);
480 float3 plane_direction = normalize(
481 transform_direction(bbox_to_world_normal, local_plane_direction));
482
483 return float4(plane_direction, -dot(plane_direction, bbox_center));
484 }
485
486 float4x4 grid_matrix_get(const Object &object, const Scene *scene)
487 {
488 const ToolSettings *ts = scene->toolsettings;
489
492 const bke::greasepencil::Layer *active_layer = grease_pencil.get_active_layer();
493
494 float4x4 mat = object.object_to_world();
495 if (active_layer && ts->gp_sculpt.lock_axis != GP_LOCKAXIS_CURSOR) {
496 mat = active_layer->to_world_space(object);
497 }
498 const View3DCursor *cursor = &scene->cursor;
499
500 /* Set the grid in the selected axis */
501 switch (ts->gp_sculpt.lock_axis) {
502 case GP_LOCKAXIS_X:
503 std::swap(mat[0], mat[2]);
504 break;
505 case GP_LOCKAXIS_Y:
506 std::swap(mat[1], mat[2]);
507 break;
508 case GP_LOCKAXIS_Z:
509 /* Default. */
510 break;
511 case GP_LOCKAXIS_CURSOR: {
512 mat = float4x4(cursor->matrix<float3x3>());
513 break;
514 }
515 case GP_LOCKAXIS_VIEW:
516 /* view aligned */
517 /* TODO(fclem): Global access. */
519 break;
520 }
521
522 mat *= 2.0f;
523
525 mat.location() = cursor->location;
526 }
527 else if (active_layer) {
528 mat.location() = active_layer->to_world_space(object).location();
529 }
530 else {
531 mat.location() = object.object_to_world().location();
532 }
533 return mat;
534 }
535
536 void draw_material_names(const ObjectRef &ob_ref, const State &state, Resources &res)
537 {
538 Object &object = *ob_ref.object;
539
540 uchar4 color;
542
544 object);
545
546 Vector<ed::greasepencil::DrawingInfo> drawings = ed::greasepencil::retrieve_visible_drawings(
547 *state.scene, grease_pencil, false);
548 if (drawings.is_empty()) {
549 return;
550 }
551
552 for (const ed::greasepencil::DrawingInfo &info : drawings) {
553 const bke::greasepencil::Drawing &drawing = info.drawing;
554
555 const bke::CurvesGeometry strokes = drawing.strokes();
556 const OffsetIndices<int> points_by_curve = strokes.points_by_curve();
557 const bke::AttrDomain domain = show_points_ ? bke::AttrDomain::Point :
559 const VArray<bool> selections = *strokes.attributes().lookup_or_default<bool>(
560 ".selection", domain, true);
561 const VArray<int> materials = *strokes.attributes().lookup_or_default<int>(
562 "material_index", bke::AttrDomain::Curve, 0);
563 const Span<float3> positions = strokes.positions();
564
565 auto show_stroke_name = [&](const int stroke_i) {
566 if (show_points_) {
567 for (const int point_i : points_by_curve[stroke_i]) {
568 if (selections[point_i]) {
569 return true;
570 }
571 }
572 return false;
573 }
574 return selections[stroke_i];
575 };
576
577 for (const int stroke_i : strokes.curves_range()) {
578 if (!show_stroke_name(stroke_i)) {
579 continue;
580 }
581 const int point_i = points_by_curve[stroke_i].first();
582 const float3 fpt = math::transform_point(object.object_to_world(), positions[point_i]);
583 if (Material *ma = BKE_object_material_get_eval(&object, materials[stroke_i] + 1)) {
585 fpt,
586 ma->id.name + 2,
587 strlen(ma->id.name + 2),
588 10,
589 0,
591 color);
592 }
593 }
594 }
595 }
596};
597
598} // namespace blender::draw::overlay
Low-level operations for curves.
Low-level operations for grease pencil.
General operations, lookup, etc. for materials.
General operations, lookup, etc. for blender objects.
#define ELEM(...)
#define STREQ(a, b)
constexpr IndexRange()=default
bool is_empty() const
GAttributeReader lookup_or_default(StringRef name, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
AttributeAccessor attributes() const
Span< float3 > positions() const
IndexRange curves_range() const
OffsetIndices< int > points_by_curve() const
const bke::CurvesGeometry & strokes() const
float4x4 to_world_space(const Object &object) const
SwapChain< ObjectMatricesBuf, 2 > matrix_buf
const float3 & location(int view_id=0) const
Definition draw_view.hh:124
bool is_persp(int view_id=0) const
Definition draw_view.hh:93
static View & default_get()
Definition draw_view.cc:317
const float4x4 & viewinv(int view_id=0) const
Definition draw_view.hh:142
const float3 & forward(int view_id=0) const
Definition draw_view.hh:130
void bind_texture(const char *name, gpu::Texture *texture, GPUSamplerState state=sampler_auto)
void push_constant(const char *name, const float &data)
void draw(gpu::Batch *batch, uint instance_len=-1, uint vertex_len=-1, uint vertex_first=-1, ResourceIDRange res_id={}, uint custom_id=0)
Definition draw_pass.hh:906
detail::PassBase< command::DrawCommandBuf > Sub
Definition draw_pass.hh:509
void sculpt_object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state)
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view) final
void begin_sync(Resources &res, const State &state) final
void object_sync(Manager &, const ObjectRef &ob_ref, Resources &, const State &state) final
void edit_object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state) final
void paint_object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state)
static void compute_depth_planes(Manager &manager, View &view, Resources &res, const State &)
static void draw_grease_pencil(Resources &res, PassMain::Sub &pass, const Scene *scene, Object *ob, ResourceHandleRange res_handle, select::ID select_id=select::SelectMap::select_invalid_id())
void foreach_index(Fn &&fn, Mode mode=exec_mode::serial) const
#define DRW_CLIPPING_UBO_SLOT
#define OVERLAY_GLOBALS_SLOT
VecBase< float, D > normalize(VecOp< float, D >) RET
float dot(VecOp< float, D >, VecOp< float, D >) RET
MatBase< R, C > transpose(MatBase< C, R >) RET
float2x2 invert(float2x2 mat)
float3 transform_direction(float3x3 mat, float3 direction)
const int state
void fill_index_range(MutableSpan< T > span, const T start=0)
gpu::Batch * DRW_cache_grease_pencil_get(const Scene *scene, Object *ob)
detail::Pass< command::DrawCommandBuf > PassSimple
gpu::Batch * DRW_cache_grease_pencil_edit_handles_get(const Scene *scene, Object *ob)
gpu::VertBuf * DRW_cache_grease_pencil_position_buffer_get(const Scene *scene, Object *ob)
gpu::Batch * DRW_cache_grease_pencil_edit_lines_get(const Scene *scene, Object *ob)
gpu::Batch * DRW_cache_grease_pencil_weight_lines_get(const Scene *scene, Object *ob)
gpu::Batch * DRW_cache_grease_pencil_edit_points_get(const Scene *scene, Object *ob)
gpu::Batch * DRW_cache_grease_pencil_weight_points_get(const Scene *scene, Object *ob)
gpu::VertBuf * DRW_cache_grease_pencil_color_buffer_get(const Scene *scene, Object *ob)
Vector< DrawingInfo > retrieve_visible_drawings(const Scene &scene, const GreasePencil &grease_pencil, const bool do_onion_skinning)
IndexMask retrieve_visible_strokes(Object &object, const bke::greasepencil::Drawing &drawing, IndexMaskMemory &memory)
MatT from_loc_scale(const typename MatT::loc_type &location, const VecBase< typename MatT::base_type, ScaleDim > &scale)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
void get_color_4ubv(int colorid, unsigned char col[4])
void GPU_framebuffer_bind(gpu::FrameBuffer *fb)
VecBase< uint8_t, 4 > uchar4
__int64 int64_t
Definition BKE_text.h:90
@ GP_SCULPT_MASK_SELECTMODE_POINT
@ GP_SCULPT_MASK_SELECTMODE_SEGMENT
@ DRW_TEXT_CACHE_GLOBALSPACE
@ DRW_TEXT_CACHE_STRING_PTR
MatBase< float, 4, 4 > float4x4
MaterialGPencilStyle * BKE_gpencil_material_settings(Object *ob, short act)
@ GP_VERTEX_MASK_SELECTMODE_POINT
@ GP_VERTEX_MASK_SELECTMODE_SEGMENT
T & DRW_object_get_data_for_drawing(const Object &object)
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)
@ OB_MODE_VERTEX_GREASE_PENCIL
@ OB_MODE_SCULPT_GREASE_PENCIL
@ OB_MODE_WEIGHT_GREASE_PENCIL
@ OB_MODE_PAINT_GREASE_PENCIL
@ V3D_GP_SHOW_MATERIAL_NAME
@ V3D_GP_SHOW_STROKE_DIRECTION
@ DRW_STATE_WRITE_COLOR
Definition draw_state.hh:32
@ DRW_STATE_BLEND_ALPHA
Definition draw_state.hh:57
@ DRW_STATE_WRITE_DEPTH
Definition draw_state.hh:31
@ DRW_STATE_DEPTH_ALWAYS
Definition draw_state.hh:38
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition draw_state.hh:40
MatBase< float, 3, 3 > float3x3
Material * BKE_object_material_get_eval(Object *ob, short act)
std::optional< Bounds< float3 > > BKE_object_boundbox_get(const Object *ob)
Definition object.cc:3726
@ GP_PROJECT_DEPTH_STROKE
Point object_to_world(Point pt, float4x4 object_to_world)
eMaterialGPencilStyle_Flag flag
View3DCursor cursor
struct ToolSettings * toolsettings
eGP_Sculpt_SelectMaskFlag gpencil_selectmode_sculpt
eGPencil_Selectmode_types gpencil_selectmode_edit
eGP_Vertex_SelectMaskFlag gpencil_selectmode_vertex
eGPencil_Placement_Flags gpencil_v3d_align
struct GP_Sculpt_Settings gp_sculpt
eView3D_GPFlag gp_flag
detail::SubPassVector< GreasePencilDepthPlane, 16 > depth_planes
ThemeColorID object_wire_theme_id(const ObjectRef &ob_ref, const State &state) const