59 #include "../gizmo_geometry.h"
60 #include "../gizmo_library_intern.h"
70 #define CIRCLE_RESOLUTION 32
76 const float fill_alpha,
86 if (color[3] == 1.0 && fill_alpha == 1.0 &&
select ==
false) {
101 if ((fill_alpha != 0.0f) || (
select ==
true)) {
102 const float fill_color[4] = {
UNPACK3(color), fill_alpha * color[3]};
110 if ((fill_alpha != 1.0f) && (
select ==
false)) {
126 const bool highlight)
133 if (button->
is_init ==
false) {
144 char *polys =
MEM_mallocN(polys_len + 1, __func__);
155 float matrix_final[4][4];
163 float matrix_final_no_offset[4][4];
177 bool need_to_pop =
true;
183 float matrix_align[4][4];
184 float matrix_final_unit[4][4];
209 const bool do_wires = (i == 1);
226 float color_contrast[4];
228 color_contrast[3] = color[3];
238 color[0] = 1.0f - color[0];
239 color[1] = 1.0f - color[1];
240 color[2] = 1.0f - color[2];
246 else if (button->
icon != -1) {
249 const float fac = 2.0f;
263 float alpha = (highlight) ? 1.0f : 0.8f;
293 float point_local[2];
327 const float *co =
NULL;
328 float matrix_final[4][4];
336 float matrix_final_no_offset[4][4];
350 co = matrix_final[3];
354 r_bounding_box->
xmin = co[0] +
area->totrct.xmin - rad;
355 r_bounding_box->
ymin = co[1] +
area->totrct.ymin - rad;
356 r_bounding_box->
xmax = r_bounding_box->
xmin + rad;
357 r_bounding_box->
ymax = r_bounding_box->
ymin + rad;
381 gzt->
idname =
"GIZMO_GT_button_2d";
414 "backdrop_fill_alpha",
418 "When below 1.0, draw the interior with a reduced alpha compared to the outline",
struct ScrArea * CTX_wm_area(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct RegionView3D * CTX_wm_region_view3d(const bContext *C)
MINLINE float rgb_to_grayscale(const float rgb[3])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void normalize_m4_m4(float R[4][4], const float M[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 struct RegionView3D *rv3d, const float co[3])
eV3DProjStatus ED_view3d_project_float_global(const struct ARegion *region, const float co[3], float r_co[2], const eV3DProjTest flag)
#define GPU_batch_uniform_1f(batch, name, x)
void GPU_batch_program_set_builtin(GPUBatch *batch, eGPUBuiltinShader shader_id)
#define GPU_batch_uniform_2fv(batch, name, val)
#define GPU_BATCH_DISCARD_SAFE(batch)
void GPU_batch_draw(GPUBatch *batch)
struct GPUBatch * GPU_batch_tris_from_poly_2d_encoded(const uchar *polys_flat, uint polys_flat_len, const struct rctf *rect) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
struct GPUBatch * GPU_batch_wire_from_poly_2d_encoded(const uchar *polys_flat, uint polys_flat_len, const struct rctf *rect) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void GPU_matrix_pop(void)
void GPU_matrix_scale_2f(float x, float y)
#define GPU_matrix_mul(x)
void GPU_matrix_push(void)
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_2D_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
static CCL_NAMESPACE_BEGIN const double alpha
bool gizmo_window_project_2d(bContext *C, const struct wmGizmo *gz, const float mval[2], int axis, bool use_offset, float r_co[2])
void gizmo_color_get(const struct wmGizmo *gz, const bool highlight, float r_color[4])
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
static void area(int d1, int d2, int e1, int e2, float weights[2])
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value)
float RNA_float_get(PointerRNA *ptr, const char *name)
int RNA_property_enum_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, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
const EnumPropertyItem rna_enum_icon_items[]
eWM_GizmoFlagGroupTypeFlag flag
struct wmGizmoGroupType * type
wmGizmoFnScreenBoundsGet screen_bounds_get
wmGizmoFnTestSelect test_select
wmGizmoFnCursorGet cursor_get
wmGizmoFnDrawSelect draw_select
struct wmGizmoGroup * parent_gzgroup
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
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)(struct wmGizmoType *))