Blender V5.3
armature_deform_test.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "BLI_listbase.hh"
8#include "BLI_string.hh"
9
10#include "BKE_action.hh"
11#include "BKE_armature.hh"
12#include "BKE_curves.hh"
13#include "BKE_deform.hh"
14#include "BKE_editmesh.hh"
15#include "BKE_grease_pencil.hh"
16#include "BKE_gtest_base.hh"
17#include "BKE_idtype.hh"
18#include "BKE_lib_id.hh"
19#include "BKE_main.hh"
20#include "BKE_mesh.hh"
21#include "BKE_object.hh"
22#include "BKE_object_deform.h"
23#include "BKE_pose.hh"
24
25#include "DNA_armature_types.h"
26#include "DNA_curves_types.h"
28#include "DNA_meshdata_types.h"
29#include "DNA_object_types.h"
30
31#include "testing/testing.h"
32
33/* TODO Parameterized tests are not registered in `blender_test`.
34 * Possible reason: the cmake gtest_add_tests function may not be able to detect them reliably.
35 * https://cmake.org/cmake/help/latest/module/GoogleTest.html
36 * https://www.kitware.com/dynamic-google-test-discovery-in-cmake-3-10/
37 */
38// #define USE_PARAMETERIZED_TESTS
39
40namespace blender::bke::tests {
41
42/* Type of data that is being deformed.
43 * This distinction is needed to handle some inconsistent behaviors. */
50
52 /* Linear interpolation. */
54 /* Dual-quaternion method, aka. "Preserve Volume" (ARM_DEF_QUATERNION). */
55 DualQuaternion,
56};
57
58enum class OutputValueTest {
59 /* Only position vector. */
61 /* Vector and deformation matrix ("full deform"). */
63};
64
65enum class WeightingTest {
66 /* Disabled (no deform). */
67 None,
68 /* Falloff from closest envelope point. */
70 /* Vertex group weight. */
72 /* Use both envelopes and vertex groups. */
74};
75
76enum class MaskingTest {
77 /* Deform all vertices. */
79 /* Limit deformation to one vertex group. */
81};
82
83/* Defines the source of vertex groups and weights for mesh deformation. */
85 /* Read vertex groups and weights from the target object's mesh data. */
87 /* Use a separate mesh for defining vertex weights. */
89};
90
92 public:
94
95 /* Translation for bones.
96 * Rotation is omitted here for simplicity, the goal is to test all the code paths rather than
97 * the details of the bone transformation. Other tests are more suitable for comparing
98 * deformation results. */
100 {
101 return float3(5, 0, 1);
102 }
104 {
105 return float3(0, -2, 0);
106 }
107
108 /* This happens usually in BKE_pose_bone_done. Update here to avoid creating a full depsgraph. */
110 {
111 BKE_pchan_calc_mat(pchanbone);
112 if (!(pchanbone.bone->flag & BONE_NO_DEFORM)) {
114 pchanbone.bone->arm_mat,
115 pchanbone.pchan->chan_mat);
116 }
117 }
118
120 {
121 Object *ob = BKE_object_add_only_object(bmain, OB_ARMATURE, "Test Armature Object");
122 bArmature *arm = BKE_id_new<bArmature>(bmain, "Test Armature");
123 ob->data = id_cast<ID *>(arm);
124
125 Bone *bone1 = MEM_new<Bone>("Bone1");
126 STRNCPY(bone1->name, "Bone1");
127 copy_v3_v3(bone1->tail, float3(0, 0, 0));
128 copy_v3_v3(bone1->head, float3(0, 0, 1));
129 BLI_addtail(&arm->bonebase, bone1);
130 BKE_armature_where_is_bone(bone1, nullptr, false);
131 bone1->weight = 1.0f;
132 /* Bone envelope large enough to include all vertices.
133 * Falloff math isn't tested here, just have to make sure vertices are included. */
134 bone1->rad_head = 2.0f;
135 bone1->rad_tail = 2.0f;
136
137 Bone *bone2 = MEM_new<Bone>("Bone2");
138 STRNCPY(bone2->name, "Bone2");
139 copy_v3_v3(bone2->tail, float3(0, 0, 0));
140 copy_v3_v3(bone2->head, float3(0, 0, 1));
141 BLI_addtail(&arm->bonebase, bone2);
142 BKE_armature_where_is_bone(bone2, nullptr, false);
143 bone2->weight = 1.0f;
144 bone2->rad_head = 2.0f;
145 bone2->rad_tail = 2.0f;
146
147 BKE_pose_ensure(bmain, ob, arm, false);
148
149 bPoseChannel *pchan1 = BKE_pose_channel_find_name(ob->pose, "Bone1");
150 bPoseChannel *pchan2 = BKE_pose_channel_find_name(ob->pose, "Bone2");
151 copy_v3_v3(pchan1->loc, offset_bone1());
152 copy_v3_v3(pchan2->loc, offset_bone2());
153 update_pose_matrices({pchan1, bone1});
154 update_pose_matrices({pchan2, bone2});
155
156 return ob;
157 }
158
160 {
161 static Array<float3> data = {float3(-1, -1, -1),
162 float3(1, -1, -1),
163 float3(-1, 1, -1),
164 float3(1, 1, -1),
165 float3(-1, -1, 1),
166 float3(1, -1, 1),
167 float3(-1, 1, 1),
168 float3(1, 1, 1)};
169 return data;
170 }
171
176
178 {
179 static Array<float> data = {1, 1, 1, 1, 1, 1, 1, 1};
180 return data;
181 }
182
184 {
185 static Array<float> data = {0, 0, 0, 0, 1, 1, 1, 1};
186 return data;
187 }
188
190 {
191 static Array<int> data = {0, 2, 5, 8};
192 return data;
193 }
194
196 {
197 Mesh *mesh = BKE_mesh_new_nomain(vertex_positions().size(), 0, 0, 0);
198 mesh->vert_positions_for_write().copy_from(vertex_positions());
199 MutableSpan<MDeformVert> dverts = mesh->deform_verts_for_write();
200 for (const int i : dverts.index_range()) {
201 const float weight0 = vertex_weights_bone1()[i];
202 const float weight1 = vertex_weights_bone2()[i];
203
204 if (weight0 > 0.0f) {
205 BKE_defvert_add_index_notest(&dverts[i], 0, weight0);
206 }
207 if (weight1 > 0.0f) {
208 BKE_defvert_add_index_notest(&dverts[i], 1, weight1);
209 }
210 }
211 mesh->tag_positions_changed();
212
213 bDeformGroup *defgroup1 = MEM_new<bDeformGroup>(__func__);
214 bDeformGroup *defgroup2 = MEM_new<bDeformGroup>(__func__);
215 STRNCPY(defgroup1->name, "Bone1");
216 STRNCPY(defgroup2->name, "Bone2");
217 BLI_addtail(&mesh->vertex_group_names, defgroup1);
218 BLI_addtail(&mesh->vertex_group_names, defgroup2);
219
220 return mesh;
221 }
222
223 /* Creates a cube with all vertices in "Bone1" group and the top face in "Bone2" group. */
225 {
226 Object *ob = BKE_object_add_only_object(bmain, OB_MESH, "Test Mesh Object");
227 Mesh *mesh_in_main = BKE_mesh_add(bmain, "Test Mesh");
228 ob->data = id_cast<ID *>(mesh_in_main);
229
231 BKE_mesh_nomain_to_mesh(mesh, mesh_in_main, ob);
232 BLI_assert(!mesh_in_main->deform_verts().is_empty());
233
234 return ob;
235 }
236
237 /* Creates curves with a mix of vertices in "Bone1" and "Bone2" groups.
238 * Curves datablock does not support vertex groups at this point, these are ignored. */
240 {
241 Object *ob = BKE_object_add_only_object(bmain, OB_CURVES, "Test Curves Object");
242 Curves *curves_id = BKE_curves_add(bmain, "Test Curves");
243 ob->data = id_cast<ID *>(curves_id);
244 bke::CurvesGeometry &curves = curves_id->geometry.wrap();
245
246 curves.resize(vertex_positions().size(), 3);
247 curves.offsets_for_write().copy_from(curve_offsets());
248
249 curves.positions_for_write().copy_from(vertex_positions());
250 MutableSpan<MDeformVert> dverts = curves.deform_verts_for_write();
251 for (const int i : dverts.index_range()) {
252 const float weight0 = vertex_weights_bone1()[i];
253 const float weight1 = vertex_weights_bone2()[i];
254
255 if (weight0 > 0.0f) {
256 BKE_defvert_add_index_notest(&dverts[i], 0, weight0);
257 }
258 if (weight1 > 0.0f) {
259 BKE_defvert_add_index_notest(&dverts[i], 1, weight1);
260 }
261 }
262 curves.tag_topology_changed();
263 curves.tag_positions_changed();
264
265 return ob;
266 }
267
268 /* Creates grease pencil with a mix of vertices in "Bone1" and "Bone2" groups. */
270 {
271 Object *ob = BKE_object_add_only_object(bmain, OB_GREASE_PENCIL, "Test Grease Pencil Object");
272 GreasePencil *grease_pencil = BKE_grease_pencil_add(bmain, "Test Grease Pencil");
273 ob->data = id_cast<ID *>(grease_pencil);
274
275 bke::greasepencil::Layer &layer = grease_pencil->add_layer("Test");
276 greasepencil::Drawing &drawing = grease_pencil->insert_frame(layer, 1)->wrap();
278
279 curves.resize(vertex_positions().size(), 3);
280 curves.offsets_for_write().copy_from(curve_offsets());
281
282 curves.positions_for_write().copy_from(vertex_positions());
283 MutableSpan<MDeformVert> dverts = curves.deform_verts_for_write();
284 for (const int i : dverts.index_range()) {
285 const float weight0 = vertex_weights_bone1()[i];
286 const float weight1 = vertex_weights_bone2()[i];
287
288 if (weight0 > 0.0f) {
289 BKE_defvert_add_index_notest(&dverts[i], 0, weight0);
290 }
291 if (weight1 > 0.0f) {
292 BKE_defvert_add_index_notest(&dverts[i], 1, weight1);
293 }
294 }
295 curves.tag_topology_changed();
296 curves.tag_positions_changed();
297
298 BKE_object_defgroup_new(ob, "Bone1");
299 BKE_object_defgroup_new(ob, "Bone2");
300
301 return ob;
302 }
303
304 /* Select the expected positions result based on data type and parameters. */
306 const WeightingTest weighting,
307 const MaskingTest masking)
308 {
309 /* Both bones weighted equally. */
310 static Array<float3> data_envelope = {float3(1.5f, -2, -0.5f),
311 float3(3.5f, -2, -0.5f),
312 float3(1.5f, 0, -0.5f),
313 float3(3.5f, 0, -0.5f),
314 float3(1.5f, -2, 1.5f),
315 float3(3.5f, -2, 1.5f),
316 float3(1.5f, 0, 1.5f),
317 float3(3.5f, 0, 1.5f)};
318 static Array<float3> data_envelope_masked = {float3(-1, -1, -1),
319 float3(1, -1, -1),
320 float3(-1, 1, -1),
321 float3(1, 1, -1),
322 float3(1.5f, -2, 1.5f),
323 float3(3.5f, -2, 1.5f),
324 float3(1.5f, 0, 1.5f),
325 float3(3.5f, 0, 1.5f)};
326 /* Bottom verts deformed only by Bone1, top group deformed equally by both bones. */
327 static Array<float3> data_vgroups = {float3(4, -1, 0),
328 float3(6, -1, 0),
329 float3(4, 1, 0),
330 float3(6, 1, 0),
331 float3(1.5f, -2, 1.5f),
332 float3(3.5f, -2, 1.5f),
333 float3(1.5f, 0, 1.5f),
334 float3(3.5f, 0, 1.5f)};
335 static Array<float3> data_vgroups_masked = {float3(-1, -1, -1),
336 float3(1, -1, -1),
337 float3(-1, 1, -1),
338 float3(1, 1, -1),
339 float3(1.5f, -2, 1.5f),
340 float3(3.5f, -2, 1.5f),
341 float3(1.5f, 0, 1.5f),
342 float3(3.5f, 0, 1.5f)};
343
344 /* Curves data type does not support vertext groups. */
345 const bool vgroups_supported = ELEM(
347 /* Might be a bug: Mesh and GreasePencil allows masking even in envelope mode, but EditMesh
348 * does not! Curves does not have vgroups and therefore masking in the first place. */
349 const bool allow_masking_with_envelope = ELEM(
351 const bool vertex_groups_enabled = ELEM(
353 const bool masked = (masking == MaskingTest::VertexGroup) &&
354 ((vgroups_supported && vertex_groups_enabled) ||
355 allow_masking_with_envelope);
356
357 switch (weighting) {
359 return vertex_positions();
361 return masked ? data_envelope_masked : data_envelope;
363 if (vgroups_supported) {
364 return masked ? data_vgroups_masked : data_vgroups;
365 }
366 else {
367 return vertex_positions();
368 }
370 if (vgroups_supported) {
371 return masked ? data_vgroups_masked : data_vgroups;
372 }
373 else {
374 return masked ? data_envelope_masked : data_envelope;
375 }
376 }
378 return {};
379 }
380
382 {
383 static Array<float3x3> data_zero = identity_deform_mats();
392
393 switch (weighting) {
395 return data_zero;
399 return data;
400 }
401 return {};
402 }
403
404 static int get_deform_flag(const InterpolationTest interpolation, const WeightingTest weighting)
405 {
406 int deform_flag = 0;
407
408 switch (interpolation) {
410 /* Nothing to change, default mode. */
411 break;
413 deform_flag |= ARM_DEF_QUATERNION;
414 break;
415 }
416
417 switch (weighting) {
419 /* Nothing to do. */
420 break;
422 deform_flag |= ARM_DEF_ENVELOPE;
423 break;
425 deform_flag |= ARM_DEF_VGROUP;
426 break;
428 deform_flag |= ARM_DEF_ENVELOPE | ARM_DEF_VGROUP;
429 break;
430 }
431
432 return deform_flag;
433 }
434
435 static const char *get_defgrp_name(const MaskingTest masking)
436 {
437 switch (masking) {
438 case MaskingTest::All:
439 return "";
441 return "Bone2";
442 }
444 return "";
445 }
446
447 void mesh_test(const InterpolationTest interpolation,
449 const WeightingTest weighting,
450 const MaskingTest masking,
451 const VertexWeightSource dvert_source)
452 {
453 Object *ob_arm = this->create_test_armature_object();
454 Object *ob_target = this->create_test_mesh_object();
455 Mesh *mesh = id_cast<Mesh *>(ob_target->data);
456 /* Mesh deform function supports a separate Mesh data block for deform_groups and dverts. */
457 Mesh *mesh_target = (dvert_source == VertexWeightSource::SeparateMesh) ? create_test_mesh() :
458 nullptr;
459
460 MutableSpan<float3> vert_positions = mesh->vert_positions_for_write();
461
462 Array<float3x3> deform_mats;
463 std::optional<MutableSpan<float3x3>> deform_mats_opt;
465 deform_mats = identity_deform_mats();
466 deform_mats_opt = deform_mats;
467 }
468
469 const int deform_flag = get_deform_flag(interpolation, weighting);
470 const char *defgrp_name = get_defgrp_name(masking);
472 *ob_target,
473 vert_positions,
474 std::nullopt,
475 deform_mats_opt,
476 deform_flag,
477 defgrp_name,
478 mesh_target);
479
480 EXPECT_EQ_SPAN(expected_positions(TargetDataType::Mesh, weighting, masking),
481 vert_positions.as_span());
483 EXPECT_EQ_SPAN(expected_deform_mats(weighting), deform_mats.as_span());
484 }
485
486 if (mesh_target) {
487 /* Not in bmain. */
488 BKE_id_free(nullptr, mesh_target);
489 }
490 BKE_id_delete(bmain, ob_arm);
491 BKE_id_delete(bmain, ob_target);
492 }
493
494 void edit_mesh_test(const InterpolationTest interpolation,
496 const WeightingTest weighting,
497 const MaskingTest masking)
498 {
499 Object *ob_arm = this->create_test_armature_object();
500 Object *ob_target = this->create_test_mesh_object();
501 Mesh *mesh = id_cast<Mesh *>(ob_target->data);
502
503 BMeshCreateParams create_params{};
504 create_params.use_toolflags = true;
505 BMesh *bm = BKE_mesh_to_bmesh(mesh, 0, false, &create_params);
506 mesh->runtime->edit_mesh = std::make_shared<BMEditMesh>();
507 mesh->runtime->edit_mesh->bm = bm;
508 Array<float3> bm_verts_wrapper = BM_mesh_vert_coords_alloc(bm);
509
510 Array<float3x3> deform_mats;
511 std::optional<MutableSpan<float3x3>> deform_mats_opt;
513 deform_mats = identity_deform_mats();
514 deform_mats_opt = deform_mats;
515 }
516
517 const int deform_flag = get_deform_flag(interpolation, weighting);
518 const char *defgrp_name = get_defgrp_name(masking);
520 *ob_target,
521 bm_verts_wrapper,
522 std::nullopt,
523 deform_mats_opt,
524 deform_flag,
525 defgrp_name,
526 *bm);
527
528 EXPECT_EQ_SPAN(expected_positions(TargetDataType::EditMesh, weighting, masking),
529 bm_verts_wrapper.as_span());
531 EXPECT_EQ_SPAN(expected_deform_mats(weighting), deform_mats.as_span());
532 }
533
534 BKE_editmesh_free_data(mesh->runtime->edit_mesh.get());
535 mesh->runtime->edit_mesh.reset();
536 BKE_id_delete(bmain, ob_arm);
537 BKE_id_delete(bmain, ob_target);
538 }
539
540 void curves_test(const InterpolationTest interpolation,
542 const WeightingTest weighting,
543 const MaskingTest masking)
544 {
545 Object *ob_arm = this->create_test_armature_object();
546 Object *ob_target = this->create_test_curves_object();
547 Curves *curves_id = id_cast<Curves *>(ob_target->data);
548 bke::CurvesGeometry &curves = curves_id->geometry.wrap();
549
550 Array<float3x3> deform_mats;
551 std::optional<MutableSpan<float3x3>> deform_mats_opt;
553 deform_mats = identity_deform_mats();
554 deform_mats_opt = deform_mats;
555 }
556
557 const int deform_flag = get_deform_flag(interpolation, weighting);
558 const char *defgrp_name = get_defgrp_name(masking);
560 *ob_target,
561 nullptr,
562 curves.positions_for_write(),
563 std::nullopt,
564 deform_mats_opt,
565 curves.deform_verts(),
566 deform_flag,
567 defgrp_name);
568
569 /* Note: Curves objects don't support vertex groups. */
570 EXPECT_EQ_SPAN(expected_positions(TargetDataType::Curves, weighting, masking),
571 curves.positions());
573 EXPECT_EQ_SPAN(expected_deform_mats(weighting), deform_mats.as_span());
574 }
575
576 BKE_id_delete(bmain, ob_arm);
577 BKE_id_delete(bmain, ob_target);
578 }
579
580 void grease_pencil_test(const InterpolationTest interpolation,
582 const WeightingTest weighting,
583 const MaskingTest masking)
584 {
585 Object *ob_arm = this->create_test_armature_object();
586 Object *ob_target = this->create_test_grease_pencil_object();
587 GreasePencil *grease_pencil = id_cast<GreasePencil *>(ob_target->data);
588
589 BLI_assert(!grease_pencil->drawings().is_empty());
590 GreasePencilDrawingBase *drawing_base = grease_pencil->drawings()[0];
591 BLI_assert(drawing_base->type == GP_DRAWING);
592 greasepencil::Drawing &drawing = reinterpret_cast<GreasePencilDrawing *>(drawing_base)->wrap();
594
595 Array<float3x3> deform_mats;
596 std::optional<MutableSpan<float3x3>> deform_mats_opt;
598 deform_mats = identity_deform_mats();
599 deform_mats_opt = deform_mats;
600 }
601
602 const int deform_flag = get_deform_flag(interpolation, weighting);
603 const char *defgrp_name = get_defgrp_name(masking);
605 *ob_target,
606 &grease_pencil->vertex_group_names,
607 curves.positions_for_write(),
608 std::nullopt,
609 deform_mats_opt,
610 curves.deform_verts(),
611 deform_flag,
612 defgrp_name);
613
614 EXPECT_EQ_SPAN(expected_positions(TargetDataType::GreasePencil, weighting, masking),
615 curves.positions());
617 EXPECT_EQ_SPAN(expected_deform_mats(weighting), deform_mats.as_span());
618 }
619
620 BKE_id_delete(bmain, ob_arm);
621 BKE_id_delete(bmain, ob_target);
622 }
623};
624
625#ifdef USE_PARAMETERIZED_TESTS
626
627using ArmatureDeformTestParams =
628 std::tuple<InterpolationTest, OutputValueTest, WeightingTest, MaskingTest, VertexWeightSource>;
629
630class ArmatureDeformParamTest : public ArmatureDeformTestBase,
631 public testing::TestWithParam<ArmatureDeformTestParams> {
632 public:
633 static void SetUpTestSuite()
634 {
636 }
637
638 static void TearDownTestSuite()
639 {
641 }
642
643 void SetUp() override
644 {
645 bmain = BKE_main_new();
646 }
647
648 void TearDown() override
649 {
650 BKE_main_free(bmain);
651 }
652};
653
654TEST_P(ArmatureDeformParamTest, MeshDeformParameterized)
655{
656 const ArmatureDeformTestParams &params = this->GetParam();
657 InterpolationTest interpolation = std::get<0>(params);
658 OutputValueTest output = std::get<1>(params);
659 WeightingTest weighting = std::get<2>(params);
660 MaskingTest masking = std::get<3>(params);
661 VertexWeightSource dvert_source = std::get<4>(params);
662
663 mesh_test(interpolation, output, weighting, masking, dvert_source);
664}
665
666TEST_P(ArmatureDeformParamTest, EditMeshDeformParameterized)
667{
668 const ArmatureDeformTestParams &params = this->GetParam();
669 InterpolationTest interpolation = std::get<0>(params);
670 OutputValueTest output = std::get<1>(params);
671 WeightingTest weighting = std::get<2>(params);
672 MaskingTest masking = std::get<3>(params);
673
674 edit_mesh_test(interpolation, output, weighting, masking);
675}
676
677TEST_P(ArmatureDeformParamTest, CurvesDeformParameterized)
678{
679 const ArmatureDeformTestParams &params = this->GetParam();
680 InterpolationTest interpolation = std::get<0>(params);
681 OutputValueTest output = std::get<1>(params);
682 WeightingTest weighting = std::get<2>(params);
683 MaskingTest masking = std::get<3>(params);
684
685 curves_test(interpolation, output, weighting, masking);
686}
687
688TEST_P(ArmatureDeformParamTest, GreasePencilDeformParameterized)
689{
690 const ArmatureDeformTestParams &params = this->GetParam();
691 InterpolationTest interpolation = std::get<0>(params);
692 OutputValueTest output = std::get<1>(params);
693 WeightingTest weighting = std::get<2>(params);
694 MaskingTest masking = std::get<3>(params);
695
696 grease_pencil_test(interpolation, output, weighting, masking);
697}
698
700 AllArmatureDeformTests,
701 ArmatureDeformParamTest,
702 testing::Combine(
705 testing::Values(WeightingTest::None,
711 [](const testing::TestParamInfo<ArmatureDeformTestParams> &info) {
712 InterpolationTest interpolation = std::get<0>(info.param);
713 OutputValueTest output = std::get<1>(info.param);
714 WeightingTest weighting = std::get<2>(info.param);
715 MaskingTest masking = std::get<3>(info.param);
716 VertexWeightSource dvert_source = std::get<4>(info.param);
717
718 std::string name;
719 switch (interpolation) {
721 name += "linear";
722 break;
724 name += "dualquat";
725 break;
726 }
727 switch (output) {
729 name += "_pos";
730 break;
732 name += "_posdefmat";
733 break;
734 }
735 switch (weighting) {
737 name += "_disabled";
738 break;
740 name += "_envelope";
741 break;
743 name += "_vgroups";
744 break;
746 name += "_envelopevgroups";
747 break;
748 }
749 switch (masking) {
750 case MaskingTest::All:
751 break;
753 name += "_masked";
754 break;
755 }
756 switch (dvert_source) {
758 break;
760 name += "_dvertsource";
761 break;
762 }
763 return name;
764 });
765
766#else // USE_PARAMETERIZED_TESTS
767
768class ArmatureDeformTest : public ArmatureDeformTestBase, public testing::Test {
769 public:
770 static void SetUpTestSuite()
771 {
773 }
774
775 static void TearDownTestSuite()
776 {
778 }
779
780 void SetUp() override
781 {
783 }
784
785 void TearDown() override
786 {
788 }
789};
790
813
832
851
870
871#endif
872
873} // namespace blender::bke::tests
Blender kernel action and pose functionality.
Low-level operations for curves.
support for deformation groups and hooks.
Low-level operations for grease pencil.
General operations, lookup, etc. for blender objects.
Functions for dealing with objects and deform verts, used by painting and tools.
Object is a sort of wrapper for general info.
#define BLI_assert_unreachable()
#define ELEM(...)
#define output
Span< T > as_span() const
Definition BLI_array.hh:254
Array(Allocator allocator={}) noexcept
Definition BLI_array.hh:78
constexpr Span< T > as_span() const
Definition BLI_span.hh:667
constexpr IndexRange index_range() const
Definition BLI_span.hh:676
bke::CurvesGeometry & strokes_for_write()
static Span< float3x3 > expected_deform_mats(const WeightingTest weighting)
void grease_pencil_test(const InterpolationTest interpolation, const OutputValueTest output, const WeightingTest weighting, const MaskingTest masking)
void edit_mesh_test(const InterpolationTest interpolation, const OutputValueTest output, const WeightingTest weighting, const MaskingTest masking)
static int get_deform_flag(const InterpolationTest interpolation, const WeightingTest weighting)
static void update_pose_matrices(bke::PChanBone pchanbone)
static const char * get_defgrp_name(const MaskingTest masking)
void mesh_test(const InterpolationTest interpolation, const OutputValueTest output, const WeightingTest weighting, const MaskingTest masking, const VertexWeightSource dvert_source)
static Span< float3 > expected_positions(const TargetDataType target_type, const WeightingTest weighting, const MaskingTest masking)
void curves_test(const InterpolationTest interpolation, const OutputValueTest output, const WeightingTest weighting, const MaskingTest masking)
#define layer
TEST_F(AnimDataTest, BKE_fcurves_id_cb_test)
PChanBoneT< bPoseChannel, Bone > PChanBone
Definition BKE_pose.hh:88
void gtest_teardown()
void gtest_setup()
INSTANTIATE_TEST_SUITE_P(, VKRenderGraphTestRender, ::testing::Values(true, false))
TEST_P(VKRenderGraphTestRender, begin_clear_attachments_end_read_back)
BLI_INLINE Texture * wrap(MTLTexture *texture)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void BKE_pchan_calc_mat(bke::PChanBone pchanbone)
char * STRNCPY(char(&dst)[N], const char *src)
struct Curves * BKE_curves_add(struct Main *bmain, const char *name)
void BKE_id_delete(Main *bmain, void *idv, const BKEIDDeleteOptions &options={}) ATTR_NONNULL()
MINLINE void copy_v3_v3(float r[3], const float a[3])
void BKE_pose_ensure(Main *bmain, Object *ob, bArmature *arm, bool do_id_user)
void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, Mesh *mesh_dst, Object *ob, bool process_shape_keys=true)
Main * BKE_main_new()
Definition main.cc:93
GreasePencil * BKE_grease_pencil_add(Main *bmain, const char *name)
BMesh const char void * data
void BKE_editmesh_free_data(BMEditMesh *em)
Definition editmesh.cc:162
void BKE_armature_deform_coords_with_curves(const Object &ob_arm, const Object &ob_target, const ListBaseT< bDeformGroup > *defbase, MutableSpan< float3 > vert_coords, std::optional< Span< float3 > > vert_coords_prev, std::optional< MutableSpan< float3x3 > > vert_deform_mats, Span< MDeformVert > dverts, int deformflag, StringRefNull defgrp_name)
Mesh * BKE_mesh_new_nomain(int verts_num, int edges_num, int faces_num, int corners_num)
BMesh * BKE_mesh_to_bmesh(Mesh *mesh, int active_shapekey, bool add_key_index, const BMeshCreateParams *params)
Array< float3 > BM_mesh_vert_coords_alloc(const BMesh *bm)
void BKE_armature_deform_coords_with_mesh(const Object &ob_arm, const Object &ob_target, MutableSpan< float3 > vert_coords, std::optional< Span< float3 > > vert_coords_prev, std::optional< MutableSpan< float3x3 > > vert_deform_mats, int deformflag, StringRefNull defgrp_name, const Mesh *me_target)
void BKE_id_free(Main *bmain, void *idv)
void BKE_armature_where_is_bone(Bone *bone, const Bone *bone_parent, bool use_recursion)
void BKE_main_free(Main *bmain)
Definition main.cc:202
void mat4_to_dquat(DualQuat *dq, const float basemat[4][4], const float mat[4][4])
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
bDeformGroup * BKE_object_defgroup_new(Object *ob, StringRef name)
Definition deform.cc:51
void BKE_defvert_add_index_notest(MDeformVert *dv, int defgroup, float weight)
Definition deform.cc:861
void BKE_armature_deform_coords_with_editmesh(const Object &ob_arm, const Object &ob_target, MutableSpan< float3 > vert_coords, std::optional< Span< float3 > > vert_coords_prev, std::optional< MutableSpan< float3x3 > > vert_deform_mats, int deformflag, StringRefNull defgrp_name, const BMesh &bm_target)
VecBase< float, 3 > float3
Object * BKE_object_add_only_object(Main *bmain, ObjectType type, const char *name) ATTR_RETURNS_NONNULL
Definition object.cc:2265
Mesh * BKE_mesh_add(Main *bmain, const char *name)
void * BKE_id_new(Main *bmain, short type, const char *name)
Definition lib_id.cc:1612
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
struct bPose * pose
ListBaseT< Bone > bonebase
struct bPoseChannel_Runtime runtime
PoseChannelT * pchan
Definition BKE_pose.hh:61