Blender V4.3
overlay_edit_uv.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8#include "DRW_render.hh"
9
10#include "draw_cache_impl.hh"
11#include "draw_manager_text.hh"
12
13#include "BLI_math_color.h"
14
15#include "BKE_customdata.hh"
16#include "BKE_editmesh.hh"
17#include "BKE_image.hh"
18#include "BKE_layer.hh"
19#include "BKE_mask.h"
20#include "BKE_mesh_types.hh"
21#include "BKE_object.hh"
22#include "BKE_paint.hh"
23
24#include "DNA_brush_types.h"
25#include "DNA_mesh_types.h"
26
28
29#include "ED_image.hh"
30
31#include "IMB_imbuf_types.hh"
32
33#include "GPU_batch.hh"
34
35#include "UI_interface.hh"
36#include "UI_resources.hh"
37
38#include "overlay_private.hh"
39
40using blender::Vector;
41
42/* Forward declarations. */
43static void overlay_edit_uv_cache_populate(OVERLAY_Data *vedata, Object &ob);
44
50
52{
53 const bool is_uv_editor = sima->mode == SI_MODE_UV;
54 if (is_uv_editor) {
55 switch (sima->dt_uv) {
56 case SI_UVDT_OUTLINE:
58 case SI_UVDT_BLACK:
60 case SI_UVDT_WHITE:
62 case SI_UVDT_DASH:
64 default:
66 }
67 }
68 else {
70 }
71}
72
73/* TODO(jbakker): the GPU texture should be cached with the mask. */
74static GPUTexture *edit_uv_mask_texture(
75 Mask *mask, const int width, const int height_, const float aspx, const float aspy)
76{
77 const int height = float(height_) * (aspy / aspx);
78 MaskRasterHandle *handle;
79 float *buffer = static_cast<float *>(MEM_mallocN(sizeof(float) * height * width, __func__));
80
81 /* Initialize rasterization handle. */
83 BKE_maskrasterize_handle_init(handle, mask, width, height, true, true, true);
84
85 BKE_maskrasterize_buffer(handle, width, height, buffer);
86
87 /* Free memory. */
89 GPUTexture *texture = GPU_texture_create_2d(
90 mask->id.name, width, height, 1, GPU_R16F, GPU_TEXTURE_USAGE_SHADER_READ, buffer);
91 MEM_freeN(buffer);
92 return texture;
93}
94
95/* -------------------------------------------------------------------- */
98
100{
101 OVERLAY_StorageList *stl = vedata->stl;
102 OVERLAY_PrivateData *pd = stl->pd;
103 const DRWContextState *draw_ctx = DRW_context_state_get();
104 SpaceImage *sima = (SpaceImage *)draw_ctx->space_data;
105 const Scene *scene = draw_ctx->scene;
106 ToolSettings *ts = scene->toolsettings;
107 const Brush *brush = BKE_paint_brush(&ts->imapaint.paint);
108 const bool show_overlays = !pd->hide_overlays;
109
110 Image *image = sima->image;
111 /* By design no image is an image type. This so editor shows UVs by default. */
112 const bool is_image_type = (image == nullptr) || ELEM(image->type,
116 const bool is_uv_editor = sima->mode == SI_MODE_UV;
117 const bool has_edit_object = (draw_ctx->object_edit) != nullptr;
118 const bool is_paint_mode = sima->mode == SI_MODE_PAINT;
119 const bool is_view_mode = sima->mode == SI_MODE_VIEW;
120 const bool is_mask_mode = sima->mode == SI_MODE_MASK;
121 const bool is_edit_mode = draw_ctx->object_mode == OB_MODE_EDIT;
122 const bool do_uv_overlay = is_image_type && is_uv_editor && has_edit_object;
123 const bool show_modified_uvs = sima->flag & SI_DRAWSHADOW;
124 const bool is_tiled_image = image && (image->source == IMA_SRC_TILED);
125 const bool do_edges_only = (ts->uv_flag & UV_SYNC_SELECTION) ?
126 /* NOTE: Ignore #SCE_SELECT_EDGE because a single selected edge
127 * on the mesh may cause single UV vertices to be selected. */
128 false :
130 const bool do_faces = ((sima->flag & SI_NO_DRAWFACES) == 0);
131 const bool do_face_dots = (ts->uv_flag & UV_SYNC_SELECTION) ?
132 (ts->selectmode & SCE_SELECT_FACE) != 0 :
134 const bool do_uvstretching_overlay = is_image_type && is_uv_editor && is_edit_mode &&
135 ((sima->flag & SI_DRAW_STRETCH) != 0);
136 const bool do_tex_paint_shadows = (sima->flag & SI_NO_DRAW_TEXPAINT) == 0;
137 const bool do_stencil_overlay = is_paint_mode && is_image_type && brush &&
139 brush->clone.image;
140
141 pd->edit_uv.do_verts = show_overlays && (!do_edges_only);
142 pd->edit_uv.do_faces = show_overlays && do_faces && !do_uvstretching_overlay;
143 pd->edit_uv.do_face_dots = show_overlays && do_faces && do_face_dots;
144 pd->edit_uv.do_uv_overlay = show_overlays && do_uv_overlay;
145 pd->edit_uv.do_uv_shadow_overlay = show_overlays && is_image_type &&
146 ((is_paint_mode && do_tex_paint_shadows &&
147 ((draw_ctx->object_mode &
149 (is_uv_editor && do_tex_paint_shadows &&
150 ((draw_ctx->object_mode & (OB_MODE_TEXTURE_PAINT)) != 0)) ||
151 (is_view_mode && do_tex_paint_shadows &&
152 ((draw_ctx->object_mode & (OB_MODE_TEXTURE_PAINT)) != 0)) ||
153 (do_uv_overlay && (show_modified_uvs)));
154
155 pd->edit_uv.do_mask_overlay = show_overlays && is_mask_mode &&
156 (sima->mask_info.mask != nullptr) &&
160 draw_ctx->depsgraph, &sima->mask_info.mask->id) :
161 nullptr;
162
163 pd->edit_uv.do_uv_stretching_overlay = show_overlays && do_uvstretching_overlay;
164 pd->edit_uv.uv_opacity = sima->uv_opacity;
166 pd->edit_uv.do_tiled_image_overlay = show_overlays && is_image_type && is_tiled_image;
167 pd->edit_uv.do_tiled_image_border_overlay = is_image_type && is_tiled_image;
168 pd->edit_uv.dash_length = 4.0f * UI_SCALE_FAC;
171 pd->edit_uv.do_stencil_overlay = show_overlays && do_stencil_overlay;
172
175 pd->edit_uv.total_area_ratio = 0.0f;
176
177 /* During engine initialization phase the `sima` isn't locked and
178 * we are able to retrieve the needed data.
179 * During cache_init the image engine locks the `sima` and makes it impossible
180 * to retrieve the data. */
184}
185
187{
188 using namespace blender::draw;
189 OVERLAY_StorageList *stl = vedata->stl;
190 OVERLAY_PassList *psl = vedata->psl;
191 OVERLAY_PrivateData *pd = stl->pd;
192
193 const DRWContextState *draw_ctx = DRW_context_state_get();
194 SpaceImage *sima = (SpaceImage *)draw_ctx->space_data;
195 ::Image *image = sima->image;
196 const Scene *scene = draw_ctx->scene;
197 ToolSettings *ts = scene->toolsettings;
198
200 /* uv edges */
201 {
205 const bool do_edges_only = (ts->uv_flag & UV_SYNC_SELECTION) ?
206 false :
212 DRW_shgroup_uniform_block(pd->edit_uv_shadow_edges_grp, "globalsBlock", G_draw.block_ubo);
218 pd->edit_uv_shadow_edges_grp, "dashLength", &pd->edit_uv.dash_length, 1);
220 pd->edit_uv_shadow_edges_grp, "doSmoothWire", &pd->edit_uv.do_smooth_wire, 1);
221 }
222
223 if (pd->edit_uv.do_uv_overlay) {
225 DRW_shgroup_uniform_block(pd->edit_uv_edges_grp, "globalsBlock", G_draw.block_ubo);
229 pd->edit_uv_edges_grp, "dashLength", &pd->edit_uv.dash_length, 1);
231 pd->edit_uv_edges_grp, "doSmoothWire", &pd->edit_uv.do_smooth_wire, 1);
232 }
233 }
234 }
235
236 if (pd->edit_uv.do_uv_overlay) {
237 if (pd->edit_uv.do_verts || pd->edit_uv.do_face_dots) {
241 }
242
243 /* uv verts */
244 if (pd->edit_uv.do_verts) {
247
248 const float point_size = UI_GetThemeValuef(TH_VERTEX_SIZE) * UI_SCALE_FAC;
249
250 DRW_shgroup_uniform_block(pd->edit_uv_verts_grp, "globalsBlock", G_draw.block_ubo);
252 pd->edit_uv_verts_grp, "pointSize", (point_size + 1.5f) * M_SQRT2);
253 DRW_shgroup_uniform_float_copy(pd->edit_uv_verts_grp, "outlineWidth", 0.75f);
254 float theme_color[4];
255 UI_GetThemeColor4fv(TH_VERTEX, theme_color);
256 srgb_to_linearrgb_v4(theme_color, theme_color);
257 DRW_shgroup_uniform_vec4_copy(pd->edit_uv_verts_grp, "color", theme_color);
258 }
259
260 /* uv faces */
261 if (pd->edit_uv.do_faces) {
266 DRW_shgroup_uniform_block(pd->edit_uv_faces_grp, "globalsBlock", G_draw.block_ubo);
268 }
269
270 /* uv face dots */
271 if (pd->edit_uv.do_face_dots) {
272 const float point_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) * UI_SCALE_FAC;
275 DRW_shgroup_uniform_block(pd->edit_uv_face_dots_grp, "globalsBlock", G_draw.block_ubo);
276 DRW_shgroup_uniform_float_copy(pd->edit_uv_face_dots_grp, "pointSize", point_size);
277 }
278 }
279
280 /* uv stretching */
287 DRW_shgroup_uniform_block(pd->edit_uv_stretching_grp, "globalsBlock", G_draw.block_ubo);
290 pd->edit_uv_stretching_grp, "stretch_opacity", pd->edit_uv.stretch_opacity);
291 }
292 else /* SI_UVDT_STRETCH_AREA */ {
295 DRW_shgroup_uniform_block(pd->edit_uv_stretching_grp, "globalsBlock", G_draw.block_ubo);
297 pd->edit_uv_stretching_grp, "totalAreaRatio", &pd->edit_uv.total_area_ratio, 1);
299 pd->edit_uv_stretching_grp, "stretch_opacity", pd->edit_uv.stretch_opacity);
300 }
301 }
302
304 blender::gpu::Batch *geom = DRW_cache_quad_wires_get();
305 float obmat[4][4];
306 unit_m4(obmat);
307
311
312 float theme_color[4], selected_color[4];
313 UI_GetThemeColorShade4fv(TH_BACK, 60, theme_color);
314 UI_GetThemeColor4fv(TH_FACE_SELECT, selected_color);
315 srgb_to_linearrgb_v4(theme_color, theme_color);
316 srgb_to_linearrgb_v4(selected_color, selected_color);
317
319 DRW_shgroup_uniform_vec4_copy(grp, "ucolor", theme_color);
320 const float3 offset = {0.0f, 0.0f, 0.0f};
321 DRW_shgroup_uniform_vec3_copy(grp, "offset", offset);
322
323 LISTBASE_FOREACH (ImageTile *, tile, &image->tiles) {
324 const int tile_x = ((tile->tile_number - 1001) % 10);
325 const int tile_y = ((tile->tile_number - 1001) / 10);
326 obmat[3][1] = float(tile_y);
327 obmat[3][0] = float(tile_x);
328 DRW_shgroup_call_obmat(grp, geom, obmat);
329 }
330 /* Only mark active border when overlays are enabled. */
332 /* Active tile border */
333 ImageTile *active_tile = static_cast<ImageTile *>(
334 BLI_findlink(&image->tiles, image->active_tile_index));
335 if (active_tile) {
336 obmat[3][0] = float((active_tile->tile_number - 1001) % 10);
337 obmat[3][1] = float((active_tile->tile_number - 1001) / 10);
339 DRW_shgroup_uniform_vec4_copy(grp, "ucolor", selected_color);
340 DRW_shgroup_call_obmat(grp, geom, obmat);
341 }
342 }
343 }
344
347 uchar color[4];
348 /* Color Management: Exception here as texts are drawn in sRGB space directly. */
350 char text[16];
351 LISTBASE_FOREACH (ImageTile *, tile, &image->tiles) {
352 BLI_snprintf(text, 5, "%d", tile->tile_number);
353 float tile_location[3] = {
354 float((tile->tile_number - 1001) % 10), float((tile->tile_number - 1001) / 10), 0.0f};
356 dt, tile_location, text, strlen(text), 10, 10, DRW_TEXT_CACHE_GLOBALSPACE, color);
357 }
358 }
359
360 if (pd->edit_uv.do_stencil_overlay) {
361 const Brush *brush = BKE_paint_brush(&ts->imapaint.paint);
362 ::Image *stencil_image = brush->clone.image;
363 GPUTexture *stencil_texture = BKE_image_get_gpu_texture(stencil_image, nullptr);
364
365 if (stencil_texture != nullptr) {
370 blender::gpu::Batch *geom = DRW_cache_quad_get();
372 DRW_shgroup_uniform_texture(grp, "imgTexture", stencil_texture);
373 DRW_shgroup_uniform_bool_copy(grp, "imgPremultiplied", true);
374 DRW_shgroup_uniform_bool_copy(grp, "imgAlphaBlend", true);
375 const float4 color = {1.0f, 1.0f, 1.0f, brush->clone.alpha};
376 DRW_shgroup_uniform_vec4_copy(grp, "ucolor", color);
377
378 float size_image[2];
379 BKE_image_get_size_fl(image, nullptr, size_image);
380 float size_stencil_image[2] = {float(GPU_texture_original_width(stencil_texture)),
381 float(GPU_texture_original_height(stencil_texture))};
382
383 float obmat[4][4];
384 unit_m4(obmat);
385 obmat[3][1] = brush->clone.offset[1];
386 obmat[3][0] = brush->clone.offset[0];
387 obmat[0][0] = size_stencil_image[0] / size_image[0];
388 obmat[1][1] = size_stencil_image[1] / size_image[1];
389
390 DRW_shgroup_call_obmat(grp, geom, obmat);
391 }
392 }
393
394 if (pd->edit_uv.do_mask_overlay) {
395 const bool is_combined_overlay = pd->edit_uv.mask_overlay_mode == MASK_OVERLAY_COMBINED;
397 state |= is_combined_overlay ? DRW_STATE_BLEND_MUL : DRW_STATE_BLEND_ALPHA;
399
401 blender::gpu::Batch *geom = DRW_cache_quad_get();
403 GPUTexture *mask_texture = edit_uv_mask_texture(pd->edit_uv.mask,
404 pd->edit_uv.image_size[0],
405 pd->edit_uv.image_size[1],
406 pd->edit_uv.image_aspect[1],
407 pd->edit_uv.image_aspect[1]);
408 pd->edit_uv.mask_texture = mask_texture;
409 DRW_shgroup_uniform_texture(grp, "imgTexture", mask_texture);
410 const float4 color = {1.0f, 1.0f, 1.0f, 1.0f};
412 DRW_shgroup_uniform_float_copy(grp, "opacity", 1.0f); /* Broken. As it always was. */
413 DRW_shgroup_call_obmat(grp, geom, nullptr);
414 }
415
416 /* HACK: When editing objects that share the same mesh we should only draw the
417 * first one in the order that is used during uv editing. We can only trust that the first object
418 * has the correct batches with the correct selection state. See #83187. */
420 draw_ctx->obact->type == OB_MESH)
421 {
423 draw_ctx->scene, draw_ctx->view_layer, nullptr, draw_ctx->object_mode);
424 for (Object *object : objects) {
425 Object *object_eval = DEG_get_evaluated_object(draw_ctx->depsgraph, object);
426 DRW_mesh_batch_cache_validate(*object_eval, *(Mesh *)object_eval->data);
427 overlay_edit_uv_cache_populate(vedata, *object_eval);
428 }
429 }
430}
431
433{
434 using namespace blender::draw;
436 return;
437 }
438
439 OVERLAY_StorageList *stl = vedata->stl;
440 OVERLAY_PrivateData *pd = stl->pd;
441 blender::gpu::Batch *geom;
442
443 const DRWContextState *draw_ctx = DRW_context_state_get();
444 const bool is_edit_object = DRW_object_is_in_edit_mode(&ob);
445 Mesh &mesh = *(Mesh *)ob.data;
446 const bool has_active_object_uvmap = CustomData_get_active_layer(&mesh.corner_data,
447 CD_PROP_FLOAT2) != -1;
448 const bool has_active_edit_uvmap = is_edit_object && (CustomData_get_active_layer(
449 &mesh.runtime->edit_mesh->bm->ldata,
450 CD_PROP_FLOAT2) != -1);
451 const bool draw_shadows = (draw_ctx->object_mode != OB_MODE_OBJECT) &&
452 (ob.mode == draw_ctx->object_mode);
453
454 if (has_active_edit_uvmap) {
455 if (pd->edit_uv.do_uv_overlay) {
457 if (geom) {
458 DRW_shgroup_call_obmat(pd->edit_uv_edges_grp, geom, nullptr);
459 }
460 if (pd->edit_uv.do_verts) {
462 if (geom) {
463 DRW_shgroup_call_obmat(pd->edit_uv_verts_grp, geom, nullptr);
464 }
465 }
466 if (pd->edit_uv.do_faces) {
468 if (geom) {
469 DRW_shgroup_call_obmat(pd->edit_uv_faces_grp, geom, nullptr);
470 }
471 }
472 if (pd->edit_uv.do_face_dots) {
474 if (geom) {
476 }
477 }
478 }
479
483 }
484 else /* SI_UVDT_STRETCH_AREA */ {
486 MEM_mallocN(sizeof(OVERLAY_StretchingAreaTotals), __func__));
487 BLI_addtail(&pd->edit_uv.totals, totals);
489 ob, mesh, &totals->total_area, &totals->total_area_uv);
490 }
491 if (geom) {
493 }
494 }
495 }
496
497 if (draw_shadows && (has_active_object_uvmap || has_active_edit_uvmap)) {
499 geom = DRW_mesh_batch_cache_get_uv_edges(ob, mesh);
500 if (geom) {
502 }
503 }
504 }
505}
506
508{
509 OVERLAY_StorageList *stl = vedata->stl;
510 OVERLAY_PrivateData *pd = stl->pd;
511
513 float total_area = 0.0f;
514 float total_area_uv = 0.0f;
515
517 total_area += *totals->total_area;
518 total_area_uv += *totals->total_area_uv;
519 }
520
521 if (total_area > FLT_EPSILON && total_area_uv > FLT_EPSILON) {
522 pd->edit_uv.total_area_ratio = total_area / total_area_uv;
523 }
524 }
526}
527
529{
530 OVERLAY_StorageList *stl = vedata->stl;
531 OVERLAY_PrivateData *pd = stl->pd;
532
535 }
536}
537
539{
540 OVERLAY_StorageList *stl = vedata->stl;
541 OVERLAY_PrivateData *pd = stl->pd;
542
544}
545
547{
548 OVERLAY_PassList *psl = vedata->psl;
549 OVERLAY_StorageList *stl = vedata->stl;
550 OVERLAY_PrivateData *pd = stl->pd;
551
554 }
555 if (pd->edit_uv.do_mask_overlay) {
556 /* Combined overlay renders in the default framebuffer and modifies the image in SRS.
557 * The alpha overlay renders in the overlay framebuffer. */
558 const bool is_combined_overlay = pd->edit_uv.mask_overlay_mode == MASK_OVERLAY_COMBINED;
559 GPUFrameBuffer *previous_framebuffer = nullptr;
560 if (is_combined_overlay) {
562 previous_framebuffer = GPU_framebuffer_active_get();
564 }
566 if (previous_framebuffer) {
567 GPU_framebuffer_bind(previous_framebuffer);
568 }
569 }
570
573 }
574
575 if (pd->edit_uv.do_uv_overlay) {
576 if (pd->edit_uv.do_faces) {
578 }
580
582 }
583 else if (pd->edit_uv.do_uv_shadow_overlay) {
585 }
586 if (pd->edit_uv.do_stencil_overlay) {
588 }
590}
591
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_active_layer(const CustomData *data, eCustomDataType type)
void BKE_image_get_size_fl(Image *image, ImageUser *iuser, float r_size[2])
GPUTexture * BKE_image_get_gpu_texture(Image *image, ImageUser *iuser)
Definition image_gpu.cc:476
blender::Vector< Object * > BKE_view_layer_array_from_objects_in_mode_unique_data(const Scene *scene, ViewLayer *view_layer, const View3D *v3d, eObjectMode mode)
void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle)
MaskRasterHandle * BKE_maskrasterize_handle_new(void)
void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask, int width, int height, bool do_aspect_correct, bool do_mask_aa, bool do_feather)
void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle, unsigned int width, unsigned int height, float *buffer)
Rasterize a buffer from a single mask (threaded execution).
General operations, lookup, etc. for blender objects.
@ OB_VISIBLE_SELF
Brush * BKE_paint_brush(Paint *paint)
Definition paint.cc:649
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition listbase.cc:496
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:110
#define M_SQRT2
MINLINE void srgb_to_linearrgb_v4(float linear[4], const float srgb[4])
void unit_m4(float m[4][4])
Definition rct.c:1127
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
unsigned char uchar
#define ELEM(...)
ID * DEG_get_evaluated_id(const Depsgraph *depsgraph, ID *id)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
@ IMAGE_PAINT_BRUSH_TYPE_CLONE
@ CD_PROP_FLOAT2
@ IMA_SRC_TILED
@ IMA_TYPE_MULTILAYER
@ IMA_TYPE_UV_TEST
@ IMA_TYPE_IMAGE
@ MASK_DRAWFLAG_OVERLAY
eMaskOverlayMode
@ MASK_OVERLAY_COMBINED
@ OB_MODE_EDIT
@ OB_MODE_TEXTURE_PAINT
@ OB_MODE_OBJECT
@ OB_MESH
@ SCE_SELECT_FACE
@ UV_SELECT_FACE
@ UV_SELECT_EDGE
@ UV_SYNC_SELECTION
@ SI_NO_DRAW_TEXPAINT
@ SI_DRAW_STRETCH
@ SI_NO_DRAWFACES
@ SI_DRAWSHADOW
@ SI_UVDT_BLACK
@ SI_UVDT_DASH
@ SI_UVDT_WHITE
@ SI_UVDT_OUTLINE
eSpaceImage_UVDT_Stretch
@ SI_UVDT_STRETCH_AREA
@ SI_UVDT_STRETCH_ANGLE
@ SI_MODE_PAINT
@ SI_MODE_VIEW
@ SI_MODE_MASK
@ SI_MODE_UV
@ USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE
#define UI_SCALE_FAC
#define DRW_PASS_CREATE(pass, state)
#define DRW_shgroup_uniform_block(shgroup, name, ubo)
#define DRW_shgroup_call_obmat(shgroup, geom, obmat)
#define DRW_TEXTURE_FREE_SAFE(tex)
void ED_space_image_get_size(SpaceImage *sima, int *r_width, int *r_height)
void ED_space_image_get_uv_aspect(SpaceImage *sima, float *r_aspx, float *r_aspy)
void ED_space_image_get_aspect(SpaceImage *sima, float *r_aspx, float *r_aspy)
GPUFrameBuffer * GPU_framebuffer_active_get()
void GPU_framebuffer_bind(GPUFrameBuffer *framebuffer)
int GPU_texture_original_height(const GPUTexture *texture)
GPUTexture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
int GPU_texture_original_width(const GPUTexture *texture)
@ GPU_TEXTURE_USAGE_SHADER_READ
Contains defines and structs used throughout the imbuf module.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a color
@ TH_BACK
@ TH_FACEDOT_SIZE
@ TH_VERTEX
@ TH_VERTEX_SIZE
@ TH_FACE_SELECT
void UI_GetThemeColor4fv(int colorid, float col[4])
void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4])
void UI_GetThemeColorShade4ubv(int colorid, int offset, unsigned char col[4])
float UI_GetThemeValuef(int colorid)
struct GPUShader GPUShader
#define U
input_tx image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") .compute_source("compositor_compute_preview.glsl") .do_static_compilation(true)
local_group_size(16, 16) .push_constant(Type texture
blender::gpu::Batch * DRW_cache_quad_get()
blender::gpu::Batch * DRW_cache_quad_wires_get()
DRW_Global G_draw
DefaultFramebufferList * DRW_viewport_framebuffer_list_get()
bool DRW_object_is_in_edit_mode(const Object *ob)
DRWTextStore * DRW_text_cache_ensure()
int DRW_object_visibility_in_active_context(const Object *ob)
const DRWContextState * DRW_context_state_get()
DRWShadingGroup * DRW_shgroup_create(GPUShader *shader, DRWPass *pass)
void DRW_shgroup_uniform_float_copy(DRWShadingGroup *shgroup, const char *name, const float value)
void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
void DRW_shgroup_uniform_vec3_copy(DRWShadingGroup *shgroup, const char *name, const float *value)
void DRW_shgroup_uniform_int_copy(DRWShadingGroup *shgroup, const char *name, const int value)
void DRW_shgroup_uniform_bool(DRWShadingGroup *shgroup, const char *name, const int *value, int arraysize)
void DRW_shgroup_uniform_vec4_copy(DRWShadingGroup *shgroup, const char *name, const float *value)
void DRW_shgroup_uniform_bool_copy(DRWShadingGroup *shgroup, const char *name, const bool value)
void DRW_shgroup_uniform_float(DRWShadingGroup *shgroup, const char *name, const float *value, int arraysize)
void DRW_shgroup_uniform_vec2_copy(DRWShadingGroup *shgroup, const char *name, const float *value)
void DRW_draw_pass(DRWPass *pass)
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)
@ DRW_TEXT_CACHE_GLOBALSPACE
DRWState
Definition draw_state.hh:25
@ DRW_STATE_BLEND_ALPHA
Definition draw_state.hh:55
@ DRW_STATE_WRITE_DEPTH
Definition draw_state.hh:29
@ DRW_STATE_WRITE_COLOR
Definition draw_state.hh:30
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition draw_state.hh:38
@ DRW_STATE_DEPTH_ALWAYS
Definition draw_state.hh:36
@ DRW_STATE_BLEND_ALPHA_PREMUL
Definition draw_state.hh:57
@ DRW_STATE_BLEND_MUL
Definition draw_state.hh:60
draw_view in_light_buf[] float
ccl_global const KernelWorkTile * tile
void *(* MEM_mallocN)(size_t len, const char *str)
Definition mallocn.cc:44
void MEM_freeN(void *vmemh)
Definition mallocn.cc:105
ccl_device_inline float4 mask(const int4 mask, const float4 a)
static ulong state[N]
blender::gpu::Batch * DRW_mesh_batch_cache_get_edituv_faces_stretch_angle(Object &object, Mesh &mesh)
blender::gpu::Batch * DRW_mesh_batch_cache_get_edituv_edges(Object &object, Mesh &mesh)
blender::gpu::Batch * DRW_mesh_batch_cache_get_edituv_facedots(Object &object, Mesh &mesh)
blender::gpu::Batch * DRW_mesh_batch_cache_get_edituv_verts(Object &object, Mesh &mesh)
blender::gpu::Batch * DRW_mesh_batch_cache_get_edituv_faces(Object &object, Mesh &mesh)
blender::gpu::Batch * DRW_mesh_batch_cache_get_uv_edges(Object &object, Mesh &mesh)
void DRW_mesh_batch_cache_validate(Object &object, Mesh &mesh)
blender::gpu::Batch * DRW_mesh_batch_cache_get_edituv_faces_stretch_area(Object &object, Mesh &mesh, float **tot_area, float **tot_uv_area)
VecBase< float, 4 > float4
static GPUTexture * edit_uv_mask_texture(Mask *mask, const int width, const int height_, const float aspx, const float aspy)
void OVERLAY_edit_uv_cache_init(OVERLAY_Data *vedata)
static void OVERLAY_edit_uv_draw_finish(OVERLAY_Data *vedata)
static OVERLAY_UVLineStyle edit_uv_line_style_from_space_image(const SpaceImage *sima)
static void edit_uv_stretching_update_ratios(OVERLAY_Data *vedata)
static void overlay_edit_uv_cache_populate(OVERLAY_Data *vedata, Object &ob)
void OVERLAY_edit_uv_draw(OVERLAY_Data *vedata)
void OVERLAY_edit_uv_cache_finish(OVERLAY_Data *vedata)
void OVERLAY_edit_uv_init(OVERLAY_Data *vedata)
GPUShader * OVERLAY_shader_edit_uv_edges_for_edge_select_get()
GPUShader * OVERLAY_shader_edit_uv_face_dots_get()
GPUShader * OVERLAY_shader_edit_uv_stencil_image()
GPUShader * OVERLAY_shader_edit_uv_mask_image()
GPUShader * OVERLAY_shader_edit_uv_verts_get()
GPUShader * OVERLAY_shader_edit_uv_tiled_image_borders_get()
GPUShader * OVERLAY_shader_edit_uv_stretching_angle_get()
OVERLAY_UVLineStyle
@ OVERLAY_UV_LINE_STYLE_DASH
@ OVERLAY_UV_LINE_STYLE_SHADOW
@ OVERLAY_UV_LINE_STYLE_WHITE
@ OVERLAY_UV_LINE_STYLE_OUTLINE
@ OVERLAY_UV_LINE_STYLE_BLACK
GPUShader * OVERLAY_shader_edit_uv_edges_get()
GPUShader * OVERLAY_shader_edit_uv_face_get()
GPUShader * OVERLAY_shader_edit_uv_stretching_area_get()
struct Image * image
float offset[2]
struct BrushClone clone
char image_brush_type
ViewLayer * view_layer
Depsgraph * depsgraph
eObjectMode object_mode
Object * object_edit
SpaceLink * space_data
GPUFrameBuffer * default_fb
struct Mask * mask
MeshRuntimeHandle * runtime
CustomData corner_data
OVERLAY_PassList * psl
OVERLAY_StorageList * stl
DRWPass * edit_uv_edges_ps
DRWPass * edit_uv_stencil_ps
DRWPass * edit_uv_tiled_image_borders_ps
DRWPass * edit_uv_faces_ps
DRWPass * edit_uv_verts_ps
DRWPass * edit_uv_stretching_ps
OVERLAY_UVLineStyle line_style
struct OVERLAY_PrivateData::@175340032015206350127150312336076341200255315207 edit_uv
DRWShadingGroup * edit_uv_verts_grp
DRWShadingGroup * edit_uv_edges_grp
DRWShadingGroup * edit_uv_shadow_edges_grp
eMaskOverlayMode mask_overlay_mode
DRWShadingGroup * edit_uv_faces_grp
DRWShadingGroup * edit_uv_stretching_grp
eSpaceImage_UVDT_Stretch draw_type
DRWShadingGroup * edit_uv_face_dots_grp
OVERLAY_PrivateData * pd
struct ToolSettings * toolsettings
MaskSpaceInfo mask_info
struct Image * image
struct ImagePaintSettings imapaint