Blender V4.3
object_data_transform.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
15#include <cstdlib>
16#include <cstring>
17
18#include "DNA_armature_types.h"
20#include "DNA_lattice_types.h"
21#include "DNA_mesh_types.h"
22#include "DNA_meta_types.h"
23#include "DNA_object_types.h"
24
25#include "BLI_listbase.h"
26#include "BLI_math_matrix.h"
27#include "BLI_math_rotation.h"
28#include "BLI_math_vector.h"
29#include "BLI_utildefines.h"
30
31#include "BKE_armature.hh"
32#include "BKE_curve.hh"
33#include "BKE_editmesh.hh"
35#include "BKE_grease_pencil.hh"
36#include "BKE_key.hh"
37#include "BKE_lattice.hh"
38#include "BKE_mball.hh"
39#include "BKE_mesh_types.hh"
40
41#include "bmesh.hh"
42
43#include "DEG_depsgraph.hh"
44
45#include "ED_armature.hh"
46#include "ED_mesh.hh"
47#include "ED_object.hh"
48
49#include "MEM_guardedalloc.h"
50
51namespace blender::ed::object {
52
53/* -------------------------------------------------------------------- */
61/* Armature */
62
64 float tail[3];
65 float head[3];
66 float roll;
67 float arm_tail[3];
68 float arm_head[3];
69 float arm_roll;
70 float rad_tail;
71 float rad_head;
72 float dist;
73 float xwidth;
74 float zwidth;
75};
76
78 ElemData_Armature *elem_array)
79{
80 ElemData_Armature *elem = elem_array;
81 LISTBASE_FOREACH (const Bone *, bone, bone_base) {
82
83#define COPY_PTR(member) memcpy(elem->member, bone->member, sizeof(bone->member))
84#define COPY_VAL(member) memcpy(&elem->member, &bone->member, sizeof(bone->member))
85 COPY_PTR(head);
86 COPY_PTR(tail);
87 COPY_VAL(roll);
88 COPY_PTR(arm_head);
89 COPY_PTR(arm_tail);
90 COPY_VAL(arm_roll);
91 COPY_VAL(rad_tail);
92 COPY_VAL(rad_head);
93 COPY_VAL(dist);
94 COPY_VAL(xwidth);
95 COPY_VAL(zwidth);
96#undef COPY_PTR
97#undef COPY_VAL
98
99 elem = armature_coords_and_quats_get_recurse(&bone->childbase, elem + 1);
100 }
101 return elem;
102}
103
105{
107}
108
110 ListBase *bone_base, const ElemData_Armature *elem_array, const float mat[4][4])
111{
112 const ElemData_Armature *elem = elem_array;
113 LISTBASE_FOREACH (Bone *, bone, bone_base) {
114
115#define COPY_PTR(member) memcpy(bone->member, elem->member, sizeof(bone->member))
116#define COPY_VAL(member) memcpy(&bone->member, &elem->member, sizeof(bone->member))
117 COPY_PTR(head);
118 COPY_PTR(tail);
119 COPY_VAL(roll);
120 COPY_PTR(arm_head);
121 COPY_PTR(arm_tail);
122 COPY_VAL(arm_roll);
123 COPY_VAL(rad_tail);
124 COPY_VAL(rad_head);
125 COPY_VAL(dist);
126 COPY_VAL(xwidth);
127 COPY_VAL(zwidth);
128#undef COPY_PTR
129#undef COPY_VAL
130
131 elem = armature_coords_and_quats_apply_with_mat4_recurse(&bone->childbase, elem + 1, mat);
132 }
133 return elem;
134}
135
137 const ElemData_Armature *elem_array,
138 const float mat[4][4])
139{
141 BKE_armature_transform(arm, mat, true);
142}
143
145{
146 /* Avoid code duplication by using a unit matrix. */
147 float mat[4][4];
148 unit_m4(mat);
149 armature_coords_and_quats_apply_with_mat4(arm, elem_array, mat);
150}
151
152/* Edit Armature */
154{
155 ElemData_Armature *elem = elem_array;
156 for (EditBone *ebone = static_cast<EditBone *>(arm->edbo->first); ebone;
157 ebone = ebone->next, elem++)
158 {
159
160#define COPY_PTR(member) memcpy(elem->member, ebone->member, sizeof(ebone->member))
161#define COPY_VAL(member) memcpy(&elem->member, &ebone->member, sizeof(ebone->member))
162 /* Unused for edit bones: arm_head, arm_tail, arm_roll */
163 COPY_PTR(head);
164 COPY_PTR(tail);
165 COPY_VAL(roll);
166 COPY_VAL(rad_tail);
167 COPY_VAL(rad_head);
168 COPY_VAL(dist);
169 COPY_VAL(xwidth);
170 COPY_VAL(zwidth);
171#undef COPY_PTR
172#undef COPY_VAL
173 }
174}
175
177 const ElemData_Armature *elem_array,
178 const float mat[4][4])
179{
180 const ElemData_Armature *elem = elem_array;
181 for (EditBone *ebone = static_cast<EditBone *>(arm->edbo->first); ebone;
182 ebone = ebone->next, elem++)
183 {
184
185#define COPY_PTR(member) memcpy(ebone->member, elem->member, sizeof(ebone->member))
186#define COPY_VAL(member) memcpy(&ebone->member, &elem->member, sizeof(ebone->member))
187 /* Unused for edit bones: arm_head, arm_tail, arm_roll */
188 COPY_PTR(head);
189 COPY_PTR(tail);
190 COPY_VAL(roll);
191 COPY_VAL(rad_tail);
192 COPY_VAL(rad_head);
193 COPY_VAL(dist);
194 COPY_VAL(xwidth);
195 COPY_VAL(zwidth);
196#undef COPY_PTR
197#undef COPY_VAL
198 }
199 ED_armature_edit_transform(arm, mat, true);
200}
201
203 const ElemData_Armature *elem_array)
204{
205 /* Avoid code duplication by using a unit matrix. */
206 float mat[4][4];
207 unit_m4(mat);
209}
210
211/* MetaBall */
212
214 float co[3];
215 float quat[4];
216 float exp[3];
217 float rad;
218};
219
221{
222 ElemData_MetaBall *elem = elem_array;
223 for (const MetaElem *ml = static_cast<const MetaElem *>(mb->elems.first); ml;
224 ml = ml->next, elem++)
225 {
226 copy_v3_v3(elem->co, &ml->x);
227 copy_qt_qt(elem->quat, ml->quat);
228 copy_v3_v3(elem->exp, &ml->expx);
229 elem->rad = ml->rad;
230 }
231}
232
234 const ElemData_MetaBall *elem_array,
235 const float mat[4][4])
236{
237 const ElemData_MetaBall *elem = elem_array;
238 for (MetaElem *ml = static_cast<MetaElem *>(mb->elems.first); ml; ml = ml->next, elem++) {
239 copy_v3_v3(&ml->x, elem->co);
240 copy_qt_qt(ml->quat, elem->quat);
241 copy_v3_v3(&ml->expx, elem->exp);
242 ml->rad = elem->rad;
243 }
244 BKE_mball_transform(mb, mat, true);
245}
246
248{
249 /* Avoid code duplication by using a unit matrix. */
250 float mat[4][4];
251 unit_m4(mat);
253}
254
257/* -------------------------------------------------------------------- */
269
272 /* Optional data for shape keys. */
273 void *key_data;
274 float elem_array[0][3];
275};
276
279 /* Optional data for shape keys. */
280 void *key_data;
281 float elem_array[0][3];
282};
283
286 /* Optional data for shape keys. */
287 void *key_data;
288 float elem_array[0][3];
289};
290
295
300
305
310
312{
313 XFormObjectData *xod_base = nullptr;
314 if (id == nullptr) {
315 return xod_base;
316 }
317
318 switch (GS(id->name)) {
319 case ID_ME: {
320 Mesh *mesh = (Mesh *)id;
321 Key *key = mesh->key;
322 const int key_index = -1;
323
324 if (is_edit_mode) {
325 BMesh *bm = mesh->runtime->edit_mesh->bm;
326 /* Always operate on all keys for the moment. */
327 // key_index = bm->shapenr - 1;
328 const int elem_array_len = bm->totvert;
329 XFormObjectData_Mesh *xod = static_cast<XFormObjectData_Mesh *>(
330 MEM_mallocN(sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__));
331 memset(xod, 0x0, sizeof(*xod));
332
334 bm, MutableSpan(reinterpret_cast<float3 *>(xod->elem_array), elem_array_len));
335 xod_base = &xod->base;
336
337 if (key != nullptr) {
338 const size_t key_size = BKE_keyblock_element_calc_size_from_shape(key, key_index);
339 if (key_size) {
340 xod->key_data = MEM_mallocN(key_size, __func__);
342 key, static_cast<float(*)[3]>(xod->key_data), key_index);
343 }
344 }
345 }
346 else {
347 const int elem_array_len = mesh->verts_num;
348 XFormObjectData_Mesh *xod = static_cast<XFormObjectData_Mesh *>(
349 MEM_mallocN(sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__));
350 memset(xod, 0x0, sizeof(*xod));
351 MutableSpan(reinterpret_cast<float3 *>(xod->elem_array), mesh->verts_num)
352 .copy_from(mesh->vert_positions());
353
354 xod_base = &xod->base;
355
356 if (key != nullptr) {
357 const size_t key_size = BKE_keyblock_element_calc_size_from_shape(key, key_index);
358 if (key_size) {
359 xod->key_data = MEM_mallocN(key_size, __func__);
361 key, static_cast<float(*)[3]>(xod->key_data), key_index);
362 }
363 }
364 }
365 break;
366 }
367 case ID_LT: {
368 Lattice *lt_orig = (Lattice *)id;
369 Lattice *lt = is_edit_mode ? lt_orig->editlatt->latt : lt_orig;
370 Key *key = lt->key;
371 const int key_index = -1;
372
373 if (is_edit_mode) {
374 /* Always operate on all keys for the moment. */
375 // key_index = lt_orig->editlatt->shapenr - 1;
376 }
377
378 const int elem_array_len = lt->pntsu * lt->pntsv * lt->pntsw;
380 MEM_mallocN(sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__));
381 memset(xod, 0x0, sizeof(*xod));
382
384 xod_base = &xod->base;
385
386 if (key != nullptr) {
387 const size_t key_size = BKE_keyblock_element_calc_size_from_shape(key, key_index);
388 if (key_size) {
389 xod->key_data = MEM_mallocN(key_size, __func__);
391 key, static_cast<float(*)[3]>(xod->key_data), key_index);
392 }
393 }
394
395 break;
396 }
397 case ID_CU_LEGACY: {
398 Curve *cu = (Curve *)id;
399 Key *key = cu->key;
400
401 const short ob_type = BKE_curve_type_get(cu);
402 if (ob_type == OB_FONT) {
403 /* We could support translation. */
404 break;
405 }
406
407 const int key_index = -1;
408 ListBase *nurbs;
409 if (is_edit_mode) {
410 EditNurb *editnurb = cu->editnurb;
411 nurbs = &editnurb->nurbs;
412 /* Always operate on all keys for the moment. */
413 // key_index = editnurb->shapenr - 1;
414 }
415 else {
416 nurbs = &cu->nurb;
417 }
418
419 const int elem_array_len = BKE_nurbList_verts_count(nurbs);
420 XFormObjectData_Curve *xod = static_cast<XFormObjectData_Curve *>(
421 MEM_mallocN(sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__));
422 memset(xod, 0x0, sizeof(*xod));
423
424 BKE_curve_nurbs_vert_coords_get(nurbs, xod->elem_array, elem_array_len);
425 xod_base = &xod->base;
426
427 if (key != nullptr) {
428 const size_t key_size = BKE_keyblock_element_calc_size_from_shape(key, key_index);
429 if (key_size) {
430 xod->key_data = MEM_mallocN(key_size, __func__);
432 key, static_cast<float(*)[3]>(xod->key_data), key_index);
433 }
434 }
435
436 break;
437 }
438 case ID_AR: {
439 bArmature *arm = (bArmature *)id;
440 if (is_edit_mode) {
441 const int elem_array_len = BLI_listbase_count(arm->edbo);
443 MEM_mallocN(sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__));
444 memset(xod, 0x0, sizeof(*xod));
445
447 xod_base = &xod->base;
448 }
449 else {
450 const int elem_array_len = BKE_armature_bonelist_count(&arm->bonebase);
452 MEM_mallocN(sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__));
453 memset(xod, 0x0, sizeof(*xod));
454
456 xod_base = &xod->base;
457 }
458 break;
459 }
460 case ID_MB: {
461 /* Edit mode and object mode are shared. */
462 MetaBall *mb = (MetaBall *)id;
463 const int elem_array_len = BLI_listbase_count(&mb->elems);
465 MEM_mallocN(sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__));
466 memset(xod, 0x0, sizeof(*xod));
467
469 xod_base = &xod->base;
470 break;
471 }
472 case ID_GD_LEGACY: {
473 bGPdata *gpd = (bGPdata *)id;
474 const int elem_array_len = BKE_gpencil_stroke_point_count(gpd);
476 MEM_mallocN(sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__));
477 memset(xod, 0x0, sizeof(*xod));
478
480 xod_base = &xod->base;
481 break;
482 }
483 case ID_GP: {
484 GreasePencil *grease_pencil = (GreasePencil *)id;
485 const int elem_array_len = BKE_grease_pencil_stroke_point_count(*grease_pencil);
487 MEM_mallocN(sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__));
488 memset(xod, 0x0, sizeof(*xod));
489
491 xod_base = &xod->base;
492 break;
493 }
494 default: {
495 break;
496 }
497 }
498 if (xod_base) {
499 xod_base->id = id;
500 xod_base->is_edit_mode = is_edit_mode;
501 }
502 return xod_base;
503}
504
506{
507 return data_xform_create_ex(id, false);
508}
509
514
516{
517 switch (GS(xod_base->id->name)) {
518 case ID_ME: {
520 if (xod->key_data != nullptr) {
521 MEM_freeN(xod->key_data);
522 }
523 break;
524 }
525 case ID_LT: {
527 if (xod->key_data != nullptr) {
528 MEM_freeN(xod->key_data);
529 }
530 break;
531 }
532 case ID_CU_LEGACY: {
534 if (xod->key_data != nullptr) {
535 MEM_freeN(xod->key_data);
536 }
537 break;
538 }
539 default: {
540 break;
541 }
542 }
543 MEM_freeN(xod_base);
544}
545
546void data_xform_by_mat4(XFormObjectData *xod_base, const float mat[4][4])
547{
548 switch (GS(xod_base->id->name)) {
549 case ID_ME: {
550 Mesh *mesh = (Mesh *)xod_base->id;
551
552 Key *key = mesh->key;
553 const int key_index = -1;
554
556 if (xod_base->is_edit_mode) {
557 BMesh *bm = mesh->runtime->edit_mesh->bm;
559 /* Always operate on all keys for the moment. */
560 // key_index = bm->shapenr - 1;
561 }
562 else {
563 MutableSpan<float3> positions = mesh->vert_positions_for_write();
564#ifdef __GNUC__ /* Invalid `xod->elem_array` warning with GCC 13.2.1. */
565# pragma GCC diagnostic push
566# pragma GCC diagnostic ignored "-Warray-bounds"
567#endif
568 for (const int i : positions.index_range()) {
569 mul_v3_m4v3(positions[i], mat, xod->elem_array[i]);
570 }
571#ifdef __GNUC__
572# pragma GCC diagnostic pop
573#endif
574 mesh->tag_positions_changed();
575 }
576
577 if (key != nullptr) {
579 key, key_index, static_cast<float(*)[3]>(xod->key_data), mat);
580 }
581
582 break;
583 }
584 case ID_LT: {
585 Lattice *lt_orig = (Lattice *)xod_base->id;
586 Lattice *lt = xod_base->is_edit_mode ? lt_orig->editlatt->latt : lt_orig;
587
588 Key *key = lt->key;
589 const int key_index = -1;
590
593 if (xod_base->is_edit_mode) {
594 /* Always operate on all keys for the moment. */
595 // key_index = lt_orig->editlatt->shapenr - 1;
596 }
597
598 if ((key != nullptr) && (xod->key_data != nullptr)) {
600 key, key_index, static_cast<float(*)[3]>(xod->key_data), mat);
601 }
602
603 break;
604 }
605 case ID_CU_LEGACY: {
606 BLI_assert(xod_base->is_edit_mode == false); /* Not used currently. */
607 Curve *cu = (Curve *)xod_base->id;
608
609 Key *key = cu->key;
610 const int key_index = -1;
611 ListBase *nurb = nullptr;
612
614 if (xod_base->is_edit_mode) {
615 EditNurb *editnurb = cu->editnurb;
616 nurb = &editnurb->nurbs;
618 &editnurb->nurbs, xod->elem_array, mat, CU_IS_2D(cu));
619 /* Always operate on all keys for the moment. */
620 // key_index = editnurb->shapenr - 1;
621 }
622 else {
623 nurb = &cu->nurb;
625 }
626
627 if ((key != nullptr) && (xod->key_data != nullptr)) {
628 BKE_keyblock_curve_data_set_with_mat4(key, nurb, key_index, xod->key_data, mat);
629 }
630
631 break;
632 }
633 case ID_AR: {
634 BLI_assert(xod_base->is_edit_mode == false); /* Not used currently. */
635 bArmature *arm = (bArmature *)xod_base->id;
637 if (xod_base->is_edit_mode) {
639 }
640 else {
642 }
643 break;
644 }
645 case ID_MB: {
646 /* Metaballs are a special case, edit-mode and object mode data is shared. */
647 MetaBall *mb = (MetaBall *)xod_base->id;
650 break;
651 }
652 case ID_GD_LEGACY: {
653 bGPdata *gpd = (bGPdata *)xod_base->id;
656 break;
657 }
658 case ID_GP: {
659 GreasePencil *grease_pencil = (GreasePencil *)xod_base->id;
662 *grease_pencil, xod->elem_array, float4x4(mat));
663 break;
664 }
665 default: {
666 break;
667 }
668 }
669}
670
672{
673 switch (GS(xod_base->id->name)) {
674 case ID_ME: {
675 Mesh *mesh = (Mesh *)xod_base->id;
676
677 Key *key = mesh->key;
678 const int key_index = -1;
679
681 if (xod_base->is_edit_mode) {
682 BMesh *bm = mesh->runtime->edit_mesh->bm;
684 /* Always operate on all keys for the moment. */
685 // key_index = bm->shapenr - 1;
686 }
687 else {
688 mesh->vert_positions_for_write().copy_from(
689 {reinterpret_cast<const float3 *>(xod->elem_array), mesh->verts_num});
690 mesh->tag_positions_changed();
691 }
692
693 if ((key != nullptr) && (xod->key_data != nullptr)) {
694 BKE_keyblock_data_set(key, key_index, xod->key_data);
695 }
696
697 break;
698 }
699 case ID_LT: {
700 Lattice *lt_orig = (Lattice *)xod_base->id;
701 Lattice *lt = xod_base->is_edit_mode ? lt_orig->editlatt->latt : lt_orig;
702
703 Key *key = lt->key;
704 const int key_index = -1;
705
708 if (xod_base->is_edit_mode) {
709 /* Always operate on all keys for the moment. */
710 // key_index = lt_orig->editlatt->shapenr - 1;
711 }
712
713 if ((key != nullptr) && (xod->key_data != nullptr)) {
714 BKE_keyblock_data_set(key, key_index, xod->key_data);
715 }
716
717 break;
718 }
719 case ID_CU_LEGACY: {
720 Curve *cu = (Curve *)xod_base->id;
721
722 Key *key = cu->key;
723 const int key_index = -1;
724
726 if (xod_base->is_edit_mode) {
727 EditNurb *editnurb = cu->editnurb;
729 /* Always operate on all keys for the moment. */
730 // key_index = editnurb->shapenr - 1;
731 }
732 else {
734 }
735
736 if ((key != nullptr) && (xod->key_data != nullptr)) {
737 BKE_keyblock_data_set(key, key_index, xod->key_data);
738 }
739
740 break;
741 }
742 case ID_AR: {
743 bArmature *arm = (bArmature *)xod_base->id;
745 if (xod_base->is_edit_mode) {
747 }
748 else {
750 }
751 break;
752 }
753 case ID_MB: {
754 /* Metaballs are a special case, edit-mode and object mode data is shared. */
755 MetaBall *mb = (MetaBall *)xod_base->id;
758 break;
759 }
760 case ID_GD_LEGACY: {
761 bGPdata *gpd = (bGPdata *)xod_base->id;
764 break;
765 }
766 case ID_GP: {
767 GreasePencil *grease_pencil = (GreasePencil *)xod_base->id;
770 break;
771 }
772 default: {
773 break;
774 }
775 }
776}
777
779{
780 switch (GS(xod_base->id->name)) {
781 case ID_ME: {
782 Mesh *mesh = (Mesh *)xod_base->id;
783 if (xod_base->is_edit_mode) {
785 params.calc_looptris = true;
786 params.calc_normals = true;
787 params.is_destructive = false;
788 EDBM_update(mesh, &params);
789 }
791 break;
792 }
793 case ID_LT: {
794 /* Generic update. */
795 Lattice *lt = (Lattice *)xod_base->id;
797 break;
798 }
799 case ID_CU_LEGACY: {
800 /* Generic update. */
801 Curve *cu = (Curve *)xod_base->id;
803 break;
804 }
805 case ID_AR: {
806 /* Generic update. */
807 bArmature *arm = (bArmature *)xod_base->id;
808 /* XXX, zero is needed, no other flags properly update this. */
809 DEG_id_tag_update(&arm->id, 0);
810 break;
811 }
812 case ID_MB: {
813 /* Generic update. */
814 MetaBall *mb = (MetaBall *)xod_base->id;
816 break;
817 }
818 case ID_GD_LEGACY: {
819 /* Generic update. */
820 bGPdata *gpd = (bGPdata *)xod_base->id;
822 break;
823 }
824 case ID_GP: {
825 /* Generic update. */
826 GreasePencil *grease_pencil = (GreasePencil *)xod_base->id;
828 break;
829 }
830
831 default: {
832 break;
833 }
834 }
835}
836
839} // namespace blender::ed::object
int BKE_armature_bonelist_count(const ListBase *lb)
Definition armature.cc:530
void BKE_armature_transform(bArmature *arm, const float mat[4][4], bool do_props)
Definition armature.cc:743
#define CU_IS_2D(cu)
Definition BKE_curve.hh:86
void BKE_curve_nurbs_vert_coords_get(const ListBase *lb, float(*vert_coords)[3], int vert_len)
Definition curve.cc:4528
void BKE_curve_nurbs_vert_coords_apply(ListBase *lb, const float(*vert_coords)[3], bool constrain_2d)
Definition curve.cc:4602
void BKE_curve_nurbs_vert_coords_apply_with_mat4(ListBase *lb, const float(*vert_coords)[3], const float mat[4][4], bool constrain_2d)
Definition curve.cc:4565
int BKE_nurbList_verts_count(const ListBase *nurb)
Definition curve.cc:535
short BKE_curve_type_get(const Curve *cu)
Definition curve.cc:416
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(const struct bGPdata *gpd)
void BKE_gpencil_point_coords_apply_with_mat4(struct bGPdata *gpd, const GPencilPointCoordinates *elem_data, const float mat[4][4])
Low-level operations for grease pencil.
void BKE_grease_pencil_point_coords_get(const GreasePencil &grease_pencil, GreasePencilPointCoordinates *elem_data)
void BKE_grease_pencil_point_coords_apply_with_mat4(GreasePencil &grease_pencil, GreasePencilPointCoordinates *elem_data, const blender::float4x4 &mat)
void BKE_grease_pencil_point_coords_apply(GreasePencil &grease_pencil, GreasePencilPointCoordinates *elem_data)
int BKE_grease_pencil_stroke_point_count(const GreasePencil &grease_pencil)
void BKE_keyblock_data_set(Key *key, int shape_index, const void *data)
Definition key.cc:1748
void BKE_keyblock_data_set_with_mat4(Key *key, int shape_index, const float(*coords)[3], const float mat[4][4])
Definition key.cc:1706
void BKE_keyblock_curve_data_set_with_mat4(Key *key, const ListBase *nurb, int shape_index, const void *data, const float mat[4][4])
Definition key.cc:1733
void BKE_keyblock_data_get_from_shape(const Key *key, float(*arr)[3], int shape_index)
Definition key.cc:1686
size_t BKE_keyblock_element_calc_size_from_shape(const Key *key, int shape_index)
Definition key.cc:1669
void BKE_lattice_vert_coords_apply(Lattice *lt, const float(*vert_coords)[3])
Definition lattice.cc:508
void BKE_lattice_vert_coords_apply_with_mat4(Lattice *lt, const float(*vert_coords)[3], const float mat[4][4])
Definition lattice.cc:498
void BKE_lattice_vert_coords_get(const Lattice *lt, float(*vert_coords)[3])
Definition lattice.cc:481
void BKE_mball_transform(MetaBall *mb, const float mat[4][4], bool do_props)
Definition mball.cc:500
#define BLI_assert(a)
Definition BLI_assert.h:50
#define LISTBASE_FOREACH(type, var, list)
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:1127
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
void copy_qt_qt(float q[4], const float a[4])
MINLINE void copy_v3_v3(float r[3], const float a[3])
void DEG_id_tag_update(ID *id, unsigned int flags)
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1085
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1041
@ ID_AR
@ ID_CU_LEGACY
@ ID_GD_LEGACY
@ ID_ME
@ ID_MB
@ ID_LT
@ ID_GP
Object is a sort of wrapper for general info.
@ OB_FONT
void EDBM_update(Mesh *mesh, const EDBMUpdate_Params *params)
Read Guarded memory(de)allocation.
void ED_armature_edit_transform(bArmature *arm, const float mat[4][4], const bool do_props)
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])
void BM_mesh_vert_coords_apply(BMesh *bm, const float(*vert_coords)[3])
void BM_mesh_vert_coords_get(BMesh *bm, MutableSpan< float3 > positions)
constexpr void copy_from(Span< T > values) const
Definition BLI_span.hh:726
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
#define GS(x)
Definition iris.cc:202
void *(* MEM_mallocN)(size_t len, const char *str)
Definition mallocn.cc:44
void MEM_freeN(void *vmemh)
Definition mallocn.cc:105
XFormObjectData * data_xform_create(ID *id)
XFormObjectData * data_xform_create_from_edit_mode(ID *id)
static void metaball_coords_and_quats_apply_with_mat4(MetaBall *mb, const ElemData_MetaBall *elem_array, const float mat[4][4])
XFormObjectData * data_xform_create_ex(ID *id, bool is_edit_mode)
void data_xform_destroy(XFormObjectData *xod_base)
static void armature_coords_and_quats_apply_with_mat4(bArmature *arm, const ElemData_Armature *elem_array, const float mat[4][4])
static void edit_armature_coords_and_quats_apply_with_mat4(bArmature *arm, const ElemData_Armature *elem_array, const float mat[4][4])
void data_xform_by_mat4(XFormObjectData *xod, const float mat[4][4])
static void armature_coords_and_quats_apply(bArmature *arm, const ElemData_Armature *elem_array)
static void armature_coords_and_quats_get(const bArmature *arm, ElemData_Armature *elem_array)
static ElemData_Armature * armature_coords_and_quats_get_recurse(const ListBase *bone_base, ElemData_Armature *elem_array)
static void edit_armature_coords_and_quats_get(const bArmature *arm, ElemData_Armature *elem_array)
static void metaball_coords_and_quats_get(const MetaBall *mb, ElemData_MetaBall *elem_array)
static void metaball_coords_and_quats_apply(MetaBall *mb, const ElemData_MetaBall *elem_array)
static void edit_armature_coords_and_quats_apply(bArmature *arm, const ElemData_Armature *elem_array)
void data_xform_tag_update(XFormObjectData *xod)
static const ElemData_Armature * armature_coords_and_quats_apply_with_mat4_recurse(ListBase *bone_base, const ElemData_Armature *elem_array, const float mat[4][4])
void data_xform_restore(XFormObjectData *xod)
#define COPY_PTR(member)
#define COPY_VAL(member)
int totvert
struct Key * key
EditNurb * editnurb
ListBase nurb
struct Lattice * latt
ListBase nurbs
Definition DNA_ID.h:413
char name[66]
Definition DNA_ID.h:425
struct Key * key
struct EditLatt * editlatt
void * first
ListBase elems
ListBase * edbo