Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BKE_context.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
#include "GPU_select.h"
#include "GPU_state.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_gizmo_library.h"
#include "ED_screen.h"
#include "ED_transform.h"
#include "ED_view3d.h"
#include "../gizmo_geometry.h"
#include "../gizmo_library_intern.h"
Go to the source code of this file.
Classes | |
struct | DialInteraction |
struct | Dial3dParams |
Functions | |
Dial Gizmo API | |
static void | GIZMO_GT_dial_3d (wmGizmoType *gzt) |
void | ED_gizmotypes_dial_3d (void) |
Dial Gizmo | |
Circle shaped gizmo for circular interaction. Currently no own handling, use with operator only. 3D Gizmo
| |
#define | DIAL_WIDTH 1.0f |
#define | DIAL_RESOLUTION 48 |
#define | DIAL_CLIP_BIAS 0.02 |
typedef struct DialInteraction | DialInteraction |
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 | 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 void | dial_ghostarc_draw_incremental_angle (const float incremental_angle, const float offset) |
static void | dial_ghostarc_draw (const float angle_ofs, float angle_delta, const float arc_inner_factor, const float color[4]) |
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 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 | dial_draw_intern (const bContext *C, wmGizmo *gz, const bool select, const bool highlight, float clip_plane[4]) |
static void | gizmo_dial_draw_select (const bContext *C, wmGizmo *gz, int select_id) |
static void | gizmo_dial_draw (const bContext *C, wmGizmo *gz) |
static int | gizmo_dial_modal (bContext *C, wmGizmo *gz, const wmEvent *event, eWM_GizmoFlagTweak tweak_flag) |
static void | gizmo_dial_exit (bContext *C, wmGizmo *gz, const bool cancel) |
static void | gizmo_dial_setup (wmGizmo *gz) |
static int | gizmo_dial_invoke (bContext *UNUSED(C), wmGizmo *gz, const wmEvent *event) |
#define DIAL_CLIP_BIAS 0.02 |
Definition at line 77 of file dial3d_gizmo.c.
#define DIAL_RESOLUTION 48 |
Definition at line 74 of file dial3d_gizmo.c.
#define DIAL_WIDTH 1.0f |
Definition at line 73 of file dial3d_gizmo.c.
typedef struct DialInteraction DialInteraction |
|
static |
Definition at line 616 of file dial3d_gizmo.c.
References color, dial_geom_draw(), dial_ghostarc_draw_incremental_angle(), dial_ghostarc_draw_with_helplines(), ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR, ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE, GPU_matrix_mul, GPU_matrix_pop(), GPU_matrix_push(), GPU_polygon_smooth(), M_PI, params, and select().
Referenced by dial_draw_intern().
|
static |
Definition at line 393 of file dial3d_gizmo.c.
References DialInteraction::angle_delta, DialInteraction::angle_increment, DialInteraction::angle_ofs, BLI_assert, C, color, CTX_wm_area(), dial_3d_draw_util(), ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE, wmGizmo::flag, gizmo_color_get(), wmGizmo::interaction_data, wmGizmo::line_width, wmGizmo::matrix_basis, DialInteraction::output, wmGizmo::ptr, RNA_enum_get(), RNA_float_get(), select(), SPACE_VIEW3D, wmGizmo::state, void, WM_gizmo_calc_matrix_final(), WM_GIZMO_DRAW_VALUE, WM_GIZMO_STATE_MODAL, WM_gizmo_target_property_find(), WM_gizmo_target_property_float_get(), and WM_gizmo_target_property_is_valid().
Referenced by gizmo_dial_draw(), and gizmo_dial_draw_select().
|
static |
Definition at line 96 of file dial3d_gizmo.c.
References BLI_assert, color, DIAL_RESOLUTION, ED_GIZMO_DIAL_DRAW_FLAG_FILL, ED_GIZMO_DIAL_DRAW_FLAG_FILL_SELECT, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR, GPU_SHADER_3D_POLYLINE_CLIPPED_UNIFORM_COLOR, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, GPU_SHADER_3D_UNIFORM_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), imm_draw_circle_fill_3d(), imm_draw_circle_partial_wire_3d(), imm_draw_circle_wire_3d(), imm_draw_disk_partial_fill_3d(), immBindBuiltinProgram(), immUnbindProgram(), immUniform1f(), immUniform2fv(), immUniform4fv(), immUniformColor4fv(), immUniformMatrix4fv(), immVertexFormat(), M_PI, pos, RAD2DEGF, select(), UNUSED_VARS, wm_gizmo_geom_data_dial, and wm_gizmo_geometryinfo_draw().
Referenced by dial_3d_draw_util().
|
static |
Definition at line 250 of file dial3d_gizmo.c.
References color, copy_v4_v4(), DIAL_RESOLUTION, DIAL_WIDTH, fabsf, float(), floorf, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_SHADER_3D_UNIFORM_COLOR, GPU_vertformat_attr_add(), imm_draw_disk_partial_fill_2d(), immBindBuiltinProgram(), immUnbindProgram(), immUniformColor4f(), immUniformColor4fv(), immVertexFormat(), M_PI, pos, RAD2DEGF, and UNPACK3.
Referenced by dial_ghostarc_draw_with_helplines().
|
static |
Draws a line from (0, 0, 0) to co_outer, at angle.
Definition at line 186 of file dial3d_gizmo.c.
References angle(), color, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_matrix_pop(), GPU_matrix_push(), GPU_matrix_rotate_3f(), GPU_PRIM_LINE_STRIP, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniform1f(), immUniform2fv(), immUniformColor4fv(), immVertex3f(), immVertex3fv(), immVertexFormat(), pos, and RAD2DEGF.
Referenced by dial_ghostarc_draw_with_helplines().
|
static |
Draws segments to indicate the position of each increment.
Definition at line 218 of file dial3d_gizmo.c.
References cosf, DIAL_WIDTH, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_PRIM_LINES, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniform1f(), immUniform2fv(), immUniformColor3f(), immVertex3fv(), immVertexFormat(), M_PI, mul_v2_fl(), offset, pos, sinf, and v.
Referenced by dial_3d_draw_util().
|
static |
Definition at line 377 of file dial3d_gizmo.c.
References dial_ghostarc_draw(), dial_ghostarc_draw_helpline(), DIAL_WIDTH, and ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE.
Referenced by dial_3d_draw_util().
|
static |
Definition at line 301 of file dial3d_gizmo.c.
References DialInteraction::angle, angle_signed_on_axis_v3v3_v3(), angle_wrap_rad(), double(), ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y, ED_view3d_global_to_vector(), ED_view3d_win_to_3d_on_plane(), fabsf, float(), DialInteraction::init, wmGizmo::interaction_data, M_PI, M_PI_2, wmGizmo::matrix_basis, mul_v3_project_m4_v3(), DialInteraction::mval, normalize_v3_v3(), plane_from_point_normal_v3(), DialInteraction::prev, wmGizmo::ptr, ARegion::regiondata, RNA_boolean_get(), RNA_enum_get(), DialInteraction::rotations, sub_v3_v3(), ARegion::winrct, wrap_angle(), rcti::xmin, and rcti::ymin.
Referenced by gizmo_dial_modal().
Definition at line 722 of file dial3d_gizmo.c.
References GIZMO_GT_dial_3d(), and WM_gizmotype_append().
Referenced by ED_spacetypes_init().
Definition at line 470 of file dial3d_gizmo.c.
References C, copy_v3_v3(), CTX_wm_region(), DIAL_CLIP_BIAS, dial_draw_intern(), dot_v3v3(), ED_GIZMO_DIAL_DRAW_FLAG_CLIP, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, wmGizmo::matrix_basis, NULL, wmGizmo::ptr, ARegion::regiondata, RNA_enum_get(), wmGizmo::state, RegionView3D::viewinv, WM_GIZMO_STATE_HIGHLIGHT, and WM_GIZMO_STATE_MODAL.
Referenced by GIZMO_GT_dial_3d().
Definition at line 451 of file dial3d_gizmo.c.
References C, copy_v3_v3(), CTX_wm_region(), DIAL_CLIP_BIAS, dial_draw_intern(), dot_v3v3(), ED_GIZMO_DIAL_DRAW_FLAG_CLIP, GPU_select_load_id(), wmGizmo::matrix_basis, NULL, wmGizmo::ptr, ARegion::regiondata, RNA_enum_get(), and RegionView3D::viewinv.
Referenced by GIZMO_GT_dial_3d().
Definition at line 541 of file dial3d_gizmo.c.
References C, DialInteraction::has_drag, DialInteraction::init, wmGizmo::interaction_data, DialInteraction::prop_angle, wmGizmo::ptr, RNA_property_float_get(), RNA_property_is_set(), RNA_struct_find_property(), WM_gizmo_target_property_anim_autokey(), WM_gizmo_target_property_find(), WM_gizmo_target_property_float_set(), and WM_gizmo_target_property_is_valid().
Referenced by GIZMO_GT_dial_3d().
Definition at line 590 of file dial3d_gizmo.c.
References wmGizmo::custom_modal, DialInteraction::init, wmGizmo::interaction_data, MEM_callocN, DialInteraction::mval, OPERATOR_RUNNING_MODAL, DialInteraction::prop_angle, WM_gizmo_target_property_find(), WM_gizmo_target_property_float_get(), and WM_gizmo_target_property_is_valid().
Referenced by GIZMO_GT_dial_3d().
|
static |
Definition at line 494 of file dial3d_gizmo.c.
References DialInteraction::angle_delta, DialInteraction::angle_increment, DialInteraction::angle_ofs, C, CTX_wm_region(), dial_ghostarc_get_angles(), DIAL_WIDTH, float(), DialInteraction::has_drag, DialInteraction::init, wmGizmo::interaction_data, wmGizmo::matrix_basis, MOUSEMOVE, OPERATOR_CANCELLED, OPERATOR_RUNNING_MODAL, DialInteraction::output, DialInteraction::prev, DialInteraction::prop_angle, wmGizmo::ptr, RNA_float_get(), DialInteraction::tweak_flag, wmEvent::type, WM_gizmo_target_property_find(), WM_gizmo_target_property_float_set(), WM_gizmo_target_property_is_valid(), WM_GIZMO_TWEAK_PRECISE, and WM_GIZMO_TWEAK_SNAP.
Referenced by GIZMO_GT_dial_3d().
Definition at line 582 of file dial3d_gizmo.c.
References copy_v3_v3(), and wmGizmo::matrix_basis.
Referenced by GIZMO_GT_dial_3d().
|
static |
Definition at line 662 of file dial3d_gizmo.c.
References wmGizmoType::draw, wmGizmoType::draw_select, ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR, ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y, ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE, ED_GIZMO_DIAL_DRAW_FLAG_CLIP, ED_GIZMO_DIAL_DRAW_FLAG_FILL, ED_GIZMO_DIAL_DRAW_FLAG_FILL_SELECT, wmGizmoType::exit, gizmo_dial_draw(), gizmo_dial_draw_select(), gizmo_dial_exit(), gizmo_dial_invoke(), gizmo_dial_modal(), gizmo_dial_setup(), wmGizmoType::idname, wmGizmoType::invoke, M_PI, wmGizmoType::modal, NULL, PROP_FLOAT, RNA_def_boolean(), RNA_def_enum_flag(), RNA_def_float(), RNA_def_float_factor(), wmGizmoType::setup, SNAP_INCREMENTAL_ANGLE, wmGizmoType::srna, wmGizmoType::struct_size, and WM_gizmotype_target_property_def().
Referenced by ED_gizmotypes_dial_3d().