42#define GIZMO_PRECISION_FAC 0.05f
50 return inverted ? (range_fac * (
min + range - value) / range) : (range_fac * (value / range));
59 return inverted ? (
min + range - (value * range / range_fac)) : (value * range / range_fac);
64 const bool constrained,
69 data->range_fac,
data->min,
data->range, value, inverted);
78 const bool constrained,
80 const bool use_precision)
96 data->range_fac,
data->min,
data->range, ofs_new, inverted);
103 if (
data->is_custom_range_set) {
113 const bool constrained,
119 else if (gz_prop->
prop !=
nullptr) {
130 if (
data->is_custom_range_set ==
false) {
133 data->range = range[1] - range[0];
134 data->min = range[0];
141 data->range_fac,
data->min,
data->range, value, inverted);
144 data->offset = value;
171 bContext *
C,
const wmGizmo *gz,
const float mval[2],
int axis,
bool use_offset,
float r_co[2])
173 float mat[4][4], imat[4][4];
175 float mat_identity[4][4];
177 if (use_offset ==
false) {
179 params.matrix_offset = mat_identity;
186 "Gizmo \"%s\" of group \"%s\" has matrix that could not be inverted "
187 "(projection will fail)",
197 float plane[4], co[3];
202 r_co[0] = co[(axis + 1) % 3];
203 r_co[1] = co[(axis + 2) % 3];
209 float co[3] = {mval[0], mval[1], 0.0f};
216 bContext *
C,
const wmGizmo *gz,
const float mval[2],
bool use_offset,
float r_co[3])
218 float mat[4][4], imat[4][4];
220 float mat_identity[4][4];
222 if (use_offset ==
false) {
224 params.matrix_offset = mat_identity;
231 "Gizmo \"%s\" of group \"%s\" has matrix that could not be inverted "
232 "(projection will fail)",
247 float co[3] = {mval[0], mval[1], 0.0f};
264 screen =
static_cast<bScreen *
>(screen->id.next))
271 if (region->runtime->gizmo_map ==
nullptr) {
282 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 mul_m4_v3(const float M[4][4], float r[3])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void unit_m4(float m[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])
BMesh const char void * data
#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::@331027022007232055216276241130041346111314317052 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])