Blender
V3.3
|
#include "BLI_math.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "BKE_context.h"
#include "RNA_access.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_view3d.h"
#include "CLG_log.h"
#include "gizmo_library_intern.h"
Go to the source code of this file.
Gizmo Library Utilities | |
This file contains functions for common behaviors of gizmos. | |
#define | GIZMO_PRECISION_FAC 0.05f |
static CLG_LogRef | LOG = {"ed.gizmo.library_utils"} |
BLI_INLINE float | gizmo_offset_from_value_constr (const float range_fac, const float min, const float range, const float value, const bool inverted) |
BLI_INLINE float | gizmo_value_from_offset_constr (const float range_fac, const float min, const float range, const float value, const bool inverted) |
float | gizmo_offset_from_value (GizmoCommonData *data, const float value, const bool constrained, const bool inverted) |
float | gizmo_value_from_offset (GizmoCommonData *data, GizmoInteraction *inter, const float offset, const bool constrained, const bool inverted, const bool use_precision) |
void | gizmo_property_data_update (wmGizmo *gz, GizmoCommonData *data, wmGizmoProperty *gz_prop, const bool constrained, const bool inverted) |
void | gizmo_property_value_reset (bContext *C, const wmGizmo *gz, GizmoInteraction *inter, wmGizmoProperty *gz_prop) |
void | gizmo_color_get (const wmGizmo *gz, const bool highlight, float r_col[4]) |
bool | gizmo_window_project_2d (bContext *C, const struct wmGizmo *gz, const float mval[2], int axis, bool use_offset, float r_co[2]) |
bool | gizmo_window_project_3d (bContext *C, const struct wmGizmo *gz, const float mval[2], bool use_offset, float r_co[3]) |
#define GIZMO_PRECISION_FAC 0.05f |
Definition at line 34 of file gizmo_library_utils.c.
Definition at line 150 of file gizmo_library_utils.c.
References wmGizmo::color, wmGizmo::color_hi, copy_v4_v4(), wmGizmo::flag, and WM_GIZMO_DRAW_HOVER.
float gizmo_offset_from_value | ( | GizmoCommonData * | data, |
const float | value, | ||
const bool | constrained, | ||
const bool | inverted | ||
) |
Definition at line 54 of file gizmo_library_utils.c.
References data, and gizmo_offset_from_value_constr().
Referenced by gizmo_arrow_exit(), and gizmo_arrow_modal().
BLI_INLINE float gizmo_offset_from_value_constr | ( | const float | range_fac, |
const float | min, | ||
const float | range, | ||
const float | value, | ||
const bool | inverted | ||
) |
Definition at line 36 of file gizmo_library_utils.c.
References min.
Referenced by gizmo_offset_from_value(), and gizmo_property_data_update().
void gizmo_property_data_update | ( | wmGizmo * | gz, |
GizmoCommonData * | data, | ||
wmGizmoProperty * | gz_prop, | ||
const bool | constrained, | ||
const bool | inverted | ||
) |
Definition at line 102 of file gizmo_library_utils.c.
References BLI_assert, wmGizmoProperty::custom_func, data, gizmo_offset_from_value_constr(), NULL, wmGizmoProperty::prop, wmGizmoProperty::value_get_fn, WM_gizmo_target_property_float_get(), and WM_gizmo_target_property_float_range_get().
Referenced by gizmo_arrow_property_update().
void gizmo_property_value_reset | ( | bContext * | C, |
const wmGizmo * | gz, | ||
GizmoInteraction * | inter, | ||
wmGizmoProperty * | gz_prop | ||
) |
Definition at line 140 of file gizmo_library_utils.c.
References C, GizmoInteraction::init_value, and WM_gizmo_target_property_float_set().
float gizmo_value_from_offset | ( | GizmoCommonData * | data, |
GizmoInteraction * | inter, | ||
const float | offset, | ||
const bool | constrained, | ||
const bool | inverted, | ||
const bool | use_precision | ||
) |
Definition at line 67 of file gizmo_library_utils.c.
References CLAMP, data, GIZMO_PRECISION_FAC, gizmo_value_from_offset_constr(), GizmoInteraction::init_offset, max, offset, GizmoInteraction::precision_offset, and GizmoInteraction::prev_offset.
Referenced by gizmo_arrow_modal().
BLI_INLINE float gizmo_value_from_offset_constr | ( | const float | range_fac, |
const float | min, | ||
const float | range, | ||
const float | value, | ||
const bool | inverted | ||
) |
Definition at line 45 of file gizmo_library_utils.c.
References min.
Referenced by gizmo_value_from_offset().
bool gizmo_window_project_2d | ( | bContext * | C, |
const struct wmGizmo * | gz, | ||
const float | mval[2], | ||
int | axis, | ||
bool | use_offset, | ||
float | r_co[2] | ||
) |
Takes mouse coordinates and returns them in relation to the gizmo. Both 2D & 3D supported, use so we can use 2D gizmos in the 3D view.
Definition at line 162 of file gizmo_library_utils.c.
References C, CLOG_WARN, copy_v2_v2(), CTX_wm_region(), ED_view3d_win_to_3d_on_plane(), wmGizmoGroupType::flag, wmGizmoType::idname, wmGizmoGroupType::idname, invert_m4_m4(), LOG, mul_m4_v3(), NULL, params, wmGizmo::parent_gzgroup, plane_from_point_normal_v3(), ARegion::regiondata, wmGizmo::type, wmGizmoGroup::type, unit_m4(), WM_gizmo_calc_matrix_final_params(), and WM_GIZMOGROUPTYPE_3D.
Referenced by gizmo_button2d_test_select(), gizmo_cage2d_invoke(), gizmo_cage2d_modal(), gizmo_cage2d_test_select(), gizmo_move_modal(), and gizmo_move_test_select().
bool gizmo_window_project_3d | ( | bContext * | C, |
const struct wmGizmo * | gz, | ||
const float | mval[2], | ||
bool | use_offset, | ||
float | r_co[3] | ||
) |
Definition at line 211 of file gizmo_library_utils.c.
References C, CLOG_WARN, copy_v2_v2(), CTX_wm_region(), CTX_wm_view3d(), ED_view3d_win_to_3d(), wmGizmoGroupType::flag, wmGizmoType::idname, wmGizmoGroupType::idname, invert_m4_m4(), LOG, mul_m4_v3(), NULL, params, wmGizmo::parent_gzgroup, wmGizmo::type, wmGizmoGroup::type, unit_m4(), WM_gizmo_calc_matrix_final_params(), and WM_GIZMOGROUPTYPE_3D.
Referenced by gizmo_cage3d_invoke(), and gizmo_cage3d_modal().
|
static |
Definition at line 31 of file gizmo_library_utils.c.
Referenced by gizmo_window_project_2d(), and gizmo_window_project_3d().