Blender  V2.93
transform_generics.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  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
24 #include <math.h>
25 
26 #include "MEM_guardedalloc.h"
27 
28 #include "DNA_gpencil_types.h"
29 
30 #include "BLI_blenlib.h"
31 #include "BLI_math.h"
32 #include "BLI_rand.h"
33 
34 #include "PIL_time.h"
35 
36 #include "BLT_translation.h"
37 
38 #include "RNA_access.h"
39 
40 #include "GPU_immediate.h"
41 #include "GPU_matrix.h"
42 
43 #include "BKE_context.h"
44 #include "BKE_layer.h"
45 #include "BKE_mask.h"
46 #include "BKE_modifier.h"
47 #include "BKE_paint.h"
48 
49 #include "ED_clip.h"
50 #include "ED_image.h"
51 #include "ED_object.h"
52 #include "ED_screen.h"
53 #include "ED_space_api.h"
54 #include "ED_uvedit.h"
55 
56 #include "WM_api.h"
57 #include "WM_types.h"
58 
59 #include "UI_resources.h"
60 #include "UI_view2d.h"
61 
62 #include "transform.h"
63 #include "transform_mode.h"
64 #include "transform_orientations.h"
65 #include "transform_snap.h"
66 
67 /* ************************** GENERICS **************************** */
68 
69 void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis, short options)
70 {
71  float v1[3], v2[3], v3[3];
72  uchar col[3], col2[3];
73 
74  if (t->spacetype == SPACE_VIEW3D) {
75  View3D *v3d = t->view;
76 
78 
79  copy_v3_v3(v3, dir);
80  mul_v3_fl(v3, v3d->clip_end);
81 
82  sub_v3_v3v3(v2, center, v3);
83  add_v3_v3v3(v1, center, v3);
84 
85  if (options & DRAWLIGHT) {
86  col[0] = col[1] = col[2] = 220;
87  }
88  else {
90  }
91  UI_make_axis_color(col, col2, axis);
92 
94 
96  immUniformColor3ubv(col2);
97 
100  immVertex3fv(pos, v2);
101  immEnd();
102 
104 
105  GPU_matrix_pop();
106  }
107 }
108 
113 {
115 }
116 
118 {
119  t->flag &= ~T_ALL_RESTRICTIONS;
120 }
121 
129 void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event)
130 {
131  Scene *sce = CTX_data_scene(C);
132  ViewLayer *view_layer = CTX_data_view_layer(C);
133  Object *obact = OBACT(view_layer);
134  const eObjectMode object_mode = obact ? obact->mode : OB_MODE_OBJECT;
136  ARegion *region = CTX_wm_region(C);
138 
140  PropertyRNA *prop;
141 
142  t->mbus = CTX_wm_message_bus(C);
143  t->depsgraph = CTX_data_depsgraph_pointer(C);
144  t->scene = sce;
145  t->view_layer = view_layer;
146  t->area = area;
147  t->region = region;
148  t->settings = ts;
149  t->reports = op ? op->reports : NULL;
150 
151  t->helpline = HLP_NONE;
152 
153  t->flag = 0;
154 
155  if (obact && ELEM(object_mode, OB_MODE_EDIT, OB_MODE_EDIT_GPENCIL)) {
156  t->obedit_type = obact->type;
157  }
158  else {
159  t->obedit_type = -1;
160  }
161 
162  /* Many kinds of transform only use a single handle. */
163  if (t->data_container == NULL) {
164  t->data_container = MEM_callocN(sizeof(*t->data_container), __func__);
165  t->data_container_len = 1;
166  }
167 
168  t->redraw = TREDRAW_HARD; /* redraw first time */
169 
170  int mval[2];
171  if (event) {
172  copy_v2_v2_int(mval, event->mval);
173  }
174  else {
175  zero_v2_int(mval);
176  }
177  copy_v2_v2_int(t->mval, mval);
178  copy_v2_v2_int(t->mouse.imval, mval);
179  copy_v2_v2_int(t->con.imval, mval);
180 
181  t->transform = NULL;
182  t->handleEvent = NULL;
183 
184  t->data_len_all = 0;
185 
186  zero_v3(t->center_global);
187 
188  unit_m3(t->mat);
189 
190  /* Default to rotate on the Z axis. */
191  t->orient_axis = 2;
192  t->orient_axis_ortho = 1;
193 
194  /* if there's an event, we're modal */
195  if (event) {
196  t->flag |= T_MODAL;
197  }
198 
199  /* Crease needs edge flag */
200  if (ELEM(t->mode, TFM_CREASE, TFM_BWEIGHT)) {
201  t->options |= CTX_EDGE_DATA;
202  }
203 
204  t->remove_on_cancel = false;
205 
206  if (op && (prop = RNA_struct_find_property(op->ptr, "remove_on_cancel")) &&
207  RNA_property_is_set(op->ptr, prop)) {
208  if (RNA_property_boolean_get(op->ptr, prop)) {
209  t->remove_on_cancel = true;
210  }
211  }
212 
213  /* GPencil editing context */
214  if (GPENCIL_EDIT_MODE(gpd)) {
215  t->options |= CTX_GPENCIL_STROKES;
216  }
217 
218  /* Assign the space type, some exceptions for running in different mode */
219  if (area == NULL) {
220  /* background mode */
221  t->spacetype = SPACE_EMPTY;
222  }
223  else if ((region == NULL) && (area->spacetype == SPACE_VIEW3D)) {
224  /* running in the text editor */
225  t->spacetype = SPACE_EMPTY;
226  }
227  else {
228  /* normal operation */
229  t->spacetype = area->spacetype;
230  }
231 
232  /* handle T_ALT_TRANSFORM initialization, we may use for different operators */
233  if (op) {
234  const char *prop_id = NULL;
235  if (t->mode == TFM_SHRINKFATTEN) {
236  prop_id = "use_even_offset";
237  }
238 
239  if (prop_id && (prop = RNA_struct_find_property(op->ptr, prop_id))) {
241  }
242  }
243 
244  if (t->spacetype == SPACE_VIEW3D) {
245  View3D *v3d = area->spacedata.first;
247 
248  t->view = v3d;
249  t->animtimer = (animscreen) ? animscreen->animtimer : NULL;
250 
251  /* turn gizmo off during transform */
252  if (t->flag & T_MODAL) {
253  t->gizmo_flag = v3d->gizmo_flag;
254  v3d->gizmo_flag = V3D_GIZMO_HIDE;
255  }
256 
257  if (t->scene->toolsettings->transform_flag & SCE_XFORM_AXIS_ALIGN) {
258  t->flag |= T_V3D_ALIGN;
259  }
260  t->around = t->scene->toolsettings->transform_pivot_point;
261 
262  /* bend always uses the cursor */
263  if (t->mode == TFM_BEND) {
264  t->around = V3D_AROUND_CURSOR;
265  }
266 
267  /* exceptional case */
268  if (t->around == V3D_AROUND_LOCAL_ORIGINS) {
269  if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) {
270  const bool use_island = transdata_check_local_islands(t, t->around);
271 
272  if ((t->obedit_type != -1) && !use_island) {
273  t->options |= CTX_NO_PET;
274  }
275  }
276  }
277 
278  if (object_mode & OB_MODE_ALL_PAINT) {
280  if (p && p->brush && (p->brush->flag & BRUSH_CURVE)) {
281  t->options |= CTX_PAINT_CURVE;
282  }
283  }
284 
285  /* initialize UV transform from */
286  if (op && ((prop = RNA_struct_find_property(op->ptr, "correct_uv")))) {
287  if (RNA_property_is_set(op->ptr, prop)) {
288  if (RNA_property_boolean_get(op->ptr, prop)) {
289  t->settings->uvcalc_flag |= UVCALC_TRANSFORM_CORRECT_SLIDE;
290  }
291  else {
292  t->settings->uvcalc_flag &= ~UVCALC_TRANSFORM_CORRECT_SLIDE;
293  }
294  }
295  else {
297  op->ptr, prop, (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT_SLIDE) != 0);
298  }
299  }
300  }
301  else if (t->spacetype == SPACE_IMAGE) {
302  SpaceImage *sima = area->spacedata.first;
303  /* XXX for now, get View2D from the active region. */
304  t->view = &region->v2d;
305  t->around = sima->around;
306 
307  if (ED_space_image_show_uvedit(sima, OBACT(t->view_layer))) {
308  /* UV transform */
309  }
310  else if (sima->mode == SI_MODE_MASK) {
311  t->options |= CTX_MASK;
312  }
313  else if (sima->mode == SI_MODE_PAINT) {
314  Paint *p = &sce->toolsettings->imapaint.paint;
315  if (p->brush && (p->brush->flag & BRUSH_CURVE)) {
316  t->options |= CTX_PAINT_CURVE;
317  }
318  }
319  /* image not in uv edit, nor in mask mode, can happen for some tools */
320  }
321  else if (t->spacetype == SPACE_NODE) {
322  /* XXX for now, get View2D from the active region. */
323  t->view = &region->v2d;
324  t->around = V3D_AROUND_CENTER_BOUNDS;
325  }
326  else if (t->spacetype == SPACE_GRAPH) {
327  SpaceGraph *sipo = area->spacedata.first;
328  t->view = &region->v2d;
329  t->around = sipo->around;
330  }
331  else if (t->spacetype == SPACE_CLIP) {
332  SpaceClip *sclip = area->spacedata.first;
333  t->view = &region->v2d;
334  t->around = sclip->around;
335 
337  t->options |= CTX_MOVIECLIP;
338  }
339  else if (ED_space_clip_check_show_maskedit(sclip)) {
340  t->options |= CTX_MASK;
341  }
342  }
343  else {
344  if (region) {
345  /* XXX for now, get View2D from the active region */
346  t->view = &region->v2d;
347  /* XXX for now, the center point is the midpoint of the data */
348  }
349  else {
350  t->view = NULL;
351  }
352  t->around = V3D_AROUND_CENTER_BOUNDS;
353  }
354 
355  BLI_assert(is_zero_v4(t->values_modal_offset));
356 
357  bool t_values_set_is_array = false;
358 
359  if (op && (prop = RNA_struct_find_property(op->ptr, "value")) &&
360  RNA_property_is_set(op->ptr, prop)) {
361  float values[4] = {0}; /* in case value isn't length 4, avoid uninitialized memory */
362  if (RNA_property_array_check(prop)) {
363  RNA_float_get_array(op->ptr, "value", values);
364  t_values_set_is_array = true;
365  }
366  else {
367  values[0] = RNA_float_get(op->ptr, "value");
368  }
369 
370  copy_v4_v4(t->values, values);
371  if (t->flag & T_MODAL) {
372  /* Run before init functions so 'values_modal_offset' can be applied on mouse input. */
373  copy_v4_v4(t->values_modal_offset, values);
374  }
375  else {
376  copy_v4_v4(t->values, values);
377  t->flag |= T_INPUT_IS_VALUES_FINAL;
378  }
379  }
380 
381  if (op && (prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) {
382  bool constraint_axis[3] = {false, false, false};
383  if (t_values_set_is_array && t->flag & T_INPUT_IS_VALUES_FINAL) {
384  /* For operators whose `t->values` is array (as Move and Scale), set constraint so that the
385  * orientation is more intuitive in the Redo Panel. */
386  constraint_axis[0] = constraint_axis[1] = constraint_axis[2] = true;
387  }
388  else if (RNA_property_is_set(op->ptr, prop)) {
389  RNA_property_boolean_get_array(op->ptr, prop, constraint_axis);
390  }
391 
392  if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) {
393  t->con.mode |= CON_APPLY;
394 
395  if (constraint_axis[0]) {
396  t->con.mode |= CON_AXIS0;
397  }
398  if (constraint_axis[1]) {
399  t->con.mode |= CON_AXIS1;
400  }
401  if (constraint_axis[2]) {
402  t->con.mode |= CON_AXIS2;
403  }
404  }
405  }
406 
407  {
408  short orient_types[3];
409  float custom_matrix[3][3];
410 
411  int orient_type_scene = V3D_ORIENT_GLOBAL;
412  int orient_type_default = -1;
413  int orient_type_set = -1;
414  int orient_type_matrix_set = -1;
415 
416  if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
417  TransformOrientationSlot *orient_slot = &t->scene->orientation_slots[SCE_ORIENT_DEFAULT];
418  orient_type_scene = orient_slot->type;
419  if (orient_type_scene == V3D_ORIENT_CUSTOM) {
420  const int index_custom = orient_slot->index_custom;
421  orient_type_scene += index_custom;
422  }
423  }
424 
425  if (op && ((prop = RNA_struct_find_property(op->ptr, "orient_type")) &&
426  RNA_property_is_set(op->ptr, prop))) {
427  orient_type_set = RNA_property_enum_get(op->ptr, prop);
428  if (orient_type_set >= V3D_ORIENT_CUSTOM + BIF_countTransformOrientation(C)) {
429  orient_type_set = V3D_ORIENT_GLOBAL;
430  }
431  }
432 
433  if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis"))) {
434  t->orient_axis = RNA_property_enum_get(op->ptr, prop);
435  }
436 
437  if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis_ortho"))) {
438  t->orient_axis_ortho = RNA_property_enum_get(op->ptr, prop);
439  }
440 
441  if (op && ((prop = RNA_struct_find_property(op->ptr, "orient_matrix")) &&
442  RNA_property_is_set(op->ptr, prop))) {
443  RNA_property_float_get_array(op->ptr, prop, &custom_matrix[0][0]);
444 
445  if ((prop = RNA_struct_find_property(op->ptr, "orient_matrix_type")) &&
446  RNA_property_is_set(op->ptr, prop)) {
447  orient_type_matrix_set = RNA_property_enum_get(op->ptr, prop);
448  }
449  else if (orient_type_set == -1) {
450  orient_type_set = V3D_ORIENT_CUSTOM_MATRIX;
451  }
452  }
453 
454  orient_type_default = orient_type_scene;
455 
456  if (orient_type_set != -1) {
457  if (!(t->con.mode & CON_APPLY)) {
458  /* Only overwrite default if not constrained. */
459  orient_type_default = orient_type_set;
460  t->is_orient_default_overwrite = true;
461  }
462  }
463  else if (orient_type_matrix_set != -1) {
464  orient_type_set = orient_type_matrix_set;
465  if (!(t->con.mode & CON_APPLY)) {
466  /* Only overwrite default if not constrained. */
467  orient_type_default = orient_type_set;
468  t->is_orient_default_overwrite = true;
469  }
470  }
471  else if (t->con.mode & CON_APPLY) {
472  orient_type_set = orient_type_scene;
473  }
474  else if (orient_type_scene == V3D_ORIENT_GLOBAL) {
475  orient_type_set = V3D_ORIENT_LOCAL;
476  }
477  else {
478  orient_type_set = V3D_ORIENT_GLOBAL;
479  }
480 
481  BLI_assert(!ELEM(-1, orient_type_default, orient_type_set));
482  if (orient_type_matrix_set == orient_type_set) {
483  /* Constraints are forced to use the custom matrix when redoing. */
484  orient_type_set = V3D_ORIENT_CUSTOM_MATRIX;
485  }
486 
487  orient_types[O_DEFAULT] = (short)orient_type_default;
488  orient_types[O_SCENE] = (short)orient_type_scene;
489  orient_types[O_SET] = (short)orient_type_set;
490 
491  for (int i = 0; i < 3; i++) {
492  /* For efficiency, avoid calculating the same orientation twice. */
493  int j;
494  for (j = 0; j < i; j++) {
495  if (orient_types[j] == orient_types[i]) {
496  memcpy(&t->orient[i], &t->orient[j], sizeof(*t->orient));
497  break;
498  }
499  }
500  if (j == i) {
501  t->orient[i].type = transform_orientation_matrix_get(
502  C, t, orient_types[i], custom_matrix, t->orient[i].matrix);
503  }
504  }
505 
506  transform_orientations_current_set(t, (t->con.mode & CON_APPLY) ? 2 : 0);
507  }
508 
509  if (op && ((prop = RNA_struct_find_property(op->ptr, "release_confirm")) &&
510  RNA_property_is_set(op->ptr, prop))) {
511  if (RNA_property_boolean_get(op->ptr, prop)) {
512  t->flag |= T_RELEASE_CONFIRM;
513  }
514  }
515  else {
516  /* Release confirms preference should not affect node editor (T69288, T70504). */
517  if (ISMOUSE(t->launch_event) &&
518  ((U.flag & USER_RELEASECONFIRM) || (t->spacetype == SPACE_NODE))) {
519  /* Global "release confirm" on mouse bindings */
520  t->flag |= T_RELEASE_CONFIRM;
521  }
522  }
523 
524  if (op && ((prop = RNA_struct_find_property(op->ptr, "mirror")) &&
525  RNA_property_is_set(op->ptr, prop))) {
526  if (!RNA_property_boolean_get(op->ptr, prop)) {
527  t->flag |= T_NO_MIRROR;
528  }
529  }
530  else if ((t->spacetype == SPACE_VIEW3D) && (t->obedit_type == OB_MESH)) {
531  /* pass */
532  }
533  else {
534  /* Avoid mirroring for unsupported contexts. */
535  t->options |= CTX_NO_MIRROR;
536  }
537 
538  /* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */
539  if (op && (prop = RNA_struct_find_property(op->ptr, "use_proportional_edit"))) {
540  if (RNA_property_is_set(op->ptr, prop)) {
541  if (RNA_property_boolean_get(op->ptr, prop)) {
542  t->flag |= T_PROP_EDIT;
543  if (RNA_boolean_get(op->ptr, "use_proportional_connected")) {
544  t->flag |= T_PROP_CONNECTED;
545  }
546  if (RNA_boolean_get(op->ptr, "use_proportional_projected")) {
547  t->flag |= T_PROP_PROJECTED;
548  }
549  }
550  }
551  else {
552  /* use settings from scene only if modal */
553  if (t->flag & T_MODAL) {
554  if ((t->options & CTX_NO_PET) == 0) {
555  bool use_prop_edit = false;
556  if (t->spacetype == SPACE_GRAPH) {
557  use_prop_edit = ts->proportional_fcurve;
558  }
559  else if (t->spacetype == SPACE_ACTION) {
560  use_prop_edit = ts->proportional_action;
561  }
562  else if (t->options & CTX_MASK) {
563  use_prop_edit = ts->proportional_mask;
564  }
565  else if (obact && obact->mode == OB_MODE_OBJECT) {
566  use_prop_edit = ts->proportional_objects;
567  }
568  else {
569  use_prop_edit = (ts->proportional_edit & PROP_EDIT_USE) != 0;
570  }
571 
572  if (use_prop_edit) {
573  t->flag |= T_PROP_EDIT;
575  t->flag |= T_PROP_CONNECTED;
576  }
578  t->flag |= T_PROP_PROJECTED;
579  }
580  }
581  }
582  }
583  }
584 
585  if (op && ((prop = RNA_struct_find_property(op->ptr, "proportional_size")) &&
586  RNA_property_is_set(op->ptr, prop))) {
587  t->prop_size = RNA_property_float_get(op->ptr, prop);
588  }
589  else {
590  t->prop_size = ts->proportional_size;
591  }
592 
593  /* TRANSFORM_FIX_ME rna restrictions */
594  if (t->prop_size <= 0.00001f) {
595  printf("Proportional size (%f) under 0.00001, resetting to 1!\n", t->prop_size);
596  t->prop_size = 1.0f;
597  }
598 
599  if (op && ((prop = RNA_struct_find_property(op->ptr, "proportional_edit_falloff")) &&
600  RNA_property_is_set(op->ptr, prop))) {
601  t->prop_mode = RNA_property_enum_get(op->ptr, prop);
602  }
603  else {
604  t->prop_mode = ts->prop_mode;
605  }
606  }
607  else { /* add not pet option to context when not available */
608  t->options |= CTX_NO_PET;
609  }
610 
611  if (t->obedit_type == OB_MESH) {
612  if (op && (prop = RNA_struct_find_property(op->ptr, "use_automerge_and_split")) &&
613  RNA_property_is_set(op->ptr, prop)) {
614  if (RNA_property_boolean_get(op->ptr, prop)) {
615  t->flag |= T_AUTOMERGE | T_AUTOSPLIT;
616  }
617  }
618  else {
619  char automerge = t->scene->toolsettings->automerge;
620  if (automerge & AUTO_MERGE) {
621  t->flag |= T_AUTOMERGE;
622  if (automerge & AUTO_MERGE_AND_SPLIT) {
623  t->flag |= T_AUTOSPLIT;
624  }
625  }
626  }
627  }
628 
629  /* Mirror is not supported with PET, turn it off. */
630 #if 0
631  if (t->flag & T_PROP_EDIT) {
632  t->flag &= ~T_MIRROR;
633  }
634 #endif
635 
636  setTransformViewAspect(t, t->aspect);
637 
638  if (op && (prop = RNA_struct_find_property(op->ptr, "center_override")) &&
639  RNA_property_is_set(op->ptr, prop)) {
640  RNA_property_float_get_array(op->ptr, prop, t->center_global);
641  mul_v3_v3(t->center_global, t->aspect);
642  t->flag |= T_OVERRIDE_CENTER;
643  }
644 
646  initNumInput(&t->num);
647 }
648 
650 {
651  if (custom_data->free_cb) {
652  /* Can take over freeing t->data and data_2d etc... */
653  custom_data->free_cb(t, tc, custom_data);
654  BLI_assert(custom_data->data == NULL);
655  }
656  else if ((custom_data->data != NULL) && custom_data->use_free) {
657  MEM_freeN(custom_data->data);
658  custom_data->data = NULL;
659  }
660  /* In case modes are switched in the same transform session. */
661  custom_data->free_cb = NULL;
662  custom_data->use_free = false;
663 }
664 
666  TransDataContainer *tc,
668 {
669  TransCustomData *custom_data = &tcdc->first_elem;
670  for (int i = 0; i < TRANS_CUSTOM_DATA_ELEM_MAX; i++, custom_data++) {
671  freeTransCustomData(t, tc, custom_data);
672  }
673 }
674 
679 {
680  freeTransCustomData(t, NULL, &t->custom.mode);
682  freeTransCustomData(t, tc, &tc->custom.mode);
683  }
684 }
685 
686 /* Here I would suggest only TransInfo related issues, like free data & reset vars. Not redraws */
688 {
689  if (t->draw_handle_view) {
690  ED_region_draw_cb_exit(t->region->type, t->draw_handle_view);
691  }
692  if (t->draw_handle_apply) {
693  ED_region_draw_cb_exit(t->region->type, t->draw_handle_apply);
694  }
695  if (t->draw_handle_pixel) {
696  ED_region_draw_cb_exit(t->region->type, t->draw_handle_pixel);
697  }
698  if (t->draw_handle_cursor) {
699  WM_paint_cursor_end(t->draw_handle_cursor);
700  }
701 
702  if (t->flag & T_MODAL_CURSOR_SET) {
704  }
705 
706  /* Free all custom-data */
707  freeTransCustomDataContainer(t, NULL, &t->custom);
709  freeTransCustomDataContainer(t, tc, &tc->custom);
710  }
711 
712  /* postTrans can be called when nothing is selected, so data is NULL already */
713  if (t->data_len_all != 0) {
715  /* free data malloced per trans-data */
716  if (ELEM(t->obedit_type, OB_CURVE, OB_SURF, OB_GPENCIL) || (t->spacetype == SPACE_GRAPH)) {
717  TransData *td = tc->data;
718  for (int a = 0; a < tc->data_len; a++, td++) {
719  if (td->flag & TD_BEZTRIPLE) {
720  MEM_freeN(td->hdata);
721  }
722  }
723  }
724  MEM_freeN(tc->data);
725 
726  MEM_SAFE_FREE(tc->data_mirror);
727  MEM_SAFE_FREE(tc->data_ext);
728  MEM_SAFE_FREE(tc->data_2d);
729  }
730  }
731 
732  MEM_SAFE_FREE(t->data_container);
733  t->data_container = NULL;
734 
735  BLI_freelistN(&t->tsnap.points);
736 
737  if (t->spacetype == SPACE_IMAGE) {
738  if (t->options & (CTX_MASK | CTX_PAINT_CURVE)) {
739  /* pass */
740  }
741  else {
742  SpaceImage *sima = t->area->spacedata.first;
743  if (sima->flag & SI_LIVE_UNWRAP) {
745  }
746  }
747  }
748  else if (t->spacetype == SPACE_VIEW3D) {
749  View3D *v3d = t->area->spacedata.first;
750  /* restore gizmo */
751  if (t->flag & T_MODAL) {
752  v3d->gizmo_flag = t->gizmo_flag;
753  }
754  }
755 
756  if (t->mouse.data) {
757  MEM_freeN(t->mouse.data);
758  }
759 
760  if (t->rng != NULL) {
761  BLI_rng_free(t->rng);
762  }
763 
764  freeSnapping(t);
765 }
766 
768 {
770 
771  TransData *td;
772 
773  for (td = tc->data; td < tc->data + tc->data_len; td++) {
774  copy_v3_v3(td->iloc, td->loc);
775  if (td->ext->rot) {
776  copy_v3_v3(td->ext->irot, td->ext->rot);
777  }
778  if (td->ext->size) {
779  copy_v3_v3(td->ext->isize, td->ext->size);
780  }
781  }
782  recalcData(t);
783 }
784 
786 {
787  /* TransData for crease has no loc */
788  if (td_basic->loc) {
789  copy_v3_v3(td_basic->loc, td_basic->iloc);
790  }
791 }
792 
793 static void restoreElement(TransData *td)
794 {
796 
797  if (td->val) {
798  *td->val = td->ival;
799  }
800 
801  if (td->ext && (td->flag & TD_NO_EXT) == 0) {
802  if (td->ext->rot) {
803  copy_v3_v3(td->ext->rot, td->ext->irot);
804  }
805  if (td->ext->rotAngle) {
806  *td->ext->rotAngle = td->ext->irotAngle;
807  }
808  if (td->ext->rotAxis) {
809  copy_v3_v3(td->ext->rotAxis, td->ext->irotAxis);
810  }
811  /* XXX, drotAngle & drotAxis not used yet */
812  if (td->ext->size) {
813  copy_v3_v3(td->ext->size, td->ext->isize);
814  }
815  if (td->ext->quat) {
816  copy_qt_qt(td->ext->quat, td->ext->iquat);
817  }
818  }
819 
820  if (td->flag & TD_BEZTRIPLE) {
821  *(td->hdata->h1) = td->hdata->ih1;
822  *(td->hdata->h2) = td->hdata->ih2;
823  }
824 }
825 
827 {
829 
830  TransData *td;
831  TransData2D *td2d;
832  TransDataMirror *tdm;
833 
834  for (td = tc->data; td < tc->data + tc->data_len; td++) {
835  restoreElement(td);
836  }
837 
838  for (tdm = tc->data_mirror; tdm < tc->data_mirror + tc->data_mirror_len; tdm++) {
840  }
841 
842  for (td2d = tc->data_2d; tc->data_2d && td2d < tc->data_2d + tc->data_len; td2d++) {
843  if (td2d->h1) {
844  td2d->h1[0] = td2d->ih1[0];
845  td2d->h1[1] = td2d->ih1[1];
846  }
847  if (td2d->h2) {
848  td2d->h2[0] = td2d->ih2[0];
849  td2d->h2[1] = td2d->ih2[1];
850  }
851  }
852 
853  unit_m3(t->mat);
854  }
855 
856  recalcData(t);
857 }
858 
860 {
861  BLI_assert(!is_zero_v3(t->aspect));
862  projectFloatView(t, t->center_global, t->center2d);
863 }
864 
865 void calculateCenterLocal(TransInfo *t, const float center_global[3])
866 {
867  /* setting constraint center */
868  /* note, init functions may over-ride t->center */
870  if (tc->use_local_mat) {
871  mul_v3_m4v3(tc->center_local, tc->imat, center_global);
872  }
873  else {
874  copy_v3_v3(tc->center_local, center_global);
875  }
876  }
877 }
878 
879 void calculateCenterCursor(TransInfo *t, float r_center[3])
880 {
881  const float *cursor = t->scene->cursor.location;
882  copy_v3_v3(r_center, cursor);
883 
884  /* If edit or pose mode, move cursor in local space */
885  if (t->options & CTX_PAINT_CURVE) {
886  if (ED_view3d_project_float_global(t->region, cursor, r_center, V3D_PROJ_TEST_NOP) !=
887  V3D_PROJ_RET_OK) {
888  r_center[0] = t->region->winx / 2.0f;
889  r_center[1] = t->region->winy / 2.0f;
890  }
891  r_center[2] = 0.0f;
892  }
893 }
894 
895 void calculateCenterCursor2D(TransInfo *t, float r_center[2])
896 {
897  const float *cursor = NULL;
898 
899  if (t->spacetype == SPACE_IMAGE) {
900  SpaceImage *sima = (SpaceImage *)t->area->spacedata.first;
901  cursor = sima->cursor;
902  }
903  else if (t->spacetype == SPACE_CLIP) {
904  SpaceClip *space_clip = (SpaceClip *)t->area->spacedata.first;
905  cursor = space_clip->cursor;
906  }
907 
908  if (cursor) {
909  if (t->options & CTX_MASK) {
910  float co[2];
911 
912  if (t->spacetype == SPACE_IMAGE) {
913  SpaceImage *sima = (SpaceImage *)t->area->spacedata.first;
914  BKE_mask_coord_from_image(sima->image, &sima->iuser, co, cursor);
915  }
916  else if (t->spacetype == SPACE_CLIP) {
917  SpaceClip *space_clip = (SpaceClip *)t->area->spacedata.first;
918  BKE_mask_coord_from_movieclip(space_clip->clip, &space_clip->user, co, cursor);
919  }
920  else {
921  BLI_assert(!"Shall not happen");
922  }
923 
924  r_center[0] = co[0] * t->aspect[0];
925  r_center[1] = co[1] * t->aspect[1];
926  }
927  else if (t->options & CTX_PAINT_CURVE) {
928  if (t->spacetype == SPACE_IMAGE) {
929  r_center[0] = UI_view2d_view_to_region_x(&t->region->v2d, cursor[0]);
930  r_center[1] = UI_view2d_view_to_region_y(&t->region->v2d, cursor[1]);
931  }
932  }
933  else {
934  r_center[0] = cursor[0] * t->aspect[0];
935  r_center[1] = cursor[1] * t->aspect[1];
936  }
937  }
938 }
939 
940 void calculateCenterCursorGraph2D(TransInfo *t, float r_center[2])
941 {
942  SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first;
943  Scene *scene = t->scene;
944 
945  /* cursor is combination of current frame, and graph-editor cursor value */
946  if (sipo->mode == SIPO_MODE_DRIVERS) {
947  r_center[0] = sipo->cursorTime;
948  r_center[1] = sipo->cursorVal;
949  }
950  else {
951  r_center[0] = (float)(scene->r.cfra);
952  r_center[1] = sipo->cursorVal;
953  }
954 }
955 
957  const TransDataBasic *td_basic,
958  float r_vec[3])
959 {
960  if (td_basic->flag & TD_SELECTED) {
961  if (!(td_basic->flag & TD_NOCENTER)) {
962  if (tc->use_local_mat) {
963  mul_v3_m4v3(r_vec, tc->mat, td_basic->center);
964  }
965  else {
966  copy_v3_v3(r_vec, td_basic->center);
967  }
968  return true;
969  }
970  }
971  return false;
972 }
973 
974 void calculateCenterMedian(TransInfo *t, float r_center[3])
975 {
976  float partial[3] = {0.0f, 0.0f, 0.0f};
977  int total = 0;
978 
980  float center[3];
981  for (int i = 0; i < tc->data_len; i++) {
982  if (transdata_center_global_get(tc, (TransDataBasic *)&tc->data[i], center)) {
983  add_v3_v3(partial, center);
984  total++;
985  }
986  }
987  for (int i = 0; i < tc->data_mirror_len; i++) {
988  if (transdata_center_global_get(tc, (TransDataBasic *)&tc->data_mirror[i], center)) {
989  add_v3_v3(partial, center);
990  total++;
991  }
992  }
993  }
994  if (total) {
995  mul_v3_fl(partial, 1.0f / (float)total);
996  }
997  copy_v3_v3(r_center, partial);
998 }
999 
1000 void calculateCenterBound(TransInfo *t, float r_center[3])
1001 {
1002  float max[3], min[3];
1003  bool changed = false;
1004  INIT_MINMAX(min, max);
1006  float center[3];
1007  for (int i = 0; i < tc->data_len; i++) {
1008  if (transdata_center_global_get(tc, (TransDataBasic *)&tc->data[i], center)) {
1010  changed = true;
1011  }
1012  }
1013  for (int i = 0; i < tc->data_mirror_len; i++) {
1014  if (transdata_center_global_get(tc, (TransDataBasic *)&tc->data_mirror[i], center)) {
1016  changed = true;
1017  }
1018  }
1019  }
1020  if (changed) {
1021  mid_v3_v3v3(r_center, min, max);
1022  }
1023 }
1024 
1028 bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3])
1029 {
1031 
1032  if (t->spacetype != SPACE_VIEW3D) {
1033  return false;
1034  }
1035  if (tc->obedit) {
1036  if (ED_object_calc_active_center_for_editmode(tc->obedit, select_only, r_center)) {
1037  mul_m4_v3(tc->obedit->obmat, r_center);
1038  return true;
1039  }
1040  }
1041  else if (t->options & CTX_POSE_BONE) {
1042  ViewLayer *view_layer = t->view_layer;
1043  Object *ob = OBACT(view_layer);
1044  if (ED_object_calc_active_center_for_posemode(ob, select_only, r_center)) {
1045  mul_m4_v3(ob->obmat, r_center);
1046  return true;
1047  }
1048  }
1049  else if (t->options & CTX_PAINT_CURVE) {
1050  Paint *p = BKE_paint_get_active(t->scene, t->view_layer);
1051  Brush *br = p->brush;
1052  PaintCurve *pc = br->paint_curve;
1053  copy_v3_v3(r_center, pc->points[pc->add_index - 1].bez.vec[1]);
1054  r_center[2] = 0.0f;
1055  return true;
1056  }
1057  else {
1058  /* object mode */
1059  ViewLayer *view_layer = t->view_layer;
1060  Object *ob = OBACT(view_layer);
1061  Base *base = BASACT(view_layer);
1062  if (ob && ((!select_only) || ((base->flag & BASE_SELECTED) != 0))) {
1063  copy_v3_v3(r_center, ob->obmat[3]);
1064  return true;
1065  }
1066  }
1067 
1068  return false;
1069 }
1070 
1071 static void calculateCenter_FromAround(TransInfo *t, int around, float r_center[3])
1072 {
1073  switch (around) {
1075  calculateCenterBound(t, r_center);
1076  break;
1078  calculateCenterMedian(t, r_center);
1079  break;
1080  case V3D_AROUND_CURSOR:
1081  if (ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP)) {
1082  calculateCenterCursor2D(t, r_center);
1083  }
1084  else if (t->spacetype == SPACE_GRAPH) {
1085  calculateCenterCursorGraph2D(t, r_center);
1086  }
1087  else {
1088  calculateCenterCursor(t, r_center);
1089  }
1090  break;
1092  /* Individual element center uses median center for helpline and such */
1093  calculateCenterMedian(t, r_center);
1094  break;
1095  case V3D_AROUND_ACTIVE: {
1096  if (calculateCenterActive(t, false, r_center)) {
1097  /* pass */
1098  }
1099  else {
1100  /* fallback */
1101  calculateCenterMedian(t, r_center);
1102  }
1103  break;
1104  }
1105  }
1106 }
1107 
1109 {
1110  if ((t->flag & T_OVERRIDE_CENTER) == 0) {
1111  calculateCenter_FromAround(t, t->around, t->center_global);
1112  }
1113  calculateCenterLocal(t, t->center_global);
1114 
1116 
1117  /* For panning from the camera-view. */
1118  if ((t->options & CTX_OBJECT) && (t->flag & T_OVERRIDE_CENTER) == 0) {
1119  if (t->spacetype == SPACE_VIEW3D && t->region && t->region->regiontype == RGN_TYPE_WINDOW) {
1120 
1121  if (t->options & CTX_CAMERA) {
1122  float axis[3];
1123  /* persinv is nasty, use viewinv instead, always right */
1124  copy_v3_v3(axis, t->viewinv[2]);
1125  normalize_v3(axis);
1126 
1127  /* 6.0 = 6 grid units */
1128  axis[0] = t->center_global[0] - 6.0f * axis[0];
1129  axis[1] = t->center_global[1] - 6.0f * axis[1];
1130  axis[2] = t->center_global[2] - 6.0f * axis[2];
1131 
1132  projectFloatView(t, axis, t->center2d);
1133 
1134  /* rotate only needs correct 2d center, grab needs ED_view3d_calc_zfac() value */
1135  if (t->mode == TFM_TRANSLATION) {
1136  copy_v3_v3(t->center_global, axis);
1137  }
1138  }
1139  }
1140  }
1141 
1142  if (t->spacetype == SPACE_VIEW3D) {
1143  /* ED_view3d_calc_zfac() defines a factor for perspective depth correction,
1144  * used in ED_view3d_win_to_delta() */
1145 
1146  /* zfac is only used convertViewVec only in cases operator was invoked in RGN_TYPE_WINDOW
1147  * and never used in other cases.
1148  *
1149  * We need special case here as well, since ED_view3d_calc_zfac will crash when called
1150  * for a region different from RGN_TYPE_WINDOW.
1151  */
1152  if (t->region->regiontype == RGN_TYPE_WINDOW) {
1153  t->zfac = ED_view3d_calc_zfac(t->region->regiondata, t->center_global, NULL);
1154  }
1155  else {
1156  t->zfac = 0.0f;
1157  }
1158  }
1159 }
1160 
1162 {
1163  int i;
1164  float dist;
1165  const bool connected = (t->flag & T_PROP_CONNECTED) != 0;
1166 
1167  t->proptext[0] = '\0';
1168 
1169  if (t->flag & T_PROP_EDIT) {
1170  const char *pet_id = NULL;
1172  TransData *td = tc->data;
1173  for (i = 0; i < tc->data_len; i++, td++) {
1174  if (td->flag & TD_SELECTED) {
1175  td->factor = 1.0f;
1176  }
1177  else if ((connected && (td->flag & TD_NOTCONNECTED || td->dist > t->prop_size)) ||
1178  (connected == 0 && td->rdist > t->prop_size)) {
1179  td->factor = 0.0f;
1180  restoreElement(td);
1181  }
1182  else {
1183  /* Use rdist for falloff calculations, it is the real distance */
1184  if (connected) {
1185  dist = (t->prop_size - td->dist) / t->prop_size;
1186  }
1187  else {
1188  dist = (t->prop_size - td->rdist) / t->prop_size;
1189  }
1190 
1191  /*
1192  * Clamp to positive numbers.
1193  * Certain corner cases with connectivity and individual centers
1194  * can give values of rdist larger than propsize.
1195  */
1196  if (dist < 0.0f) {
1197  dist = 0.0f;
1198  }
1199 
1200  switch (t->prop_mode) {
1201  case PROP_SHARP:
1202  td->factor = dist * dist;
1203  break;
1204  case PROP_SMOOTH:
1205  td->factor = 3.0f * dist * dist - 2.0f * dist * dist * dist;
1206  break;
1207  case PROP_ROOT:
1208  td->factor = sqrtf(dist);
1209  break;
1210  case PROP_LIN:
1211  td->factor = dist;
1212  break;
1213  case PROP_CONST:
1214  td->factor = 1.0f;
1215  break;
1216  case PROP_SPHERE:
1217  td->factor = sqrtf(2 * dist - dist * dist);
1218  break;
1219  case PROP_RANDOM:
1220  if (t->rng == NULL) {
1221  /* Lazy initialization. */
1222  uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX);
1223  t->rng = BLI_rng_new(rng_seed);
1224  }
1225  td->factor = BLI_rng_get_float(t->rng) * dist;
1226  break;
1227  case PROP_INVSQUARE:
1228  td->factor = dist * (2.0f - dist);
1229  break;
1230  default:
1231  td->factor = 1;
1232  break;
1233  }
1234  }
1235  }
1236  }
1237 
1238  switch (t->prop_mode) {
1239  case PROP_SHARP:
1240  pet_id = N_("(Sharp)");
1241  break;
1242  case PROP_SMOOTH:
1243  pet_id = N_("(Smooth)");
1244  break;
1245  case PROP_ROOT:
1246  pet_id = N_("(Root)");
1247  break;
1248  case PROP_LIN:
1249  pet_id = N_("(Linear)");
1250  break;
1251  case PROP_CONST:
1252  pet_id = N_("(Constant)");
1253  break;
1254  case PROP_SPHERE:
1255  pet_id = N_("(Sphere)");
1256  break;
1257  case PROP_RANDOM:
1258  pet_id = N_("(Random)");
1259  break;
1260  case PROP_INVSQUARE:
1261  pet_id = N_("(InvSquare)");
1262  break;
1263  default:
1264  break;
1265  }
1266 
1267  if (pet_id) {
1268  BLI_strncpy(t->proptext, IFACE_(pet_id), sizeof(t->proptext));
1269  }
1270  }
1271  else {
1273  TransData *td = tc->data;
1274  for (i = 0; i < tc->data_len; i++, td++) {
1275  td->factor = 1.0;
1276  }
1277  }
1278  }
1279 }
1280 
1286 void transform_data_ext_rotate(TransData *td, float mat[3][3], bool use_drot)
1287 {
1288  float totmat[3][3];
1289  float smat[3][3];
1290  float fmat[3][3];
1291  float obmat[3][3];
1292 
1293  float dmat[3][3]; /* delta rotation */
1294  float dmat_inv[3][3];
1295 
1296  mul_m3_m3m3(totmat, mat, td->mtx);
1297  mul_m3_m3m3(smat, td->smtx, mat);
1298 
1299  /* logic from BKE_object_rot_to_mat3 */
1300  if (use_drot) {
1301  if (td->ext->rotOrder > 0) {
1302  eulO_to_mat3(dmat, td->ext->drot, td->ext->rotOrder);
1303  }
1304  else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
1305 #if 0
1306  axis_angle_to_mat3(dmat, td->ext->drotAxis, td->ext->drotAngle);
1307 #else
1308  unit_m3(dmat);
1309 #endif
1310  }
1311  else {
1312  float tquat[4];
1313  normalize_qt_qt(tquat, td->ext->dquat);
1314  quat_to_mat3(dmat, tquat);
1315  }
1316 
1317  invert_m3_m3(dmat_inv, dmat);
1318  }
1319 
1320  if (td->ext->rotOrder == ROT_MODE_QUAT) {
1321  float quat[4];
1322 
1323  /* Calculate the total rotation. */
1324  quat_to_mat3(obmat, td->ext->iquat);
1325  if (use_drot) {
1326  mul_m3_m3m3(obmat, dmat, obmat);
1327  }
1328 
1329  /* mat = transform, obmat = object rotation */
1330  mul_m3_m3m3(fmat, smat, obmat);
1331 
1332  if (use_drot) {
1333  mul_m3_m3m3(fmat, dmat_inv, fmat);
1334  }
1335 
1336  mat3_to_quat(quat, fmat);
1337 
1338  /* apply */
1339  copy_qt_qt(td->ext->quat, quat);
1340  }
1341  else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
1342  float axis[3], angle;
1343 
1344  /* Calculate the total rotation. */
1345  axis_angle_to_mat3(obmat, td->ext->irotAxis, td->ext->irotAngle);
1346  if (use_drot) {
1347  mul_m3_m3m3(obmat, dmat, obmat);
1348  }
1349 
1350  /* mat = transform, obmat = object rotation */
1351  mul_m3_m3m3(fmat, smat, obmat);
1352 
1353  if (use_drot) {
1354  mul_m3_m3m3(fmat, dmat_inv, fmat);
1355  }
1356 
1357  mat3_to_axis_angle(axis, &angle, fmat);
1358 
1359  /* apply */
1360  copy_v3_v3(td->ext->rotAxis, axis);
1361  *td->ext->rotAngle = angle;
1362  }
1363  else {
1364  float eul[3];
1365 
1366  /* Calculate the total rotation. */
1367  eulO_to_mat3(obmat, td->ext->irot, td->ext->rotOrder);
1368  if (use_drot) {
1369  mul_m3_m3m3(obmat, dmat, obmat);
1370  }
1371 
1372  /* mat = transform, obmat = object rotation */
1373  mul_m3_m3m3(fmat, smat, obmat);
1374 
1375  if (use_drot) {
1376  mul_m3_m3m3(fmat, dmat_inv, fmat);
1377  }
1378 
1379  mat3_to_compatible_eulO(eul, td->ext->rot, td->ext->rotOrder, fmat);
1380 
1381  /* apply */
1382  copy_v3_v3(td->ext->rot, eul);
1383  }
1384 }
1385 
1387 {
1388  if (!(ob->mode & OB_MODE_ALL_WEIGHT_PAINT)) {
1389  return NULL;
1390  }
1391  /* Important that ob_armature can be set even when its not selected T23412.
1392  * Lines below just check is also visible. */
1393  Object *ob_armature = BKE_modifiers_is_deformed_by_armature(ob);
1394  if (ob_armature && ob_armature->mode & OB_MODE_POSE) {
1395  Base *base_arm = BKE_view_layer_base_find(t->view_layer, ob_armature);
1396  if (base_arm) {
1397  View3D *v3d = t->view;
1398  if (BASE_VISIBLE(v3d, base_arm)) {
1399  return ob_armature;
1400  }
1401  }
1402  }
1403  return NULL;
1404 }
typedef float(TangentPoint)[2]
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:714
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:689
struct ViewLayer * CTX_data_view_layer(const bContext *C)
Definition: context.c:1044
struct bGPdata * CTX_data_gpencil_data(const bContext *C)
Definition: context.c:1371
struct wmMsgBus * CTX_wm_message_bus(const bContext *C)
Definition: context.c:746
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:725
struct Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Definition: context.c:1401
struct ToolSettings * CTX_data_tool_settings(const bContext *C)
Definition: context.c:1208
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:699
struct Base * BKE_view_layer_base_find(struct ViewLayer *view_layer, struct Object *ob)
Definition: layer.c:394
void BKE_mask_coord_from_image(struct Image *image, struct ImageUser *iuser, float r_co[2], const float co[2])
Definition: mask.c:1236
void BKE_mask_coord_from_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2])
Definition: mask.c:1219
struct Object * BKE_modifiers_is_deformed_by_armature(struct Object *ob)
struct Paint * BKE_paint_get_active(struct Scene *sce, struct ViewLayer *view_layer)
Definition: paint.c:447
struct Paint * BKE_paint_get_active_from_context(const struct bContext *C)
#define BLI_assert(a)
Definition: BLI_assert.h:58
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:547
void unit_m3(float m[3][3])
Definition: math_matrix.c:58
void mul_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:732
bool invert_m3_m3(float R[3][3], const float A[3][3])
Definition: math_matrix.c:1161
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
Definition: math_matrix.c:742
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
Definition: math_matrix.c:391
void mat3_to_quat(float q[4], const float mat[3][3])
float normalize_qt_qt(float r[4], const float q[4])
void mat3_to_axis_angle(float axis[3], float *angle, const float M[3][3])
void eulO_to_mat3(float mat[3][3], const float eul[3], const short order)
void axis_angle_to_mat3(float R[3][3], const float axis[3], const float angle)
void copy_qt_qt(float q[4], const float a[4])
Definition: math_rotation.c:52
void quat_to_mat3(float mat[3][3], const float q[4])
void mat3_to_compatible_eulO(float eul[3], const float old[3], const short order, const float mat[3][3])
MINLINE void copy_v4_v4(float r[4], const float a[4])
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
Definition: math_vector.c:1020
MINLINE float normalize_v3(float r[3])
MINLINE void mul_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE bool is_zero_v4(const float a[4]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v2_v2_int(int r[2], const int 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
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
Definition: math_vector.c:270
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
Random number functions.
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1)
Definition: rand.cc:76
struct RNG * BLI_rng_new(unsigned int seed)
Definition: rand.cc:54
float BLI_rng_get_float(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: rand.cc:120
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Definition: string.c:108
unsigned char uchar
Definition: BLI_sys_types.h:86
unsigned int uint
Definition: BLI_sys_types.h:83
#define INIT_MINMAX(min, max)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define ELEM(...)
#define IFACE_(msgid)
#define N_(msgid)
@ ROT_MODE_QUAT
@ ROT_MODE_AXISANGLE
@ BRUSH_CURVE
#define GPENCIL_EDIT_MODE(gpd)
@ BASE_SELECTED
#define OB_MODE_ALL_PAINT
#define OB_MODE_ALL_WEIGHT_PAINT
eObjectMode
@ OB_MODE_EDIT_GPENCIL
@ OB_MODE_EDIT
@ OB_MODE_POSE
@ OB_MODE_OBJECT
@ OB_SURF
@ OB_MESH
@ OB_CURVE
@ OB_GPENCIL
#define PROP_RANDOM
#define PROP_LIN
@ AUTO_MERGE
@ AUTO_MERGE_AND_SPLIT
@ SCE_XFORM_AXIS_ALIGN
#define PROP_SPHERE
#define UVCALC_TRANSFORM_CORRECT_SLIDE
#define BASACT(_view_layer)
#define OBACT(_view_layer)
#define PROP_SMOOTH
#define PROP_ROOT
@ SCE_ORIENT_DEFAULT
@ PROP_EDIT_PROJECTED
@ PROP_EDIT_USE
@ PROP_EDIT_CONNECTED
#define PROP_INVSQUARE
#define PROP_CONST
#define PROP_SHARP
#define BASE_VISIBLE(v3d, base)
@ RGN_TYPE_WINDOW
@ SI_LIVE_UNWRAP
@ SPACE_CLIP
@ SPACE_ACTION
@ SPACE_NODE
@ SPACE_EMPTY
@ SPACE_IMAGE
@ SPACE_GRAPH
@ SPACE_VIEW3D
@ SIPO_MODE_DRIVERS
@ SI_MODE_PAINT
@ SI_MODE_MASK
@ USER_RELEASECONFIRM
@ V3D_ORIENT_CUSTOM
@ V3D_ORIENT_GLOBAL
@ V3D_ORIENT_CUSTOM_MATRIX
@ V3D_ORIENT_LOCAL
@ V3D_AROUND_ACTIVE
@ V3D_AROUND_CENTER_BOUNDS
@ V3D_AROUND_CURSOR
@ V3D_AROUND_CENTER_MEDIAN
@ V3D_AROUND_LOCAL_ORIGINS
@ V3D_GIZMO_HIDE
bool ED_space_clip_check_show_trackedit(struct SpaceClip *sc)
Definition: clip_editor.c:548
bool ED_space_clip_check_show_maskedit(struct SpaceClip *sc)
Definition: clip_editor.c:557
bool ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit)
Definition: image_edit.c:460
void initNumInput(NumInput *n)
Definition: numinput.c:83
bool ED_object_calc_active_center_for_posemode(struct Object *ob, const bool select_only, float r_center[3])
Definition: object_utils.c:113
bool ED_object_calc_active_center_for_editmode(struct Object *obedit, const bool select_only, float r_center[3])
Definition: object_utils.c:54
bScreen * ED_screen_animation_playing(const struct wmWindowManager *wm)
void ED_region_draw_cb_exit(struct ARegionType *, void *)
Definition: spacetypes.c:253
@ TFM_RESIZE
Definition: ED_transform.h:48
@ TFM_SHRINKFATTEN
Definition: ED_transform.h:53
@ TFM_CREASE
Definition: ED_transform.h:57
@ TFM_BEND
Definition: ED_transform.h:52
@ TFM_ROTATION
Definition: ED_transform.h:47
@ TFM_BWEIGHT
Definition: ED_transform.h:72
@ TFM_TRANSLATION
Definition: ED_transform.h:46
@ TFM_TRACKBALL
Definition: ED_transform.h:55
int BIF_countTransformOrientation(const struct bContext *C)
void ED_uvedit_live_unwrap_end(short cancel)
@ V3D_PROJ_TEST_NOP
Definition: ED_view3d.h:193
@ V3D_PROJ_RET_OK
Definition: ED_view3d.h:176
eV3DProjStatus ED_view3d_project_float_global(const struct ARegion *region, const float co[3], float r_co[2], const eV3DProjTest flag)
float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3], bool *r_flip)
NSNotificationCenter * center
void immUnbindProgram(void)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
void immUniformColor3ubv(const unsigned char rgb[3])
GPUVertFormat * immVertexFormat(void)
void immVertex3fv(uint attr_id, const float data[3])
void immBegin(GPUPrimType, uint vertex_len)
void immEnd(void)
_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
_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 v1
void GPU_matrix_pop(void)
Definition: gpu_matrix.cc:142
void GPU_matrix_push(void)
Definition: gpu_matrix.cc:135
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:36
@ GPU_SHADER_3D_UNIFORM_COLOR
Definition: GPU_shader.h:200
@ GPU_FETCH_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
Platform independent time functions.
#define C
Definition: RandGen.cpp:39
void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, const char axis)
@ TH_GRID
Definition: UI_resources.h:84
void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
Definition: resources.c:1350
float UI_view2d_view_to_region_x(const struct View2D *v2d, float x)
float UI_view2d_view_to_region_y(const struct View2D *v2d, float y)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
unsigned int U
Definition: btGjkEpa3.h:78
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
CCL_NAMESPACE_BEGIN struct Options options
Scene scene
uint pos
uint col
#define UINT_MAX
Definition: hash_md5.c:58
#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
MINLINE void zero_v2_int(int r[2])
static unsigned a[3]
Definition: RandGen.cpp:92
static void area(int d1, int d2, int e1, int e2, float weights[2])
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2941
bool RNA_property_array_check(PropertyRNA *prop)
Definition: rna_access.c:1223
void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
Definition: rna_access.c:3033
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:6655
void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, bool *values)
Definition: rna_access.c:2420
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:866
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
Definition: rna_access.c:6378
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2331
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
Definition: rna_access.c:2358
float RNA_float_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6355
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:3543
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6261
#define min(a, b)
Definition: sort.c:51
short flag
float vec[3][3]
struct PaintCurve * paint_curve
float obmat[4][4]
PaintCurvePoint * points
struct Brush * brush
struct ToolSettings * toolsettings
struct RenderData r
struct MovieClipUser user
float cursor[2]
struct MovieClip * clip
float cursor[2]
struct ImageUser iuser
struct Image * image
struct ImagePaintSettings imapaint
TransCustomData first_elem
Definition: transform.h:426
unsigned int use_free
Definition: transform.h:408
void(* free_cb)(struct TransInfo *, struct TransDataContainer *tc, struct TransCustomData *custom_data)
Definition: transform.h:405
float ih2[2]
float ih1[2]
struct Object * obedit
Definition: transform.h:461
float mat[4][4]
Definition: transform.h:463
TransData * data
Definition: transform.h:448
TransDataCurveHandleFlags * hdata
float smtx[3][3]
float mtx[3][3]
TransDataExtension * ext
float * val
float clip_end
char gizmo_flag
struct wmTimer * animtimer
int mval[2]
Definition: WM_types.h:583
struct ReportList * reports
struct PointerRNA * ptr
long int PIL_check_seconds_timer_i(void)
Definition: time.c:90
void setTransformViewAspect(TransInfo *t, float r_aspect[3])
Definition: transform.c:113
bool transdata_check_local_islands(TransInfo *t, short around)
Definition: transform.c:79
void setTransformViewMatrices(TransInfo *t)
Definition: transform.c:89
void projectFloatView(TransInfo *t, const float vec[3], float adr[2])
Definition: transform.c:376
#define DRAWLIGHT
Definition: transform.h:773
@ CON_APPLY
Definition: transform.h:177
@ CON_AXIS1
Definition: transform.h:180
@ CON_AXIS0
Definition: transform.h:179
@ CON_AXIS2
Definition: transform.h:181
#define TRANS_CUSTOM_DATA_ELEM_MAX
Definition: transform.h:430
void recalcData(TransInfo *t)
@ CTX_MOVIECLIP
Definition: transform.h:84
@ CTX_PAINT_CURVE
Definition: transform.h:86
@ CTX_POSE_BONE
Definition: transform.h:87
@ CTX_OBJECT
Definition: transform.h:85
@ CTX_EDGE_DATA
Definition: transform.h:81
@ CTX_GPENCIL_STROKES
Definition: transform.h:82
@ CTX_MASK
Definition: transform.h:83
@ CTX_NO_MIRROR
Definition: transform.h:91
@ CTX_NO_PET
Definition: transform.h:90
@ CTX_CAMERA
Definition: transform.h:79
#define TRANS_DATA_CONTAINER_FIRST_OK(t)
Definition: transform.h:808
@ TREDRAW_HARD
Definition: transform.h:199
@ T_OVERRIDE_CENTER
Definition: transform.h:143
@ T_RELEASE_CONFIRM
Definition: transform.h:137
@ T_MODAL
Definition: transform.h:132
@ T_AUTOSPLIT
Definition: transform.h:152
@ T_PROP_CONNECTED
Definition: transform.h:112
@ T_ALT_TRANSFORM
Definition: transform.h:140
@ T_AUTOMERGE
Definition: transform.h:150
@ T_NO_MIRROR
Definition: transform.h:125
@ T_ALL_RESTRICTIONS
Definition: transform.h:109
@ T_PROP_EDIT
Definition: transform.h:111
@ T_INPUT_IS_VALUES_FINAL
Definition: transform.h:129
@ T_V3D_ALIGN
Definition: transform.h:116
@ T_MODAL_CURSOR_SET
Definition: transform.h:145
@ T_PROP_PROJECTED
Definition: transform.h:113
#define TRANS_DATA_CONTAINER_FIRST_SINGLE(t)
Definition: transform.h:810
@ TRANS_CANCEL
Definition: transform.h:193
#define FOREACH_TRANS_DATA_CONTAINER(t, th)
Definition: transform.h:813
@ HLP_NONE
Definition: transform.h:205
@ TD_BEZTRIPLE
@ TD_NOTCONNECTED
@ TD_NO_EXT
@ TD_SELECTED
@ TD_NOCENTER
Object * transform_object_deform_pose_armature_get(const TransInfo *t, Object *ob)
void calculateCenter(TransInfo *t)
void postTrans(bContext *C, TransInfo *t)
bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3])
void transform_data_ext_rotate(TransData *td, float mat[3][3], bool use_drot)
void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event)
void calculateCenterCursor2D(TransInfo *t, float r_center[2])
static void transdata_restore_basic(TransDataBasic *td_basic)
void resetTransRestrictions(TransInfo *t)
void calculateCenter2D(TransInfo *t)
void calculateCenterCursorGraph2D(TransInfo *t, float r_center[2])
static void freeTransCustomDataContainer(TransInfo *t, TransDataContainer *tc, TransCustomDataContainer *tcdc)
void calculateCenterMedian(TransInfo *t, float r_center[3])
static void restoreElement(TransData *td)
static void freeTransCustomData(TransInfo *t, TransDataContainer *tc, TransCustomData *custom_data)
static void calculateCenter_FromAround(TransInfo *t, int around, float r_center[3])
void calculateCenterCursor(TransInfo *t, float r_center[3])
void resetTransModal(TransInfo *t)
void restoreTransObjects(TransInfo *t)
static bool transdata_center_global_get(const TransDataContainer *tc, const TransDataBasic *td_basic, float r_vec[3])
void calculatePropRatio(TransInfo *t)
void applyTransObjects(TransInfo *t)
void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis, short options)
void calculateCenterLocal(TransInfo *t, const float center_global[3])
void freeTransCustomDataForMode(TransInfo *t)
void calculateCenterBound(TransInfo *t, float r_center[3])
float max
transform modes used by different operators.
void transform_orientations_current_set(TransInfo *t, const short orient_index)
short transform_orientation_matrix_get(bContext *C, TransInfo *t, short orient_index, const float custom[3][3], float r_spacemtx[3][3])
void freeSnapping(TransInfo *t)
void WM_cursor_modal_restore(wmWindow *win)
Definition: wm_cursors.c:216
#define ISMOUSE(event_type)
bool WM_paint_cursor_end(wmPaintCursor *handle)