44#define GIZMO_PRECISION_FAC 0.05f
52 return inverted ? (range_fac * (
min + range - value) / range) : (range_fac * (value / range));
61 return inverted ? (
min + range - (value * range / range_fac)) : (value * range / range_fac);
66 const bool constrained,
80 const bool constrained,
82 const bool use_precision)
105 if (
data->is_custom_range_set) {
115 const bool constrained,
118 if (gz_prop->
custom_func.value_get_fn !=
nullptr) {
121 else if (gz_prop->
prop !=
nullptr) {
132 if (
data->is_custom_range_set ==
false) {
135 data->range = range[1] - range[0];
136 data->min = range[0];
146 data->offset = value;
173 bContext *
C,
const wmGizmo *gz,
const float mval[2],
int axis,
bool use_offset,
float r_co[2])
175 float mat[4][4], imat[4][4];
177 float mat_identity[4][4];
179 if (use_offset ==
false) {
188 "Gizmo \"%s\" of group \"%s\" has matrix that could not be inverted "
189 "(projection will fail)",
199 float plane[4], co[3];
204 r_co[0] = co[(axis + 1) % 3];
205 r_co[1] = co[(axis + 2) % 3];
211 float co[3] = {mval[0], mval[1], 0.0f};
218 bContext *
C,
const wmGizmo *gz,
const float mval[2],
bool use_offset,
float r_co[3])
220 float mat[4][4], imat[4][4];
222 float mat_identity[4][4];
224 if (use_offset ==
false) {
233 "Gizmo \"%s\" of group \"%s\" has matrix that could not be inverted "
234 "(projection will fail)",
249 float co[3] = {mval[0], mval[1], 0.0f};
266 screen =
static_cast<bScreen *
>(screen->id.next))
268 for (
ScrArea &area : screen->areabase) {
281 for (
wmGizmo &gz : gzgroup.gizmos) {
#define CLOG_WARN(clg_ref,...)
bool clip_ray(float3 &start, float3 &end, const float3 direction, const float max_distance, const float4 frustum_planes[6])
#define GIZMO_PRECISION_FAC
ccl_device_inline float3x3 inverted(const float3x3 m)
float gizmo_offset_from_value(GizmoCommonData *data, float value, bool constrained, bool inverted)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
const ListBaseT< wmGizmoGroup > * WM_gizmomap_group_list(wmGizmoMap *gzmap)
bool gizmo_window_project_3d(bContext *C, const wmGizmo *gz, const float mval[2], bool use_offset, float r_co[3])
MINLINE void copy_v2_v2(float r[2], const float a[2])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void WM_gizmo_calc_matrix_final_params(const wmGizmo *gz, const wmGizmoMatrixParams *params, float r_mat[4][4])
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
void WM_gizmo_target_property_float_set(bContext *C, const wmGizmo *gz, wmGizmoProperty *gz_prop, const float value)
void mul_m4_v3(const float M[4][4], float r[3])
float gizmo_value_from_offset(GizmoCommonData *data, GizmoInteraction *inter, float offset, bool constrained, bool inverted, bool use_precision)
BMesh const char void * data
bool ED_view3d_win_to_3d_on_plane(const ARegion *region, const float plane[4], const float mval[2], bool do_clip, float r_out[3])
BLI_INLINE float gizmo_value_from_offset_constr(const float range_fac, const float min, const float range, const float value, const bool inverted)
wmGizmo * gizmo_find_from_properties(const IDProperty *properties, const int spacetype, const int regionid)
void unit_m4(float m[4][4])
void gizmo_color_get(const wmGizmo *gz, bool highlight, float r_color[4])
void gizmo_property_data_update(wmGizmo *gz, GizmoCommonData *data, wmGizmoProperty *gz_prop, bool constrained, bool inverted)
BLI_INLINE float gizmo_offset_from_value_constr(const float range_fac, const float min, const float range, const float value, const bool inverted)
bool gizmo_window_project_2d(bContext *C, const wmGizmo *gz, const float mval[2], int axis, bool use_offset, float r_co[2])
MINLINE void copy_v4_v4(float r[4], const float a[4])
void ED_view3d_win_to_3d(const View3D *v3d, const ARegion *region, const float depth_pt[3], const float mval[2], float r_out[3])
void gizmo_property_value_reset(bContext *C, const wmGizmo *gz, GizmoInteraction *inter, wmGizmoProperty *gz_prop)
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
float WM_gizmo_target_property_float_get(const wmGizmo *gz, wmGizmoProperty *gz_prop)
bool WM_gizmo_target_property_float_range_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, float range[2])
bke::ARegionRuntime * runtime
ListBaseT< ARegion > regionbase
eWM_GizmoFlagGroupTypeFlag flag
const float(* matrix_offset)[4]
struct blender::wmGizmoProperty::@216011055122204070127377170176223170047224321165 custom_func
wmGizmoGroup * parent_gzgroup