Blender  V2.93
gizmo_library_intern.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2016 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
29 typedef struct GizmoCommonData {
30  float range_fac; /* factor for arrow min/max distance */
31  float offset;
32 
33  /* property range for constrained gizmos */
34  float range;
35  /* min/max value for constrained gizmos */
36  float min, max;
37 
40 
41 typedef struct GizmoInteraction {
42  float init_value; /* initial property value */
43  float init_mval[2];
44  float init_offset;
45  float init_matrix_final[4][4];
46  float init_matrix_basis[4][4];
47 
48  /* offset of last handling step */
49  float prev_offset;
50  /* Total offset added by precision tweaking.
51  * Needed to allow toggling precision on/off without causing jumps */
54 
56  const float value,
57  const bool constrained,
58  const bool inverted);
60  GizmoInteraction *inter,
61  const float offset,
62  const bool constrained,
63  const bool inverted,
64  const bool use_precision);
65 
66 void gizmo_property_data_update(struct wmGizmo *gz,
68  wmGizmoProperty *gz_prop,
69  const bool constrained,
70  const bool inverted);
71 
73  const struct wmGizmo *gz,
74  GizmoInteraction *inter,
75  wmGizmoProperty *gz_prop);
76 
77 /* -------------------------------------------------------------------- */
78 
79 void gizmo_color_get(const struct wmGizmo *gz, const bool highlight, float r_color[4]);
80 
82  const struct wmGizmo *gz,
83  const float mval[2],
84  int axis,
85  bool use_offset,
86  float r_co[2]);
87 
89  bContext *C, const struct wmGizmo *gz, const float mval[2], bool use_offset, float r_co[3]);
90 
91 /* -------------------------------------------------------------------- */
92 /* Gizmo drawing */
93 
94 #include "gizmo_geometry.h"
95 
96 void wm_gizmo_geometryinfo_draw(const struct GizmoGeomInfo *info,
97  const bool select,
98  const float color[4]);
100  const float color[4], const float (*verts)[3], uint vert_count, uint pos, uint primitive_type);
unsigned int uint
Definition: BLI_sys_types.h:83
#define C
Definition: RandGen.cpp:39
static float verts[][3]
bool gizmo_window_project_3d(bContext *C, const struct 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)
bool gizmo_window_project_2d(bContext *C, const struct wmGizmo *gz, const float mval[2], int axis, bool use_offset, float r_co[2])
struct GizmoCommonData GizmoCommonData
void gizmo_color_get(const struct wmGizmo *gz, const bool highlight, float r_color[4])
void gizmo_property_value_reset(bContext *C, const struct wmGizmo *gz, GizmoInteraction *inter, wmGizmoProperty *gz_prop)
void gizmo_property_data_update(struct wmGizmo *gz, GizmoCommonData *data, wmGizmoProperty *gz_prop, const bool constrained, const bool inverted)
void wm_gizmo_geometryinfo_draw(const struct GizmoGeomInfo *info, const bool select, const float color[4])
struct GizmoInteraction GizmoInteraction
void wm_gizmo_vec_draw(const float color[4], const float(*verts)[3], uint vert_count, uint pos, uint primitive_type)
float gizmo_offset_from_value(GizmoCommonData *data, const float value, const bool constrained, const bool inverted)
uint pos
float init_matrix_basis[4][4]
float init_matrix_final[4][4]
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: util_avxb.h:167