40#define GIZMO_PRECISION_FAC 0.05f
48 return inverted ? (range_fac * (
min + range - value) / range) : (range_fac * (value /
range));
57 return inverted ? (
min + range - (value * range / range_fac)) : (value * range / range_fac);
62 const bool constrained,
67 data->range_fac, data->min, data->range, value, inverted);
76 const bool constrained,
78 const bool use_precision)
80 const float max = data->min + data->range;
94 data->range_fac, data->min, data->range, ofs_new, inverted);
101 if (data->is_custom_range_set) {
102 CLAMP(value, data->min, max);
111 const bool constrained,
117 else if (gz_prop->
prop !=
nullptr) {
128 if (data->is_custom_range_set ==
false) {
131 data->range = range[1] - range[0];
132 data->min = range[0];
139 data->range_fac, data->min, data->range, value, inverted);
142 data->offset = value;
169 bContext *C,
const wmGizmo *gz,
const float mval[2],
int axis,
bool use_offset,
float r_co[2])
171 float mat[4][4], imat[4][4];
173 float mat_identity[4][4];
175 if (use_offset ==
false) {
177 params.matrix_offset = mat_identity;
184 "Gizmo \"%s\" of group \"%s\" has matrix that could not be inverted "
185 "(projection will fail)",
195 float plane[4], co[3];
197 bool clip_ray = ((
RegionView3D *)region->regiondata)->is_persp;
200 r_co[0] = co[(axis + 1) % 3];
201 r_co[1] = co[(axis + 2) % 3];
207 float co[3] = {mval[0], mval[1], 0.0f};
214 bContext *C,
const wmGizmo *gz,
const float mval[2],
bool use_offset,
float r_co[3])
216 float mat[4][4], imat[4][4];
218 float mat_identity[4][4];
220 if (use_offset ==
false) {
222 params.matrix_offset = mat_identity;
229 "Gizmo \"%s\" of group \"%s\" has matrix that could not be inverted "
230 "(projection will fail)",
245 float co[3] = {mval[0], mval[1], 0.0f};
261 screen =
static_cast<bScreen *
>(screen->id.next))
268 if (region->gizmo_map ==
nullptr) {
277 if (gz->properties == properties) {
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
#define LISTBASE_FOREACH(type, var, list)
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
void unit_m4(float m[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void copy_v2_v2(float r[2], const float a[2])
#define CLOG_WARN(clg_ref,...)
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])
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])
#define GIZMO_PRECISION_FAC
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 gizmo_color_get(const wmGizmo *gz, const bool highlight, float r_color[4])
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_3d(bContext *C, const wmGizmo *gz, const float mval[2], bool use_offset, float r_co[3])
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)
bool gizmo_window_project_2d(bContext *C, const wmGizmo *gz, const float mval[2], int axis, bool use_offset, float r_co[2])
float gizmo_offset_from_value(GizmoCommonData *data, const float value, const bool constrained, const bool inverted)
void gizmo_property_value_reset(bContext *C, const wmGizmo *gz, GizmoInteraction *inter, wmGizmoProperty *gz_prop)
eWM_GizmoFlagGroupTypeFlag flag
wmGizmoPropertyFnGet value_get_fn
struct wmGizmoProperty::@1373 custom_func
wmGizmoGroup * parent_gzgroup
void WM_gizmo_calc_matrix_final_params(const wmGizmo *gz, const WM_GizmoMatrixParams *params, float r_mat[4][4])
const ListBase * WM_gizmomap_group_list(wmGizmoMap *gzmap)
void WM_gizmo_target_property_float_set(bContext *C, const wmGizmo *gz, wmGizmoProperty *gz_prop, const float value)
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])