Blender  V2.93
transform_input.c
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 
21 #include <math.h>
22 #include <stdlib.h>
23 
24 #include "DNA_screen_types.h"
25 
26 #include "BKE_context.h"
27 
28 #include "BLI_math.h"
29 #include "BLI_utildefines.h"
30 
31 #include "WM_api.h"
32 #include "WM_types.h"
33 
34 #include "transform.h"
35 
36 #include "MEM_guardedalloc.h"
37 
38 /* -------------------------------------------------------------------- */
43 static void InputVector(TransInfo *t, MouseInput *mi, const double mval[2], float output[3])
44 {
45  convertViewVec(t, output, mval[0] - mi->imval[0], mval[1] - mi->imval[1]);
46 }
47 
49 static void InputSpring(TransInfo *UNUSED(t),
50  MouseInput *mi,
51  const double mval[2],
52  float output[3])
53 {
54  double dx, dy;
55  float ratio;
56 
57  dx = ((double)mi->center[0] - mval[0]);
58  dy = ((double)mi->center[1] - mval[1]);
59  ratio = hypot(dx, dy) / (double)mi->factor;
60 
61  output[0] = ratio;
62 }
63 
65 static void InputSpringFlip(TransInfo *t, MouseInput *mi, const double mval[2], float output[3])
66 {
67  InputSpring(t, mi, mval, output);
68 
69  /* flip scale */
70  /* values can become really big when zoomed in so use longs T26598. */
71  if (((int64_t)((int)mi->center[0] - mval[0]) * (int64_t)((int)mi->center[0] - mi->imval[0]) +
72  (int64_t)((int)mi->center[1] - mval[1]) * (int64_t)((int)mi->center[1] - mi->imval[1])) <
73  0) {
74  output[0] *= -1.0f;
75  }
76 }
77 
79 static void InputSpringDelta(TransInfo *t, MouseInput *mi, const double mval[2], float output[3])
80 {
81  InputSpring(t, mi, mval, output);
82  output[0] -= 1.0f;
83 }
84 
87  MouseInput *mi,
88  const double mval[2],
89  float output[3])
90 {
91  output[0] = (float)(mi->imval[1] - mval[1]);
92  output[1] = (float)(mval[0] - mi->imval[0]);
93 
94  output[0] *= mi->factor;
95  output[1] *= mi->factor;
96 }
97 
100  MouseInput *mi,
101  const double mval[2],
102  float output[3])
103 {
104  const int winx = t->region ? t->region->winx : 1;
105 
106  output[0] = ((mval[0] - mi->imval[0]) / winx) * 2.0f;
107 }
108 
111  MouseInput *mi,
112  const double mval[2],
113  float output[3])
114 {
115  float vec[3];
116 
117  InputVector(t, mi, mval, vec);
118  project_v3_v3v3(vec, vec, t->viewinv[0]);
119 
120  output[0] = dot_v3v3(t->viewinv[0], vec) * 2.0f;
121 }
122 
123 static void InputVerticalRatio(TransInfo *t, MouseInput *mi, const double mval[2], float output[3])
124 {
125  const int winy = t->region ? t->region->winy : 1;
126 
127  /* Dragging up increases (matching viewport zoom). */
128  output[0] = ((mval[1] - mi->imval[1]) / winy) * 2.0f;
129 }
130 
133  MouseInput *mi,
134  const double mval[2],
135  float output[3])
136 {
137  float vec[3];
138 
139  InputVector(t, mi, mval, vec);
140  project_v3_v3v3(vec, vec, t->viewinv[1]);
141 
142  /* Dragging up increases (matching viewport zoom). */
143  output[0] = dot_v3v3(t->viewinv[1], vec) * 2.0f;
144 }
145 
148  MouseInput *mi,
149  const double mval[2],
150  float output[3])
151 {
152  double length;
153  double distance;
154  double dx, dy;
155  const int *data = mi->data;
156 
157  if (data) {
158  int mdx, mdy;
159  dx = data[2] - data[0];
160  dy = data[3] - data[1];
161 
162  length = hypot(dx, dy);
163 
164  mdx = mval[0] - data[2];
165  mdy = mval[1] - data[3];
166 
167  distance = (length != 0.0) ? (mdx * dx + mdy * dy) / length : 0.0;
168 
169  output[0] = (length != 0.0) ? (double)(distance / length) : 0.0;
170  }
171 }
172 
174 static void InputCustomRatio(TransInfo *t, MouseInput *mi, const double mval[2], float output[3])
175 {
176  InputCustomRatioFlip(t, mi, mval, output);
177  output[0] = -output[0];
178 }
179 
181  double angle;
182  double mval_prev[2];
183 };
184 
186 static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const double mval[2], float output[3])
187 {
188  struct InputAngle_Data *data = mi->data;
189  float dir_prev[2], dir_curr[2], mi_center[2];
190  copy_v2_v2(mi_center, mi->center);
191 
192  sub_v2_v2v2(dir_prev, (const float[2]){UNPACK2(data->mval_prev)}, mi_center);
193  sub_v2_v2v2(dir_curr, (const float[2]){UNPACK2(mval)}, mi_center);
194 
195  if (normalize_v2(dir_prev) && normalize_v2(dir_curr)) {
196  float dphi = angle_normalized_v2v2(dir_prev, dir_curr);
197 
198  if (cross_v2v2(dir_prev, dir_curr) > 0.0f) {
199  dphi = -dphi;
200  }
201 
202  data->angle += ((double)dphi) * (mi->precision ? (double)mi->precision_factor : 1.0);
203 
204  data->mval_prev[0] = mval[0];
205  data->mval_prev[1] = mval[1];
206  }
207 
208  output[0] = data->angle;
209 }
210 
211 static void InputAngleSpring(TransInfo *t, MouseInput *mi, const double mval[2], float output[3])
212 {
213  float toutput[3];
214 
215  InputAngle(t, mi, mval, output);
216  InputSpring(t, mi, mval, toutput);
217 
218  output[1] = toutput[0];
219 }
220 
223 /* -------------------------------------------------------------------- */
231  MouseInput *mi,
232  const int mval_start[2],
233  const int mval_end[2])
234 {
235  int *data;
236 
237  mi->data = MEM_reallocN(mi->data, sizeof(int[4]));
238 
239  data = mi->data;
240 
241  data[0] = mval_start[0];
242  data[1] = mval_start[1];
243  data[2] = mval_end[0];
244  data[3] = mval_end[1];
245 }
246 
247 void setCustomPointsFromDirection(TransInfo *t, MouseInput *mi, const float dir[2])
248 {
249  BLI_ASSERT_UNIT_V2(dir);
250  const int win_axis = t->region ? ((abs((int)(t->region->winx * dir[0])) +
251  abs((int)(t->region->winy * dir[1]))) /
252  2) :
253  1;
254  const int mval_start[2] = {
255  mi->imval[0] + dir[0] * win_axis,
256  mi->imval[1] + dir[1] * win_axis,
257  };
258  const int mval_end[2] = {mi->imval[0], mi->imval[1]};
259  setCustomPoints(t, mi, mval_start, mval_end);
260 }
261 
264 /* -------------------------------------------------------------------- */
269  MouseInput *mi,
270  const float center[2],
271  const int mval[2],
272  const bool precision)
273 {
274  mi->factor = 0;
275  mi->precision = precision;
276 
277  mi->center[0] = center[0];
278  mi->center[1] = center[1];
279 
280  mi->imval[0] = mval[0];
281  mi->imval[1] = mval[1];
282 
283  mi->post = NULL;
284 }
285 
286 static void calcSpringFactor(MouseInput *mi)
287 {
288  mi->factor = sqrtf(
289  ((float)(mi->center[1] - mi->imval[1])) * ((float)(mi->center[1] - mi->imval[1])) +
290  ((float)(mi->center[0] - mi->imval[0])) * ((float)(mi->center[0] - mi->imval[0])));
291 
292  if (mi->factor == 0.0f) {
293  mi->factor = 1.0f; /* prevent Inf */
294  }
295 }
296 
298 {
299  /* In case we allocate a new value. */
300  void *mi_data_prev = mi->data;
301 
302  mi->use_virtual_mval = true;
303  mi->precision_factor = 1.0f / 10.0f;
304 
305  switch (mode) {
306  case INPUT_VECTOR:
307  mi->apply = InputVector;
308  t->helpline = HLP_NONE;
309  break;
310  case INPUT_SPRING:
311  calcSpringFactor(mi);
312  mi->apply = InputSpring;
313  t->helpline = HLP_SPRING;
314  break;
315  case INPUT_SPRING_FLIP:
316  calcSpringFactor(mi);
317  mi->apply = InputSpringFlip;
318  t->helpline = HLP_SPRING;
319  break;
320  case INPUT_SPRING_DELTA:
321  calcSpringFactor(mi);
322  mi->apply = InputSpringDelta;
323  t->helpline = HLP_SPRING;
324  break;
325  case INPUT_ANGLE:
326  case INPUT_ANGLE_SPRING: {
327  struct InputAngle_Data *data;
328  mi->use_virtual_mval = false;
329  mi->precision_factor = 1.0f / 30.0f;
330  data = MEM_callocN(sizeof(struct InputAngle_Data), "angle accumulator");
331  data->mval_prev[0] = mi->imval[0];
332  data->mval_prev[1] = mi->imval[1];
333  mi->data = data;
334  if (mode == INPUT_ANGLE) {
335  mi->apply = InputAngle;
336  }
337  else {
338  calcSpringFactor(mi);
339  mi->apply = InputAngleSpring;
340  }
341  t->helpline = HLP_ANGLE;
342  break;
343  }
344  case INPUT_TRACKBALL:
345  mi->precision_factor = 1.0f / 30.0f;
346  /* factor has to become setting or so */
347  mi->factor = 0.01f;
348  mi->apply = InputTrackBall;
349  t->helpline = HLP_TRACKBALL;
350  break;
353  t->helpline = HLP_HARROW;
354  break;
357  t->helpline = HLP_HARROW;
358  break;
361  t->helpline = HLP_VARROW;
362  break;
365  t->helpline = HLP_VARROW;
366  break;
367  case INPUT_CUSTOM_RATIO:
368  mi->apply = InputCustomRatio;
369  t->helpline = HLP_CARROW;
370  break;
373  t->helpline = HLP_CARROW;
374  break;
375  case INPUT_NONE:
376  default:
377  mi->apply = NULL;
378  break;
379  }
380 
381  /* setup for the mouse cursor: either set a custom one,
382  * or hide it if it will be drawn with the helpline */
383  wmWindow *win = CTX_wm_window(t->context);
384  switch (t->helpline) {
385  case HLP_NONE:
386  /* INPUT_VECTOR, INPUT_CUSTOM_RATIO, INPUT_CUSTOM_RATIO_FLIP */
387  if (t->flag & T_MODAL) {
388  t->flag |= T_MODAL_CURSOR_SET;
390  }
391  break;
392  case HLP_SPRING:
393  case HLP_ANGLE:
394  case HLP_TRACKBALL:
395  case HLP_HARROW:
396  case HLP_VARROW:
397  case HLP_CARROW:
398  if (t->flag & T_MODAL) {
399  t->flag |= T_MODAL_CURSOR_SET;
401  }
402  break;
403  default:
404  break;
405  }
406 
407  /* if we've allocated new data, free the old data
408  * less hassle than checking before every alloc above */
409  if (mi_data_prev && (mi_data_prev != mi->data)) {
410  MEM_freeN(mi_data_prev);
411  }
412 }
413 
414 void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *t, float values[3]))
415 {
416  mi->post = post;
417 }
418 
419 void applyMouseInput(TransInfo *t, MouseInput *mi, const int mval[2], float output[3])
420 {
421  double mval_db[2];
422 
423  if (mi->use_virtual_mval) {
424  /* update accumulator */
425  double mval_delta[2];
426 
427  mval_delta[0] = (mval[0] - mi->imval[0]) - mi->virtual_mval.prev[0];
428  mval_delta[1] = (mval[1] - mi->imval[1]) - mi->virtual_mval.prev[1];
429 
430  mi->virtual_mval.prev[0] += mval_delta[0];
431  mi->virtual_mval.prev[1] += mval_delta[1];
432 
433  if (mi->precision) {
434  mval_delta[0] *= (double)mi->precision_factor;
435  mval_delta[1] *= (double)mi->precision_factor;
436  }
437 
438  mi->virtual_mval.accum[0] += mval_delta[0];
439  mi->virtual_mval.accum[1] += mval_delta[1];
440 
441  mval_db[0] = mi->imval[0] + mi->virtual_mval.accum[0];
442  mval_db[1] = mi->imval[1] + mi->virtual_mval.accum[1];
443  }
444  else {
445  mval_db[0] = mval[0];
446  mval_db[1] = mval[1];
447  }
448 
449  if (mi->apply != NULL) {
450  mi->apply(t, mi, mval_db, output);
451  }
452 
453  if (!is_zero_v3(t->values_modal_offset)) {
454  float values_ofs[3];
455  if (t->con.mode & CON_APPLY) {
456  mul_v3_m3v3(values_ofs, t->spacemtx, t->values_modal_offset);
457  }
458  else {
459  copy_v3_v3(values_ofs, t->values_modal_offset);
460  }
461  add_v3_v3(t->values, values_ofs);
462  }
463 
464  if (mi->post) {
465  mi->post(t, output);
466  }
467 }
468 
typedef float(TangentPoint)[2]
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:699
#define BLI_ASSERT_UNIT_V2(v)
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
Definition: math_matrix.c:901
float angle_normalized_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
Definition: math_vector.c:521
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
void project_v3_v3v3(float out[3], const float p[3], const float v_proj[3])
Definition: math_vector.c:674
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float cross_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE float normalize_v2(float r[2])
MINLINE void add_v3_v3(float r[3], const float a[3])
#define UNPACK2(a)
#define UNUSED(x)
typedef double(DMatrix)[4][4]
NSNotificationCenter * center
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
#define output
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
Definition: btQuaternion.h:895
#define sqrtf(x)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
INLINE Rall1d< T, V, S > hypot(const Rall1d< T, V, S > &y, const Rall1d< T, V, S > &x)
Definition: rall1d.h:383
__int64 int64_t
Definition: stdint.h:92
bool use_virtual_mval
Definition: transform.h:396
double accum[2]
Definition: transform.h:399
struct MouseInput::@563 virtual_mval
void(* apply)(struct TransInfo *t, struct MouseInput *mi, const double mval[2], float output[3])
Definition: transform.h:376
double prev[2]
Definition: transform.h:398
float center[2]
Definition: transform.h:383
int imval[2]
Definition: transform.h:380
void(* post)(struct TransInfo *t, float values[3])
Definition: transform.h:377
float precision_factor
Definition: transform.h:382
float factor
Definition: transform.h:384
void * data
Definition: transform.h:386
bool precision
Definition: transform.h:381
void convertViewVec(TransInfo *t, float r_vec[3], double dx, double dy)
Definition: transform.c:180
MouseInputMode
Definition: transform.h:726
@ INPUT_TRACKBALL
Definition: transform.h:734
@ INPUT_VERTICAL_ABSOLUTE
Definition: transform.h:738
@ INPUT_SPRING
Definition: transform.h:729
@ INPUT_VECTOR
Definition: transform.h:728
@ INPUT_ANGLE_SPRING
Definition: transform.h:733
@ INPUT_CUSTOM_RATIO_FLIP
Definition: transform.h:740
@ INPUT_HORIZONTAL_RATIO
Definition: transform.h:735
@ INPUT_VERTICAL_RATIO
Definition: transform.h:737
@ INPUT_CUSTOM_RATIO
Definition: transform.h:739
@ INPUT_HORIZONTAL_ABSOLUTE
Definition: transform.h:736
@ INPUT_SPRING_DELTA
Definition: transform.h:731
@ INPUT_NONE
Definition: transform.h:727
@ INPUT_ANGLE
Definition: transform.h:732
@ INPUT_SPRING_FLIP
Definition: transform.h:730
@ CON_APPLY
Definition: transform.h:177
@ T_MODAL
Definition: transform.h:132
@ T_MODAL_CURSOR_SET
Definition: transform.h:145
@ HLP_HARROW
Definition: transform.h:208
@ HLP_ANGLE
Definition: transform.h:207
@ HLP_SPRING
Definition: transform.h:206
@ HLP_CARROW
Definition: transform.h:210
@ HLP_TRACKBALL
Definition: transform.h:211
@ HLP_NONE
Definition: transform.h:205
@ HLP_VARROW
Definition: transform.h:209
static void InputSpring(TransInfo *UNUSED(t), MouseInput *mi, const double mval[2], float output[3])
static void InputHorizontalAbsolute(TransInfo *t, MouseInput *mi, const double mval[2], float output[3])
static void InputCustomRatioFlip(TransInfo *UNUSED(t), MouseInput *mi, const double mval[2], float output[3])
static void InputSpringFlip(TransInfo *t, MouseInput *mi, const double mval[2], float output[3])
static void InputAngleSpring(TransInfo *t, MouseInput *mi, const double mval[2], float output[3])
static void InputVector(TransInfo *t, MouseInput *mi, const double mval[2], float output[3])
static void InputHorizontalRatio(TransInfo *t, MouseInput *mi, const double mval[2], float output[3])
static void InputSpringDelta(TransInfo *t, MouseInput *mi, const double mval[2], float output[3])
void setInputPostFct(MouseInput *mi, void(*post)(struct TransInfo *t, float values[3]))
static void InputCustomRatio(TransInfo *t, MouseInput *mi, const double mval[2], float output[3])
static void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, const double mval[2], float output[3])
static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const double mval[2], float output[3])
void setCustomPointsFromDirection(TransInfo *t, MouseInput *mi, const float dir[2])
static void InputVerticalRatio(TransInfo *t, MouseInput *mi, const double mval[2], float output[3])
void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
void initMouseInput(TransInfo *UNUSED(t), MouseInput *mi, const float center[2], const int mval[2], const bool precision)
void setCustomPoints(TransInfo *UNUSED(t), MouseInput *mi, const int mval_start[2], const int mval_end[2])
static void calcSpringFactor(MouseInput *mi)
void applyMouseInput(TransInfo *t, MouseInput *mi, const int mval[2], float output[3])
static void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, const double mval[2], float output[3])
__forceinline const avxi abs(const avxi &a)
Definition: util_avxi.h:186
ccl_device_inline float distance(const float2 &a, const float2 &b)
void WM_cursor_modal_set(wmWindow *win, int val)
Definition: wm_cursors.c:207
@ WM_CURSOR_NSEW_SCROLL
Definition: wm_cursors.h:67
@ WM_CURSOR_NONE
Definition: wm_cursors.h:74