Blender  V3.3
view3d_buttons.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2009 Blender Foundation. All rights reserved. */
3 
8 #include <float.h>
9 #include <math.h>
10 #include <stdio.h>
11 #include <string.h>
12 
13 #include "DNA_armature_types.h"
14 #include "DNA_curve_types.h"
15 #include "DNA_lattice_types.h"
16 #include "DNA_mesh_types.h"
17 #include "DNA_meshdata_types.h"
18 #include "DNA_meta_types.h"
19 #include "DNA_object_types.h"
20 #include "DNA_scene_types.h"
21 
22 #include "MEM_guardedalloc.h"
23 
24 #include "BLT_translation.h"
25 
26 #include "BLI_array_utils.h"
27 #include "BLI_bitmap.h"
28 #include "BLI_blenlib.h"
29 #include "BLI_math.h"
30 #include "BLI_utildefines.h"
31 
32 #include "BKE_action.h"
33 #include "BKE_armature.h"
34 #include "BKE_context.h"
35 #include "BKE_curve.h"
36 #include "BKE_customdata.h"
37 #include "BKE_deform.h"
38 #include "BKE_editmesh.h"
39 #include "BKE_object.h"
40 #include "BKE_object_deform.h"
41 #include "BKE_report.h"
42 #include "BKE_screen.h"
43 
44 #include "DEG_depsgraph.h"
45 
46 #include "WM_api.h"
47 #include "WM_types.h"
48 
49 #include "RNA_access.h"
50 #include "RNA_prototypes.h"
51 
52 #include "ED_mesh.h"
53 #include "ED_object.h"
54 #include "ED_screen.h"
55 
56 #include "UI_interface.h"
57 #include "UI_resources.h"
58 
59 #include "view3d_intern.h" /* own include */
60 
61 /* ******************* view3d space & buttons ************** */
62 enum {
63  B_REDR = 2,
66 };
67 
68 /* All must start w/ location */
69 
70 typedef struct {
71  float location[3];
73 
74 typedef struct {
75  float location[3], bv_weight, v_crease, be_weight, skin[2], e_crease;
77 
78 typedef struct {
79  float location[3], weight, b_weight, radius, tilt;
81 
82 typedef struct {
83  float location[3], weight;
85 
86 typedef union {
92 
93 /* temporary struct for storing transform properties */
94 
95 typedef struct {
96  float ob_obmat_orig[4][4];
97  float ob_dims_orig[3];
98  float ob_scale_orig[3];
99  float ob_dims[3];
100  /* Floats only (treated as an array). */
104 
105 #define TRANSFORM_MEDIAN_ARRAY_LEN (sizeof(TransformMedian) / sizeof(float))
106 
108 
109 /* -------------------------------------------------------------------- */
114  const struct uiBlockInteraction_Params *params,
115  void *arg1)
116 {
117  const int retval_test = B_TRANSFORM_PANEL_MEDIAN;
119  params->unique_retval_ids, params->unique_retval_ids_len, &retval_test) == -1) {
120  return NULL;
121  }
122 
123  BMEditMesh *em = arg1;
124 
125  int verts_mask_count = 0;
126  BMIter iter;
127  BMVert *eve;
128  int i;
129 
130  BLI_bitmap *verts_mask = BLI_BITMAP_NEW(em->bm->totvert, __func__);
131  BM_ITER_MESH_INDEX (eve, &iter, em->bm, BM_VERTS_OF_MESH, i) {
132  if (!BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
133  continue;
134  }
135  BLI_BITMAP_ENABLE(verts_mask, i);
136  verts_mask_count += 1;
137  }
138 
140  em->bm,
142  .do_tessellate = true,
143  .do_normals = true,
144  },
145  verts_mask,
146  verts_mask_count);
147 
148  MEM_freeN(verts_mask);
149 
150  return bmpinfo;
151 }
152 
154  const struct uiBlockInteraction_Params *UNUSED(params),
155  void *UNUSED(arg1),
156  void *user_data)
157 {
158  BMPartialUpdate *bmpinfo = user_data;
159  if (bmpinfo == NULL) {
160  return;
161  }
162  BM_mesh_partial_destroy(bmpinfo);
163 }
164 
166  struct bContext *C,
167  const struct uiBlockInteraction_Params *UNUSED(params),
168  void *arg1,
169  void *user_data)
170 {
171  BMPartialUpdate *bmpinfo = user_data;
172  if (bmpinfo == NULL) {
173  return;
174  }
175 
176  View3D *v3d = CTX_wm_view3d(C);
178  if (tfp->tag_for_update == false) {
179  return;
180  }
181  tfp->tag_for_update = false;
182 
183  BMEditMesh *em = arg1;
184 
186 }
187 
190 /* Helper function to compute a median changed value,
191  * when the value should be clamped in [0.0, 1.0].
192  * Returns either 0.0, 1.0 (both can be applied directly), a positive scale factor
193  * for scale down, or a negative one for scale up.
194  */
195 static float compute_scale_factor(const float ve_median, const float median)
196 {
197  if (ve_median <= 0.0f) {
198  return 0.0f;
199  }
200  if (ve_median >= 1.0f) {
201  return 1.0f;
202  }
203 
204  /* Scale value to target median. */
205  float median_new = ve_median;
206  float median_orig = ve_median - median; /* Previous median value. */
207 
208  /* In case of floating point error. */
209  CLAMP(median_orig, 0.0f, 1.0f);
210  CLAMP(median_new, 0.0f, 1.0f);
211 
212  if (median_new <= median_orig) {
213  /* Scale down. */
214  return median_new / median_orig;
215  }
216 
217  /* Scale up, negative to indicate it... */
218  return -(1.0f - median_new) / (1.0f - median_orig);
219 }
220 
227 static void apply_raw_diff(float *val, const int tot, const float ve_median, const float median)
228 {
229  *val = (tot == 1) ? ve_median : (*val + median);
230 }
231 
232 static void apply_raw_diff_v3(float val[3],
233  const int tot,
234  const float ve_median[3],
235  const float median[3])
236 {
237  if (tot == 1) {
238  copy_v3_v3(val, ve_median);
239  }
240  else {
241  add_v3_v3(val, median);
242  }
243 }
244 
245 static void apply_scale_factor(
246  float *val, const int tot, const float ve_median, const float median, const float sca)
247 {
248  if (tot == 1 || ve_median == median) {
249  *val = ve_median;
250  }
251  else {
252  *val *= sca;
253  }
254 }
255 
256 static void apply_scale_factor_clamp(float *val,
257  const int tot,
258  const float ve_median,
259  const float sca)
260 {
261  if (tot == 1) {
262  *val = ve_median;
263  CLAMP(*val, 0.0f, 1.0f);
264  }
265  else if (ELEM(sca, 0.0f, 1.0f)) {
266  *val = sca;
267  }
268  else {
269  *val = (sca > 0.0f) ? (*val * sca) : (1.0f + ((1.0f - *val) * sca));
270  CLAMP(*val, 0.0f, 1.0f);
271  }
272 }
273 
275 {
276  if (v3d->runtime.properties_storage == NULL) {
278  "TransformProperties");
279  }
280  return v3d->runtime.properties_storage;
281 }
282 
283 /* is used for both read and write... */
284 static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim)
285 {
286  uiBlock *block = (layout) ? uiLayoutAbsoluteBlock(layout) : NULL;
288  TransformMedian median_basis, ve_median_basis;
289  int tot, totedgedata, totcurvedata, totlattdata, totcurvebweight;
290  bool has_meshdata = false;
291  bool has_skinradius = false;
292  PointerRNA data_ptr;
293 
294  copy_vn_fl((float *)&median_basis, TRANSFORM_MEDIAN_ARRAY_LEN, 0.0f);
295  tot = totedgedata = totcurvedata = totlattdata = totcurvebweight = 0;
296 
297  if (ob->type == OB_MESH) {
298  TransformMedian_Mesh *median = &median_basis.mesh;
299  Mesh *me = ob->data;
300  BMEditMesh *em = me->edit_mesh;
301  BMesh *bm = em->bm;
302  BMVert *eve;
303  BMEdge *eed;
304  BMIter iter;
305 
306  const int cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT);
307  const int cd_vert_crease_offset = CustomData_get_offset(&bm->vdata, CD_CREASE);
308  const int cd_vert_skin_offset = CustomData_get_offset(&bm->vdata, CD_MVERT_SKIN);
309  const int cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT);
310  const int cd_edge_crease_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
311 
312  has_skinradius = (cd_vert_skin_offset != -1);
313 
314  if (bm->totvertsel) {
315  BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
316  if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
317  tot++;
318  add_v3_v3(median->location, eve->co);
319 
320  if (cd_vert_bweight_offset != -1) {
321  median->bv_weight += BM_ELEM_CD_GET_FLOAT(eve, cd_vert_bweight_offset);
322  }
323 
324  if (cd_vert_crease_offset != -1) {
325  median->v_crease += BM_ELEM_CD_GET_FLOAT(eve, cd_vert_crease_offset);
326  }
327 
328  if (has_skinradius) {
329  MVertSkin *vs = BM_ELEM_CD_GET_VOID_P(eve, cd_vert_skin_offset);
330  add_v2_v2(median->skin, vs->radius); /* Third val not used currently. */
331  }
332  }
333  }
334  }
335 
336  if ((cd_edge_bweight_offset != -1) || (cd_edge_crease_offset != -1)) {
337  if (bm->totedgesel) {
338  BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
339  if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
340  if (cd_edge_bweight_offset != -1) {
341  median->be_weight += BM_ELEM_CD_GET_FLOAT(eed, cd_edge_bweight_offset);
342  }
343 
344  if (cd_edge_crease_offset != -1) {
345  median->e_crease += BM_ELEM_CD_GET_FLOAT(eed, cd_edge_crease_offset);
346  }
347 
348  totedgedata++;
349  }
350  }
351  }
352  }
353  else {
354  totedgedata = bm->totedgesel;
355  }
356 
357  has_meshdata = (tot || totedgedata);
358  }
359  else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
360  TransformMedian_Curve *median = &median_basis.curve;
361  Curve *cu = ob->data;
362  BPoint *bp;
363  BezTriple *bezt;
364  int a;
365  ListBase *nurbs = BKE_curve_editNurbs_get(cu);
366  StructRNA *seltype = NULL;
367  void *selp = NULL;
368 
369  LISTBASE_FOREACH (Nurb *, nu, nurbs) {
370  if (nu->type == CU_BEZIER) {
371  bezt = nu->bezt;
372  a = nu->pntsu;
373  while (a--) {
374  if (bezt->f2 & SELECT) {
375  add_v3_v3(median->location, bezt->vec[1]);
376  tot++;
377  median->weight += bezt->weight;
378  median->radius += bezt->radius;
379  median->tilt += bezt->tilt;
380  if (!totcurvedata) { /* I.e. first time... */
381  selp = bezt;
382  seltype = &RNA_BezierSplinePoint;
383  }
384  totcurvedata++;
385  }
386  else {
387  if (bezt->f1 & SELECT) {
388  add_v3_v3(median->location, bezt->vec[0]);
389  tot++;
390  }
391  if (bezt->f3 & SELECT) {
392  add_v3_v3(median->location, bezt->vec[2]);
393  tot++;
394  }
395  }
396  bezt++;
397  }
398  }
399  else {
400  bp = nu->bp;
401  a = nu->pntsu * nu->pntsv;
402  while (a--) {
403  if (bp->f1 & SELECT) {
404  add_v3_v3(median->location, bp->vec);
405  median->b_weight += bp->vec[3];
406  totcurvebweight++;
407  tot++;
408  median->weight += bp->weight;
409  median->radius += bp->radius;
410  median->tilt += bp->tilt;
411  if (!totcurvedata) { /* I.e. first time... */
412  selp = bp;
413  seltype = &RNA_SplinePoint;
414  }
415  totcurvedata++;
416  }
417  bp++;
418  }
419  }
420  }
421 
422  if (totcurvedata == 1) {
423  RNA_pointer_create(&cu->id, seltype, selp, &data_ptr);
424  }
425  }
426  else if (ob->type == OB_LATTICE) {
427  Lattice *lt = ob->data;
428  TransformMedian_Lattice *median = &median_basis.lattice;
429  BPoint *bp;
430  int a;
431  StructRNA *seltype = NULL;
432  void *selp = NULL;
433 
434  a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
435  bp = lt->editlatt->latt->def;
436  while (a--) {
437  if (bp->f1 & SELECT) {
438  add_v3_v3(median->location, bp->vec);
439  tot++;
440  median->weight += bp->weight;
441  if (!totlattdata) { /* I.e. first time... */
442  selp = bp;
443  seltype = &RNA_LatticePoint;
444  }
445  totlattdata++;
446  }
447  bp++;
448  }
449 
450  if (totlattdata == 1) {
451  RNA_pointer_create(&lt->id, seltype, selp, &data_ptr);
452  }
453  }
454 
455  if (tot == 0) {
456  uiDefBut(block,
458  0,
459  IFACE_("Nothing selected"),
460  0,
461  130,
462  200,
463  20,
464  NULL,
465  0,
466  0,
467  0,
468  0,
469  "");
470  return;
471  }
472 
473  /* Location, X/Y/Z */
474  mul_v3_fl(median_basis.generic.location, 1.0f / (float)tot);
475  if (v3d->flag & V3D_GLOBAL_STATS) {
476  mul_m4_v3(ob->obmat, median_basis.generic.location);
477  }
478 
479  if (has_meshdata) {
480  TransformMedian_Mesh *median = &median_basis.mesh;
481  if (totedgedata) {
482  median->e_crease /= (float)totedgedata;
483  median->be_weight /= (float)totedgedata;
484  }
485  if (tot) {
486  median->bv_weight /= (float)tot;
487  median->v_crease /= (float)tot;
488  if (has_skinradius) {
489  median->skin[0] /= (float)tot;
490  median->skin[1] /= (float)tot;
491  }
492  }
493  }
494  else if (totcurvedata) {
495  TransformMedian_Curve *median = &median_basis.curve;
496  if (totcurvebweight) {
497  median->b_weight /= (float)totcurvebweight;
498  }
499  median->weight /= (float)totcurvedata;
500  median->radius /= (float)totcurvedata;
501  median->tilt /= (float)totcurvedata;
502  }
503  else if (totlattdata) {
504  TransformMedian_Lattice *median = &median_basis.lattice;
505  median->weight /= (float)totlattdata;
506  }
507 
508  if (block) { /* buttons */
509  uiBut *but;
510  int yi = 200;
511  const float tilt_limit = DEG2RADF(21600.0f);
512  const int butw = 200;
513  const int buth = 20 * UI_DPI_FAC;
514  const int but_margin = 2;
515  const char *c;
516 
517  memcpy(&tfp->ve_median, &median_basis, sizeof(tfp->ve_median));
518 
519  UI_block_align_begin(block);
520  if (tot == 1) {
521  if (totcurvedata) {
522  /* Curve */
523  c = IFACE_("Control Point:");
524  }
525  else {
526  /* Mesh or lattice */
527  c = IFACE_("Vertex:");
528  }
529  }
530  else {
531  c = IFACE_("Median:");
532  }
533  uiDefBut(block, UI_BTYPE_LABEL, 0, c, 0, yi -= buth, butw, buth, NULL, 0, 0, 0, 0, "");
534 
535  UI_block_align_begin(block);
536 
537  /* Should be no need to translate these. */
538  but = uiDefButF(block,
539  UI_BTYPE_NUM,
541  IFACE_("X:"),
542  0,
543  yi -= buth,
544  butw,
545  buth,
546  &tfp->ve_median.generic.location[0],
547  -lim,
548  lim,
549  0,
550  0,
551  "");
555  but = uiDefButF(block,
556  UI_BTYPE_NUM,
558  IFACE_("Y:"),
559  0,
560  yi -= buth,
561  butw,
562  buth,
563  &tfp->ve_median.generic.location[1],
564  -lim,
565  lim,
566  0,
567  0,
568  "");
572  but = uiDefButF(block,
573  UI_BTYPE_NUM,
575  IFACE_("Z:"),
576  0,
577  yi -= buth,
578  butw,
579  buth,
580  &tfp->ve_median.generic.location[2],
581  -lim,
582  lim,
583  0,
584  0,
585  "");
589 
590  if (totcurvebweight == tot) {
591  but = uiDefButF(block,
592  UI_BTYPE_NUM,
594  IFACE_("W:"),
595  0,
596  yi -= buth,
597  butw,
598  buth,
599  &(tfp->ve_median.curve.b_weight),
600  0.01,
601  100.0,
602  0,
603  0,
604  "");
607  }
608 
609  UI_block_align_begin(block);
610  uiDefButBitS(block,
613  B_REDR,
614  IFACE_("Global"),
615  0,
616  yi -= buth + but_margin,
617  100,
618  buth,
619  &v3d->flag,
620  0,
621  0,
622  0,
623  0,
624  TIP_("Displays global values"));
625  uiDefButBitS(block,
628  B_REDR,
629  IFACE_("Local"),
630  100,
631  yi,
632  100,
633  buth,
634  &v3d->flag,
635  0,
636  0,
637  0,
638  0,
639  TIP_("Displays local values"));
640  UI_block_align_end(block);
641 
642  /* Meshes... */
643  if (has_meshdata) {
644  TransformMedian_Mesh *ve_median = &tfp->ve_median.mesh;
645  if (tot) {
646  uiDefBut(block,
648  0,
649  tot == 1 ? IFACE_("Vertex Data:") : IFACE_("Vertices Data:"),
650  0,
651  yi -= buth + but_margin,
652  butw,
653  buth,
654  NULL,
655  0.0,
656  0.0,
657  0,
658  0,
659  "");
660  /* customdata layer added on demand */
661  but = uiDefButF(block,
662  UI_BTYPE_NUM,
664  tot == 1 ? IFACE_("Bevel Weight:") : IFACE_("Mean Bevel Weight:"),
665  0,
666  yi -= buth + but_margin,
667  butw,
668  buth,
669  &ve_median->bv_weight,
670  0.0,
671  1.0,
672  0,
673  0,
674  TIP_("Vertex weight used by Bevel modifier"));
677  /* customdata layer added on demand */
678  but = uiDefButF(block,
679  UI_BTYPE_NUM,
681  tot == 1 ? IFACE_("Vertex Crease:") : IFACE_("Mean Vertex Crease:"),
682  0,
683  yi -= buth + but_margin,
684  butw,
685  buth,
686  &ve_median->v_crease,
687  0.0,
688  1.0,
689  0,
690  0,
691  TIP_("Weight used by the Subdivision Surface modifier"));
694  }
695  if (has_skinradius) {
696  UI_block_align_begin(block);
697  but = uiDefButF(block,
698  UI_BTYPE_NUM,
700  tot == 1 ? IFACE_("Radius X:") : IFACE_("Mean Radius X:"),
701  0,
702  yi -= buth + but_margin,
703  butw,
704  buth,
705  &ve_median->skin[0],
706  0.0,
707  100.0,
708  0,
709  0,
710  TIP_("X radius used by Skin modifier"));
713  but = uiDefButF(block,
714  UI_BTYPE_NUM,
716  tot == 1 ? IFACE_("Radius Y:") : IFACE_("Mean Radius Y:"),
717  0,
718  yi -= buth + but_margin,
719  butw,
720  buth,
721  &ve_median->skin[1],
722  0.0,
723  100.0,
724  0,
725  0,
726  TIP_("Y radius used by Skin modifier"));
729  UI_block_align_end(block);
730  }
731  if (totedgedata) {
732  uiDefBut(block,
734  0,
735  totedgedata == 1 ? IFACE_("Edge Data:") : IFACE_("Edges Data:"),
736  0,
737  yi -= buth + but_margin,
738  butw,
739  buth,
740  NULL,
741  0.0,
742  0.0,
743  0,
744  0,
745  "");
746  /* customdata layer added on demand */
747  but = uiDefButF(block,
748  UI_BTYPE_NUM,
750  totedgedata == 1 ? IFACE_("Bevel Weight:") : IFACE_("Mean Bevel Weight:"),
751  0,
752  yi -= buth + but_margin,
753  butw,
754  buth,
755  &ve_median->be_weight,
756  0.0,
757  1.0,
758  0,
759  0,
760  TIP_("Edge weight used by Bevel modifier"));
763  /* customdata layer added on demand */
764  but = uiDefButF(block,
765  UI_BTYPE_NUM,
767  totedgedata == 1 ? IFACE_("Crease:") : IFACE_("Mean Crease:"),
768  0,
769  yi -= buth + but_margin,
770  butw,
771  buth,
772  &ve_median->e_crease,
773  0.0,
774  1.0,
775  0,
776  0,
777  TIP_("Weight used by the Subdivision Surface modifier"));
780  }
781  }
782  /* Curve... */
783  else if (totcurvedata) {
784  TransformMedian_Curve *ve_median = &tfp->ve_median.curve;
785  if (totcurvedata == 1) {
786  but = uiDefButR(block,
787  UI_BTYPE_NUM,
788  0,
789  IFACE_("Weight:"),
790  0,
791  yi -= buth + but_margin,
792  butw,
793  buth,
794  &data_ptr,
795  "weight_softbody",
796  0,
797  0.0,
798  1.0,
799  0,
800  0,
801  NULL);
804  but = uiDefButR(block,
805  UI_BTYPE_NUM,
806  0,
807  IFACE_("Radius:"),
808  0,
809  yi -= buth + but_margin,
810  butw,
811  buth,
812  &data_ptr,
813  "radius",
814  0,
815  0.0,
816  100.0,
817  0,
818  0,
819  NULL);
822  but = uiDefButR(block,
823  UI_BTYPE_NUM,
824  0,
825  IFACE_("Tilt:"),
826  0,
827  yi -= buth + but_margin,
828  butw,
829  buth,
830  &data_ptr,
831  "tilt",
832  0,
833  -tilt_limit,
834  tilt_limit,
835  0,
836  0,
837  NULL);
840  }
841  else if (totcurvedata > 1) {
842  but = uiDefButF(block,
843  UI_BTYPE_NUM,
845  IFACE_("Mean Weight:"),
846  0,
847  yi -= buth + but_margin,
848  butw,
849  buth,
850  &ve_median->weight,
851  0.0,
852  1.0,
853  0,
854  0,
855  TIP_("Weight used for Soft Body Goal"));
858  but = uiDefButF(block,
859  UI_BTYPE_NUM,
861  IFACE_("Mean Radius:"),
862  0,
863  yi -= buth + but_margin,
864  butw,
865  buth,
866  &ve_median->radius,
867  0.0,
868  100.0,
869  0,
870  0,
871  TIP_("Radius of curve control points"));
874  but = uiDefButF(block,
875  UI_BTYPE_NUM,
877  IFACE_("Mean Tilt:"),
878  0,
879  yi -= buth + but_margin,
880  butw,
881  buth,
882  &ve_median->tilt,
883  -tilt_limit,
884  tilt_limit,
885  0,
886  0,
887  TIP_("Tilt of curve control points"));
891  }
892  }
893  /* Lattice... */
894  else if (totlattdata) {
895  TransformMedian_Lattice *ve_median = &tfp->ve_median.lattice;
896  if (totlattdata == 1) {
897  uiDefButR(block,
898  UI_BTYPE_NUM,
899  0,
900  IFACE_("Weight:"),
901  0,
902  yi -= buth + but_margin,
903  butw,
904  buth,
905  &data_ptr,
906  "weight_softbody",
907  0,
908  0.0,
909  1.0,
910  0,
911  0,
912  NULL);
915  }
916  else if (totlattdata > 1) {
917  but = uiDefButF(block,
918  UI_BTYPE_NUM,
920  IFACE_("Mean Weight:"),
921  0,
922  yi -= buth + but_margin,
923  butw,
924  buth,
925  &ve_median->weight,
926  0.0,
927  1.0,
928  0,
929  0,
930  TIP_("Weight used for Soft Body Goal"));
933  }
934  }
935 
936  UI_block_align_end(block);
937 
938  if (ob->type == OB_MESH) {
939  Mesh *me = ob->data;
940  BMEditMesh *em = me->edit_mesh;
941  if (em != NULL) {
947  .arg1 = em,
948  });
949  }
950  }
951  }
952  else { /* apply */
953  memcpy(&ve_median_basis, &tfp->ve_median, sizeof(tfp->ve_median));
954 
955  if (v3d->flag & V3D_GLOBAL_STATS) {
956  invert_m4_m4(ob->imat, ob->obmat);
957  mul_m4_v3(ob->imat, median_basis.generic.location);
958  mul_m4_v3(ob->imat, ve_median_basis.generic.location);
959  }
960  sub_vn_vnvn((float *)&median_basis,
961  (float *)&ve_median_basis,
962  (float *)&median_basis,
964 
965  /* Note with a single element selected, we always do. */
966  const bool apply_vcos = (tot == 1) || (len_squared_v3(median_basis.generic.location) != 0.0f);
967 
968  if ((ob->type == OB_MESH) &&
969  (apply_vcos || median_basis.mesh.bv_weight || median_basis.mesh.v_crease ||
970  median_basis.mesh.skin[0] || median_basis.mesh.skin[1] || median_basis.mesh.be_weight ||
971  median_basis.mesh.e_crease)) {
972  const TransformMedian_Mesh *median = &median_basis.mesh, *ve_median = &ve_median_basis.mesh;
973  Mesh *me = ob->data;
974  BMEditMesh *em = me->edit_mesh;
975  BMesh *bm = em->bm;
976  BMIter iter;
977  BMVert *eve;
978  BMEdge *eed;
979 
980  int cd_vert_bweight_offset = -1;
981  int cd_vert_crease_offset = -1;
982  int cd_vert_skin_offset = -1;
983  int cd_edge_bweight_offset = -1;
984  int cd_edge_crease_offset = -1;
985 
986  float scale_bv_weight = 1.0f;
987  float scale_v_crease = 1.0f;
988  float scale_skin[2] = {1.0f, 1.0f};
989  float scale_be_weight = 1.0f;
990  float scale_e_crease = 1.0f;
991 
992  /* Vertices */
993 
994  if (apply_vcos || median->bv_weight || median->v_crease || median->skin[0] ||
995  median->skin[1]) {
996  if (median->bv_weight) {
998  cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT);
999  BLI_assert(cd_vert_bweight_offset != -1);
1000 
1001  scale_bv_weight = compute_scale_factor(ve_median->bv_weight, median->bv_weight);
1002  }
1003 
1004  if (median->v_crease) {
1006  cd_vert_crease_offset = CustomData_get_offset(&bm->vdata, CD_CREASE);
1007  BLI_assert(cd_vert_crease_offset != -1);
1008 
1009  scale_v_crease = compute_scale_factor(ve_median->v_crease, median->v_crease);
1010  }
1011 
1012  for (int i = 0; i < 2; i++) {
1013  if (median->skin[i]) {
1014  cd_vert_skin_offset = CustomData_get_offset(&bm->vdata, CD_MVERT_SKIN);
1015  BLI_assert(cd_vert_skin_offset != -1);
1016 
1017  if (ve_median->skin[i] != median->skin[i]) {
1018  scale_skin[i] = ve_median->skin[i] / (ve_median->skin[i] - median->skin[i]);
1019  }
1020  }
1021  }
1022 
1023  BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
1024  if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
1025  if (apply_vcos) {
1026  apply_raw_diff_v3(eve->co, tot, ve_median->location, median->location);
1027  }
1028 
1029  if (cd_vert_bweight_offset != -1) {
1030  float *b_weight = BM_ELEM_CD_GET_VOID_P(eve, cd_vert_bweight_offset);
1031  apply_scale_factor_clamp(b_weight, tot, ve_median->bv_weight, scale_bv_weight);
1032  }
1033 
1034  if (cd_vert_crease_offset != -1) {
1035  float *crease = BM_ELEM_CD_GET_VOID_P(eve, cd_vert_crease_offset);
1036  apply_scale_factor_clamp(crease, tot, ve_median->v_crease, scale_v_crease);
1037  }
1038 
1039  if (cd_vert_skin_offset != -1) {
1040  MVertSkin *vs = BM_ELEM_CD_GET_VOID_P(eve, cd_vert_skin_offset);
1041 
1042  /* That one is not clamped to [0.0, 1.0]. */
1043  for (int i = 0; i < 2; i++) {
1044  if (median->skin[i] != 0.0f) {
1046  &vs->radius[i], tot, ve_median->skin[i], median->skin[i], scale_skin[i]);
1047  }
1048  }
1049  }
1050  }
1051  }
1052  }
1053 
1054  if (apply_vcos) {
1055  /* Tell the update callback to run. */
1056  tfp->tag_for_update = true;
1057  }
1058 
1059  /* Edges */
1060 
1061  if (median->be_weight || median->e_crease) {
1062  if (median->be_weight) {
1064  cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT);
1065  BLI_assert(cd_edge_bweight_offset != -1);
1066 
1067  scale_be_weight = compute_scale_factor(ve_median->be_weight, median->be_weight);
1068  }
1069 
1070  if (median->e_crease) {
1072  cd_edge_crease_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
1073  BLI_assert(cd_edge_crease_offset != -1);
1074 
1075  scale_e_crease = compute_scale_factor(ve_median->e_crease, median->e_crease);
1076  }
1077 
1078  BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
1079  if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
1080  if (median->be_weight != 0.0f) {
1081  float *b_weight = BM_ELEM_CD_GET_VOID_P(eed, cd_edge_bweight_offset);
1082  apply_scale_factor_clamp(b_weight, tot, ve_median->be_weight, scale_be_weight);
1083  }
1084 
1085  if (median->e_crease != 0.0f) {
1086  float *crease = BM_ELEM_CD_GET_VOID_P(eed, cd_edge_crease_offset);
1087  apply_scale_factor_clamp(crease, tot, ve_median->e_crease, scale_e_crease);
1088  }
1089  }
1090  }
1091  }
1092  }
1093  else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF) &&
1094  (apply_vcos || median_basis.curve.b_weight || median_basis.curve.weight ||
1095  median_basis.curve.radius || median_basis.curve.tilt)) {
1096  const TransformMedian_Curve *median = &median_basis.curve,
1097  *ve_median = &ve_median_basis.curve;
1098  Curve *cu = ob->data;
1099  BPoint *bp;
1100  BezTriple *bezt;
1101  int a;
1102  ListBase *nurbs = BKE_curve_editNurbs_get(cu);
1103  const float scale_w = compute_scale_factor(ve_median->weight, median->weight);
1104 
1105  LISTBASE_FOREACH (Nurb *, nu, nurbs) {
1106  if (nu->type == CU_BEZIER) {
1107  for (a = nu->pntsu, bezt = nu->bezt; a--; bezt++) {
1108  if (bezt->f2 & SELECT) {
1109  if (apply_vcos) {
1110  /* Here we always have to use the diff... :/
1111  * Cannot avoid some glitches when going e.g. from 3 to 0.0001 (see T37327),
1112  * unless we use doubles.
1113  */
1114  add_v3_v3(bezt->vec[0], median->location);
1115  add_v3_v3(bezt->vec[1], median->location);
1116  add_v3_v3(bezt->vec[2], median->location);
1117  }
1118  if (median->weight) {
1119  apply_scale_factor_clamp(&bezt->weight, tot, ve_median->weight, scale_w);
1120  }
1121  if (median->radius) {
1122  apply_raw_diff(&bezt->radius, tot, ve_median->radius, median->radius);
1123  }
1124  if (median->tilt) {
1125  apply_raw_diff(&bezt->tilt, tot, ve_median->tilt, median->tilt);
1126  }
1127  }
1128  else if (apply_vcos) {
1129  /* Handles can only have their coordinates changed here. */
1130  if (bezt->f1 & SELECT) {
1131  apply_raw_diff_v3(bezt->vec[0], tot, ve_median->location, median->location);
1132  }
1133  if (bezt->f3 & SELECT) {
1134  apply_raw_diff_v3(bezt->vec[2], tot, ve_median->location, median->location);
1135  }
1136  }
1137  }
1138  }
1139  else {
1140  for (a = nu->pntsu * nu->pntsv, bp = nu->bp; a--; bp++) {
1141  if (bp->f1 & SELECT) {
1142  if (apply_vcos) {
1143  apply_raw_diff_v3(bp->vec, tot, ve_median->location, median->location);
1144  }
1145  if (median->b_weight) {
1146  apply_raw_diff(&bp->vec[3], tot, ve_median->b_weight, median->b_weight);
1147  }
1148  if (median->weight) {
1149  apply_scale_factor_clamp(&bp->weight, tot, ve_median->weight, scale_w);
1150  }
1151  if (median->radius) {
1152  apply_raw_diff(&bp->radius, tot, ve_median->radius, median->radius);
1153  }
1154  if (median->tilt) {
1155  apply_raw_diff(&bp->tilt, tot, ve_median->tilt, median->tilt);
1156  }
1157  }
1158  }
1159  }
1160  if (CU_IS_2D(cu)) {
1161  BKE_nurb_project_2d(nu);
1162  }
1163  BKE_nurb_handles_test(nu, true, false); /* test for bezier too */
1164  }
1165  }
1166  else if ((ob->type == OB_LATTICE) && (apply_vcos || median_basis.lattice.weight)) {
1167  const TransformMedian_Lattice *median = &median_basis.lattice,
1168  *ve_median = &ve_median_basis.lattice;
1169  Lattice *lt = ob->data;
1170  BPoint *bp;
1171  int a;
1172  const float scale_w = compute_scale_factor(ve_median->weight, median->weight);
1173 
1174  a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
1175  bp = lt->editlatt->latt->def;
1176  while (a--) {
1177  if (bp->f1 & SELECT) {
1178  if (apply_vcos) {
1179  apply_raw_diff_v3(bp->vec, tot, ve_median->location, median->location);
1180  }
1181  if (median->weight) {
1182  apply_scale_factor_clamp(&bp->weight, tot, ve_median->weight, scale_w);
1183  }
1184  }
1185  bp++;
1186  }
1187  }
1188 
1189  /* ED_undo_push(C, "Transform properties"); */
1190  }
1191 }
1192 
1193 #undef TRANSFORM_MEDIAN_ARRAY_LEN
1194 
1195 static void v3d_object_dimension_buts(bContext *C, uiLayout *layout, View3D *v3d, Object *ob)
1196 {
1197  uiBlock *block = (layout) ? uiLayoutAbsoluteBlock(layout) : NULL;
1199 
1200  if (block) {
1201  BLI_assert(C == NULL);
1202  int yi = 200;
1203  const int butw = 200;
1204  const int buth = 20 * UI_DPI_FAC;
1205 
1207  copy_v3_v3(tfp->ob_dims_orig, tfp->ob_dims);
1208  copy_v3_v3(tfp->ob_scale_orig, ob->scale);
1209  copy_m4_m4(tfp->ob_obmat_orig, ob->obmat);
1210 
1211  uiDefBut(block,
1213  0,
1214  IFACE_("Dimensions:"),
1215  0,
1216  yi -= buth,
1217  butw,
1218  buth,
1219  NULL,
1220  0,
1221  0,
1222  0,
1223  0,
1224  "");
1225  UI_block_align_begin(block);
1226  const float lim = FLT_MAX;
1227  for (int i = 0; i < 3; i++) {
1228  uiBut *but;
1229  const char text[3] = {'X' + i, ':', '\0'};
1230  but = uiDefButF(block,
1231  UI_BTYPE_NUM,
1233  text,
1234  0,
1235  yi -= buth,
1236  butw,
1237  buth,
1238  &(tfp->ob_dims[i]),
1239  0.0f,
1240  lim,
1241  0,
1242  0,
1243  "");
1244  UI_but_number_step_size_set(but, 10);
1247  }
1248  UI_block_align_end(block);
1249  }
1250  else { /* apply */
1251  int axis_mask = 0;
1252  for (int i = 0; i < 3; i++) {
1253  if (tfp->ob_dims[i] == tfp->ob_dims_orig[i]) {
1254  axis_mask |= (1 << i);
1255  }
1256  }
1258  ob, tfp->ob_dims, axis_mask, tfp->ob_scale_orig, tfp->ob_obmat_orig);
1259 
1260  PointerRNA obptr;
1261  RNA_id_pointer_create(&ob->id, &obptr);
1262  PropertyRNA *prop = RNA_struct_find_property(&obptr, "scale");
1263  RNA_property_update(C, &obptr, prop);
1264  }
1265 }
1266 
1267 #define B_VGRP_PNL_EDIT_SINGLE 8 /* or greater */
1268 
1269 static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event)
1270 {
1271  if (event < B_VGRP_PNL_EDIT_SINGLE) {
1272  /* not for me */
1273  return;
1274  }
1275 
1276  ViewLayer *view_layer = CTX_data_view_layer(C);
1277  Object *ob = view_layer->basact->object;
1281 }
1282 
1284 {
1285  ViewLayer *view_layer = CTX_data_view_layer(C);
1286  Object *ob = OBACT(view_layer);
1288  MDeformVert *dvert_act = ED_mesh_active_dvert_get_only(ob);
1289  if (dvert_act) {
1290  return (dvert_act->totweight != 0);
1291  }
1292  }
1293 
1294  return false;
1295 }
1296 
1297 static void view3d_panel_vgroup(const bContext *C, Panel *panel)
1298 {
1299  uiBlock *block = uiLayoutAbsoluteBlock(panel->layout);
1301  ViewLayer *view_layer = CTX_data_view_layer(C);
1302  Object *ob = view_layer->basact->object;
1303 
1304  MDeformVert *dv;
1305 
1307 
1308  if (dv && dv->totweight) {
1310 
1311  wmOperatorType *ot;
1312  PointerRNA op_ptr, tools_ptr;
1313  PointerRNA *but_ptr;
1314 
1315  uiLayout *col, *bcol;
1316  uiLayout *row;
1317  uiBut *but;
1318  bDeformGroup *dg;
1319  uint i;
1320  int subset_count, vgroup_tot;
1321  const bool *vgroup_validmap;
1322  eVGroupSelect subset_type = ts->vgroupsubset;
1323  int yco = 0;
1324  int lock_count = 0;
1325 
1327 
1328  bcol = uiLayoutColumn(panel->layout, true);
1329  row = uiLayoutRow(bcol, true); /* The filter button row */
1330 
1331  RNA_pointer_create(NULL, &RNA_ToolSettings, ts, &tools_ptr);
1332  uiItemR(row, &tools_ptr, "vertex_group_subset", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
1333 
1334  col = uiLayoutColumn(bcol, true);
1335 
1337  ob, subset_type, &vgroup_tot, &subset_count);
1338  const ListBase *defbase = BKE_object_defgroup_list(ob);
1339 
1340  for (i = 0, dg = defbase->first; dg; i++, dg = dg->next) {
1341  bool locked = (dg->flag & DG_LOCK_WEIGHT) != 0;
1342  if (vgroup_validmap[i]) {
1344  if (dw) {
1345  int x, xco = 0;
1346  int icon;
1347  uiLayout *split = uiLayoutSplit(col, 0.45, true);
1348  row = uiLayoutRow(split, true);
1349 
1350  /* The Weight Group Name */
1351 
1352  ot = WM_operatortype_find("OBJECT_OT_vertex_weight_set_active", true);
1353  but = uiDefButO_ptr(block,
1354  UI_BTYPE_BUT,
1355  ot,
1357  dg->name,
1358  xco,
1359  yco,
1360  (x = UI_UNIT_X * 5),
1361  UI_UNIT_Y,
1362  "");
1363  but_ptr = UI_but_operator_ptr_get(but);
1364  RNA_int_set(but_ptr, "weight_group", i);
1366  if (BKE_object_defgroup_active_index_get(ob) != i + 1) {
1368  }
1369  xco += x;
1370 
1371  row = uiLayoutRow(split, true);
1372  uiLayoutSetEnabled(row, !locked);
1373 
1374  /* The weight group value */
1375  /* To be reworked still */
1376  but = uiDefButF(block,
1377  UI_BTYPE_NUM,
1379  "",
1380  xco,
1381  yco,
1382  (x = UI_UNIT_X * 4),
1383  UI_UNIT_Y,
1384  &dw->weight,
1385  0.0,
1386  1.0,
1387  0,
1388  0,
1389  "");
1393  if (locked) {
1394  lock_count++;
1395  }
1396  xco += x;
1397 
1398  /* The weight group paste function */
1399  icon = (locked) ? ICON_BLANK1 : ICON_PASTEDOWN;
1400  uiItemFullO(row,
1401  "OBJECT_OT_vertex_weight_paste",
1402  "",
1403  icon,
1404  NULL,
1406  0,
1407  &op_ptr);
1408  RNA_int_set(&op_ptr, "weight_group", i);
1409 
1410  /* The weight entry delete function */
1411  icon = (locked) ? ICON_LOCKED : ICON_X;
1412  uiItemFullO(row,
1413  "OBJECT_OT_vertex_weight_delete",
1414  "",
1415  icon,
1416  NULL,
1418  0,
1419  &op_ptr);
1420  RNA_int_set(&op_ptr, "weight_group", i);
1421 
1422  yco -= UI_UNIT_Y;
1423  }
1424  }
1425  }
1426  MEM_freeN((void *)vgroup_validmap);
1427 
1428  yco -= 2;
1429 
1430  col = uiLayoutColumn(panel->layout, true);
1431  row = uiLayoutRow(col, true);
1432 
1433  ot = WM_operatortype_find("OBJECT_OT_vertex_weight_normalize_active_vertex", 1);
1434  but = uiDefButO_ptr(
1435  block,
1436  UI_BTYPE_BUT,
1437  ot,
1439  "Normalize",
1440  0,
1441  yco,
1442  UI_UNIT_X * 5,
1443  UI_UNIT_Y,
1444  TIP_("Normalize weights of active vertex (if affected groups are unlocked)"));
1445  if (lock_count) {
1447  }
1448 
1449  ot = WM_operatortype_find("OBJECT_OT_vertex_weight_copy", 1);
1450  but = uiDefButO_ptr(
1451  block,
1452  UI_BTYPE_BUT,
1453  ot,
1455  "Copy",
1456  UI_UNIT_X * 5,
1457  yco,
1458  UI_UNIT_X * 5,
1459  UI_UNIT_Y,
1460  TIP_("Copy active vertex to other selected vertices (if affected groups are unlocked)"));
1461  if (lock_count) {
1463  }
1464  }
1465 }
1466 
1468 {
1469  uiLayout *split, *colsub;
1470 
1471  split = uiLayoutSplit(layout, 0.8f, false);
1472 
1473  if (ptr->type == &RNA_PoseBone) {
1474  PointerRNA boneptr;
1475  Bone *bone;
1476 
1477  boneptr = RNA_pointer_get(ptr, "bone");
1478  bone = boneptr.data;
1479  uiLayoutSetActive(split, !(bone->parent && bone->flag & BONE_CONNECTED));
1480  }
1481  colsub = uiLayoutColumn(split, true);
1482  uiItemR(colsub, ptr, "location", 0, NULL, ICON_NONE);
1483  colsub = uiLayoutColumn(split, true);
1485  uiItemL(colsub, "", ICON_NONE);
1486  uiItemR(colsub,
1487  ptr,
1488  "lock_location",
1490  "",
1491  ICON_DECORATE_UNLOCKED);
1492 
1493  split = uiLayoutSplit(layout, 0.8f, false);
1494 
1495  switch (RNA_enum_get(ptr, "rotation_mode")) {
1496  case ROT_MODE_QUAT: /* quaternion */
1497  colsub = uiLayoutColumn(split, true);
1498  uiItemR(colsub, ptr, "rotation_quaternion", 0, IFACE_("Rotation"), ICON_NONE);
1499  colsub = uiLayoutColumn(split, true);
1501  uiItemR(colsub, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, IFACE_("4L"), ICON_NONE);
1502  if (RNA_boolean_get(ptr, "lock_rotations_4d")) {
1503  uiItemR(colsub,
1504  ptr,
1505  "lock_rotation_w",
1507  "",
1508  ICON_DECORATE_UNLOCKED);
1509  }
1510  else {
1511  uiItemL(colsub, "", ICON_NONE);
1512  }
1513  uiItemR(colsub,
1514  ptr,
1515  "lock_rotation",
1517  "",
1518  ICON_DECORATE_UNLOCKED);
1519  break;
1520  case ROT_MODE_AXISANGLE: /* axis angle */
1521  colsub = uiLayoutColumn(split, true);
1522  uiItemR(colsub, ptr, "rotation_axis_angle", 0, IFACE_("Rotation"), ICON_NONE);
1523  colsub = uiLayoutColumn(split, true);
1525  uiItemR(colsub, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, IFACE_("4L"), ICON_NONE);
1526  if (RNA_boolean_get(ptr, "lock_rotations_4d")) {
1527  uiItemR(colsub,
1528  ptr,
1529  "lock_rotation_w",
1531  "",
1532  ICON_DECORATE_UNLOCKED);
1533  }
1534  else {
1535  uiItemL(colsub, "", ICON_NONE);
1536  }
1537  uiItemR(colsub,
1538  ptr,
1539  "lock_rotation",
1541  "",
1542  ICON_DECORATE_UNLOCKED);
1543  break;
1544  default: /* euler rotations */
1545  colsub = uiLayoutColumn(split, true);
1546  uiItemR(colsub, ptr, "rotation_euler", 0, IFACE_("Rotation"), ICON_NONE);
1547  colsub = uiLayoutColumn(split, true);
1549  uiItemL(colsub, "", ICON_NONE);
1550  uiItemR(colsub,
1551  ptr,
1552  "lock_rotation",
1554  "",
1555  ICON_DECORATE_UNLOCKED);
1556  break;
1557  }
1558  uiItemR(layout, ptr, "rotation_mode", 0, "", ICON_NONE);
1559 
1560  split = uiLayoutSplit(layout, 0.8f, false);
1561  colsub = uiLayoutColumn(split, true);
1562  uiItemR(colsub, ptr, "scale", 0, NULL, ICON_NONE);
1563  colsub = uiLayoutColumn(split, true);
1565  uiItemL(colsub, "", ICON_NONE);
1566  uiItemR(colsub,
1567  ptr,
1568  "lock_scale",
1570  "",
1571  ICON_DECORATE_UNLOCKED);
1572 }
1573 
1574 static void v3d_posearmature_buts(uiLayout *layout, Object *ob)
1575 {
1576  bPoseChannel *pchan;
1577  PointerRNA pchanptr;
1578  uiLayout *col;
1579 
1581 
1582  if (!pchan) {
1583  uiItemL(layout, IFACE_("No Bone Active"), ICON_NONE);
1584  return;
1585  }
1586 
1587  RNA_pointer_create(&ob->id, &RNA_PoseBone, pchan, &pchanptr);
1588 
1589  col = uiLayoutColumn(layout, false);
1590 
1591  /* XXX: RNA buts show data in native types (i.e. quats, 4-component axis/angle, etc.)
1592  * but old-school UI shows in eulers always. Do we want to be able to still display in Eulers?
1593  * Maybe needs RNA/UI options to display rotations as different types. */
1594  v3d_transform_butsR(col, &pchanptr);
1595 }
1596 
1597 static void v3d_editarmature_buts(uiLayout *layout, Object *ob)
1598 {
1599  bArmature *arm = ob->data;
1600  EditBone *ebone;
1601  uiLayout *col;
1602  PointerRNA eboneptr;
1603 
1604  ebone = arm->act_edbone;
1605 
1606  if (!ebone || (ebone->layer & arm->layer) == 0) {
1607  uiItemL(layout, IFACE_("Nothing selected"), ICON_NONE);
1608  return;
1609  }
1610 
1611  RNA_pointer_create(&arm->id, &RNA_EditBone, ebone, &eboneptr);
1612 
1613  col = uiLayoutColumn(layout, false);
1614  uiItemR(col, &eboneptr, "head", 0, NULL, ICON_NONE);
1615  if (ebone->parent && ebone->flag & BONE_CONNECTED) {
1616  PointerRNA parptr = RNA_pointer_get(&eboneptr, "parent");
1617  uiItemR(col, &parptr, "tail_radius", 0, IFACE_("Radius (Parent)"), ICON_NONE);
1618  }
1619  else {
1620  uiItemR(col, &eboneptr, "head_radius", 0, IFACE_("Radius"), ICON_NONE);
1621  }
1622 
1623  uiItemR(col, &eboneptr, "tail", 0, NULL, ICON_NONE);
1624  uiItemR(col, &eboneptr, "tail_radius", 0, IFACE_("Radius"), ICON_NONE);
1625 
1626  uiItemR(col, &eboneptr, "roll", 0, NULL, ICON_NONE);
1627  uiItemR(col, &eboneptr, "length", 0, NULL, ICON_NONE);
1628  uiItemR(col, &eboneptr, "envelope_distance", 0, IFACE_("Envelope"), ICON_NONE);
1629 }
1630 
1631 static void v3d_editmetaball_buts(uiLayout *layout, Object *ob)
1632 {
1633  PointerRNA mbptr, ptr;
1634  MetaBall *mball = ob->data;
1635  uiLayout *col;
1636 
1637  if (!mball || !(mball->lastelem)) {
1638  uiItemL(layout, IFACE_("Nothing selected"), ICON_NONE);
1639  return;
1640  }
1641 
1642  RNA_pointer_create(&mball->id, &RNA_MetaBall, mball, &mbptr);
1643 
1644  RNA_pointer_create(&mball->id, &RNA_MetaElement, mball->lastelem, &ptr);
1645 
1646  col = uiLayoutColumn(layout, false);
1647  uiItemR(col, &ptr, "co", 0, NULL, ICON_NONE);
1648 
1649  uiItemR(col, &ptr, "radius", 0, NULL, ICON_NONE);
1650  uiItemR(col, &ptr, "stiffness", 0, NULL, ICON_NONE);
1651 
1652  uiItemR(col, &ptr, "type", 0, NULL, ICON_NONE);
1653 
1654  col = uiLayoutColumn(layout, true);
1655  switch (RNA_enum_get(&ptr, "type")) {
1656  case MB_BALL:
1657  break;
1658  case MB_CUBE:
1659  uiItemL(col, IFACE_("Size:"), ICON_NONE);
1660  uiItemR(col, &ptr, "size_x", 0, "X", ICON_NONE);
1661  uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NONE);
1662  uiItemR(col, &ptr, "size_z", 0, "Z", ICON_NONE);
1663  break;
1664  case MB_TUBE:
1665  uiItemL(col, IFACE_("Size:"), ICON_NONE);
1666  uiItemR(col, &ptr, "size_x", 0, "X", ICON_NONE);
1667  break;
1668  case MB_PLANE:
1669  uiItemL(col, IFACE_("Size:"), ICON_NONE);
1670  uiItemR(col, &ptr, "size_x", 0, "X", ICON_NONE);
1671  uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NONE);
1672  break;
1673  case MB_ELIPSOID:
1674  uiItemL(col, IFACE_("Size:"), ICON_NONE);
1675  uiItemR(col, &ptr, "size_x", 0, "X", ICON_NONE);
1676  uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NONE);
1677  uiItemR(col, &ptr, "size_z", 0, "Z", ICON_NONE);
1678  break;
1679  }
1680 }
1681 
1682 static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event)
1683 {
1684  ViewLayer *view_layer = CTX_data_view_layer(C);
1685  View3D *v3d = CTX_wm_view3d(C);
1686  Object *ob = OBACT(view_layer);
1687 
1688  switch (event) {
1689 
1690  case B_REDR:
1692  return; /* no notifier! */
1693 
1695  if (ob) {
1696  v3d_editvertex_buts(NULL, v3d, ob, 1.0);
1698  }
1699  break;
1701  if (ob) {
1702  v3d_object_dimension_buts(C, NULL, v3d, ob);
1703  }
1704  break;
1705  }
1706 
1707  /* default for now */
1709 }
1710 
1712 {
1713  ViewLayer *view_layer = CTX_data_view_layer(C);
1714  return (view_layer->basact != NULL);
1715 }
1716 
1717 static void view3d_panel_transform(const bContext *C, Panel *panel)
1718 {
1719  uiBlock *block;
1720  ViewLayer *view_layer = CTX_data_view_layer(C);
1721  Object *ob = view_layer->basact->object;
1722  Object *obedit = OBEDIT_FROM_OBACT(ob);
1723  uiLayout *col;
1724 
1725  block = uiLayoutGetBlock(panel->layout);
1727 
1728  col = uiLayoutColumn(panel->layout, false);
1729 
1730  if (ob == obedit) {
1731  if (ob->type == OB_ARMATURE) {
1733  }
1734  else if (ob->type == OB_MBALL) {
1736  }
1737  else {
1738  View3D *v3d = CTX_wm_view3d(C);
1739  v3d_editvertex_buts(col, v3d, ob, FLT_MAX);
1740  }
1741  }
1742  else if (ob->mode & OB_MODE_POSE) {
1744  }
1745  else {
1746  PointerRNA obptr;
1747 
1748  RNA_id_pointer_create(&ob->id, &obptr);
1749  v3d_transform_butsR(col, &obptr);
1750 
1751  /* Dimensions and editmode are mostly the same check. */
1752  if (OB_TYPE_SUPPORT_EDITMODE(ob->type) ||
1754  View3D *v3d = CTX_wm_view3d(C);
1755  v3d_object_dimension_buts(NULL, col, v3d, ob);
1756  }
1757  }
1758 }
1759 
1760 static void hide_collections_menu_draw(const bContext *C, Menu *menu)
1761 {
1763 }
1764 
1766 {
1767  PanelType *pt;
1768 
1769  pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel object");
1770  strcpy(pt->idname, "VIEW3D_PT_transform");
1771  strcpy(pt->label, N_("Transform")); /* XXX C panels unavailable through RNA bpy.types! */
1772  strcpy(pt->category, "Item");
1776  BLI_addtail(&art->paneltypes, pt);
1777 
1778  pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel vgroup");
1779  strcpy(pt->idname, "VIEW3D_PT_vgroup");
1780  strcpy(pt->label, N_("Vertex Weights")); /* XXX C panels unavailable through RNA bpy.types! */
1781  strcpy(pt->category, "Item");
1783  pt->draw = view3d_panel_vgroup;
1785  BLI_addtail(&art->paneltypes, pt);
1786 
1787  MenuType *mt;
1788 
1789  mt = MEM_callocN(sizeof(MenuType), "spacetype view3d menu collections");
1790  strcpy(mt->idname, "VIEW3D_MT_collection");
1791  strcpy(mt->label, N_("Collection"));
1794  WM_menutype_add(mt);
1795 }
1796 
1798 {
1800  if (ob == NULL) {
1801  BKE_report(op->reports, RPT_WARNING, "No active object found");
1802  return OPERATOR_CANCELLED;
1803  }
1804  if (((ob->mode & OB_MODE_EDIT) == 0) && (ELEM(ob->type, OB_ARMATURE))) {
1806  return OPERATOR_CANCELLED;
1807  }
1808 
1809  UI_pie_menu_invoke(C, "VIEW3D_MT_object_mode_pie", CTX_wm_window(C)->eventstate);
1810  return OPERATOR_CANCELLED;
1811 }
1812 
1814 {
1815  ot->name = "Object Mode Menu";
1816  ot->idname = "VIEW3D_OT_object_mode_pie_or_toggle";
1817 
1820 
1821  /* flags */
1822  ot->flag = 0;
1823 }
typedef float(TangentPoint)[2]
Blender kernel action and pose functionality.
struct bPoseChannel * BKE_pose_channel_active_if_layer_visible(struct Object *ob)
Definition: action.c:720
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:738
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct ViewLayer * CTX_data_view_layer(const bContext *C)
Definition: context.c:1100
struct Object * CTX_data_active_object(const bContext *C)
Definition: context.c:1353
struct View3D * CTX_wm_view3d(const bContext *C)
Definition: context.c:784
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
struct ListBase * BKE_curve_editNurbs_get(struct Curve *cu)
Definition: curve.cc:426
#define CU_IS_2D(cu)
Definition: BKE_curve.h:67
void BKE_nurb_project_2d(struct Nurb *nu)
Definition: curve.cc:736
void BKE_nurb_handles_test(struct Nurb *nu, bool use_handles, bool use_around_local)
Definition: curve.cc:4105
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_offset(const struct CustomData *data, int type)
support for deformation groups and hooks.
int BKE_object_defgroup_active_index_get(const struct Object *ob)
struct MDeformWeight * BKE_defvert_find_index(const struct MDeformVert *dv, int defgroup)
const struct ListBase * BKE_object_defgroup_list(const struct Object *ob)
void BKE_editmesh_looptri_and_normals_calc_with_partial(BMEditMesh *em, struct BMPartialUpdate *bmpinfo)
Definition: editmesh.c:166
General operations, lookup, etc. for blender objects.
void BKE_object_dimensions_get(struct Object *ob, float r_vec[3])
Definition: object.cc:3786
bool BKE_object_is_in_wpaint_select_vert(const struct Object *ob)
bool BKE_object_is_in_editmode_vgroup(const struct Object *ob)
void BKE_object_dimensions_set_ex(struct Object *ob, const float value[3], int axis_mask, const float ob_scale_orig[3], const float ob_obmat_orig[4][4])
Definition: object.cc:3802
Functions for dealing with objects and deform verts, used by painting and tools.
bool * BKE_object_defgroup_subset_from_select_type(struct Object *ob, enum eVGroupSelect subset_type, int *r_defgroup_tot, int *r_subset_count)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition: report.c:83
Generic array manipulation API.
#define BLI_array_findindex(arr, arr_len, p)
#define BLI_assert(a)
Definition: BLI_assert.h:46
#define BLI_BITMAP_NEW(_num, _alloc_string)
Definition: BLI_bitmap.h:40
#define BLI_BITMAP_ENABLE(_bitmap, _index)
Definition: BLI_bitmap.h:81
unsigned int BLI_bitmap
Definition: BLI_bitmap.h:16
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
bool invert_m4_m4(float R[4][4], const float A[4][4])
Definition: math_matrix.c:1287
void mul_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:729
void copy_m4_m4(float m1[4][4], const float m2[4][4])
Definition: math_matrix.c:77
#define DEG2RADF(_deg)
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v3_fl(float r[3], float f)
void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, int size)
Definition: math_vector.c:1171
MINLINE void copy_v3_v3(float r[3], const float a[3])
void copy_vn_fl(float *array_tar, int size, float val)
Definition: math_vector.c:1259
MINLINE void add_v2_v2(float r[2], const float a[2])
MINLINE void add_v3_v3(float r[3], const float a[3])
unsigned int uint
Definition: BLI_sys_types.h:67
#define UNUSED(x)
#define ELEM(...)
#define TIP_(msgid)
#define IFACE_(msgid)
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:791
@ ROT_MODE_QUAT
@ ROT_MODE_AXISANGLE
@ BONE_CONNECTED
@ CU_BEZIER
@ CD_MVERT_SKIN
@ CD_BWEIGHT
@ ME_CDFLAG_VERT_CREASE
@ ME_CDFLAG_EDGE_CREASE
@ ME_CDFLAG_VERT_BWEIGHT
@ ME_CDFLAG_EDGE_BWEIGHT
#define MB_BALL
#define MB_TUBE
#define MB_ELIPSOID
#define MB_PLANE
#define MB_CUBE
@ OB_MODE_EDIT
@ OB_MODE_POSE
@ OB_MODE_OBJECT
Object is a sort of wrapper for general info.
@ OB_LATTICE
@ OB_MBALL
@ OB_SURF
@ OB_ARMATURE
@ OB_MESH
@ OB_POINTCLOUD
@ OB_VOLUME
@ OB_CURVES_LEGACY
@ OB_CURVES
#define DG_LOCK_WEIGHT
#define OB_TYPE_SUPPORT_EDITMODE(_type)
#define OBEDIT_FROM_OBACT(ob)
#define OBACT(_view_layer)
eVGroupSelect
#define V3D_GLOBAL_STATS
@ OPERATOR_CANCELLED
struct MDeformVert * ED_mesh_active_dvert_get_only(struct Object *ob)
Definition: meshtools.cc:1472
void ED_vgroup_vert_active_mirror(struct Object *ob, int def_nr)
bool ED_object_mode_set(struct bContext *C, eObjectMode mode)
Definition: object_modes.c:231
void ED_collection_hide_menu_draw(const struct bContext *C, struct uiLayout *layout)
void ED_area_tag_redraw(ScrArea *area)
Definition: area.c:729
bool ED_operator_view3d_active(struct bContext *C)
Definition: screen_ops.c:225
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
@ PROP_UNIT_ROTATION
Definition: RNA_types.h:75
@ PROP_UNIT_LENGTH
Definition: RNA_types.h:71
#define RNA_TRANSLATION_PREC_DEFAULT
Definition: RNA_types.h:117
#define C
Definition: RandGen.cpp:25
@ UI_BUT_TEXT_RIGHT
Definition: UI_interface.h:261
@ UI_BUT_TEXT_LEFT
Definition: UI_interface.h:259
#define UI_UNIT_Y
void uiLayoutSetActive(uiLayout *layout, bool active)
uiBlock * uiLayoutGetBlock(uiLayout *layout)
@ UI_BUT_DISABLED
Definition: UI_interface.h:196
@ UI_BUT_INACTIVE
Definition: UI_interface.h:203
@ UI_EMBOSS_NONE_OR_STATUS
Definition: UI_interface.h:116
void uiLayoutSetEnabled(uiLayout *layout, bool enabled)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void UI_block_interaction_set(uiBlock *block, uiBlockInteraction_CallbackData *callbacks)
uiBut * uiDefBut(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
Definition: interface.cc:4806
uiBut * uiDefButF(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip)
Definition: interface.cc:5042
struct PointerRNA * UI_but_operator_ptr_get(uiBut *but)
Definition: interface.cc:5908
void uiItemL(uiLayout *layout, const char *name, int icon)
void UI_but_drawflag_enable(uiBut *but, int flag)
Definition: interface.cc:5873
uiBlock * uiLayoutAbsoluteBlock(uiLayout *layout)
void UI_but_number_step_size_set(uiBut *but, float step_size)
Definition: interface.cc:6455
void UI_block_func_handle_set(uiBlock *block, uiBlockHandleFunc func, void *arg)
Definition: interface.cc:5953
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
@ UI_ITEM_R_TOGGLE
@ UI_ITEM_R_EXPAND
@ UI_ITEM_R_ICON_ONLY
uiBut * uiDefButR(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip)
Definition: interface.cc:5258
#define UI_DPI_FAC
Definition: UI_interface.h:305
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
uiBut * uiDefButBitS(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip)
Definition: interface.cc:5164
void UI_block_align_begin(uiBlock *block)
Definition: interface.cc:3910
void uiLayoutSetEmboss(uiLayout *layout, eUIEmbossType emboss)
uiLayout * uiLayoutSplit(uiLayout *layout, float percentage, bool align)
void uiItemFullO(uiLayout *layout, const char *opname, const char *name, int icon, struct IDProperty *properties, wmOperatorCallContext context, int flag, struct PointerRNA *r_opptr)
uiBut * uiDefButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, wmOperatorCallContext opcontext, const char *str, int x, int y, short width, short height, const char *tip)
Definition: interface.cc:5303
void UI_but_number_precision_set(uiBut *but, float precision)
Definition: interface.cc:6464
#define UI_UNIT_X
@ UI_BTYPE_BUT
Definition: UI_interface.h:330
@ UI_BTYPE_TOGGLE
Definition: UI_interface.h:340
@ UI_BTYPE_TOGGLE_N
Definition: UI_interface.h:341
@ UI_BTYPE_LABEL
Definition: UI_interface.h:354
@ UI_BTYPE_NUM
Definition: UI_interface.h:337
void UI_but_unit_type_set(uiBut *but, int unit_type)
Definition: interface.cc:5934
void UI_but_flag_enable(uiBut *but, int flag)
Definition: interface.cc:5858
int UI_pie_menu_invoke(struct bContext *C, const char *idname, const struct wmEvent *event)
void UI_block_align_end(uiBlock *block)
Definition: interface.cc:3923
#define NC_GEOM
Definition: WM_types.h:343
#define ND_DATA
Definition: WM_types.h:456
@ WM_OP_INVOKE_DEFAULT
Definition: WM_types.h:201
@ WM_OP_EXEC_DEFAULT
Definition: WM_types.h:208
#define ND_SPACE_VIEW3D
Definition: WM_types.h:471
#define NC_SPACE
Definition: WM_types.h:342
#define BM_ELEM_CD_GET_FLOAT(ele, offset)
Definition: bmesh_class.h:553
@ BM_ELEM_SELECT
Definition: bmesh_class.h:471
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
Definition: bmesh_class.h:541
#define BM_elem_flag_test(ele, hflag)
Definition: bmesh_inline.h:12
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
@ BM_EDGES_OF_MESH
@ BM_VERTS_OF_MESH
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_cd_flag_ensure(BMesh *bm, Mesh *mesh, const char cd_flag)
void BM_mesh_partial_destroy(BMPartialUpdate *bmpinfo)
BMPartialUpdate * BM_mesh_partial_create_from_verts_group_single(BMesh *bm, const BMPartialUpdate_Params *params, const BLI_bitmap *verts_mask, const int verts_mask_count)
#define SELECT
Scene scene
void * user_data
uint col
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
static unsigned c
Definition: RandGen.cpp:83
static unsigned a[3]
Definition: RandGen.cpp:78
void split(const std::string &s, const char delim, std::vector< std::string > &tokens)
Definition: abc_util.cc:92
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5167
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
Definition: rna_access.c:112
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:4921
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:717
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2138
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4863
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
static const float tilt_limit
Definition: rna_curve.c:844
ListBase paneltypes
Definition: BKE_screen.h:198
struct BMesh * bm
Definition: BKE_editmesh.h:40
float co[3]
Definition: bmesh_class.h:87
int totvert
Definition: bmesh_class.h:297
CustomData vdata
Definition: bmesh_class.h:337
CustomData edata
Definition: bmesh_class.h:337
int totvertsel
Definition: bmesh_class.h:298
int totedgesel
Definition: bmesh_class.h:298
float weight
uint8_t f1
float vec[4]
float radius
float tilt
struct Object * object
uint8_t f3
float vec[3][3]
uint8_t f1
uint8_t f2
struct Bone * parent
struct EditBone * parent
Definition: BKE_armature.h:41
struct Lattice * latt
struct EditLatt * editlatt
struct BPoint * def
void * first
Definition: DNA_listBase.h:31
char label[BKE_ST_MAXNAME]
Definition: BKE_screen.h:362
char idname[BKE_ST_MAXNAME]
Definition: BKE_screen.h:361
void(* draw)(const struct bContext *C, struct Menu *menu)
Definition: BKE_screen.h:370
char translation_context[BKE_ST_MAXNAME]
Definition: BKE_screen.h:363
struct uiLayout * layout
Definition: BKE_screen.h:378
struct BMEditMesh * edit_mesh
MetaElem * lastelem
float scale[3]
float imat[4][4]
float obmat[4][4]
void * data
void(* draw)(const struct bContext *C, struct Panel *panel)
Definition: BKE_screen.h:248
bool(* poll)(const struct bContext *C, struct PanelType *pt)
Definition: BKE_screen.h:242
char idname[BKE_ST_MAXNAME]
Definition: BKE_screen.h:223
char translation_context[BKE_ST_MAXNAME]
Definition: BKE_screen.h:226
char category[BKE_ST_MAXNAME]
Definition: BKE_screen.h:228
char label[BKE_ST_MAXNAME]
Definition: BKE_screen.h:224
struct uiLayout * layout
struct StructRNA * type
Definition: RNA_types.h:37
void * data
Definition: RNA_types.h:38
struct ToolSettings * toolsettings
float ob_obmat_orig[4][4]
TransformMedian ve_median
TransformMedian median
View3D_Runtime runtime
struct Base * basact
struct EditBone * act_edbone
unsigned int layer
struct bDeformGroup * next
const char * name
Definition: WM_types.h:888
const char * idname
Definition: WM_types.h:890
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:943
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
struct ReportList * reports
TransformMedian_Mesh mesh
TransformMedian_Lattice lattice
TransformMedian_Generic generic
TransformMedian_Curve curve
#define N_(msgid)
static void apply_raw_diff_v3(float val[3], const int tot, const float ve_median[3], const float median[3])
static void v3d_editarmature_buts(uiLayout *layout, Object *ob)
static void apply_raw_diff(float *val, const int tot, const float ve_median, const float median)
static void editmesh_partial_update_update_fn(struct bContext *C, const struct uiBlockInteraction_Params *UNUSED(params), void *arg1, void *user_data)
#define TRANSFORM_MEDIAN_ARRAY_LEN
static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
static void view3d_panel_transform(const bContext *C, Panel *panel)
static void v3d_object_dimension_buts(bContext *C, uiLayout *layout, View3D *v3d, Object *ob)
static void editmesh_partial_update_end_fn(struct bContext *UNUSED(C), const struct uiBlockInteraction_Params *UNUSED(params), void *UNUSED(arg1), void *user_data)
static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event)
static void apply_scale_factor_clamp(float *val, const int tot, const float ve_median, const float sca)
void view3d_buttons_register(ARegionType *art)
static bool view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt))
static float compute_scale_factor(const float ve_median, const float median)
static int view3d_object_mode_menu(bContext *C, wmOperator *op)
static void hide_collections_menu_draw(const bContext *C, Menu *menu)
void VIEW3D_OT_object_mode_pie_or_toggle(wmOperatorType *ot)
#define B_VGRP_PNL_EDIT_SINGLE
@ B_TRANSFORM_PANEL_DIMS
@ B_TRANSFORM_PANEL_MEDIAN
@ B_REDR
static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim)
static void v3d_editmetaball_buts(uiLayout *layout, Object *ob)
static void v3d_posearmature_buts(uiLayout *layout, Object *ob)
static bool view3d_panel_transform_poll(const bContext *C, PanelType *UNUSED(pt))
static void view3d_panel_vgroup(const bContext *C, Panel *panel)
static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event)
static TransformProperties * v3d_transform_props_ensure(View3D *v3d)
static void apply_scale_factor(float *val, const int tot, const float ve_median, const float median, const float sca)
static void * editmesh_partial_update_begin_fn(struct bContext *UNUSED(C), const struct uiBlockInteraction_Params *params, void *arg1)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3480
wmOperatorType * ot
Definition: wm_files.c:3479
bool WM_menutype_add(MenuType *mt)
Definition: wm_menu_type.c:51
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)