Blender
V3.3
|
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "DNA_view3d_types.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 "MEM_guardedalloc.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_view3d.h"
#include "UI_interface.h"
#include "../gizmo_geometry.h"
#include "../gizmo_library_intern.h"
Go to the source code of this file.
Classes | |
struct | ArrowGizmo3D |
struct | ArrowGizmoInteraction |
Functions | |
Arrow Gizmo API | |
void | ED_gizmo_arrow3d_set_ui_range (wmGizmo *gz, const float min, const float max) |
void | ED_gizmo_arrow3d_set_range_fac (wmGizmo *gz, const float range_fac) |
static void | GIZMO_GT_arrow_3d (wmGizmoType *gzt) |
void | ED_gizmotypes_arrow_3d (void) |
Arrow Gizmo | |
Simple arrow gizmo which is dragged into a certain direction. The arrow head can have varying shapes, e.g. cone, box, etc. 2D/3D Gizmo
| |
#define | ARROW_SELECT_THRESHOLD_PX (5) |
typedef struct ArrowGizmo3D | ArrowGizmo3D |
typedef struct ArrowGizmoInteraction | ArrowGizmoInteraction |
static void | gizmo_arrow_matrix_basis_get (const wmGizmo *gz, float r_matrix[4][4]) |
static void | arrow_draw_geom (const ArrowGizmo3D *arrow, const bool select, const float color[4], const float arrow_length) |
static void | arrow_draw_intern (ArrowGizmo3D *arrow, const bool select, const bool highlight) |
static void | gizmo_arrow_draw_select (const bContext *UNUSED(C), wmGizmo *gz, int select_id) |
static void | gizmo_arrow_draw (const bContext *UNUSED(C), wmGizmo *gz) |
static int | gizmo_arrow_test_select (bContext *UNUSED(C), wmGizmo *gz, const int mval[2]) |
static int | gizmo_arrow_modal (bContext *C, wmGizmo *gz, const wmEvent *event, eWM_GizmoFlagTweak tweak_flag) |
static void | gizmo_arrow_setup (wmGizmo *gz) |
static int | gizmo_arrow_invoke (bContext *UNUSED(C), wmGizmo *gz, const wmEvent *event) |
static void | gizmo_arrow_property_update (wmGizmo *gz, wmGizmoProperty *gz_prop) |
static void | gizmo_arrow_exit (bContext *C, wmGizmo *gz, const bool cancel) |
#define ARROW_SELECT_THRESHOLD_PX (5) |
Definition at line 54 of file arrow3d_gizmo.c.
typedef struct ArrowGizmo3D ArrowGizmo3D |
typedef struct ArrowGizmoInteraction ArrowGizmoInteraction |
|
static |
Definition at line 76 of file arrow3d_gizmo.c.
References ARRAY_SIZE, ARROW_SELECT_THRESHOLD_PX, BLI_assert, color, ED_GIZMO_ARROW_DRAW_FLAG_STEM, ED_GIZMO_ARROW_STYLE_BOX, ED_GIZMO_ARROW_STYLE_CONE, ED_GIZMO_ARROW_STYLE_CROSS, ED_GIZMO_ARROW_STYLE_NORMAL, ArrowGizmo3D::gizmo, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_matrix_pop(), GPU_matrix_push(), GPU_matrix_scale_3f(), GPU_matrix_translate_3f(), GPU_PRIM_LINE_LOOP, GPU_PRIM_LINE_STRIP, GPU_PRIM_LINES, 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_cylinder_fill_3d(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniform1f(), immUniform2fv(), immUniformColor4fv(), immVertex3f(), immVertexFormat(), len, wmGizmo::line_width, pos, wmGizmo::ptr, RNA_enum_get(), RNA_float_get_array(), select(), size(), width, wm_gizmo_geom_data_arrow, wm_gizmo_geom_data_cube, wm_gizmo_geometryinfo_draw(), and wm_gizmo_vec_draw().
Referenced by arrow_draw_intern().
|
static |
Definition at line 182 of file arrow3d_gizmo.c.
References arrow_draw_geom(), color, ArrowGizmo3D::gizmo, gizmo_color_get(), GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_matrix_mul, GPU_matrix_pop(), GPU_matrix_push(), ArrowGizmoInteraction::init_arrow_length, GizmoInteraction::init_matrix_final, ArrowGizmoInteraction::inter, wmGizmo::interaction_data, wmGizmo::ptr, RNA_float_get(), select(), and WM_gizmo_calc_matrix_final().
Referenced by gizmo_arrow_draw(), and gizmo_arrow_draw_select().
Define a custom factor for arrow min/max distance.
Definition at line 474 of file arrow3d_gizmo.c.
References BLI_assert, ArrowGizmo3D::data, GizmoCommonData::range_fac, WM_gizmo_target_property_find(), and WM_gizmo_target_property_is_valid().
Referenced by WIDGETGROUP_camera_refresh(), WIDGETGROUP_forcefield_setup(), and WIDGETGROUP_light_spot_setup().
Define a custom property UI range.
Definition at line 460 of file arrow3d_gizmo.c.
References BLI_assert, ArrowGizmo3D::data, GizmoCommonData::is_custom_range_set, GizmoCommonData::max, max, min, GizmoCommonData::min, GizmoCommonData::range, WM_gizmo_target_property_find(), and WM_gizmo_target_property_is_valid().
Referenced by WIDGETGROUP_forcefield_setup().
Definition at line 541 of file arrow3d_gizmo.c.
References GIZMO_GT_arrow_3d(), and WM_gizmotype_append().
Referenced by ED_spacetypes_init().
Definition at line 222 of file arrow3d_gizmo.c.
References arrow_draw_intern(), wmGizmo::state, and WM_GIZMO_STATE_HIGHLIGHT.
Referenced by GIZMO_GT_arrow_3d().
|
static |
Definition at line 216 of file arrow3d_gizmo.c.
References arrow_draw_intern(), and GPU_select_load_id().
Referenced by GIZMO_GT_arrow_3d().
Definition at line 423 of file arrow3d_gizmo.c.
References C, data, ArrowGizmo3D::data, ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED, ED_GIZMO_ARROW_XFORM_FLAG_INVERTED, ArrowGizmo3D::gizmo, gizmo_offset_from_value(), gizmo_property_value_reset(), GizmoInteraction::init_offset, wmGizmo::interaction_data, wmGizmo::ptr, RNA_enum_get(), WM_gizmo_target_property_anim_autokey(), WM_gizmo_target_property_find(), WM_gizmo_target_property_float_get(), and WM_gizmo_target_property_is_valid().
Referenced by GIZMO_GT_arrow_3d().
Definition at line 388 of file arrow3d_gizmo.c.
References ArrowGizmo3D::data, gizmo_arrow_matrix_basis_get(), GizmoInteraction::init_matrix_basis, GizmoInteraction::init_matrix_final, GizmoInteraction::init_mval, GizmoInteraction::init_offset, GizmoInteraction::init_value, wmGizmo::interaction_data, MEM_callocN, GizmoCommonData::offset, OPERATOR_RUNNING_MODAL, wmGizmo::ptr, RNA_float_get(), WM_gizmo_calc_matrix_final(), WM_gizmo_target_property_find(), WM_gizmo_target_property_float_get(), and WM_gizmo_target_property_is_valid().
Referenced by GIZMO_GT_arrow_3d().
Definition at line 68 of file arrow3d_gizmo.c.
References copy_m4_m4(), ArrowGizmo3D::data, ArrowGizmo3D::gizmo, madd_v3_v3fl(), wmGizmo::matrix_basis, and GizmoCommonData::offset.
Referenced by gizmo_arrow_invoke(), and GIZMO_GT_arrow_3d().
|
static |
Calculate arrow offset independent from prop min value, meaning the range will not be offset by min value first.
Definition at line 284 of file arrow3d_gizmo.c.
References acosf, C, copy_v3_v3(), CTX_wm_region(), CTX_wm_window(), data, ArrowGizmo3D::data, dot_v3v3(), ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED, ED_GIZMO_ARROW_XFORM_FLAG_INVERTED, ED_region_tag_redraw_editor_overlays(), ED_view3d_win_to_ray(), ArrowGizmo3D::gizmo, gizmo_offset_from_value(), gizmo_value_from_offset(), GizmoInteraction::init_matrix_basis, GizmoInteraction::init_mval, wmGizmo::interaction_data, isect_ray_plane_v3(), len_v3(), madd_v3_v3v3fl(), wmGizmo::matrix_basis, MOUSEMOVE, wmEvent::mval, normalize_v3(), normalize_v3_v3(), offset, OPERATOR_RUNNING_MODAL, plane_from_point_normal_v3(), project_plane_v3_v3v3(), wmGizmo::ptr, RAD2DEGF, ARegion::regiondata, RNA_enum_get(), sub_v3_v3v3(), wmEvent::type, UNPACK2, RegionView3D::viewinv, WM_event_add_mousemove(), WM_gizmo_target_property_find(), WM_gizmo_target_property_float_get(), WM_gizmo_target_property_float_set(), WM_gizmo_target_property_is_valid(), and WM_GIZMO_TWEAK_PRECISE.
Referenced by GIZMO_GT_arrow_3d().
|
static |
Definition at line 414 of file arrow3d_gizmo.c.
References ArrowGizmo3D::data, ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED, ED_GIZMO_ARROW_XFORM_FLAG_INVERTED, ArrowGizmo3D::gizmo, gizmo_property_data_update(), wmGizmo::ptr, and RNA_enum_get().
Referenced by GIZMO_GT_arrow_3d().
Definition at line 379 of file arrow3d_gizmo.c.
References ArrowGizmo3D::data, wmGizmo::flag, ArrowGizmo3D::gizmo, GizmoCommonData::range_fac, and WM_GIZMO_DRAW_MODAL.
Referenced by GIZMO_GT_arrow_3d().
Selection for 2D views.
Definition at line 230 of file arrow3d_gizmo.c.
References ARROW_SELECT_THRESHOLD_PX, closest_to_line_v2(), copy_v2_v2(), ArrowGizmo3D::gizmo, len_squared_v2v2(), wmGizmo::line_width, mat4_to_scale(), mul_m4_v3(), wmGizmo::ptr, RNA_float_get(), square_f(), UNPACK2, and WM_gizmo_calc_matrix_final().
Referenced by GIZMO_GT_arrow_3d().
|
static |
Definition at line 483 of file arrow3d_gizmo.c.
References wmGizmoType::draw, wmGizmoType::draw_select, ED_GIZMO_ARROW_DRAW_FLAG_STEM, ED_GIZMO_ARROW_STYLE_BOX, ED_GIZMO_ARROW_STYLE_CONE, ED_GIZMO_ARROW_STYLE_CROSS, ED_GIZMO_ARROW_STYLE_NORMAL, ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED, ED_GIZMO_ARROW_XFORM_FLAG_INVERTED, wmGizmoType::exit, gizmo_arrow_draw(), gizmo_arrow_draw_select(), gizmo_arrow_exit(), gizmo_arrow_invoke(), gizmo_arrow_matrix_basis_get(), gizmo_arrow_modal(), gizmo_arrow_property_update(), gizmo_arrow_setup(), gizmo_arrow_test_select(), wmGizmoType::idname, wmGizmoType::invoke, wmGizmoType::matrix_basis_get, wmGizmoType::modal, NULL, PROP_FLOAT, wmGizmoType::property_update, RNA_def_enum(), RNA_def_enum_flag(), RNA_def_float(), RNA_def_float_vector(), wmGizmoType::setup, wmGizmoType::srna, wmGizmoType::struct_size, wmGizmoType::test_select, and WM_gizmotype_target_property_def().
Referenced by ED_gizmotypes_arrow_3d().