Blender V4.3
cage3d_gizmo.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2014 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
16#include "MEM_guardedalloc.h"
17
18#include "BLI_math_matrix.h"
20
21#include "BKE_context.hh"
22
23#include "GPU_immediate.hh"
24#include "GPU_immediate_util.hh"
25#include "GPU_matrix.hh"
26#include "GPU_select.hh"
27#include "GPU_shader.hh"
28#include "GPU_state.hh"
29
30#include "RNA_access.hh"
31#include "RNA_define.hh"
32
33#include "WM_api.hh"
34#include "WM_types.hh"
35
36#include "ED_gizmo_library.hh"
37#include "ED_screen.hh"
38#include "ED_view3d.hh"
39
40/* own includes */
42
43#define GIZMO_MARGIN_OFFSET_SCALE 1.5f
44
46 float orig_matrix_final_no_offset[4][4],
47 bool use_space)
48{
49 float mat_identity[4][4];
50 WM_GizmoMatrixParams params = {nullptr};
51 unit_m4(mat_identity);
52 if (use_space == false) {
53 params.matrix_basis = mat_identity;
54 }
55 params.matrix_offset = mat_identity;
56 WM_gizmo_calc_matrix_final_params(gz, &params, orig_matrix_final_no_offset);
57}
58
59static void gizmo_calc_rect_view_scale(const wmGizmo *gz, const float dims[3], float scale[3])
60{
61 UNUSED_VARS(dims);
62
63 /* Unlike cage2d, no need to correct for aspect. */
64 float matrix_final_no_offset[4][4];
65
66 float x_axis[3], y_axis[3], z_axis[3];
67 gizmo_calc_matrix_final_no_offset(gz, matrix_final_no_offset, false);
68 mul_v3_mat3_m4v3(x_axis, matrix_final_no_offset, gz->matrix_offset[0]);
69 mul_v3_mat3_m4v3(y_axis, matrix_final_no_offset, gz->matrix_offset[1]);
70 mul_v3_mat3_m4v3(z_axis, matrix_final_no_offset, gz->matrix_offset[2]);
71
72 scale[0] = 1.0f / len_v3(x_axis);
73 scale[1] = 1.0f / len_v3(y_axis);
74 scale[2] = 1.0f / len_v3(z_axis);
75}
76
77static void gizmo_calc_rect_view_margin(const wmGizmo *gz, const float dims[3], float margin[3])
78{
79 const float handle_size = 9.0f;
80 /* XXX, the scale isn't taking offset into account, we need to calculate scale per handle! */
81 // handle_size *= gz->scale_final;
82
83 float scale_xyz[3];
84 gizmo_calc_rect_view_scale(gz, dims, scale_xyz);
85 margin[0] = (handle_size * scale_xyz[0]);
86 margin[1] = (handle_size * scale_xyz[1]);
87 margin[2] = (handle_size * scale_xyz[2]);
88}
89
90/* -------------------------------------------------------------------- */
91
93 float r_pt[3],
94 bool r_constrain_axis[3],
95 bool has_translation)
96{
99 {
101 int range[3];
102 range[2] = index % 3;
103 index = index / 3;
104 range[1] = index % 3;
105 index = index / 3;
106 range[0] = index % 3;
107
108 const float sign[3] = {0.5f, 0.0f, -0.5f};
109 for (int i = 0; i < 3; i++) {
110 r_pt[i] = has_translation ? sign[range[i]] : 0.0f;
111 r_constrain_axis[i] = (range[i] == 1);
112 }
113 }
114}
115
116/* -------------------------------------------------------------------- */
122static void cage3d_draw_box_corners(const float r[3],
123 const float margin[3],
124 const float color[3],
125 const float line_width)
126{
128 UNUSED_VARS(margin);
129
131 immUniformColor3fv(color);
132
133 float viewport[4];
134 GPU_viewport_size_get_f(viewport);
135 immUniform2fv("viewportSize", &viewport[2]);
136 immUniform1f("lineWidth", line_width * U.pixelsize);
137
139
141}
142
144 const float matrix_final[4][4],
145 const float color[4],
146 const int highlighted,
147 const float size[3],
148 const float margin[3])
149{
152 {
153 int index = (highlighted - ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z);
154 int range[3];
155 range[2] = index % 3;
156 index = index / 3;
157 range[1] = index % 3;
158 index = index / 3;
159 range[0] = index % 3;
160
161 const float sign[3] = {-1.0f, 0.0f, 1.0f};
162 float co[3];
163
164 for (int i = 0; i < 3; i++) {
165 co[i] = size[i] * sign[range[i]];
166 }
167 const float rad[3] = {margin[0] / 3, margin[1] / 3, margin[2] / 3};
168 float co_test[3];
169 mul_v3_m4v3(co_test, matrix_final, co);
170 float rad_scale[3];
171 mul_v3_v3fl(rad_scale, rad, ED_view3d_pixel_size(rv3d, co_test));
172
173 {
177 immUniformColor3fv(color);
178 imm_draw_cube_fill_3d(pos, co, rad_scale);
180 }
181 }
182}
183
186/* -------------------------------------------------------------------- */
192static void imm_draw_point_aspect_3d(uint pos, const float co[3], const float rad[3], bool solid)
193{
194 if (solid) {
195 imm_draw_cube_fill_3d(pos, co, rad);
196 }
197 else {
198 imm_draw_cube_wire_3d(pos, co, rad);
199 }
200}
201
202static void cage3d_draw_circle_wire(const float r[3],
203 const float margin[3],
204 const float color[3],
205 const int transform_flag,
206 const int draw_options,
207 const float line_width)
208{
210
212 immUniformColor3fv(color);
213
214 float viewport[4];
215 GPU_viewport_size_get_f(viewport);
216 immUniform2fv("viewportSize", &viewport[2]);
217 immUniform1f("lineWidth", line_width * U.pixelsize);
218
220
221#if 0
222 if (transform_flag & ED_GIZMO_CAGE_XFORM_FLAG_TRANSLATE) {
224 const float rad[2] = {margin[0] / 2, margin[1] / 2};
225 const float center[2] = {0.0f, 0.0f};
226
228 immVertex2f(pos, center[0] - rad[0], center[1] - rad[1]);
229 immVertex2f(pos, center[0] + rad[0], center[1] + rad[1]);
230 immVertex2f(pos, center[0] + rad[0], center[1] - rad[1]);
231 immVertex2f(pos, center[0] - rad[0], center[1] + rad[1]);
232 immEnd();
233 }
234 }
235#else
236 UNUSED_VARS(margin, transform_flag, draw_options);
237#endif
238
240}
241
243 const float matrix_final[4][4],
244 const float r[3],
245 const float margin[3],
246 const float color[3],
247 bool solid,
248 const float handle_scale)
249{
251 const float rad[3] = {margin[0] / 3, margin[1] / 3, margin[2] / 3};
252
254 immUniformColor3fv(color);
255
256 const float sign[3] = {-1.0f, 0.0f, 1.0f};
257 for (int x = 0; x < 3; x++) {
258 for (int y = 0; y < 3; y++) {
259 for (int z = 0; z < 3; z++) {
260 if (x == 1 && y == 1 && z == 1) {
261 continue;
262 }
263 const float co[3] = {r[0] * sign[x], r[1] * sign[y], r[2] * sign[z]};
264 float co_test[3];
265 mul_v3_m4v3(co_test, matrix_final, co);
266 float rad_scale[3];
267 mul_v3_v3fl(rad_scale, rad, ED_view3d_pixel_size(rv3d, co_test) * handle_scale);
268 imm_draw_point_aspect_3d(pos, co, rad_scale, solid);
269 }
270 }
271 }
272
274}
275
279 RegionView3D *rv3d, wmGizmo *gz, const bool select, const bool highlight, const int select_id)
280{
281 // const bool use_clamp = (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) == 0;
282 float dims[3];
283 RNA_float_get_array(gz->ptr, "dimensions", dims);
284 float matrix_final[4][4];
285
286 const int transform_flag = RNA_enum_get(gz->ptr, "transform");
287 const int draw_style = RNA_enum_get(gz->ptr, "draw_style");
288 const int draw_options = RNA_enum_get(gz->ptr, "draw_options");
289
290 const float size_real[3] = {dims[0] / 2.0f, dims[1] / 2.0f, dims[2] / 2.0f};
291
292 WM_gizmo_calc_matrix_final(gz, matrix_final);
293
295 GPU_matrix_mul(matrix_final);
296
297 float margin[3];
298 gizmo_calc_rect_view_margin(gz, dims, margin);
299
300 /* Handy for quick testing draw (if it's outside bounds). */
301 if (false) {
305 immUniformColor4f(1, 1, 1, 0.5f);
306 float s = 0.5f;
307 immRectf(pos, -s, -s, s, s);
310 }
311
312 if (select) {
313/* Expand for hot-spot. */
314#if 0
315 const float size[3] = {
316 size_real[0] + margin[0] / 2,
317 size_real[1] + margin[1] / 2,
318 size_real[2] + margin[2] / 2,
319 };
320#else
321 /* just use same value for now. */
322 const float size[3] = {UNPACK3(size_real)};
323#endif
324
325 if (transform_flag & ED_GIZMO_CAGE_XFORM_FLAG_SCALE) {
328 i++)
329 {
331 continue;
332 }
333 GPU_select_load_id(select_id | i);
334 cage3d_draw_box_interaction(rv3d, matrix_final, gz->color, i, size, margin);
335 }
336 }
337 if (transform_flag & ED_GIZMO_CAGE_XFORM_FLAG_TRANSLATE) {
338 const int transform_part = ED_GIZMO_CAGE3D_PART_TRANSLATE;
339 GPU_select_load_id(select_id | transform_part);
340 cage3d_draw_box_interaction(rv3d, matrix_final, gz->color, transform_part, size, margin);
341 }
342 }
343 else {
344#if 0
345 rctf _r {}
346 _r.xmin = -size_real[0];
347 _r.ymin = -size_real[1];
348 _r.xmax = size_real[0];
349 _r.ymax = size_real[1];
350#endif
351 if (draw_style == ED_GIZMO_CAGE3D_STYLE_BOX) {
352 float color[4], black[3] = {0, 0, 0};
353 gizmo_color_get(gz, highlight, color);
354
355 /* corner gizmos */
356 cage3d_draw_box_corners(size_real, margin, black, gz->line_width + 3.0f);
357
358 /* corner gizmos */
359 cage3d_draw_box_corners(size_real, margin, color, gz->line_width);
360
361 bool show = false;
363 /* Only show if we're drawing the center handle
364 * otherwise the entire rectangle is the hot-spot. */
366 show = true;
367 }
368 }
369 else {
370 show = true;
371 }
372
373 if (show) {
375 rv3d, matrix_final, gz->color, gz->highlight_part, size_real, margin);
376 }
377 }
378 else if (draw_style == ED_GIZMO_CAGE3D_STYLE_CIRCLE) {
379 float color[4], black[3] = {0, 0, 0};
380 gizmo_color_get(gz, highlight, color);
381
383
385 size_real, margin, black, transform_flag, draw_options, gz->line_width + 3.0f);
387 size_real, margin, color, transform_flag, draw_options, gz->line_width);
388
389 /* Corner gizmos (draw the outer & inner so there is a visible outline). */
390 GPU_polygon_smooth(true);
391 cage3d_draw_circle_handles(rv3d, matrix_final, size_real, margin, black, true, 1.0f);
392 cage3d_draw_circle_handles(rv3d, matrix_final, size_real, margin, color, true, 1.0f / 1.5f);
393 GPU_polygon_smooth(false);
394
396 }
397 else {
398 BLI_assert(0);
399 }
400 }
401
403}
404
408static void gizmo_cage3d_draw_select(const bContext *C, wmGizmo *gz, int select_id)
409{
410 ARegion *region = CTX_wm_region(C);
411 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
412 gizmo_cage3d_draw_intern(rv3d, gz, true, false, select_id);
413}
414
415static void gizmo_cage3d_draw(const bContext *C, wmGizmo *gz)
416{
417 ARegion *region = CTX_wm_region(C);
418 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
419 const bool is_highlight = (gz->state & WM_GIZMO_STATE_HIGHLIGHT) != 0;
420 gizmo_cage3d_draw_intern(rv3d, gz, false, is_highlight, -1);
421}
422
424{
427 }
428
429 return WM_CURSOR_DEFAULT;
430}
431
433 float orig_mouse[3];
434 float orig_matrix_offset[4][4];
435 float orig_matrix_final_no_offset[4][4];
436};
437
439{
440 gz->flag |= /* WM_GIZMO_DRAW_MODAL | */ /* TODO */
442}
443
444static int gizmo_cage3d_invoke(bContext *C, wmGizmo *gz, const wmEvent *event)
445{
447 MEM_callocN(sizeof(RectTransformInteraction), "cage_interaction"));
448
449 copy_m4_m4(data->orig_matrix_offset, gz->matrix_offset);
450 gizmo_calc_matrix_final_no_offset(gz, data->orig_matrix_final_no_offset, true);
451
453 C, gz, blender::float2(blender::int2(event->mval)), false, data->orig_mouse) == 0)
454 {
455 zero_v3(data->orig_mouse);
456 }
457
459
461}
462
464 wmGizmo *gz,
465 const wmEvent *event,
466 eWM_GizmoFlagTweak /*tweak_flag*/)
467{
468 if (event->type != MOUSEMOVE) {
470 }
471 /* For transform logic to be manageable we operate in -0.5..0.5 2D space,
472 * no matter the size of the rectangle, mouse coords are scaled to unit space.
473 * The mouse coords have been projected into the matrix
474 * so we don't need to worry about axis alignment.
475 *
476 * - The cursor offset are multiplied by 'dims'.
477 * - Matrix translation is also multiplied by 'dims'.
478 */
480 float point_local[3];
481
482 float dims[3];
483 RNA_float_get_array(gz->ptr, "dimensions", dims);
484
485 {
486 float matrix_back[4][4];
487 copy_m4_m4(matrix_back, gz->matrix_offset);
488 copy_m4_m4(gz->matrix_offset, data->orig_matrix_offset);
489
490 bool ok = gizmo_window_project_3d(
491 C, gz, blender::float2(blender::int2(event->mval)), false, point_local);
492 copy_m4_m4(gz->matrix_offset, matrix_back);
493 if (!ok) {
495 }
496 }
497
498 const int transform_flag = RNA_enum_get(gz->ptr, "transform");
499 wmGizmoProperty *gz_prop;
500
501 gz_prop = WM_gizmo_target_property_find(gz, "matrix");
502 if (gz_prop->type != nullptr) {
504 }
505
507 /* do this to prevent clamping from changing size */
508 copy_m4_m4(gz->matrix_offset, data->orig_matrix_offset);
509 gz->matrix_offset[3][0] = data->orig_matrix_offset[3][0] +
510 (point_local[0] - data->orig_mouse[0]);
511 gz->matrix_offset[3][1] = data->orig_matrix_offset[3][1] +
512 (point_local[1] - data->orig_mouse[1]);
513 gz->matrix_offset[3][2] = data->orig_matrix_offset[3][2] +
514 (point_local[2] - data->orig_mouse[2]);
515 }
517 /* Add this (if we need it). */
518 }
519 else {
520 /* scale */
521 copy_m4_m4(gz->matrix_offset, data->orig_matrix_offset);
522
523 float pivot[3];
524 bool constrain_axis[3] = {false};
525 bool has_translation = transform_flag & ED_GIZMO_CAGE_XFORM_FLAG_TRANSLATE;
526 gizmo_rect_pivot_from_scale_part(gz->highlight_part, pivot, constrain_axis, has_translation);
527
528 float scale[3] = {1.0f, 1.0f, 1.0f};
529 for (int i = 0; i < 3; i++) {
530 if (constrain_axis[i] == false) {
531 /* Original cursor position relative to pivot, remapped to [-1, 1] */
532 const float delta_orig = (data->orig_mouse[i] - data->orig_matrix_offset[3][i]) /
533 (dims[i] * len_v3(data->orig_matrix_offset[i])) -
534 pivot[i];
535 const float delta_curr = (point_local[i] - data->orig_matrix_offset[3][i]) /
536 (dims[i] * len_v3(data->orig_matrix_offset[i])) -
537 pivot[i];
538
539 if ((transform_flag & ED_GIZMO_CAGE_XFORM_FLAG_SCALE_SIGNED) == 0) {
540 if (signum_i(delta_orig) != signum_i(delta_curr)) {
541 scale[i] = 0.0f;
542 continue;
543 }
544 }
545
546 /* Original cursor position does not exactly lie on the cage boundary due to margin. */
547 const float delta_boundary = signf(delta_orig) * 0.5f - pivot[i];
548 scale[i] = delta_curr / delta_boundary;
549 }
550 }
551
552 if (transform_flag & ED_GIZMO_CAGE_XFORM_FLAG_SCALE_UNIFORM) {
553 if (constrain_axis[0] == false && constrain_axis[1] == false) {
554 scale[1] = scale[0] = (scale[1] + scale[0]) / 2.0f;
555 }
556 else if (constrain_axis[0] == false) {
557 scale[1] = scale[0];
558 }
559 else if (constrain_axis[1] == false) {
560 scale[0] = scale[1];
561 }
562 else {
563 BLI_assert(0);
564 }
565 }
566
567 /* scale around pivot */
568 float matrix_scale[4][4];
569 unit_m4(matrix_scale);
570
571 mul_v3_fl(matrix_scale[0], scale[0]);
572 mul_v3_fl(matrix_scale[1], scale[1]);
573 mul_v3_fl(matrix_scale[2], scale[2]);
574
576 matrix_scale, blender::float3(pivot[0] * dims[0], pivot[1] * dims[1], pivot[2] * dims[2]));
577 mul_m4_m4m4(gz->matrix_offset, data->orig_matrix_offset, matrix_scale);
578 }
579
580 if (gz_prop->type != nullptr) {
582 }
583
584 /* tag the region for redraw */
587
589}
590
592{
593 if (STREQ(gz_prop->type->idname, "matrix")) {
594 if (WM_gizmo_target_property_array_length(gz, gz_prop) == 16) {
596 }
597 else {
598 BLI_assert(0);
599 }
600 }
601 else {
602 BLI_assert(0);
603 }
604}
605
606static void gizmo_cage3d_exit(bContext *C, wmGizmo *gz, const bool cancel)
607{
609
610 if (!cancel) {
611 return;
612 }
613
614 wmGizmoProperty *gz_prop;
615
616 /* reset properties */
617 gz_prop = WM_gizmo_target_property_find(gz, "matrix");
618 if (gz_prop->type != nullptr) {
619 WM_gizmo_target_property_float_set_array(C, gz, gz_prop, &data->orig_matrix_offset[0][0]);
620 }
621
622 copy_m4_m4(gz->matrix_offset, data->orig_matrix_offset);
623}
624
625/* -------------------------------------------------------------------- */
630{
631 /* identifiers */
632 gzt->idname = "GIZMO_GT_cage_3d";
633
634 /* api callbacks */
635 gzt->draw = gizmo_cage3d_draw;
641 gzt->exit = gizmo_cage3d_exit;
643
644 gzt->struct_size = sizeof(wmGizmo);
645
646 /* rna */
647 static const EnumPropertyItem rna_enum_draw_style[] = {
648 {ED_GIZMO_CAGE3D_STYLE_BOX, "BOX", 0, "Box", ""},
649 {ED_GIZMO_CAGE3D_STYLE_CIRCLE, "CIRCLE", 0, "Circle", ""},
650 {0, nullptr, 0, nullptr, nullptr},
651 };
652 static const EnumPropertyItem rna_enum_transform[] = {
653 {ED_GIZMO_CAGE_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Move", ""},
654 {ED_GIZMO_CAGE_XFORM_FLAG_SCALE, "SCALE", 0, "Scale", ""},
655 {ED_GIZMO_CAGE_XFORM_FLAG_SCALE_UNIFORM, "SCALE_UNIFORM", 0, "Scale Uniform", ""},
656 {0, nullptr, 0, nullptr, nullptr},
657 };
658 static const EnumPropertyItem rna_enum_draw_options[] = {
659 {ED_GIZMO_CAGE_DRAW_FLAG_XFORM_CENTER_HANDLE, "XFORM_CENTER_HANDLE", 0, "Center Handle", ""},
660 {0, nullptr, 0, nullptr, nullptr},
661 };
662 static const float unit_v3[3] = {1.0f, 1.0f, 1.0f};
664 gzt->srna, "dimensions", 3, unit_v3, 0, FLT_MAX, "Dimensions", "", 0.0f, FLT_MAX);
665 RNA_def_enum_flag(gzt->srna, "transform", rna_enum_transform, 0, "Transform Options", "");
666 RNA_def_enum(gzt->srna,
667 "draw_style",
668 rna_enum_draw_style,
670 "Draw Style",
671 "");
673 "draw_options",
674 rna_enum_draw_options,
676 "Draw Options",
677 "");
678
680}
681
686
wmWindow * CTX_wm_window(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
#define BLI_assert(a)
Definition BLI_assert.h:50
MINLINE float signf(float f)
MINLINE int signum_i(float a)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void unit_m4(float m[4][4])
Definition rct.c:1127
void transform_pivot_set_m4(float mat[4][4], const float pivot[3])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
void mul_v3_mat3_m4v3(float r[3], const float mat[4][4], const float vec[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
unsigned int uint
#define UNUSED_VARS(...)
#define UNPACK3(a)
#define STREQ(a, b)
@ OPERATOR_RUNNING_MODAL
@ ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MID_Y_MID_Z
@ ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z
@ ED_GIZMO_CAGE3D_PART_ROTATE
@ ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z
@ ED_GIZMO_CAGE3D_PART_TRANSLATE
@ ED_GIZMO_CAGE_DRAW_FLAG_XFORM_CENTER_HANDLE
@ ED_GIZMO_CAGE3D_STYLE_BOX
@ ED_GIZMO_CAGE3D_STYLE_CIRCLE
@ ED_GIZMO_CAGE_XFORM_FLAG_SCALE
@ ED_GIZMO_CAGE_XFORM_FLAG_TRANSLATE
@ ED_GIZMO_CAGE_XFORM_FLAG_SCALE_UNIFORM
@ ED_GIZMO_CAGE_XFORM_FLAG_SCALE_SIGNED
void ED_region_tag_redraw_editor_overlays(ARegion *region)
Definition area.cc:669
float ED_view3d_pixel_size(const RegionView3D *rv3d, const float co[3])
void immEnd()
void immUniform2fv(const char *name, const float data[2])
void immUnbindProgram()
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 immUniform1f(const char *name, float x)
GPUVertFormat * immVertexFormat()
void immBegin(GPUPrimType, uint vertex_len)
void immUniformColor3fv(const float rgb[3])
void immRectf(uint pos, float x1, float y1, float x2, float y2)
void imm_draw_cube_wire_3d(uint pos, const float center[3], const float aspect[3])
void imm_draw_cube_fill_3d(uint pos, const float center[3], const float aspect[3])
void GPU_matrix_push()
#define GPU_matrix_mul(x)
void GPU_matrix_pop()
@ GPU_PRIM_LINES
bool GPU_select_load_id(unsigned int id)
@ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
@ GPU_SHADER_3D_UNIFORM_COLOR
@ 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_viewport_size_get_f(float coords[4])
Definition gpu_state.cc:262
void GPU_polygon_smooth(bool enable)
Definition gpu_state.cc:83
@ GPU_FETCH_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
Read Guarded memory(de)allocation.
@ PROP_FLOAT
Definition RNA_types.hh:67
eWM_GizmoFlagTweak
Gizmo tweak flag. Bit-flag passed to gizmo while tweaking.
@ WM_GIZMO_DRAW_NO_SCALE
@ WM_GIZMOGROUPTYPE_3D
@ WM_GIZMO_STATE_HIGHLIGHT
unsigned int U
Definition btGjkEpa3.h:78
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition btQuadWord.h:117
static void gizmo_cage3d_property_update(wmGizmo *gz, wmGizmoProperty *gz_prop)
static void cage3d_draw_circle_handles(const RegionView3D *rv3d, const float matrix_final[4][4], const float r[3], const float margin[3], const float color[3], bool solid, const float handle_scale)
static void cage3d_draw_box_corners(const float r[3], const float margin[3], const float color[3], const float line_width)
static void gizmo_cage3d_draw_select(const bContext *C, wmGizmo *gz, int select_id)
static void gizmo_cage3d_draw_intern(RegionView3D *rv3d, wmGizmo *gz, const bool select, const bool highlight, const int select_id)
static void gizmo_calc_rect_view_scale(const wmGizmo *gz, const float dims[3], float scale[3])
static int gizmo_cage3d_get_cursor(wmGizmo *gz)
static void gizmo_rect_pivot_from_scale_part(int part, float r_pt[3], bool r_constrain_axis[3], bool has_translation)
static void gizmo_cage3d_setup(wmGizmo *gz)
static int gizmo_cage3d_invoke(bContext *C, wmGizmo *gz, const wmEvent *event)
static void cage3d_draw_circle_wire(const float r[3], const float margin[3], const float color[3], const int transform_flag, const int draw_options, const float line_width)
static void GIZMO_GT_cage_3d(wmGizmoType *gzt)
static void gizmo_cage3d_draw(const bContext *C, wmGizmo *gz)
static int gizmo_cage3d_modal(bContext *C, wmGizmo *gz, const wmEvent *event, eWM_GizmoFlagTweak)
static void gizmo_calc_rect_view_margin(const wmGizmo *gz, const float dims[3], float margin[3])
void ED_gizmotypes_cage_3d()
static void imm_draw_point_aspect_3d(uint pos, const float co[3], const float rad[3], bool solid)
static void gizmo_cage3d_exit(bContext *C, wmGizmo *gz, const bool cancel)
static void cage3d_draw_box_interaction(const RegionView3D *rv3d, const float matrix_final[4][4], const float color[4], const int highlighted, const float size[3], const float margin[3])
static void gizmo_calc_matrix_final_no_offset(const wmGizmo *gz, float orig_matrix_final_no_offset[4][4], bool use_space)
void gizmo_color_get(const wmGizmo *gz, bool highlight, float r_color[4])
bool gizmo_window_project_3d(bContext *C, const wmGizmo *gz, const float mval[2], bool use_offset, float r_co[3])
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void *(* MEM_callocN)(size_t len, const char *str)
Definition mallocn.cc:42
ccl_device_inline float4 select(const int4 mask, const float4 a, const float4 b)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
#define FLT_MAX
Definition stdcycles.h:14
float orig_matrix_final_no_offset[4][4]
float xmin
int mval[2]
Definition WM_types.hh:728
short type
Definition WM_types.hh:722
eWM_GizmoFlagGroupTypeFlag flag
wmGizmoGroupType * type
const wmGizmoPropertyType * type
StructRNA * srna
wmGizmoFnDraw draw
wmGizmoFnModal modal
wmGizmoFnSetup setup
const char * idname
wmGizmoFnExit exit
wmGizmoFnCursorGet cursor_get
wmGizmoFnInvoke invoke
wmGizmoFnDrawSelect draw_select
wmGizmoFnPropertyUpdate property_update
wmGizmoGroup * parent_gzgroup
void * interaction_data
eWM_GizmoFlagState state
float matrix_offset[4][4]
float color[4]
PointerRNA * ptr
float line_width
eWM_GizmoFlag flag
@ WM_CURSOR_NSEW_SCROLL
Definition wm_cursors.hh:51
@ WM_CURSOR_DEFAULT
Definition wm_cursors.hh:15
void WM_event_add_mousemove(wmWindow *win)
@ MOUSEMOVE
void WM_gizmo_calc_matrix_final_params(const wmGizmo *gz, const WM_GizmoMatrixParams *params, float r_mat[4][4])
Definition wm_gizmo.cc:519
void WM_gizmo_calc_matrix_final(const wmGizmo *gz, float r_mat[4][4])
Definition wm_gizmo.cc:569
void WM_gizmo_target_property_float_get_array(const wmGizmo *gz, wmGizmoProperty *gz_prop, float *value)
int WM_gizmo_target_property_array_length(const wmGizmo *, wmGizmoProperty *gz_prop)
void WM_gizmotype_target_property_def(wmGizmoType *gzt, const char *idname, int data_type, int array_length)
void WM_gizmo_target_property_float_set_array(bContext *C, const wmGizmo *gz, wmGizmoProperty *gz_prop, const float *value)
wmGizmoProperty * WM_gizmo_target_property_find(wmGizmo *gz, const char *idname)
void WM_gizmotype_append(void(*gtfunc)(wmGizmoType *))