Blender V4.5
wm_gesture.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2008 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#include "DNA_screen_types.h"
12#include "DNA_userdef_types.h"
13#include "DNA_vec_types.h"
15
16#include "MEM_guardedalloc.h"
17
18#include "BLI_bitmap_draw_2d.h"
19#include "BLI_lasso_2d.hh"
20#include "BLI_listbase.h"
21#include "BLI_math_vector.h"
22#include "BLI_rect.h"
23#include "BLI_utildefines.h"
24
25#include "WM_api.hh"
26#include "WM_types.hh"
27
28#include "wm.hh"
29
30#include "GPU_immediate.hh"
31#include "GPU_immediate_util.hh"
32#include "GPU_state.hh"
33
34#include "BIF_glutil.hh"
35
36using blender::Array;
37using blender::int2;
38
39wmGesture *WM_gesture_new(wmWindow *window, const ARegion *region, const wmEvent *event, int type)
40{
41 wmGesture *gesture = MEM_callocN<wmGesture>("new gesture");
42
43 BLI_addtail(&window->gesture, gesture);
44
45 gesture->type = type;
46 gesture->event_type = event->type;
47 gesture->event_modifier = event->modifier;
48 gesture->event_keymodifier = event->keymodifier;
49 gesture->winrct = region->winrct;
50 gesture->user_data.use_free = true; /* Free if user-data is set. */
52 gesture->move = false;
53
54 int xy[2];
56
57 if (ELEM(type,
62 {
63 rcti *rect = MEM_callocN<rcti>("gesture rect new");
64
65 gesture->customdata = rect;
66 rect->xmin = xy[0] - gesture->winrct.xmin;
67 rect->ymin = xy[1] - gesture->winrct.ymin;
68 if (type == WM_GESTURE_CIRCLE) {
69 /* Caller is responsible for initializing 'xmax' to radius. */
70 }
71 else {
72 rect->xmax = xy[0] - gesture->winrct.xmin;
73 rect->ymax = xy[1] - gesture->winrct.ymin;
74 }
75 }
76 else if (ELEM(type, WM_GESTURE_LINES, WM_GESTURE_LASSO)) {
77 float *lasso;
78 gesture->points_alloc = 1024;
79 gesture->customdata = lasso = MEM_malloc_arrayN<float>(size_t(2 * gesture->points_alloc),
80 "lasso points");
81 lasso[0] = xy[0] - gesture->winrct.xmin;
82 lasso[1] = xy[1] - gesture->winrct.ymin;
83 gesture->points = 1;
84 }
85 else if (ELEM(type, WM_GESTURE_POLYLINE)) {
86 gesture->points_alloc = 64;
87 short *border = MEM_malloc_arrayN<short>(size_t(2 * gesture->points_alloc), "polyline points");
88 gesture->customdata = border;
89 border[0] = xy[0] - gesture->winrct.xmin;
90 border[1] = xy[1] - gesture->winrct.ymin;
91 gesture->mval.x = border[0];
92 gesture->mval.y = border[1];
93 gesture->points = 1;
94 }
95
96 return gesture;
97}
98
99void WM_gesture_end(wmWindow *win, wmGesture *gesture)
100{
101 BLI_remlink(&win->gesture, gesture);
102 MEM_freeN(gesture->customdata);
104 MEM_freeN(gesture);
105}
106
108{
109 while (win->gesture.first) {
110 WM_gesture_end(win, static_cast<wmGesture *>(win->gesture.first));
111 }
112}
113
115{
116 while (win->gesture.first) {
117 WM_gesture_end(win, static_cast<wmGesture *>(win->gesture.first));
118 }
119}
120
122{
123 if (gesture == nullptr) {
124 return true;
125 }
126 return (gesture->is_active_prev == false);
127}
128
129/* ******************* gesture draw ******************* */
130
131static void wm_gesture_draw_line_active_side(const rcti *rect, const bool flip)
132{
136
139
140 const float gradient_length = 150.0f * UI_SCALE_FAC;
141 float line_dir[2];
142 float gradient_dir[2];
143 float gradient_point[2][2];
144
145 const float line_start[2] = {float(rect->xmin), float(rect->ymin)};
146 const float line_end[2] = {float(rect->xmax), float(rect->ymax)};
147 const float color_line_gradient_start[4] = {0.2f, 0.2f, 0.2f, 0.4f};
148 const float color_line_gradient_end[4] = {0.0f, 0.0f, 0.0f, 0.0f};
149
150 sub_v2_v2v2(line_dir, line_end, line_start);
151 normalize_v2(line_dir);
152 ortho_v2_v2(gradient_dir, line_dir);
153 if (!flip) {
154 mul_v2_fl(gradient_dir, -1.0f);
155 }
156 mul_v2_fl(gradient_dir, gradient_length);
157 add_v2_v2v2(gradient_point[0], line_start, gradient_dir);
158 add_v2_v2v2(gradient_point[1], line_end, gradient_dir);
159
161 immAttr4f(shdr_col, UNPACK4(color_line_gradient_start));
162 immVertex2f(shdr_pos, line_start[0], line_start[1]);
163 immAttr4f(shdr_col, UNPACK4(color_line_gradient_start));
164 immVertex2f(shdr_pos, line_end[0], line_end[1]);
165 immAttr4f(shdr_col, UNPACK4(color_line_gradient_end));
166 immVertex2f(shdr_pos, gradient_point[1][0], gradient_point[1][1]);
167
168 immAttr4f(shdr_col, UNPACK4(color_line_gradient_start));
169 immVertex2f(shdr_pos, line_start[0], line_start[1]);
170 immAttr4f(shdr_col, UNPACK4(color_line_gradient_end));
171 immVertex2f(shdr_pos, gradient_point[1][0], gradient_point[1][1]);
172 immAttr4f(shdr_col, UNPACK4(color_line_gradient_end));
173 immVertex2f(shdr_pos, gradient_point[0][0], gradient_point[0][1]);
174 immEnd();
175
178}
179
181{
182 const rcti *rect = (rcti *)gt->customdata;
183
184 if (gt->draw_active_side) {
186 }
187
188 uint shdr_pos = GPU_vertformat_attr_add(
190
192
193 float viewport_size[4];
194 GPU_viewport_size_get_f(viewport_size);
195 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
196
197 immUniform1i("colors_len", 2); /* "advanced" mode. */
198 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
199 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
200 immUniform1f("dash_width", 8.0f);
201 immUniform1f("udash_factor", 0.5f);
202
203 float xmin = float(rect->xmin);
204 float ymin = float(rect->ymin);
205
207 immVertex2f(shdr_pos, xmin, ymin);
208 immVertex2f(shdr_pos, float(rect->xmax), float(rect->ymax));
209 immEnd();
210
212}
213
215{
216 const rcti *rect = static_cast<const rcti *>(gt->customdata);
217
218 uint shdr_pos = GPU_vertformat_attr_add(
220
222
224 immUniformColor4f(1.0f, 1.0f, 1.0f, 0.05f);
225
226 immRectf(shdr_pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
227
229
231
233
235
236 float viewport_size[4];
237 GPU_viewport_size_get_f(viewport_size);
238 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
239
240 immUniform1i("colors_len", 2); /* "advanced" mode. */
241 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
242 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
243 immUniform1f("dash_width", 8.0f);
244 immUniform1f("udash_factor", 0.5f);
245
247 shdr_pos, float(rect->xmin), float(rect->ymin), float(rect->xmax), float(rect->ymax));
248
250
251 /* Draws a diagonal line in the lined box to test #wm_gesture_draw_line. */
252 // wm_gesture_draw_line(gt);
253}
254
256{
257 const rcti *rect = static_cast<const rcti *>(gt->customdata);
258
260
261 const uint shdr_pos = GPU_vertformat_attr_add(
263
265
266 immUniformColor4f(1.0f, 1.0f, 1.0f, 0.05f);
267 imm_draw_circle_fill_2d(shdr_pos, float(rect->xmin), float(rect->ymin), float(rect->xmax), 40);
268
270
272
274
275 float viewport_size[4];
276 GPU_viewport_size_get_f(viewport_size);
277 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
278
279 immUniform1i("colors_len", 2); /* "advanced" mode. */
280 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
281 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
282 immUniform1f("dash_width", 4.0f);
283 immUniform1f("udash_factor", 0.5f);
284
285 imm_draw_circle_wire_2d(shdr_pos, float(rect->xmin), float(rect->ymin), float(rect->xmax), 40);
286
288}
289
292 int width;
293};
294
295static void draw_filled_lasso_px_cb(int x, int x_end, int y, void *user_data)
296{
297 LassoFillData *data = static_cast<LassoFillData *>(user_data);
298 uchar *col = &(data->px[(y * data->width) + x]);
299 memset(col, 0x10, x_end - x);
300}
301
302static void draw_filled_lasso(wmGesture *gt, const blender::int2 *lasso_pt_extra)
303{
304 const int mcoords_len = gt->points + (lasso_pt_extra ? 1 : 0);
305 Array<int2> mcoords(mcoords_len);
306 int i;
307 rcti rect;
308 const float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
309
310 if (gt->type == WM_GESTURE_POLYLINE) {
311 const short *lasso = static_cast<const short *>(gt->customdata);
312 for (i = 0; i < mcoords_len; i++, lasso += 2) {
313 mcoords[i][0] = lasso[0];
314 mcoords[i][1] = lasso[1];
315 }
316 }
317 else {
318 const float *lasso = static_cast<const float *>(gt->customdata);
319 for (i = 0; i < mcoords_len; i++, lasso += 2) {
320 mcoords[i][0] = lasso[0];
321 mcoords[i][1] = lasso[1];
322 }
323 }
324
325 if (lasso_pt_extra) {
326 mcoords[mcoords_len - 1][0] = lasso_pt_extra->x;
327 mcoords[mcoords_len - 1][1] = lasso_pt_extra->y;
328 }
329
330 BLI_lasso_boundbox(&rect, mcoords);
331
332 BLI_rcti_translate(&rect, gt->winrct.xmin, gt->winrct.ymin);
333 BLI_rcti_isect(&gt->winrct, &rect, &rect);
334 BLI_rcti_translate(&rect, -gt->winrct.xmin, -gt->winrct.ymin);
335
336 /* Highly unlikely this will fail, but could crash if (mcoords_len == 0). */
337 if (BLI_rcti_is_empty(&rect) == false) {
338 const int w = BLI_rcti_size_x(&rect);
339 const int h = BLI_rcti_size_y(&rect);
340 uchar *pixel_buf = MEM_calloc_arrayN<uchar>(size_t(w) * size_t(h), __func__);
341 LassoFillData lasso_fill_data = {pixel_buf, w};
342
344 rect.ymin,
345 rect.xmax,
346 rect.ymax,
347 mcoords,
349 &lasso_fill_data);
350
352
354 GPU_shader_bind(state.shader);
356 state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
357
359 &state, rect.xmin, rect.ymin, w, h, GPU_R8, false, pixel_buf, 1.0f, 1.0f, nullptr);
360
362
363 MEM_freeN(pixel_buf);
364
366 }
367}
368
369/* TODO: Extract this common functionality so it can be shared between Sculpt brushes, the annotate
370 * tool, and this common logic. */
371static void draw_lasso_smooth_stroke_indicator(wmGesture *gt, const uint shdr_pos)
372{
373 float(*lasso)[2] = static_cast<float(*)[2]>(gt->customdata);
374 float last_x = lasso[gt->points - 1][0];
375 float last_y = lasso[gt->points - 1][1];
376
378 GPU_line_smooth(true);
380
381 GPU_line_width(1.25f);
382 const float color[3] = {1.0f, 0.39f, 0.39f};
383
384 const float radius = 4.0f;
385
386 /* Draw Inner Ring */
387 immUniformColor4f(color[0], color[1], color[2], 0.8f);
388 imm_draw_circle_wire_2d(shdr_pos, gt->mval.x, gt->mval.y, radius, 40);
389
390 /* Draw Outer Ring: Dark color for contrast on light backgrounds (e.g. gray on white) */
391 float darkcolor[3];
392 mul_v3_v3fl(darkcolor, color, 0.40f);
393 immUniformColor4f(darkcolor[0], darkcolor[1], darkcolor[2], 0.8f);
394 imm_draw_circle_wire_2d(shdr_pos, gt->mval.x, gt->mval.y, radius + 1, 40);
395
396 /* Draw line from the last saved position to the current mouse position. */
397 immUniformColor4f(color[0], color[1], color[2], 0.8f);
399 immVertex2f(shdr_pos, gt->mval.x, gt->mval.y);
400 immVertex2f(shdr_pos, last_x, last_y);
401 immEnd();
402
404 GPU_line_smooth(false);
406}
407
408static void wm_gesture_draw_lasso(wmGesture *gt, bool filled)
409{
410 const float *lasso = (float *)gt->customdata;
411 int i;
412
413 if (filled) {
414 draw_filled_lasso(gt, nullptr);
415 }
416
417 const int numverts = gt->points;
418
419 /* Nothing to draw, do early output. */
420 if (numverts < 2) {
421 return;
422 }
423
424 const uint shdr_pos = GPU_vertformat_attr_add(
426
428
429 float viewport_size[4];
430 GPU_viewport_size_get_f(viewport_size);
431 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
432
433 immUniform1i("colors_len", 2); /* "advanced" mode. */
434 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
435 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
436 immUniform1f("dash_width", 2.0f);
437 immUniform1f("udash_factor", 0.5f);
438
440
441 for (i = 0; i < gt->points; i++, lasso += 2) {
442 immVertex2f(shdr_pos, lasso[0], lasso[1]);
443 }
444
445 immEnd();
447
448 if (gt->use_smooth) {
450 }
451}
452
453static void draw_start_vertex_circle(const wmGesture &gt, const uint shdr_pos)
454{
455 const int numverts = gt.points;
456
457 /* Draw the circle around the starting vertex. */
458 const short(*border)[2] = static_cast<short int(*)[2]>(gt.customdata);
459
460 const float start_pos[2] = {float(border[0][0]), float(border[0][1])};
461 const float current_pos[2] = {float(gt.mval.x), float(gt.mval.y)};
462
463 const float dist = len_v2v2(start_pos, current_pos);
465
466 if (dist < limit && numverts > 2) {
467 const float u = smoothstep(0.0f, limit, dist);
468 const float radius = interpf(
470
472
473 const blender::float3 color = {1.0f, 1.0f, 1.0f};
474 immUniformColor4f(color.x, color.y, color.z, 0.8f);
475 imm_draw_circle_wire_2d(shdr_pos, start_pos[0], start_pos[1], radius, 15.0f);
476
477 const blender::float3 darker_color = color * 0.4f;
478 immUniformColor4f(darker_color.x, darker_color.y, darker_color.z, 0.8f);
479 imm_draw_circle_wire_2d(shdr_pos, start_pos[0], start_pos[1], radius + 1, 15.0f);
480
482 }
483}
484
486{
487 draw_filled_lasso(gt, &gt->mval);
488
489 const int numverts = gt->points + 1;
490 if (numverts < 2) {
491 return;
492 }
493
494 const uint shdr_pos = GPU_vertformat_attr_add(
496
498
499 float viewport_size[4];
500 GPU_viewport_size_get_f(viewport_size);
501 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
502
503 immUniform1i("colors_len", 2); /* "advanced" mode */
504 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
505 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
506 immUniform1f("dash_width", 2.0f);
507 immUniform1f("udash_factor", 0.5f);
508
509 immBegin(GPU_PRIM_LINE_LOOP, numverts);
510
511 const short *border = (short *)gt->customdata;
512 for (int i = 0; i < gt->points; i++, border += 2) {
513 immVertex2f(shdr_pos, float(border[0]), float(border[1]));
514 }
515 immVertex2f(shdr_pos, float(gt->mval.x), float(gt->mval.y));
516
517 immEnd();
518
520
521 draw_start_vertex_circle(*gt, shdr_pos);
522}
523
524static void wm_gesture_draw_cross(const wmWindow *win, const wmGesture *gt)
525{
526 const rcti *rect = static_cast<const rcti *>(gt->customdata);
527 const blender::int2 win_size = WM_window_native_pixel_size(win);
528
529 float x1, x2, y1, y2;
530
531 const uint shdr_pos = GPU_vertformat_attr_add(
533
535
536 float viewport_size[4];
537 GPU_viewport_size_get_f(viewport_size);
538 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
539
540 immUniform1i("colors_len", 2); /* "advanced" mode. */
541 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
542 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
543 immUniform1f("dash_width", 8.0f);
544 immUniform1f("udash_factor", 0.5f);
545
547
548 x1 = float(rect->xmin - win_size[0]);
549 y1 = float(rect->ymin);
550 x2 = float(rect->xmin + win_size[0]);
551 y2 = y1;
552
553 immVertex2f(shdr_pos, x1, y1);
554 immVertex2f(shdr_pos, x2, y2);
555
556 x1 = float(rect->xmin);
557 y1 = float(rect->ymin - win_size[1]);
558 x2 = x1;
559 y2 = float(rect->ymin + win_size[1]);
560
561 immVertex2f(shdr_pos, x1, y1);
562 immVertex2f(shdr_pos, x2, y2);
563
564 immEnd();
565
567}
568
570{
571 wmGesture *gt = (wmGesture *)win->gesture.first;
572
573 GPU_line_width(1.0f);
574 for (; gt; gt = gt->next) {
575 /* All in sub-window space. */
576 wmViewport(&gt->winrct);
577
578 if (gt->type == WM_GESTURE_RECT) {
580 }
581 else if (gt->type == WM_GESTURE_CIRCLE) {
583 }
584 else if (gt->type == WM_GESTURE_CROSS_RECT) {
585 if (gt->is_active) {
587 }
588 else {
589 wm_gesture_draw_cross(win, gt);
590 }
591 }
592 else if (gt->type == WM_GESTURE_LINES) {
593 wm_gesture_draw_lasso(gt, false);
594 }
595 else if (gt->type == WM_GESTURE_LASSO) {
596 wm_gesture_draw_lasso(gt, true);
597 }
598 else if (gt->type == WM_GESTURE_STRAIGHTLINE) {
600 }
601 else if (gt->type == WM_GESTURE_POLYLINE) {
603 }
604 }
605}
606
608{
610
611 if (screen) {
612 screen->do_draw_gesture = true;
613 }
614}
void immDrawPixelsTexTiled(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, const void *rect, float xzoom, float yzoom, const float color[4])
Definition glutil.cc:329
IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
Definition glutil.cc:36
void BLI_bitmap_draw_2d_poly_v2i_n(int xmin, int ymin, int xmax, int ymax, blender::Span< blender::int2 > verts, void(*callback)(int x, int x_end, int y, void *), void *user_data)
void BLI_lasso_boundbox(rcti *rect, blender::Span< blender::int2 > mcoords)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:111
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:131
MINLINE float pow2f(float x)
MINLINE float interpf(float target, float origin, float t)
MINLINE float len_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
void ortho_v2_v2(float out[2], const float v[2])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE float normalize_v2(float n[2])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition BLI_rect.h:198
void BLI_rcti_translate(struct rcti *rect, int x, int y)
Definition rct.cc:566
bool BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.h:194
bool BLI_rcti_is_empty(const struct rcti *rect)
unsigned char uchar
unsigned int uint
#define UNPACK4(a)
#define ELEM(...)
#define UI_SCALE_FAC
void immUniform4f(const char *name, float x, float y, float z, float w)
void immEnd()
void immUnbindProgram()
void immUniform2f(const char *name, float x, float y)
void immUniformColor4f(float r, float g, float b, float a)
void immVertex2f(uint attr_id, float x, float y)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
void immUniform1i(const char *name, int x)
void immUniform1f(const char *name, float x)
GPUVertFormat * immVertexFormat()
void immAttr4f(uint attr_id, float x, float y, float z, float w)
void immBegin(GPUPrimType, uint vertex_len)
void imm_draw_box_wire_2d(uint pos, float x1, float y1, float x2, float y2)
void imm_draw_circle_fill_2d(uint shdr_pos, float x, float y, float radius, int nsegments)
void immRectf(uint pos, float x1, float y1, float x2, float y2)
void imm_draw_circle_wire_2d(uint shdr_pos, float x, float y, float radius, int nsegments)
@ GPU_PRIM_LINE_LOOP
@ GPU_PRIM_LINES
@ GPU_PRIM_LINE_STRIP
@ GPU_PRIM_TRIS
int GPU_shader_get_uniform(GPUShader *shader, const char *name)
void GPU_shader_bind(GPUShader *shader, const blender::gpu::shader::SpecializationConstants *constants_state=nullptr)
void GPU_shader_uniform_float_ex(GPUShader *shader, int location, int length, int array_size, const float *value)
void GPU_shader_unbind()
@ GPU_SHADER_3D_SMOOTH_COLOR
@ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR
@ GPU_BLEND_ADDITIVE_PREMULT
Definition GPU_state.hh:90
@ GPU_BLEND_NONE
Definition GPU_state.hh:85
@ GPU_BLEND_ALPHA
Definition GPU_state.hh:87
void GPU_blend(eGPUBlend blend)
Definition gpu_state.cc:42
void GPU_line_width(float width)
Definition gpu_state.cc:166
void GPU_line_smooth(bool enable)
Definition gpu_state.cc:78
void GPU_viewport_size_get_f(float coords[4])
Definition gpu_state.cc:273
@ GPU_R8
@ GPU_FETCH_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, blender::StringRef name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
Read Guarded memory(de)allocation.
#define WM_GESTURE_RECT
Definition WM_types.hh:599
#define WM_GESTURE_STRAIGHTLINE
Definition WM_types.hh:603
#define WM_GESTURE_LINES
Definition WM_types.hh:598
#define WM_GESTURE_LASSO
Definition WM_types.hh:601
#define WM_GESTURE_CIRCLE
Definition WM_types.hh:602
#define WM_GESTURE_CROSS_RECT
Definition WM_types.hh:600
#define WM_GESTURE_POLYLINE
Definition WM_types.hh:604
BMesh const char void * data
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
uint col
format
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
Definition mallocn.cc:123
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
Definition mallocn.cc:133
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
MINLINE float smoothstep(float edge0, float edge1, float x)
static ulong state[N]
constexpr float POLYLINE_CLICK_RADIUS
Definition WM_types.hh:594
VecBase< int32_t, 2 > int2
VecBase< float, 3 > float3
void * first
char do_draw_gesture
int ymin
int ymax
int xmin
int xmax
int event_type
Definition WM_types.hh:612
uint is_active_prev
Definition WM_types.hh:638
int modal_state
Definition WM_types.hh:625
void * customdata
Definition WM_types.hh:660
int points_alloc
Definition WM_types.hh:624
wmGenericUserData user_data
Definition WM_types.hh:663
uint move
Definition WM_types.hh:642
bool draw_active_side
Definition WM_types.hh:627
uint use_flip
Definition WM_types.hh:648
uint is_active
Definition WM_types.hh:636
short event_keymodifier
Definition WM_types.hh:616
uint8_t event_modifier
Definition WM_types.hh:614
wmGesture * next
Definition WM_types.hh:610
rcti winrct
Definition WM_types.hh:620
uint use_smooth
Definition WM_types.hh:651
blender::int2 mval
Definition WM_types.hh:629
i
Definition text_draw.cc:230
int xy[2]
Definition wm_draw.cc:174
void WM_event_drag_start_xy(const wmEvent *event, int r_xy[2])
@ GESTURE_MODAL_NOP
static void wm_gesture_draw_circle(wmGesture *gt)
static void draw_start_vertex_circle(const wmGesture &gt, const uint shdr_pos)
static void wm_gesture_draw_polyline(wmGesture *gt)
static void draw_filled_lasso_px_cb(int x, int x_end, int y, void *user_data)
static void wm_gesture_draw_cross(const wmWindow *win, const wmGesture *gt)
wmGesture * WM_gesture_new(wmWindow *window, const ARegion *region, const wmEvent *event, int type)
Definition wm_gesture.cc:39
void wm_gesture_draw(wmWindow *win)
static void wm_gesture_draw_rect(wmGesture *gt)
void wm_gesture_tag_redraw(wmWindow *win)
static void wm_gesture_draw_lasso(wmGesture *gt, bool filled)
static void draw_lasso_smooth_stroke_indicator(wmGesture *gt, const uint shdr_pos)
static void wm_gesture_draw_line(wmGesture *gt)
static void draw_filled_lasso(wmGesture *gt, const blender::int2 *lasso_pt_extra)
bool WM_gesture_is_modal_first(const wmGesture *gesture)
void WM_gestures_free_all(wmWindow *win)
void WM_gesture_end(wmWindow *win, wmGesture *gesture)
Definition wm_gesture.cc:99
void WM_gestures_remove(wmWindow *win)
static void wm_gesture_draw_line_active_side(const rcti *rect, const bool flip)
void wmViewport(const rcti *winrct)
void WM_generic_user_data_free(wmGenericUserData *wm_userdata)
Definition wm_utils.cc:45
blender::int2 WM_window_native_pixel_size(const wmWindow *win)
bScreen * WM_window_get_active_screen(const wmWindow *win)