31#include "testing/testing.h"
123 ob->
data = id_cast<ID *>(arm);
125 Bone *bone1 = MEM_new<Bone>(
"Bone1");
137 Bone *bone2 = MEM_new<Bone>(
"Bone2");
204 if (weight0 > 0.0f) {
207 if (weight1 > 0.0f) {
211 mesh->tag_positions_changed();
213 bDeformGroup *defgroup1 = MEM_new<bDeformGroup>(__func__);
214 bDeformGroup *defgroup2 = MEM_new<bDeformGroup>(__func__);
228 ob->
data = id_cast<ID *>(mesh_in_main);
232 BLI_assert(!mesh_in_main->deform_verts().is_empty());
243 ob->
data = id_cast<ID *>(curves_id);
255 if (weight0 > 0.0f) {
258 if (weight1 > 0.0f) {
262 curves.tag_topology_changed();
263 curves.tag_positions_changed();
288 if (weight0 > 0.0f) {
291 if (weight1 > 0.0f) {
295 curves.tag_topology_changed();
296 curves.tag_positions_changed();
345 const bool vgroups_supported =
ELEM(
349 const bool allow_masking_with_envelope =
ELEM(
351 const bool vertex_groups_enabled =
ELEM(
354 ((vgroups_supported && vertex_groups_enabled) ||
355 allow_masking_with_envelope);
361 return masked ? data_envelope_masked : data_envelope;
363 if (vgroups_supported) {
364 return masked ? data_vgroups_masked : data_vgroups;
370 if (vgroups_supported) {
371 return masked ? data_vgroups_masked : data_vgroups;
374 return masked ? data_envelope_masked : data_envelope;
408 switch (interpolation) {
463 std::optional<MutableSpan<float3x3>> deform_mats_opt;
466 deform_mats_opt = deform_mats;
506 mesh->runtime->edit_mesh = std::make_shared<BMEditMesh>();
507 mesh->runtime->edit_mesh->bm =
bm;
511 std::optional<MutableSpan<float3x3>> deform_mats_opt;
514 deform_mats_opt = deform_mats;
535 mesh->runtime->edit_mesh.reset();
547 Curves *curves_id = id_cast<Curves *>(ob_target->
data);
551 std::optional<MutableSpan<float3x3>> deform_mats_opt;
554 deform_mats_opt = deform_mats;
562 curves.positions_for_write(),
596 std::optional<MutableSpan<float3x3>> deform_mats_opt;
599 deform_mats_opt = deform_mats;
607 curves.positions_for_write(),
625#ifdef USE_PARAMETERIZED_TESTS
627using ArmatureDeformTestParams =
628 std::tuple<InterpolationTest, OutputValueTest, WeightingTest, MaskingTest, VertexWeightSource>;
630class ArmatureDeformParamTest :
public ArmatureDeformTestBase,
631 public testing::TestWithParam<ArmatureDeformTestParams> {
633 static void SetUpTestSuite()
638 static void TearDownTestSuite()
643 void SetUp()
override
645 bmain = BKE_main_new();
648 void TearDown()
override
654TEST_P(ArmatureDeformParamTest, MeshDeformParameterized)
656 const ArmatureDeformTestParams ¶ms = this->GetParam();
663 mesh_test(interpolation,
output, weighting, masking, dvert_source);
666TEST_P(ArmatureDeformParamTest, EditMeshDeformParameterized)
668 const ArmatureDeformTestParams ¶ms = this->GetParam();
674 edit_mesh_test(interpolation,
output, weighting, masking);
677TEST_P(ArmatureDeformParamTest, CurvesDeformParameterized)
679 const ArmatureDeformTestParams ¶ms = this->GetParam();
685 curves_test(interpolation,
output, weighting, masking);
688TEST_P(ArmatureDeformParamTest, GreasePencilDeformParameterized)
690 const ArmatureDeformTestParams ¶ms = this->GetParam();
696 grease_pencil_test(interpolation,
output, weighting, masking);
700 AllArmatureDeformTests,
701 ArmatureDeformParamTest,
711 [](
const testing::TestParamInfo<ArmatureDeformTestParams> &info) {
719 switch (interpolation) {
732 name +=
"_posdefmat";
746 name +=
"_envelopevgroups";
756 switch (dvert_source) {
760 name +=
"_dvertsource";
806 mesh_test(ipol,
output, weight,
mask, dvert_source);
864 grease_pencil_test(ipol,
output, weight,
mask);
Blender kernel action and pose functionality.
Low-level operations for curves.
Low-level operations for grease pencil.
General operations, lookup, etc. for blender objects.
Object is a sort of wrapper for general info.
#define BLI_assert_unreachable()
Span< T > as_span() const
Array(Allocator allocator={}) noexcept
constexpr Span< T > as_span() const
constexpr IndexRange index_range() const
bke::CurvesGeometry & strokes_for_write()
@ PositionAndDeformMatrix
@ EnvelopeAndVertexGroups
TEST_F(AnimDataTest, BKE_fcurves_id_cb_test)
PChanBoneT< bPoseChannel, Bone > PChanBone
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)
GreasePencil * BKE_grease_pencil_add(Main *bmain, const char *name)
BMesh const char void * data
void BKE_editmesh_free_data(BMEditMesh *em)
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)
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)
bDeformGroup * BKE_object_defgroup_new(Object *ob, StringRef name)
void BKE_defvert_add_index_notest(MDeformVert *dv, int defgroup, float weight)
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
Mesh * BKE_mesh_add(Main *bmain, const char *name)
void * BKE_id_new(Main *bmain, short type, const char *name)
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
GreasePencilDrawingType type
static MatBase identity()
ListBaseT< Bone > bonebase
struct DualQuat deform_dual_quat
struct bPoseChannel_Runtime runtime