68 const float fill_alpha,
70 const float screen_scale)
75 const float max_pixel_error = 0.25f;
77 nsegments =
max_ff(nsegments, 8);
78 nsegments =
min_ff(nsegments, 1000);
85 if (color[3] == 1.0 && fill_alpha == 1.0 &&
select ==
false) {
100 if ((fill_alpha != 0.0f) || (
select ==
true)) {
101 const float fill_color[4] = {
UNPACK3(color), fill_alpha * color[3]};
109 if ((fill_alpha != 1.0f) && (
select ==
false)) {
125 const bool highlight)
132 if (button->
is_init ==
false) {
143 char *polys =
static_cast<char *
>(
MEM_mallocN(polys_len + 1, __func__));
146 (
uchar *)polys, polys_len,
nullptr);
148 (
uchar *)polys, polys_len,
nullptr);
154 float matrix_final[4][4];
162 float matrix_final_no_offset[4][4];
176 bool need_to_pop =
true;
180 float screen_scale = 200.0f;
183 float matrix_align[4][4];
184 float matrix_final_unit[4][4];
212 const bool do_wires = (i == 1);
229 float color_contrast[4];
231 color_contrast[3] = color[3];
241 color[0] = 1.0f - color[0];
242 color[1] = 1.0f - color[1];
243 color[2] = 1.0f - color[2];
249 else if (button->
icon != -1) {
252 const float fac = 2.0f;
266 float alpha = (highlight) ? 1.0f : 0.8f;
296 float point_local[2];
327#define CIRCLE_RESOLUTION_3D 32
332 const float *co =
nullptr;
333 float matrix_final[4][4];
342 float matrix_final_no_offset[4][4];
357 co = matrix_final[3];
361 r_bounding_box->
xmin = co[0] + area->totrct.xmin - rad;
362 r_bounding_box->
ymin = co[1] + area->totrct.ymin - rad;
363 r_bounding_box->
xmax = r_bounding_box->
xmin + rad;
364 r_bounding_box->
ymax = r_bounding_box->
ymin + rad;
388 gzt->
idname =
"GIZMO_GT_button_2d";
405 {0,
nullptr, 0,
nullptr,
nullptr},
421 "backdrop_fill_alpha",
425 "When below 1.0, draw the interior with a reduced alpha compared to the outline",
ScrArea * CTX_wm_area(const bContext *C)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
MINLINE float max_ff(float a, float b)
MINLINE float min_ff(float a, float b)
MINLINE float rgb_to_grayscale(const float rgb[3])
float mat4_to_scale(const float mat[4][4])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void normalize_m4_m4(float rmat[4][4], const float mat[4][4]) ATTR_NONNULL()
void transpose_m4(float R[4][4])
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v2_v2(float r[2], const float a[2])
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void zero_v3(float r[3])
@ ED_GIZMO_BUTTON_SHOW_BACKDROP
@ ED_GIZMO_BUTTON_SHOW_OUTLINE
@ ED_GIZMO_BUTTON_SHOW_HELPLINE
float ED_view3d_pixel_size_no_ui_scale(const RegionView3D *rv3d, const float co[3])
eV3DProjStatus ED_view3d_project_float_global(const ARegion *region, const float co[3], float r_co[2], eV3DProjTest flag)
#define GPU_batch_uniform_1f(batch, name, x)
#define GPU_batch_uniform_2fv(batch, name, val)
#define GPU_BATCH_DISCARD_SAFE(batch)
void GPU_batch_program_set_builtin(blender::gpu::Batch *batch, eGPUBuiltinShader shader_id)
void GPU_batch_draw(blender::gpu::Batch *batch)
blender::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)
blender::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 GPU_matrix_scale_2f(float x, float y)
#define GPU_matrix_mul(x)
void GPU_matrix_translate_2f(float x, float y)
bool GPU_select_load_id(unsigned int id)
void GPU_shader_uniform_4f(GPUShader *sh, const char *name, float x, float y, float z, float w)
@ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
@ GPU_SHADER_3D_UNIFORM_COLOR
void GPU_blend(eGPUBlend blend)
void GPU_line_smooth(bool enable)
void GPU_viewport_size_get_f(float coords[4])
void GPU_polygon_smooth(bool enable)
Read Guarded memory(de)allocation.
#define ICON_DEFAULT_HEIGHT
void UI_icon_draw_alpha(float x, float y, int icon_id, float alpha)
#define ICON_DEFAULT_WIDTH
@ WM_GIZMO_STATE_HIGHLIGHT
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void gizmo_color_get(const wmGizmo *gz, bool highlight, float r_color[4])
bool gizmo_window_project_2d(bContext *C, const wmGizmo *gz, const float mval[2], int axis, bool use_offset, float r_co[2])
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
ccl_device_inline float4 select(const int4 mask, const float4 a, const float4 b)
VecBase< int32_t, 2 > int2
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
float RNA_float_get(PointerRNA *ptr, const char *name)
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
std::string RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop)
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)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
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)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
const EnumPropertyItem rna_enum_icon_items[]
eWM_GizmoFlagGroupTypeFlag flag
wmGizmoFnScreenBoundsGet screen_bounds_get
wmGizmoFnTestSelect test_select
wmGizmoFnCursorGet cursor_get
wmGizmoFnDrawSelect draw_select
wmGizmoGroup * parent_gzgroup
void WM_gizmo_calc_matrix_final(const wmGizmo *gz, float r_mat[4][4])
void WM_gizmo_calc_matrix_final_no_offset(const wmGizmo *gz, float r_mat[4][4])
void WM_gizmotype_append(void(*gtfunc)(wmGizmoType *))