Filtering Skeleton Bones

In this task, we want to split the animation of a humanoid skeleton between two controllers: one for the upper body and one for the lower body.

Below is the skeleton we want to animate:

../../../_images/tk_filtering_skeleton_bones01.png

The skeleton and bone indices

For each controller, we will use the RED::ISkeletalAnimationController::SetBoneFilter to filter-in and filter-out the desired bones.

// RED::Object* lowerController and upperController are skeletal animation clip controllers controlling the same skeleton.
RED::ISkeletalAnimationController* ilowerController = lowerController->As< RED::ISkeletalAnimationController >();
RED::ISkeletalAnimationController* iupperController = upperController->As< RED::ISkeletalAnimationController >();

// By default, bones are unfiltered. Just filter-out the upper body.
RC_TEST( ilowerController->SetBoneFilter( 1, true, true ) );

// Filter-out all the skeleton then filter-in the upper body.
RC_TEST( iupperController->SetBoneFilter( 0, true, true ) );
RC_TEST( iupperController->SetBoneFilter( 1, false, false ) );

In the lower body controller, we have excluded the bone hierarchy from bone 1.

In the upper body controller, we first excluded all the bones then included the bone hierarchy from bone 1.

For upper body, we could also have excluded bone 0 only, then leg bones and their hierarchies:

// The lower body filtering could be done also:
RC_TEST( iupperController->SetBoneFilter( 0, true, false ) );
RC_TEST( iupperController->SetBoneFilter( 8, true, true ) );
RC_TEST( iupperController->SetBoneFilter( 11, true, true ) );