31#include "testing/testing.h"
202 if (weight0 > 0.0f) {
205 if (weight1 > 0.0f) {
209 mesh->tag_positions_changed();
226 ob->
data = mesh_in_main;
230 BLI_assert(!mesh_in_main->deform_verts().is_empty());
241 ob->
data = curves_id;
253 if (weight0 > 0.0f) {
256 if (weight1 > 0.0f) {
260 curves.tag_topology_changed();
261 curves.tag_positions_changed();
271 ob->
data = grease_pencil;
286 if (weight0 > 0.0f) {
289 if (weight1 > 0.0f) {
293 curves.tag_topology_changed();
294 curves.tag_positions_changed();
343 const bool vgroups_supported =
ELEM(
347 const bool allow_masking_with_envelope =
ELEM(
349 const bool vertex_groups_enabled =
ELEM(
352 ((vgroups_supported && vertex_groups_enabled) ||
353 allow_masking_with_envelope);
359 return masked ? data_envelope_masked : data_envelope;
361 if (vgroups_supported) {
362 return masked ? data_vgroups_masked : data_vgroups;
368 if (vgroups_supported) {
369 return masked ? data_vgroups_masked : data_vgroups;
372 return masked ? data_envelope_masked : data_envelope;
406 switch (interpolation) {
461 std::optional<MutableSpan<float3x3>> deform_mats_opt;
464 deform_mats_opt = deform_mats;
508 std::optional<MutableSpan<float3x3>> deform_mats_opt;
511 deform_mats_opt = deform_mats;
532 MEM_delete(edit_mesh);
548 std::optional<MutableSpan<float3x3>> deform_mats_opt;
551 deform_mats_opt = deform_mats;
559 curves.positions_for_write(),
586 BLI_assert(!grease_pencil->drawings().is_empty());
593 std::optional<MutableSpan<float3x3>> deform_mats_opt;
596 deform_mats_opt = deform_mats;
604 curves.positions_for_write(),
622#ifdef USE_PARAMETERIZED_TESTS
624using ArmatureDeformTestParams =
625 std::tuple<InterpolationTest, OutputValueTest, WeightingTest, MaskingTest, VertexWeightSource>;
627class ArmatureDeformParamTest :
public ArmatureDeformTestBase,
628 public testing::TestWithParam<ArmatureDeformTestParams> {
630 static void SetUpTestSuite()
636 static void TearDownTestSuite()
641 void SetUp()
override
646 void TearDown()
override
652TEST_P(ArmatureDeformParamTest, MeshDeformParameterized)
654 const ArmatureDeformTestParams &
params = this->GetParam();
661 mesh_test(interpolation,
output, weighting, masking, dvert_source);
664TEST_P(ArmatureDeformParamTest, EditMeshDeformParameterized)
666 const ArmatureDeformTestParams &
params = this->GetParam();
672 edit_mesh_test(interpolation,
output, weighting, masking);
675TEST_P(ArmatureDeformParamTest, CurvesDeformParameterized)
677 const ArmatureDeformTestParams &
params = this->GetParam();
683 curves_test(interpolation,
output, weighting, masking);
686TEST_P(ArmatureDeformParamTest, GreasePencilDeformParameterized)
688 const ArmatureDeformTestParams &
params = this->GetParam();
694 grease_pencil_test(interpolation,
output, weighting, masking);
698 AllArmatureDeformTests,
699 ArmatureDeformParamTest,
709 [](
const testing::TestParamInfo<ArmatureDeformTestParams> &info) {
717 switch (interpolation) {
730 name +=
"_posdefmat";
744 name +=
"_envelopevgroups";
754 switch (dvert_source) {
758 name +=
"_dvertsource";
805 mesh_test(ipol,
output, weight,
mask, dvert_source);
863 grease_pencil_test(ipol,
output, weight,
mask);
Blender kernel action and pose functionality.
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
void BKE_armature_deform_coords_with_mesh(const Object &ob_arm, const Object &ob_target, blender::MutableSpan< blender::float3 > vert_coords, std::optional< blender::Span< blender::float3 > > vert_coords_prev, std::optional< blender::MutableSpan< blender::float3x3 > > vert_deform_mats, int deformflag, blender::StringRefNull defgrp_name, const Mesh *me_target)
void BKE_armature_deform_coords_with_curves(const Object &ob_arm, const Object &ob_target, const ListBase *defbase, blender::MutableSpan< blender::float3 > vert_coords, std::optional< blender::Span< blender::float3 > > vert_coords_prev, std::optional< blender::MutableSpan< blender::float3x3 > > vert_deform_mats, blender::Span< MDeformVert > dverts, int deformflag, blender::StringRefNull defgrp_name)
void BKE_pchan_calc_mat(bPoseChannel *pchan)
void BKE_armature_where_is_bone(Bone *bone, const Bone *bone_parent, bool use_recursion)
void BKE_pose_ensure(Main *bmain, Object *ob, bArmature *arm, bool do_id_user)
void BKE_armature_deform_coords_with_editmesh(const Object &ob_arm, const Object &ob_target, blender::MutableSpan< blender::float3 > vert_coords, std::optional< blender::Span< blender::float3 > > vert_coords_prev, std::optional< blender::MutableSpan< blender::float3x3 > > vert_deform_mats, int deformflag, blender::StringRefNull defgrp_name, const BMEditMesh &em_target)
struct Curves * BKE_curves_add(struct Main *bmain, const char *name)
Low-level operations for curves.
void BKE_editmesh_free_data(BMEditMesh *em)
BMEditMesh * BKE_editmesh_create(BMesh *bm)
Low-level operations for grease pencil.
GreasePencil * BKE_grease_pencil_add(Main *bmain, const char *name)
void BKE_id_delete(Main *bmain, void *idv) ATTR_NONNULL()
void BKE_id_free(Main *bmain, void *idv)
void * BKE_id_new(Main *bmain, short type, const char *name)
void BKE_main_free(Main *bmain)
Mesh * BKE_mesh_new_nomain(int verts_num, int edges_num, int faces_num, int corners_num)
Mesh * BKE_mesh_add(Main *bmain, const char *name)
void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, Mesh *mesh_dst, Object *ob, bool process_shape_keys=true)
BMesh * BKE_mesh_to_bmesh(Mesh *mesh, int active_shapekey, bool add_key_index, const BMeshCreateParams *params)
General operations, lookup, etc. for blender objects.
Object * BKE_object_add_only_object(Main *bmain, int type, const char *name) ATTR_RETURNS_NONNULL
#define BLI_assert_unreachable()
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void mat4_to_dquat(DualQuat *dq, const float basemat[4][4], const float mat[4][4])
MINLINE void copy_v3_v3(float r[3], const float a[3])
char * STRNCPY(char(&dst)[N], const char *src)
Object is a sort of wrapper for general info.
BMesh const char void * data
Array< float3 > BM_mesh_vert_coords_alloc(BMesh *bm)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Span< T > as_span() const
constexpr Span< T > as_span() const
constexpr IndexRange index_range() const
void * MEM_callocN(size_t len, const char *str)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
TEST_F(ArmatureDeformTest, MeshDeform)
@ PositionAndDeformMatrix
@ EnvelopeAndVertexGroups
INSTANTIATE_TEST_SUITE_P(, VKRenderGraphTestRender, ::testing::Values(true, false))
TEST_P(VKRenderGraphTestRender, begin_clear_attachments_end_read_back)
VecBase< float, 3 > float3
float wrap(float value, float max, float min)
ListBase vertex_group_names
struct DualQuat deform_dual_quat
struct bPoseChannel_Runtime runtime
static MatBase identity()