Blender V5.3
button2d_gizmo.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
16
17#include "MEM_guardedalloc.h"
18
19#include "BLI_listbase.hh"
20#include "BLI_math_color_c.hh"
21#include "BLI_math_matrix_c.hh"
22#include "BLI_math_vector_c.hh"
24#include "BLI_rect.hh"
25
26#include "DNA_userdef_types.h"
27
28#include "BKE_context.hh"
29
30#include "GPU_batch.hh"
31#include "GPU_batch_utils.hh"
32#include "GPU_immediate.hh"
33#include "GPU_immediate_util.hh"
34#include "GPU_matrix.hh"
35#include "GPU_select.hh"
36#include "GPU_state.hh"
37
38#include "RNA_access.hh"
39#include "RNA_define.hh"
40#include "RNA_enum_types.hh"
41
42#include "WM_api.hh"
43#include "WM_types.hh"
44
45#include "ED_gizmo_library.hh"
46#include "ED_view3d.hh"
47
48#include "UI_interface.hh"
49#include "UI_interface_icons.hh"
50
51/* own includes */
53
54namespace blender {
55
57{
58 rcti group_bounds = {0};
59
60 for (wmGizmo &gz : gzgroup->gizmos) {
62 continue;
63 }
64 rcti gizmo_bounds;
65 gz.type->screen_bounds_get(C, &gz, &gizmo_bounds);
66 if (BLI_rcti_is_empty(&group_bounds)) {
67 group_bounds = gizmo_bounds;
68 }
69 else {
70 BLI_rcti_union(&group_bounds, &gizmo_bounds);
71 }
72 }
73
74 rctf draw_rect;
75 BLI_rctf_rcti_copy(&draw_rect, &group_bounds);
76 const float rad = BLI_rctf_size_x(&draw_rect) / 2.0f;
77
78 ScrArea *area = CTX_wm_area(C);
79 BLI_rctf_translate(&draw_rect, -area->totrct.xmin, -area->totrct.ymin);
80
81 float background_color[4];
82 ui::theme::get_color_4fv(TH_HEADER, background_color);
83 background_color[3] = std::max(background_color[3], 0.3f);
84
85 float outline_color[4];
86 copy_v4_v4(outline_color, background_color);
87 outline_color[3] = std::max(outline_color[3], 0.5f);
88
89 /* A bit of padding above and below. */
90 BLI_rctf_pad(&draw_rect, 0.0f, rad * 0.2f);
93 &draw_rect, background_color, nullptr, 1.0f, outline_color, U.pixelsize, rad);
94}
95
96/* -------------------------------------------------------------------- */
99
103 /* Use an icon or shape */
104 int icon;
105 gpu::Batch *shape_batch[2];
106};
107
109
110/* -------------------------------------------------------------------- */
113
115 const float color[4],
116 const float fill_alpha,
117 const bool select,
118 const float screen_scale)
119{
120 float viewport[4];
121 GPU_viewport_size_get_f(viewport);
122
123 const float max_pixel_error = 0.25f;
124 int nsegments = int(ceilf(M_PI / acosf(1.0f - max_pixel_error / screen_scale)));
125 nsegments = max_ff(nsegments, 8);
126 nsegments = min_ff(nsegments, 1000);
127
128 GPUVertFormat *format = immVertexFormat();
129 /* NOTE(Metal): Prefer 3D coordinate for 2D rendering when using 3D shader. */
130 uint pos = GPU_vertformat_attr_add(format, "pos", gpu::VertAttrType::SFLOAT_32_32_32);
131
132 /* TODO: other draw styles. */
133 if (color[3] == 1.0 && fill_alpha == 1.0 && select == false) {
136 imm_draw_circle_fill_3d(pos, 0.0f, 0.0f, 1.0f, nsegments);
138
140 immUniform2fv("viewportSize", &viewport[2]);
141 immUniform1f("lineWidth", (gz->line_width * U.pixelsize) + WM_gizmo_select_bias(select));
143 imm_draw_circle_wire_3d(pos, 0.0f, 0.0f, 1.0f, nsegments);
145 }
146 else {
147 /* Draw fill. */
148 if ((fill_alpha != 0.0f) || (select == true)) {
149 const float fill_color[4] = {UNPACK3(color), fill_alpha * color[3]};
151 immUniformColor4fv(fill_color);
152 imm_draw_circle_fill_3d(pos, 0.0f, 0.0f, 1.0f, nsegments);
154 }
155
156 /* Draw outline. */
157 if ((fill_alpha != 1.0f) && (select == false)) {
159 immUniform2fv("viewportSize", &viewport[2]);
160 immUniform1f("lineWidth", (gz->line_width * U.pixelsize) + WM_gizmo_select_bias(select));
162 imm_draw_circle_wire_3d(pos, 0.0f, 0.0f, 1.0f, nsegments);
164 }
165 }
166
168}
169
170static void button2d_draw_intern(const bContext *C,
171 wmGizmo *gz,
172 const bool select,
173 const bool highlight)
174{
175 ButtonGizmo2D *button = reinterpret_cast<ButtonGizmo2D *>(gz);
176 float viewport[4];
177 GPU_viewport_size_get_f(viewport);
178
179 const int draw_options = RNA_enum_get(gz->ptr, "draw_options");
180 if (button->is_init == false) {
181 button->is_init = true;
182 button->icon = -1;
183
184 PropertyRNA *icon_prop = RNA_struct_find_property(gz->ptr, "icon");
185 PropertyRNA *icon_value_prop = RNA_struct_find_property(gz->ptr, "icon_value");
186 PropertyRNA *shape_prop = RNA_struct_find_property(gz->ptr, "shape");
187
188 /* Same logic as in the RNA UI API, use icon_value only if icon is not defined. */
189 if (RNA_property_is_set(gz->ptr, icon_prop)) {
190 button->icon = RNA_property_enum_get(gz->ptr, icon_prop);
191 }
192 else if (RNA_property_is_set(gz->ptr, icon_value_prop)) {
193 button->icon = RNA_property_int_get(gz->ptr, icon_value_prop);
194 ui::icon_ensure_deferred(C, button->icon, false);
195 }
196 else if (RNA_property_is_set(gz->ptr, shape_prop)) {
197 const uint polys_len = RNA_property_string_length(gz->ptr, shape_prop);
198 if (polys_len > 0) [[likely]] {
199 char *polys = MEM_new_array_uninitialized<char>(polys_len, __func__);
200 RNA_property_string_get(gz->ptr, shape_prop, polys);
202 reinterpret_cast<const uchar *>(polys), polys_len, nullptr);
204 reinterpret_cast<const uchar *>(polys), polys_len, nullptr);
205 MEM_delete(polys);
206 }
207 }
208 }
209
210 float color[4];
211 float matrix_final[4][4];
212
213 gizmo_color_get(gz, highlight, color);
214 WM_gizmo_calc_matrix_final(gz, matrix_final);
215
216 bool is_3d = (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) != 0;
217
218 if ((select == false) && (draw_options & ED_GIZMO_BUTTON_SHOW_HELPLINE)) {
219 float matrix_final_no_offset[4][4];
220 WM_gizmo_calc_matrix_final_no_offset(gz, matrix_final_no_offset);
222 immVertexFormat(), "pos", gpu::VertAttrType::SFLOAT_32_32_32);
224 immUniform2fv("viewportSize", &viewport[2]);
225 immUniform1f("lineWidth", (gz->line_width * U.pixelsize) + WM_gizmo_select_bias(select));
228 immVertex3fv(pos, matrix_final[3]);
229 immVertex3fv(pos, matrix_final_no_offset[3]);
230 immEnd();
232 }
233
234 bool need_to_pop = true;
236 GPU_matrix_mul(matrix_final);
237
238 float screen_scale = 200.0f;
239 if (is_3d) {
241 float matrix_align[4][4];
242 float matrix_final_unit[4][4];
243 normalize_m4_m4(matrix_final_unit, matrix_final);
244 mul_m4_m4m4(matrix_align, rv3d->viewmat, matrix_final_unit);
245 zero_v3(matrix_align[3]);
246 transpose_m4(matrix_align);
247 GPU_matrix_mul(matrix_align);
248 }
249 else {
250 screen_scale = mat4_to_scale(matrix_final);
251 }
252
253 if (select) {
254 BLI_assert(is_3d);
255 button2d_geom_draw_backdrop(gz, color, 1.0, select, screen_scale);
256 }
257 else {
258
260
261 if (draw_options & ED_GIZMO_BUTTON_SHOW_BACKDROP) {
262 const float fill_alpha = RNA_float_get(gz->ptr, "backdrop_fill_alpha");
263 button2d_geom_draw_backdrop(gz, color, fill_alpha, select, screen_scale);
264 }
265
266 if (button->shape_batch[0] != nullptr) {
267 GPU_line_smooth(true);
268 GPU_polygon_smooth(false);
269 for (uint i = 0; i < ARRAY_SIZE(button->shape_batch) && button->shape_batch[i]; i++) {
270 const bool do_wires = (i == 1);
271 if (do_wires) {
274 GPU_batch_uniform_2fv(button->shape_batch[i], "viewportSize", &viewport[2]);
275 GPU_batch_uniform_1f(button->shape_batch[i], "lineWidth", gz->line_width * U.pixelsize);
276 }
277 else {
279 }
280
281 /* Invert line color for wire. */
282 if (draw_options & ED_GIZMO_BUTTON_SHOW_BACKDROP) {
283 /* If we have a backdrop already,
284 * draw a contrasting shape over it instead of drawing it the same color.
285 * Use a low value instead of 50% so some darker primary colors
286 * aren't considered being close to black. */
287 float color_contrast[4];
288 copy_v3_fl(color_contrast, srgb_to_grayscale(color) < 0.2f ? 1 : 0);
289 color_contrast[3] = color[3];
290 GPU_shader_uniform_4f(button->shape_batch[i]->shader, "color", UNPACK4(color_contrast));
291 }
292 else {
293 GPU_shader_uniform_4f(button->shape_batch[i]->shader, "color", UNPACK4(color));
294 }
295
296 GPU_batch_draw(button->shape_batch[i]);
297
298 if (draw_options & ED_GIZMO_BUTTON_SHOW_OUTLINE) {
299 color[0] = 1.0f - color[0];
300 color[1] = 1.0f - color[1];
301 color[2] = 1.0f - color[2];
302 }
303 }
304 GPU_line_smooth(false);
305 GPU_polygon_smooth(true);
306 }
307 else if (button->icon != -1) {
308 float pos[2];
309 if (is_3d) {
310 const float fac = 2.0f;
311 GPU_matrix_translate_2f(-(fac / 2), -(fac / 2));
314 pos[0] = 1.0f;
315 pos[1] = 1.0f;
316 }
317 else {
318 pos[0] = gz->matrix_basis[3][0] - (ICON_DEFAULT_WIDTH / 2.0) * UI_SCALE_FAC;
319 pos[1] = gz->matrix_basis[3][1] - (ICON_DEFAULT_HEIGHT / 2.0) * UI_SCALE_FAC;
321 need_to_pop = false;
322 }
323
324 float alpha = (highlight) ? 1.0f : 0.6f;
325 GPU_polygon_smooth(false);
326
327 uchar icon_color[4];
328
329 ui::theme::get_color_4ubv(highlight ? TH_TEXT_HI : TH_TEXT, icon_color);
330
331 ui::icon_draw_ex(pos[0],
332 pos[1],
333 button->icon,
335 alpha,
336 0.0f,
337 icon_color,
338 false,
340
341 GPU_polygon_smooth(true);
342 }
344 }
345
346 if (need_to_pop) {
348 }
349}
350
351static void gizmo_button2d_draw_select(const bContext *C, wmGizmo *gz, int select_id)
352{
353 GPU_select_load_id(select_id);
354 button2d_draw_intern(C, gz, true, false);
355}
356
357static void gizmo_button2d_draw(const bContext *C, wmGizmo *gz)
358{
359 const bool is_highlight = (gz->state & WM_GIZMO_STATE_HIGHLIGHT) != 0;
360
362 button2d_draw_intern(C, gz, false, is_highlight);
364}
365
366static int gizmo_button2d_test_select(bContext *C, wmGizmo *gz, const int mval[2])
367{
368 float point_local[2];
369
370 if (false) {
371 /* correct, but unnecessarily slow. */
372 if (gizmo_window_project_2d(C, gz, float2{int2(mval)}, 2, true, point_local) == false) {
373 return -1;
374 }
375 }
376 else {
377 copy_v2_v2(point_local, float2{int2(mval)});
378 sub_v2_v2(point_local, gz->matrix_basis[3]);
379 mul_v2_fl(point_local, 1.0f / gz->scale_final);
380 }
381 /* The 'gz->scale_final' is already applied when projecting. */
382 if (len_squared_v2(point_local) < 1.0f) {
383 return 0;
384 }
385
386 return -1;
387}
388
390{
391 if (RNA_boolean_get(gz->ptr, "show_drag")) {
393 }
394 return WM_CURSOR_DEFAULT;
395}
396
397#define CIRCLE_RESOLUTION_3D 32
398static bool gizmo_button2d_bounds(const bContext *C, wmGizmo *gz, rcti *r_bounding_box)
399{
400 ScrArea *area = CTX_wm_area(C);
401 float rad = CIRCLE_RESOLUTION_3D * UI_SCALE_FAC / 2.0f;
402 const float *co = nullptr;
403 float matrix_final[4][4];
404 float co_proj[3];
405 WM_gizmo_calc_matrix_final(gz, matrix_final);
406
408 ARegion *region = CTX_wm_region(C);
409 if (ED_view3d_project_float_global(region, matrix_final[3], co_proj, V3D_PROJ_TEST_NOP) ==
411 {
412 float matrix_final_no_offset[4][4];
413 const RegionView3D *rv3d = static_cast<const RegionView3D *>(region->regiondata);
414 WM_gizmo_calc_matrix_final_no_offset(gz, matrix_final_no_offset);
415 const float factor = ED_view3d_pixel_size_no_ui_scale(rv3d, matrix_final_no_offset[3]) /
416 ED_view3d_pixel_size_no_ui_scale(rv3d, matrix_final[3]);
417 /* It's possible (although unlikely) `matrix_final_no_offset` is behind the view.
418 * `matrix_final` has already been projected so both can't be negative. */
419 if (factor > 0.0f) {
420 rad *= factor;
421 }
422 co = co_proj;
423 }
424 }
425 else {
426 rad = mat4_to_scale(matrix_final);
427 co = matrix_final[3];
428 }
429
430 if (co != nullptr) {
431 r_bounding_box->xmin = co[0] + area->totrct.xmin - rad;
432 r_bounding_box->ymin = co[1] + area->totrct.ymin - rad;
433 r_bounding_box->xmax = co[0] + area->totrct.xmin + rad;
434 r_bounding_box->ymax = co[1] + area->totrct.ymin + rad;
435 return true;
436 }
437 return false;
438}
439
441{
442 ButtonGizmo2D *shape = reinterpret_cast<ButtonGizmo2D *>(gz);
443
444 for (uint i = 0; i < ARRAY_SIZE(shape->shape_batch); i++) {
446 }
447}
448
450
451/* -------------------------------------------------------------------- */
454
456{
457 /* identifiers */
458 gzt->idname = "GIZMO_GT_button_2d";
459
460 /* API callbacks. */
467
468 gzt->struct_size = sizeof(ButtonGizmo2D);
469
470 /* rna */
471 static const EnumPropertyItem rna_enum_draw_options[] = {
472 {ED_GIZMO_BUTTON_SHOW_OUTLINE, "OUTLINE", 0, "Outline", ""},
473 {ED_GIZMO_BUTTON_SHOW_BACKDROP, "BACKDROP", 0, "Backdrop", ""},
474 {ED_GIZMO_BUTTON_SHOW_HELPLINE, "HELPLINE", 0, "Help Line", ""},
475 {0, nullptr, 0, nullptr, nullptr},
476 };
477 PropertyRNA *prop;
478
479 RNA_def_enum_flag(gzt->srna, "draw_options", rna_enum_draw_options, 0, "Draw Options", "");
480
481 prop = RNA_def_property(gzt->srna, "icon", PROP_ENUM, PROP_NONE);
483
484 RNA_def_property(gzt->srna, "icon_value", PROP_INT, PROP_UNSIGNED);
485
486 /* Passed to 'GPU_batch_tris_from_poly_2d_encoded' */
488
489 /* Currently only used for cursor display. */
490 RNA_def_boolean(gzt->srna, "show_drag", true, "Show Drag", "");
491
492 RNA_def_float(gzt->srna,
493 "backdrop_fill_alpha",
494 1.0f,
495 0.0f,
496 1.0,
497 "When below 1.0, draw the interior with a reduced alpha compared to the outline",
498 "",
499 0.0f,
500 1.0f);
501}
502
507 /* Button Gizmo API */
509
510} // namespace blender
#define M_PI
#define UI_SCALE_FAC
#define UI_INV_SCALE_FAC
#define GPU_batch_uniform_1f(batch, name, x)
Definition GPU_batch.hh:267
#define GPU_batch_uniform_2fv(batch, name, val)
Definition GPU_batch.hh:273
#define GPU_BATCH_DISCARD_SAFE(batch)
Definition GPU_batch.hh:199
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define ICON_DEFAULT_HEIGHT
#define UI_NO_ICON_OVERLAY_TEXT
#define ICON_DEFAULT_WIDTH
#define UNPACK4(a)
#define UNUSED_VARS(...)
#define UNPACK3(a)
#define CIRCLE_RESOLUTION_3D
#define acosf(x)
void get_color_4ubv(int colorid, unsigned char col[4])
void get_color_4fv(int colorid, float col[4])
void icon_draw_ex(float x, float y, int icon_id, float aspect, float alpha, float desaturate, const uchar mono_color[4], bool mono_border, const IconTextOverlay *text_overlay, const bool inverted=false, float scale=1.0f)
void draw_roundbox_corner_set(int type)
void draw_roundbox_4fv_ex(const rctf *rect, const float inner1[4], const float inner2[4], float shade_dir, const float outline[4], float outline_width, float rad)
void icon_ensure_deferred(const bContext *C, int icon_id, bool big)
BMesh Iterators.
MINLINE float min_ff(float a, float b)
UserDef U
Definition blender.cc:58
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
@ V3D_PROJ_RET_OK
Definition ED_view3d.hh:273
ScrArea * CTX_wm_area(const bContext *C)
int RNA_enum_get(PointerRNA *ptr, const char *name)
void immEnd()
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
unsigned int uint
Definition BKE_text.h:55
void GPU_polygon_smooth(bool enable)
Definition gpu_state.cc:85
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
bool GPU_select_load_id(unsigned int id)
int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop)
void WM_gizmotype_append(void(*gtfunc)(wmGizmoType *))
MINLINE void mul_v2_fl(float r[2], float f)
float mat4_to_scale(const float mat[4][4])
MINLINE void copy_v2_v2(float r[2], const float a[2])
GPUVertFormat * immVertexFormat()
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
void immBegin(GPUPrimType, uint vertex_len)
void WM_gizmo_calc_matrix_final_no_offset(const wmGizmo *gz, float r_mat[4][4])
Definition wm_gizmo.cc:556
void GPU_line_smooth(bool enable)
Definition gpu_state.cc:80
std::string RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop)
@ GPU_PRIM_LINE_STRIP
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void WM_gizmo_calc_matrix_final(const wmGizmo *gz, float r_mat[4][4])
Definition wm_gizmo.cc:569
static void gizmo_button2d_free(wmGizmo *gz)
void immUniformColor4fv(const float rgba[4])
void ED_gizmotypes_button_2d()
MINLINE float srgb_to_grayscale(const float rgb[3])
void immUnbindProgram()
void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src)
void GPU_matrix_mul(const float m[4][4])
void GPU_matrix_scale_2f(float x, float y)
@ GPU_BLEND_NONE
Definition GPU_state.hh:88
@ GPU_BLEND_ALPHA
Definition GPU_state.hh:90
static int gizmo_button2d_test_select(bContext *C, wmGizmo *gz, const int mval[2])
static float WM_gizmo_select_bias(bool select)
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
void immUniform1f(const char *name, float x)
unsigned char uchar
Definition BKE_text.h:58
@ PROP_STRING
Definition RNA_types.hh:213
void GPU_viewport_size_get_f(float coords[4])
Definition gpu_state.cc:258
@ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
void ED_gizmo_button2d_group_background(const bContext *C, wmGizmoGroup *gzgroup)
gpu::Batch * GPU_batch_wire_from_poly_2d_encoded(const uchar *polys_flat, uint polys_flat_len, const rctf *rect) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_rcti_union(struct rcti *rct_a, const struct rcti *rct_b)
eV3DProjStatus ED_view3d_project_float_global(const ARegion *region, const float co[3], float r_co[2], eV3DProjTest flag)
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
gpu::Batch * GPU_batch_tris_from_poly_2d_encoded(const uchar *polys_flat, uint polys_flat_len, const rctf *rect) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void GPU_batch_draw(gpu::Batch *batch)
static void button2d_draw_intern(const bContext *C, wmGizmo *gz, const bool select, const bool highlight)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
void gizmo_color_get(const wmGizmo *gz, bool highlight, float r_color[4])
bool BLI_rcti_is_empty(const struct rcti *rect)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void imm_draw_circle_fill_3d(uint pos, float x, float y, float radius, int nsegments)
void GPU_matrix_translate_2f(float x, float y)
MINLINE void zero_v3(float r[3])
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
void GPU_batch_program_set_builtin(gpu::Batch *batch, GPUBuiltinShader shader_id)
static void gizmo_button2d_draw(const bContext *C, wmGizmo *gz)
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
void immVertex3fv(uint attr_id, const float data[3])
static void button2d_geom_draw_backdrop(const wmGizmo *gz, const float color[4], const float fill_alpha, const bool select, const float screen_scale)
@ WM_CURSOR_NSEW_SCROLL
Definition wm_cursors.hh:54
@ WM_CURSOR_DEFAULT
Definition wm_cursors.hh:17
void transpose_m4(float R[4][4])
@ WM_GIZMO_STATE_HIGHLIGHT
MINLINE void copy_v3_fl(float r[3], float f)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition BLI_rect.hh:211
float ED_view3d_pixel_size_no_ui_scale(const RegionView3D *rv3d, const float co[3])
MINLINE float max_ff(float a, float b)
bool gizmo_window_project_2d(bContext *C, const wmGizmo *gz, const float mval[2], int axis, bool use_offset, float r_co[2])
@ V3D_PROJ_TEST_NOP
Definition ED_view3d.hh:295
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)
void BLI_rctf_translate(struct rctf *rect, float x, float y)
Definition rct.cc:587
void immUniform2fv(const char *name, const float data[2])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void sub_v2_v2(float r[2], const float a[2])
void GPU_blend(GPUBlend blend)
Definition gpu_state.cc:44
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void normalize_m4_m4(float rmat[4][4], const float mat[4][4]) ATTR_NONNULL()
@ PROP_BYTESTRING
Definition RNA_types.hh:295
@ PROP_UNSIGNED
Definition RNA_types.hh:306
const EnumPropertyItem rna_enum_icon_items[]
Definition rna_ui_api.cc:30
@ ED_GIZMO_BUTTON_SHOW_BACKDROP
@ ED_GIZMO_BUTTON_SHOW_OUTLINE
@ ED_GIZMO_BUTTON_SHOW_HELPLINE
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
void GPU_matrix_pop()
void imm_draw_circle_wire_3d(uint pos, float x, float y, float radius, int nsegments)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
static void gizmo_button2d_draw_select(const bContext *C, wmGizmo *gz, int select_id)
static void GIZMO_GT_button_2d(wmGizmoType *gzt)
ARegion * CTX_wm_region(const bContext *C)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
void BLI_rctf_pad(struct rctf *rect, float pad_x, float pad_y)
Definition rct.cc:651
void GPU_matrix_push()
void GPU_shader_uniform_4f(gpu::Shader *sh, const char *name, float x, float y, float z, float w)
static int gizmo_button2d_cursor_get(wmGizmo *gz)
static bool gizmo_button2d_bounds(const bContext *C, wmGizmo *gz, rcti *r_bounding_box)
#define ceilf
gpu::Batch * shape_batch[2]
eWM_GizmoFlagGroupTypeFlag flag
wmGizmoGroupType * type
ListBaseT< wmGizmo > gizmos
wmGizmoFnDrawSelect draw_select
wmGizmoFnCursorGet cursor_get
wmGizmoFnScreenBoundsGet screen_bounds_get
wmGizmoFnTestSelect test_select
float matrix_basis[4][4]
const wmGizmoType * type
wmGizmoGroup * parent_gzgroup
eWM_GizmoFlag flag
eWM_GizmoFlagState state