Follow up pose search reselection questions

This question was created in reference to: [Pose Search reselection of poses of the same [Content removed]

I’m investigating a bit more on anim reselection. I’ve detected that changing the Disable Reselection flag on an asset entry in a pose search database doesn’t necessarily trigger a reindexing. This seems to be because changing that property doesn’t cause the generated hash key to change in FPoseSearchDatabaseAsyncCacheTask::StartNewRequestIfNeeded.

I was able to reindex by changing some other float values in the database details (looping cost bias).

Is this a known issue? Or are we supposed to reindex the databases somehow? I recall the game anim sample had a motion match call on all databases to force an indexing.

A few related questions:

  • When setting that flag animations are flagged with (J) for Pose Jump Threshold. Why is there no distinction between pose jump threshold and Disable Reselection?
  • I saw that reselection is still possible if the PSDB::ExcludeFromDatabaseParameters trim the animation too short. So a pose that was marked as invalid, with J or H flags, could still be selected instead of others that have a worse cost. So are these flags “soft” restrictions that can be sometimes skipped?
  • Could you tell me more about these two flags?
    • A: Discarded by asset index filter
    • F: Discarded by pose filter

Thank you

I believe CL 31198554 in //UE5/Main fixes the Disable Reselection issue. Also, while investigating that is currently works in our mainline, I found an invalid misleading comment in SDatabaseAssetListItem::OnDisableReselectionChanged “// no need to rebuild the SearchIndex (ViewModelPtr->BuildSearchIndex()), since bDisableReselection is a runtime only parameter” that I’m going to remove.

> Or are we supposed to reindex the databases somehow?

No, we’re trying as much as possible to avoid having to reindex databases manually, and I’d recommend to consider for integration all the improvements and bug fixes related to ..\Engine\Plugins\Animation\PoseSearch\Source\Runtime\Private\PoseSearchDerivedDataKey.cpp

> When setting that flag animations are flagged with (J) for Pose Jump Threshold. Why is there no distinction between pose jump threshold and Disable Reselection?

Disable Reselection got its own EPoseCandidateFlags::DiscardedBy_AssetReselection value ("R ") with CL 36102255

>I saw that reselection is still possible if the PSDB::ExcludeFromDatabaseParameters trim the animation too short. So a pose that was marked as invalid, with J or H flags, could still be selected instead of others that have a worse cost. So are these flags “soft” restrictions that can be sometimes skipped?

not sure I follow: do you mean in “EvaluatePoseKernel”, “if (SearchFilters.AreFiltersValid(SearchIndex, PoseValues, QueryValues, DynamicWeightsSqrt, PoseIdx…” sometimes fails to exclude invalid poses? Or is it because “UPoseSearchDatabase::SearchContinuingPose” doesn’t apply any filters (and perhaps is should)?

>A: Discarded by asset index filter

the pose didn’t pass FSelectableAssetIdxFilter::IsFilterValid, meaning that the associated asset index (not the source index asset, but one of the FSearchIndexAsset in FSearchIndexAsset::Assets) should not be searched

>F: Discarded by pose filter

the pose got discarded because any of the schema channels invalidated it, via their IPoseSearchFilter interface, where if IPoseSearchFilter::IsFilterActive is true makes IPoseSearchFilter::IsFilterValid getting called and being able to prune poses. For example if in any “UPoseSearchFeatureChannel_Position” you set “MaxPositionDistanceSquared” > 0 , “UPoseSearchFeatureChannel_Position::IsFilterValid” will discard all those poses where the query is too (MaxPositionDistanceSquared cm^2 away) far from the evaluated poses.

Sorry about that, I’m gonna add comments in EPoseCandidateFlags to clarify their meaning