43 #include "../gizmo_geometry.h"
44 #include "../gizmo_library_intern.h"
73 #define DIAL_WIDTH 1.0f
74 #define DIAL_RESOLUTION 48
77 #define DIAL_CLIP_BIAS 0.02
90 const float matrix_final[4][4],
91 const float line_width,
97 const float line_width,
99 const float axis_modal_mat[4][4],
100 const float clip_plane[4],
101 const float arc_partial_angle,
102 const float arc_inner_factor,
103 const int draw_options)
105 #ifdef USE_GIZMO_CUSTOM_DIAL
131 if (arc_partial_angle == 0.0f) {
132 if (arc_inner_factor == 0.0f) {
141 float arc_partial_deg =
RAD2DEGF((
M_PI * 2) - arc_partial_angle);
149 -arc_partial_deg / 2,
159 if (arc_partial_angle == 0.0f) {
161 if (arc_inner_factor != 0.0f) {
166 float arc_partial_deg =
RAD2DEGF((
M_PI * 2) - arc_partial_angle);
170 if (arc_inner_factor != 0.0f) {
187 const float co_outer[3],
188 const float color[4],
189 const float line_width)
220 const int tot_incr = (2 *
M_PI) / incremental_angle;
235 for (
int i = 0; i < tot_incr; i++) {
252 const float arc_inner_factor,
253 const float color[4])
262 int rotation_count = (int)
floorf(
fabsf(angle_delta) / pi2);
263 angle_delta = fmod(angle_delta, pi2);
266 const float angle_background = angle_delta >= 0 ? (pi2 - angle_delta) : -(pi2 + angle_delta);
268 float color_background[4] = {0};
269 if (arc_inner_factor != 0.0) {
270 color_background[3] =
color[3] / 2.0f;
273 if (rotation_count != 0) {
276 color_background[3] =
color[3] * rotation_count;
304 const float mat[4][4],
305 const float co_outer[3],
314 float view_vec[3], axis_vec[3];
318 float proj_outer_rel[3];
322 float proj_mval_new_rel[3];
323 float proj_mval_init_rel[3];
329 region, dial_plane, inter->
init.
mval,
false, proj_mval_init_rel)) {
378 const float angle_delta,
379 const float arc_inner_factor,
380 const float color_helpline[4],
381 const int draw_options)
384 const float co_outer[4] = {0.0f,
DIAL_WIDTH, 0.0f};
385 const float color_arc_inner[4] = {0.8f, 0.8f, 0.8f, 0.2f};
396 float matrix_final[4][4];
406 const float arc_partial_angle =
RNA_float_get(gz->
ptr,
"arc_partial_angle");
409 float angle_ofs = 0.0f;
410 float angle_delta = 0.0f;
411 float angle_increment = 0.0f;
441 .draw_options = draw_options,
442 .angle_ofs = angle_ofs,
443 .angle_delta = angle_delta,
444 .angle_increment = angle_increment,
445 .arc_partial_angle = arc_partial_angle,
446 .arc_inner_factor = arc_inner_factor,
447 .clip_plane = clip_plane,
453 float clip_plane_buf[4];
474 float clip_plane_buf[4];
508 const float co_outer[4] = {0.0f,
DIAL_WIDTH, 0.0f};
509 float angle_ofs, angle_delta, angle_increment = 0.0f;
516 angle_delta = (
float)roundf((
double)angle_delta / angle_increment) * angle_increment;
519 angle_increment *= 0.2f;
522 if (angle_delta != 0.0f) {
545 bool use_reset_value =
false;
546 float reset_value = 0.0f;
552 use_reset_value =
true;
560 use_reset_value =
true;
566 if (use_reset_value) {
584 const float dir_default[3] = {0.0f, 0.0f, 1.0f};
599 inter->
init.
mval[0] =
event->mval[0];
600 inter->
init.
mval[1] =
event->mval[1];
617 const float matrix_final[4][4],
618 const float line_width,
619 const float color[4],
645 if (
params->angle_increment) {
655 params->arc_partial_angle,
665 gzt->
idname =
"GIZMO_GT_dial_3d";
690 gzt->
srna,
"arc_inner_factor", 0.0f, 0.0f, 1.0f,
"Arc Inner Factor",
"", 0.0f, 1.0f);
706 "Angle to snap in steps",
715 "Value to use for a single click action",
typedef float(TangentPoint)[2]
struct ScrArea * CTX_wm_area(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
void mul_v3_project_m4_v3(float r[3], const float mat[4][4], const float vec[3])
float angle_wrap_rad(float angle)
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
float angle_signed_on_axis_v3v3_v3(const float v1[3], const float v2[3], const float axis[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3_v3(float r[3], const float a[3])
typedef double(DMatrix)[4][4]
@ ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR
@ ED_GIZMO_DIAL_DRAW_FLAG_FILL_SELECT
@ ED_GIZMO_DIAL_DRAW_FLAG_FILL
@ ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y
@ ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE
@ ED_GIZMO_DIAL_DRAW_FLAG_CLIP
bool ED_view3d_win_to_3d_on_plane(const struct ARegion *region, const float plane[4], const float mval[2], bool do_clip, float r_out[3])
void ED_view3d_global_to_vector(const struct RegionView3D *rv3d, const float coord[3], float vec[3])
void GPU_matrix_pop(void)
#define GPU_matrix_mul(x)
void GPU_matrix_push(void)
void GPU_matrix_rotate_3f(float deg, float x, float y, float z)
bool GPU_select_load_id(unsigned int id)
@ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
@ GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_3D_POLYLINE_CLIPPED_UNIFORM_COLOR
void GPU_blend(eGPUBlend blend)
void GPU_viewport_size_get_f(float coords[4])
void GPU_polygon_smooth(bool enable)
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
eWM_GizmoFlagTweak
Gizmo tweak flag. Bit-flag passed to gizmo while tweaking.
@ WM_GIZMO_STATE_HIGHLIGHT
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
ATTR_WARN_UNUSED_RESULT const BMVert * v
ccl_device_inline float wrap_angle(float a)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
static void dial_ghostarc_draw_incremental_angle(const float incremental_angle, const float offset)
static void dial_3d_draw_util(const float matrix_basis[4][4], const float matrix_final[4][4], const float line_width, const float color[4], const bool select, struct Dial3dParams *params)
static void gizmo_dial_exit(bContext *C, wmGizmo *gz, const bool cancel)
static void dial_ghostarc_get_angles(const wmGizmo *gz, const wmEvent *event, const ARegion *region, const float mat[4][4], const float co_outer[3], float *r_start, float *r_delta)
static int gizmo_dial_modal(bContext *C, wmGizmo *gz, const wmEvent *event, eWM_GizmoFlagTweak tweak_flag)
static void gizmo_dial_setup(wmGizmo *gz)
static void dial_ghostarc_draw_with_helplines(const float angle_ofs, const float angle_delta, const float arc_inner_factor, const float color_helpline[4], const int draw_options)
static void gizmo_dial_draw(const bContext *C, wmGizmo *gz)
static void gizmo_dial_draw_select(const bContext *C, wmGizmo *gz, int select_id)
static void dial_draw_intern(const bContext *C, wmGizmo *gz, const bool select, const bool highlight, float clip_plane[4])
void ED_gizmotypes_dial_3d(void)
static void dial_ghostarc_draw(const float angle_ofs, float angle_delta, const float arc_inner_factor, const float color[4])
struct DialInteraction DialInteraction
static void GIZMO_GT_dial_3d(wmGizmoType *gzt)
static void dial_geom_draw(const float color[4], const float line_width, const bool select, const float axis_modal_mat[4][4], const float clip_plane[4], const float arc_partial_angle, const float arc_inner_factor, const int draw_options)
static void dial_ghostarc_draw_helpline(const float angle, const float co_outer[3], const float color[4], const float line_width)
static int gizmo_dial_invoke(bContext *UNUSED(C), wmGizmo *gz, const wmEvent *event)
SyclQueue void void size_t num_bytes void
GizmoGeomInfo wm_gizmo_geom_data_dial
void wm_gizmo_geometryinfo_draw(const GizmoGeomInfo *info, const bool UNUSED(select), const float color[4])
void gizmo_color_get(const struct wmGizmo *gz, bool highlight, float r_color[4])
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void *(* MEM_callocN)(size_t len, const char *str)
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
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)
PropertyRNA * RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
struct DialInteraction::@344 init
struct DialInteraction::@345 prev
struct DialInteraction::@346 output
eWM_GizmoFlagTweak tweak_flag
wmGizmoFnDrawSelect draw_select
wmGizmoFnModal custom_modal
void WM_gizmo_calc_matrix_final(const wmGizmo *gz, float r_mat[4][4])
void WM_gizmo_target_property_float_set(bContext *C, const wmGizmo *gz, wmGizmoProperty *gz_prop, const float value)
wmGizmoProperty * WM_gizmo_target_property_find(wmGizmo *gz, const char *idname)
bool WM_gizmo_target_property_is_valid(const wmGizmoProperty *gz_prop)
void WM_gizmotype_target_property_def(wmGizmoType *gzt, const char *idname, int data_type, int array_length)
float WM_gizmo_target_property_float_get(const wmGizmo *gz, wmGizmoProperty *gz_prop)
void WM_gizmo_target_property_anim_autokey(bContext *C, const wmGizmo *UNUSED(gz), wmGizmoProperty *gz_prop)
void WM_gizmotype_append(void(*gtfunc)(struct wmGizmoType *))