Blender  V2.93
object_data_transform.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 
30 #include <stdlib.h>
31 #include <string.h>
32 
33 #include "DNA_anim_types.h"
34 #include "DNA_armature_types.h"
35 #include "DNA_collection_types.h"
36 #include "DNA_gpencil_types.h"
37 #include "DNA_lattice_types.h"
38 #include "DNA_mesh_types.h"
39 #include "DNA_meta_types.h"
40 #include "DNA_object_types.h"
41 #include "DNA_scene_types.h"
42 
43 #include "BLI_listbase.h"
44 #include "BLI_math.h"
45 #include "BLI_utildefines.h"
46 
47 #include "BKE_armature.h"
48 #include "BKE_curve.h"
49 #include "BKE_editmesh.h"
50 #include "BKE_gpencil_geom.h"
51 #include "BKE_key.h"
52 #include "BKE_lattice.h"
53 #include "BKE_mball.h"
54 #include "BKE_mesh.h"
55 #include "BKE_scene.h"
56 
57 #include "bmesh.h"
58 
59 #include "DEG_depsgraph.h"
60 #include "DEG_depsgraph_query.h"
61 
62 #include "WM_types.h"
63 
64 #include "ED_armature.h"
65 #include "ED_mesh.h"
66 #include "ED_object.h"
67 
68 #include "MEM_guardedalloc.h"
69 
70 /* -------------------------------------------------------------------- */
78 /* Armature */
79 
81  float tail[3];
82  float head[3];
83  float roll;
84  float arm_tail[3];
85  float arm_head[3];
86  float arm_roll;
87  float rad_tail;
88  float rad_head;
89  float dist;
90  float xwidth;
91  float zwidth;
92 };
93 
95  const ListBase *bone_base, struct ElemData_Armature *elem_array)
96 {
97  struct ElemData_Armature *elem = elem_array;
98  LISTBASE_FOREACH (const Bone *, bone, bone_base) {
99 
100 #define COPY_PTR(member) memcpy(elem->member, bone->member, sizeof(bone->member))
101 #define COPY_VAL(member) memcpy(&elem->member, &bone->member, sizeof(bone->member))
102  COPY_PTR(head);
103  COPY_PTR(tail);
104  COPY_VAL(roll);
110  COPY_VAL(dist);
111  COPY_VAL(xwidth);
112  COPY_VAL(zwidth);
113 #undef COPY_PTR
114 #undef COPY_VAL
115 
116  elem = armature_coords_and_quats_get_recurse(&bone->childbase, elem + 1);
117  }
118  return elem;
119 }
120 
122  struct ElemData_Armature *elem_array)
123 {
125 }
126 
128  ListBase *bone_base, const struct ElemData_Armature *elem_array, const float mat[4][4])
129 {
130  const struct ElemData_Armature *elem = elem_array;
131  LISTBASE_FOREACH (Bone *, bone, bone_base) {
132 
133 #define COPY_PTR(member) memcpy(bone->member, elem->member, sizeof(bone->member))
134 #define COPY_VAL(member) memcpy(&bone->member, &elem->member, sizeof(bone->member))
135  COPY_PTR(head);
136  COPY_PTR(tail);
137  COPY_VAL(roll);
143  COPY_VAL(dist);
144  COPY_VAL(xwidth);
145  COPY_VAL(zwidth);
146 #undef COPY_PTR
147 #undef COPY_VAL
148 
149  elem = armature_coords_and_quats_apply_with_mat4_recurse(&bone->childbase, elem + 1, mat);
150  }
151  return elem;
152 }
153 
155  const struct ElemData_Armature *elem_array,
156  const float mat[4][4])
157 {
159  BKE_armature_transform(arm, mat, true);
160 }
161 
163  const struct ElemData_Armature *elem_array)
164 {
165  /* Avoid code duplication by using a unit matrix. */
166  float mat[4][4];
167  unit_m4(mat);
168  armature_coords_and_quats_apply_with_mat4(arm, elem_array, mat);
169 }
170 
171 /* Edit Armature */
173  struct ElemData_Armature *elem_array)
174 {
175  struct ElemData_Armature *elem = elem_array;
176  for (EditBone *ebone = arm->edbo->first; ebone; ebone = ebone->next, elem++) {
177 
178 #define COPY_PTR(member) memcpy(elem->member, ebone->member, sizeof(ebone->member))
179 #define COPY_VAL(member) memcpy(&elem->member, &ebone->member, sizeof(ebone->member))
180  /* Unused for edit bones: arm_head, arm_tail, arm_roll */
181  COPY_PTR(head);
182  COPY_PTR(tail);
183  COPY_VAL(roll);
186  COPY_VAL(dist);
187  COPY_VAL(xwidth);
188  COPY_VAL(zwidth);
189 #undef COPY_PTR
190 #undef COPY_VAL
191  }
192 }
193 
195  bArmature *arm, const struct ElemData_Armature *elem_array, const float mat[4][4])
196 {
197  const struct ElemData_Armature *elem = elem_array;
198  for (EditBone *ebone = arm->edbo->first; ebone; ebone = ebone->next, elem++) {
199 
200 #define COPY_PTR(member) memcpy(ebone->member, elem->member, sizeof(ebone->member))
201 #define COPY_VAL(member) memcpy(&ebone->member, &elem->member, sizeof(ebone->member))
202  /* Unused for edit bones: arm_head, arm_tail, arm_roll */
203  COPY_PTR(head);
204  COPY_PTR(tail);
205  COPY_VAL(roll);
208  COPY_VAL(dist);
209  COPY_VAL(xwidth);
210  COPY_VAL(zwidth);
211 #undef COPY_PTR
212 #undef COPY_VAL
213  }
214  ED_armature_edit_transform(arm, mat, true);
215 }
216 
218  const struct ElemData_Armature *elem_array)
219 {
220  /* Avoid code duplication by using a unit matrix. */
221  float mat[4][4];
222  unit_m4(mat);
224 }
225 
226 /* MetaBall */
227 
229  float co[3];
230  float quat[4];
231  float exp[3];
232  float rad;
233 };
234 
235 static void metaball_coords_and_quats_get(const MetaBall *mb, struct ElemData_MetaBall *elem_array)
236 {
237  struct ElemData_MetaBall *elem = elem_array;
238  for (const MetaElem *ml = mb->elems.first; ml; ml = ml->next, elem++) {
239  copy_v3_v3(elem->co, &ml->x);
240  copy_qt_qt(elem->quat, ml->quat);
241  copy_v3_v3(elem->exp, &ml->expx);
242  elem->rad = ml->rad;
243  }
244 }
245 
247  const struct ElemData_MetaBall *elem_array,
248  const float mat[4][4])
249 {
250  const struct ElemData_MetaBall *elem = elem_array;
251  for (MetaElem *ml = mb->elems.first; ml; ml = ml->next, elem++) {
252  copy_v3_v3(&ml->x, elem->co);
253  copy_qt_qt(ml->quat, elem->quat);
254  copy_v3_v3(&ml->expx, elem->exp);
255  ml->rad = elem->rad;
256  }
257  BKE_mball_transform(mb, mat, true);
258 }
259 
261  const struct ElemData_MetaBall *elem_array)
262 {
263  /* Avoid code duplication by using a unit matrix. */
264  float mat[4][4];
265  unit_m4(mat);
266  metaball_coords_and_quats_apply_with_mat4(mb, elem_array, mat);
267 }
268 
271 /* -------------------------------------------------------------------- */
280  ID *id;
282 };
283 
285  struct XFormObjectData base;
286  /* Optional data for shape keys. */
287  void *key_data;
288  float elem_array[0][3];
289 };
290 
292  struct XFormObjectData base;
293  /* Optional data for shape keys. */
294  void *key_data;
295  float elem_array[0][3];
296 };
297 
299  struct XFormObjectData base;
300  /* Optional data for shape keys. */
301  void *key_data;
302  float elem_array[0][3];
303 };
304 
306  struct XFormObjectData base;
307  struct ElemData_Armature elem_array[0];
308 };
309 
311  struct XFormObjectData base;
312  struct ElemData_MetaBall elem_array[0];
313 };
314 
316  struct XFormObjectData base;
318 };
319 
321 {
322  struct XFormObjectData *xod_base = NULL;
323  if (id == NULL) {
324  return xod_base;
325  }
326 
327  switch (GS(id->name)) {
328  case ID_ME: {
329  Mesh *me = (Mesh *)id;
330  struct Key *key = me->key;
331  const int key_index = -1;
332 
333  if (is_edit_mode) {
334  BMesh *bm = me->edit_mesh->bm;
335  /* Always operate on all keys for the moment. */
336  // key_index = bm->shapenr - 1;
337  const int elem_array_len = bm->totvert;
338  struct XFormObjectData_Mesh *xod = MEM_mallocN(
339  sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__);
340  memset(xod, 0x0, sizeof(*xod));
341 
343  xod_base = &xod->base;
344 
345  if (key != NULL) {
346  const size_t key_size = BKE_keyblock_element_calc_size_from_shape(key, key_index);
347  if (key_size) {
348  xod->key_data = MEM_mallocN(key_size, __func__);
349  BKE_keyblock_data_get_from_shape(key, xod->key_data, key_index);
350  }
351  }
352  }
353  else {
354  const int elem_array_len = me->totvert;
355  struct XFormObjectData_Mesh *xod = MEM_mallocN(
356  sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__);
357  memset(xod, 0x0, sizeof(*xod));
358 
360  xod_base = &xod->base;
361 
362  if (key != NULL) {
363  const size_t key_size = BKE_keyblock_element_calc_size_from_shape(key, key_index);
364  if (key_size) {
365  xod->key_data = MEM_mallocN(key_size, __func__);
366  BKE_keyblock_data_get_from_shape(key, xod->key_data, key_index);
367  }
368  }
369  }
370  break;
371  }
372  case ID_LT: {
373  Lattice *lt_orig = (Lattice *)id;
374  Lattice *lt = is_edit_mode ? lt_orig->editlatt->latt : lt_orig;
375  struct Key *key = lt->key;
376  const int key_index = -1;
377 
378  if (is_edit_mode) {
379  /* Always operate on all keys for the moment. */
380  // key_index = lt_orig->editlatt->shapenr - 1;
381  }
382 
383  const int elem_array_len = lt->pntsu * lt->pntsv * lt->pntsw;
384  struct XFormObjectData_Lattice *xod = MEM_mallocN(
385  sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__);
386  memset(xod, 0x0, sizeof(*xod));
387 
389  xod_base = &xod->base;
390 
391  if (key != NULL) {
392  const size_t key_size = BKE_keyblock_element_calc_size_from_shape(key, key_index);
393  if (key_size) {
394  xod->key_data = MEM_mallocN(key_size, __func__);
395  BKE_keyblock_data_get_from_shape(key, xod->key_data, key_index);
396  }
397  }
398 
399  break;
400  }
401  case ID_CU: {
402  Curve *cu = (Curve *)id;
403  struct Key *key = cu->key;
404 
405  const short ob_type = BKE_curve_type_get(cu);
406  if (ob_type == OB_FONT) {
407  /* We could support translation. */
408  break;
409  }
410 
411  const int key_index = -1;
412  ListBase *nurbs;
413  if (is_edit_mode) {
414  EditNurb *editnurb = cu->editnurb;
415  nurbs = &editnurb->nurbs;
416  /* Always operate on all keys for the moment. */
417  // key_index = editnurb->shapenr - 1;
418  }
419  else {
420  nurbs = &cu->nurb;
421  }
422 
423  const int elem_array_len = BKE_nurbList_verts_count(nurbs);
424  struct XFormObjectData_Curve *xod = MEM_mallocN(
425  sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__);
426  memset(xod, 0x0, sizeof(*xod));
427 
428  BKE_curve_nurbs_vert_coords_get(nurbs, xod->elem_array, elem_array_len);
429  xod_base = &xod->base;
430 
431  if (key != NULL) {
432  const size_t key_size = BKE_keyblock_element_calc_size_from_shape(key, key_index);
433  if (key_size) {
434  xod->key_data = MEM_mallocN(key_size, __func__);
435  BKE_keyblock_data_get_from_shape(key, xod->key_data, key_index);
436  }
437  }
438 
439  break;
440  }
441  case ID_AR: {
442  bArmature *arm = (bArmature *)id;
443  if (is_edit_mode) {
444  const int elem_array_len = BLI_listbase_count(arm->edbo);
446  sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__);
447  memset(xod, 0x0, sizeof(*xod));
448 
450  xod_base = &xod->base;
451  }
452  else {
453  const int elem_array_len = BKE_armature_bonelist_count(&arm->bonebase);
455  sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__);
456  memset(xod, 0x0, sizeof(*xod));
457 
459  xod_base = &xod->base;
460  }
461  break;
462  }
463  case ID_MB: {
464  /* Edit mode and object mode are shared. */
465  MetaBall *mb = (MetaBall *)id;
466  const int elem_array_len = BLI_listbase_count(&mb->elems);
468  sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__);
469  memset(xod, 0x0, sizeof(*xod));
470 
472  xod_base = &xod->base;
473  break;
474  }
475  case ID_GD: {
476  bGPdata *gpd = (bGPdata *)id;
477  const int elem_array_len = BKE_gpencil_stroke_point_count(gpd);
478  struct XFormObjectData_GPencil *xod = MEM_mallocN(
479  sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__);
480  memset(xod, 0x0, sizeof(*xod));
481 
483  xod_base = &xod->base;
484  break;
485  }
486  default: {
487  break;
488  }
489  }
490  if (xod_base) {
491  xod_base->id = id;
492  xod_base->is_edit_mode = is_edit_mode;
493  }
494  return xod_base;
495 }
496 
498 {
499  return ED_object_data_xform_create_ex(id, false);
500 }
501 
503 {
504  return ED_object_data_xform_create_ex(id, true);
505 }
506 
508 {
509  switch (GS(xod_base->id->name)) {
510  case ID_ME: {
511  struct XFormObjectData_Mesh *xod = (struct XFormObjectData_Mesh *)xod_base;
512  if (xod->key_data != NULL) {
513  MEM_freeN(xod->key_data);
514  }
515  break;
516  }
517  case ID_LT: {
518  struct XFormObjectData_Lattice *xod = (struct XFormObjectData_Lattice *)xod_base;
519  if (xod->key_data != NULL) {
520  MEM_freeN(xod->key_data);
521  }
522  break;
523  }
524  case ID_CU: {
525  struct XFormObjectData_Curve *xod = (struct XFormObjectData_Curve *)xod_base;
526  if (xod->key_data != NULL) {
527  MEM_freeN(xod->key_data);
528  }
529  break;
530  }
531  default: {
532  break;
533  }
534  }
535  MEM_freeN(xod_base);
536 }
537 
538 void ED_object_data_xform_by_mat4(struct XFormObjectData *xod_base, const float mat[4][4])
539 {
540  switch (GS(xod_base->id->name)) {
541  case ID_ME: {
542  Mesh *me = (Mesh *)xod_base->id;
543 
544  struct Key *key = me->key;
545  const int key_index = -1;
546 
547  struct XFormObjectData_Mesh *xod = (struct XFormObjectData_Mesh *)xod_base;
548  if (xod_base->is_edit_mode) {
549  BMesh *bm = me->edit_mesh->bm;
550  BM_mesh_vert_coords_apply_with_mat4(bm, xod->elem_array, mat);
551  /* Always operate on all keys for the moment. */
552  // key_index = bm->shapenr - 1;
553  }
554  else {
555  BKE_mesh_vert_coords_apply_with_mat4(me, xod->elem_array, mat);
556  }
557 
558  if (key != NULL) {
559  BKE_keyblock_data_set_with_mat4(key, key_index, xod->key_data, mat);
560  }
561 
562  break;
563  }
564  case ID_LT: {
565  Lattice *lt_orig = (Lattice *)xod_base->id;
566  Lattice *lt = xod_base->is_edit_mode ? lt_orig->editlatt->latt : lt_orig;
567 
568  struct Key *key = lt->key;
569  const int key_index = -1;
570 
571  struct XFormObjectData_Lattice *xod = (struct XFormObjectData_Lattice *)xod_base;
572  BKE_lattice_vert_coords_apply_with_mat4(lt, xod->elem_array, mat);
573  if (xod_base->is_edit_mode) {
574  /* Always operate on all keys for the moment. */
575  // key_index = lt_orig->editlatt->shapenr - 1;
576  }
577 
578  if ((key != NULL) && (xod->key_data != NULL)) {
579  BKE_keyblock_data_set_with_mat4(key, key_index, xod->key_data, mat);
580  }
581 
582  break;
583  }
584  case ID_CU: {
585  BLI_assert(xod_base->is_edit_mode == false); /* Not used currently. */
586  Curve *cu = (Curve *)xod_base->id;
587 
588  struct Key *key = cu->key;
589  const int key_index = -1;
590  ListBase *nurb = NULL;
591 
592  struct XFormObjectData_Curve *xod = (struct XFormObjectData_Curve *)xod_base;
593  if (xod_base->is_edit_mode) {
594  EditNurb *editnurb = cu->editnurb;
595  nurb = &editnurb->nurbs;
597  &editnurb->nurbs, xod->elem_array, mat, CU_IS_2D(cu));
598  /* Always operate on all keys for the moment. */
599  // key_index = editnurb->shapenr - 1;
600  }
601  else {
602  nurb = &cu->nurb;
603  BKE_curve_nurbs_vert_coords_apply_with_mat4(&cu->nurb, xod->elem_array, mat, CU_IS_2D(cu));
604  }
605 
606  if ((key != NULL) && (xod->key_data != NULL)) {
607  BKE_keyblock_curve_data_set_with_mat4(key, nurb, key_index, xod->key_data, mat);
608  }
609 
610  break;
611  }
612  case ID_AR: {
613  BLI_assert(xod_base->is_edit_mode == false); /* Not used currently. */
614  bArmature *arm = (bArmature *)xod_base->id;
615  struct XFormObjectData_Armature *xod = (struct XFormObjectData_Armature *)xod_base;
616  if (xod_base->is_edit_mode) {
617  edit_armature_coords_and_quats_apply_with_mat4(arm, xod->elem_array, mat);
618  }
619  else {
620  armature_coords_and_quats_apply_with_mat4(arm, xod->elem_array, mat);
621  }
622  break;
623  }
624  case ID_MB: {
625  /* Metaballs are a special case, edit-mode and object mode data is shared. */
626  MetaBall *mb = (MetaBall *)xod_base->id;
627  struct XFormObjectData_MetaBall *xod = (struct XFormObjectData_MetaBall *)xod_base;
628  metaball_coords_and_quats_apply_with_mat4(mb, xod->elem_array, mat);
629  break;
630  }
631  case ID_GD: {
632  bGPdata *gpd = (bGPdata *)xod_base->id;
633  struct XFormObjectData_GPencil *xod = (struct XFormObjectData_GPencil *)xod_base;
634  BKE_gpencil_point_coords_apply_with_mat4(gpd, xod->elem_array, mat);
635  break;
636  }
637  default: {
638  break;
639  }
640  }
641 }
642 
644 {
645  switch (GS(xod_base->id->name)) {
646  case ID_ME: {
647  Mesh *me = (Mesh *)xod_base->id;
648 
649  struct Key *key = me->key;
650  const int key_index = -1;
651 
652  struct XFormObjectData_Mesh *xod = (struct XFormObjectData_Mesh *)xod_base;
653  if (xod_base->is_edit_mode) {
654  BMesh *bm = me->edit_mesh->bm;
655  BM_mesh_vert_coords_apply(bm, xod->elem_array);
656  /* Always operate on all keys for the moment. */
657  // key_index = bm->shapenr - 1;
658  }
659  else {
660  BKE_mesh_vert_coords_apply(me, xod->elem_array);
661  }
662 
663  if ((key != NULL) && (xod->key_data != NULL)) {
664  BKE_keyblock_data_set(key, key_index, xod->key_data);
665  }
666 
667  break;
668  }
669  case ID_LT: {
670  Lattice *lt_orig = (Lattice *)xod_base->id;
671  Lattice *lt = xod_base->is_edit_mode ? lt_orig->editlatt->latt : lt_orig;
672 
673  struct Key *key = lt->key;
674  const int key_index = -1;
675 
676  struct XFormObjectData_Lattice *xod = (struct XFormObjectData_Lattice *)xod_base;
677  BKE_lattice_vert_coords_apply(lt, xod->elem_array);
678  if (xod_base->is_edit_mode) {
679  /* Always operate on all keys for the moment. */
680  // key_index = lt_orig->editlatt->shapenr - 1;
681  }
682 
683  if ((key != NULL) && (xod->key_data != NULL)) {
684  BKE_keyblock_data_set(key, key_index, xod->key_data);
685  }
686 
687  break;
688  }
689  case ID_CU: {
690  Curve *cu = (Curve *)xod_base->id;
691 
692  struct Key *key = cu->key;
693  const int key_index = -1;
694 
695  struct XFormObjectData_Curve *xod = (struct XFormObjectData_Curve *)xod_base;
696  if (xod_base->is_edit_mode) {
697  EditNurb *editnurb = cu->editnurb;
698  BKE_curve_nurbs_vert_coords_apply(&editnurb->nurbs, xod->elem_array, CU_IS_2D(cu));
699  /* Always operate on all keys for the moment. */
700  // key_index = editnurb->shapenr - 1;
701  }
702  else {
703  BKE_curve_nurbs_vert_coords_apply(&cu->nurb, xod->elem_array, CU_IS_2D(cu));
704  }
705 
706  if ((key != NULL) && (xod->key_data != NULL)) {
707  BKE_keyblock_data_set(key, key_index, xod->key_data);
708  }
709 
710  break;
711  }
712  case ID_AR: {
713  bArmature *arm = (bArmature *)xod_base->id;
714  struct XFormObjectData_Armature *xod = (struct XFormObjectData_Armature *)xod_base;
715  if (xod_base->is_edit_mode) {
716  edit_armature_coords_and_quats_apply(arm, xod->elem_array);
717  }
718  else {
719  armature_coords_and_quats_apply(arm, xod->elem_array);
720  }
721  break;
722  }
723  case ID_MB: {
724  /* Metaballs are a special case, edit-mode and object mode data is shared. */
725  MetaBall *mb = (MetaBall *)xod_base->id;
726  struct XFormObjectData_MetaBall *xod = (struct XFormObjectData_MetaBall *)xod_base;
727  metaball_coords_and_quats_apply(mb, xod->elem_array);
728  break;
729  }
730  case ID_GD: {
731  bGPdata *gpd = (bGPdata *)xod_base->id;
732  struct XFormObjectData_GPencil *xod = (struct XFormObjectData_GPencil *)xod_base;
733  BKE_gpencil_point_coords_apply(gpd, xod->elem_array);
734  break;
735  }
736  default: {
737  break;
738  }
739  }
740 }
741 
743 {
744  switch (GS(xod_base->id->name)) {
745  case ID_ME: {
746  Mesh *me = (Mesh *)xod_base->id;
747  if (xod_base->is_edit_mode) {
748  EDBM_update_generic(me, true, false);
750  }
752  break;
753  }
754  case ID_LT: {
755  /* Generic update. */
756  Lattice *lt = (Lattice *)xod_base->id;
758  break;
759  }
760  case ID_CU: {
761  /* Generic update. */
762  Curve *cu = (Curve *)xod_base->id;
764  break;
765  }
766  case ID_AR: {
767  /* Generic update. */
768  bArmature *arm = (bArmature *)xod_base->id;
769  /* XXX, zero is needed, no other flags properly update this. */
770  DEG_id_tag_update(&arm->id, 0);
771  break;
772  }
773  case ID_MB: {
774  /* Generic update. */
775  MetaBall *mb = (MetaBall *)xod_base->id;
777  break;
778  }
779  case ID_GD: {
780  /* Generic update. */
781  bGPdata *gpd = (bGPdata *)xod_base->id;
783  break;
784  }
785 
786  default: {
787  break;
788  }
789  }
790 }
791 
int BKE_armature_bonelist_count(struct ListBase *lb)
Definition: armature.c:361
void BKE_armature_transform(struct bArmature *arm, const float mat[4][4], const bool do_props)
Definition: armature.c:567
void BKE_curve_nurbs_vert_coords_apply_with_mat4(struct ListBase *lb, const float(*vert_coords)[3], const float mat[4][4], const bool constrain_2d)
Definition: curve.c:4703
int BKE_nurbList_verts_count(const struct ListBase *nurb)
void BKE_curve_nurbs_vert_coords_get(const struct ListBase *lb, float(*vert_coords)[3], int vert_len)
#define CU_IS_2D(cu)
Definition: BKE_curve.h:83
short BKE_curve_type_get(const struct Curve *cu)
void BKE_curve_nurbs_vert_coords_apply(struct ListBase *lb, const float(*vert_coords)[3], const bool constrain_2d)
Definition: curve.c:4740
void BKE_gpencil_point_coords_apply(struct bGPdata *gpd, const GPencilPointCoordinates *elem_data)
void BKE_gpencil_point_coords_get(struct bGPdata *gpd, GPencilPointCoordinates *elem_data)
int BKE_gpencil_stroke_point_count(struct bGPdata *gpd)
void BKE_gpencil_point_coords_apply_with_mat4(struct bGPdata *gpd, const GPencilPointCoordinates *elem_data, const float mat[4][4])
void BKE_keyblock_data_get_from_shape(const struct Key *key, float(*arr)[3], const int shape_index)
void BKE_keyblock_curve_data_set_with_mat4(struct Key *key, const struct ListBase *nurb, const int shape_index, const void *data, const float mat[4][4])
void BKE_keyblock_data_set_with_mat4(struct Key *key, const int shape_index, const float(*coords)[3], const float mat[4][4])
Definition: key.c:1685
void BKE_keyblock_data_set(struct Key *key, const int shape_index, const void *data)
Definition: key.c:1734
size_t BKE_keyblock_element_calc_size_from_shape(const struct Key *key, const int shape_index)
void BKE_lattice_vert_coords_apply(struct Lattice *lt, const float(*vert_coords)[3])
Definition: lattice.c:534
void BKE_lattice_vert_coords_apply_with_mat4(struct Lattice *lt, const float(*vert_coords)[3], const float mat[4][4])
Definition: lattice.c:524
void BKE_lattice_vert_coords_get(const struct Lattice *lt, float(*vert_coords)[3])
void BKE_mball_transform(struct MetaBall *mb, const float mat[4][4], const bool do_props)
Definition: mball.c:617
void BKE_mesh_vert_coords_apply(struct Mesh *mesh, const float(*vert_coords)[3])
Definition: mesh.c:1755
void BKE_mesh_vert_coords_apply_with_mat4(struct Mesh *mesh, const float(*vert_coords)[3], const float mat[4][4])
Definition: mesh.c:1766
void BKE_mesh_vert_coords_get(const struct Mesh *mesh, float(*vert_coords)[3])
#define BLI_assert(a)
Definition: BLI_assert.h:58
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void unit_m4(float m[4][4])
Definition: rct.c:1140
void copy_qt_qt(float q[4], const float a[4])
Definition: math_rotation.c:52
MINLINE void copy_v3_v3(float r[3], const float a[3])
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_COPY_ON_WRITE
Definition: DNA_ID.h:654
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:611
@ ID_AR
Definition: DNA_ID_enums.h:78
@ ID_GD
Definition: DNA_ID_enums.h:83
@ ID_ME
Definition: DNA_ID_enums.h:60
@ ID_MB
Definition: DNA_ID_enums.h:62
@ ID_LT
Definition: DNA_ID_enums.h:66
@ ID_CU
Definition: DNA_ID_enums.h:61
Object groups, one object can be in many groups at once.
Object is a sort of wrapper for general info.
@ OB_FONT
void EDBM_update_generic(struct Mesh *me, const bool do_tessellation, const bool is_destructive)
void EDBM_mesh_normals_update(struct BMEditMesh *em)
Read Guarded memory(de)allocation.
void ED_armature_edit_transform(bArmature *arm, const float mat[4][4], const bool do_props)
Definition: armature_edit.c:72
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_vert_coords_apply_with_mat4(BMesh *bm, const float(*vert_coords)[3], const float mat[4][4])
Definition: bmesh_mesh.c:3084
void BM_mesh_vert_coords_apply(BMesh *bm, const float(*vert_coords)[3])
Definition: bmesh_mesh.c:3074
void BM_mesh_vert_coords_get(BMesh *bm, float(*vert_coords)[3])
Definition: bmesh_mesh.c:3056
#define GS(x)
Definition: iris.c:241
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
static const struct ElemData_Armature * armature_coords_and_quats_apply_with_mat4_recurse(ListBase *bone_base, const struct ElemData_Armature *elem_array, const float mat[4][4])
static void metaball_coords_and_quats_apply(MetaBall *mb, const struct ElemData_MetaBall *elem_array)
struct XFormObjectData * ED_object_data_xform_create_ex(ID *id, bool is_edit_mode)
static void metaball_coords_and_quats_apply_with_mat4(MetaBall *mb, const struct ElemData_MetaBall *elem_array, const float mat[4][4])
void ED_object_data_xform_restore(struct XFormObjectData *xod_base)
static void edit_armature_coords_and_quats_apply_with_mat4(bArmature *arm, const struct ElemData_Armature *elem_array, const float mat[4][4])
void ED_object_data_xform_tag_update(struct XFormObjectData *xod_base)
#define COPY_PTR(member)
struct XFormObjectData * ED_object_data_xform_create(ID *id)
static void edit_armature_coords_and_quats_get(const bArmature *arm, struct ElemData_Armature *elem_array)
static void metaball_coords_and_quats_get(const MetaBall *mb, struct ElemData_MetaBall *elem_array)
struct XFormObjectData * ED_object_data_xform_create_from_edit_mode(ID *id)
void ED_object_data_xform_destroy(struct XFormObjectData *xod_base)
static void armature_coords_and_quats_apply(bArmature *arm, const struct ElemData_Armature *elem_array)
#define COPY_VAL(member)
static void edit_armature_coords_and_quats_apply(bArmature *arm, const struct ElemData_Armature *elem_array)
static void armature_coords_and_quats_apply_with_mat4(bArmature *arm, const struct ElemData_Armature *elem_array, const float mat[4][4])
static struct ElemData_Armature * armature_coords_and_quats_get_recurse(const ListBase *bone_base, struct ElemData_Armature *elem_array)
void ED_object_data_xform_by_mat4(struct XFormObjectData *xod_base, const float mat[4][4])
static void armature_coords_and_quats_get(const bArmature *arm, struct ElemData_Armature *elem_array)
struct BMesh * bm
Definition: BKE_editmesh.h:52
int totvert
Definition: bmesh_class.h:297
struct Key * key
EditNurb * editnurb
ListBase nurb
struct Lattice * latt
ListBase nurbs
Definition: DNA_ID.h:273
char name[66]
Definition: DNA_ID.h:283
struct Key * key
struct EditLatt * editlatt
void * first
Definition: DNA_listBase.h:47
struct BMEditMesh * edit_mesh
int totvert
struct Key * key
ListBase elems
struct ElemData_Armature elem_array[0]
struct XFormObjectData base
struct XFormObjectData base
struct XFormObjectData base
struct GPencilPointCoordinates elem_array[0]
struct XFormObjectData base
struct XFormObjectData base
struct XFormObjectData base
struct ElemData_MetaBall elem_array[0]
ListBase bonebase
ListBase * edbo