Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Second Element of TArray Changing When Passed by Ref?

So I have a FCompactPose OutPose which holds a struct variable of it's parent class FBaseCompactPose SourcePose.

In AnimNodeSequencePlayer::Evaluate_AnyThread(), I create an FBoneContainer which contains a TArray SkeletonToCompactPose, which is essentially just an array of int32 representing each bone in a skeleton.

Upon initialization, it has the correct number of bones with correct indices. This FBoneContainer is then stored in OutPose.SourcePose

Next, GetAnimationPose(FCompactPose& OutPose) is called, which then calls GetBonePose(FCompactPose& OutPose).

In GetBonePose(FCompactPose& OutPose), a new const FBoneContainer& RequiredBones is set to equal OutPose.SourcePose.GetFBoneContainer().

In this case, in a skeleton with 80 bones FCompactPoseBoneIndex and SkeletonBoneIndex should both equal 0 up to 79. When the FBoneContainer is initialized this is true. But in AnimSequence::GetBonePose(FCompactPose& OutPose), FCompactPoseBoneIndex at SkeletonBoneIndex of 1 equals a random number in the 100s, once 714, another time 652. But only the value at the index of 1, all other indices are as they should be.

This is how it's accessed:

 const FCompactPoseBoneIndex BoneIndex = RequiredBones.GetCompactPoseIndexFromSkeletonIndex(SkeletonBoneIndex);
 //Nasty, we break our type safety, code in the lower levels should be adjusted for this
 const int32 CompactPoseBoneIndex = BoneIndex.GetInt();
 UE_LOG(LogTemp, Warning, TEXT("CompactPoseBoneIndex: %d, SkeletonBoneIndex: %d. AnimSequence::GetBonePose()"), CompactPoseBoneIndex, SkeletonBoneIndex); 

How could this single index, which isn't even the very first index in the array, be changed but not the others?

The SourcePose variable in OutPose is not UPROPERTY(), so I thought maybe it might be getting garbage collected, but all the other values are saved and correct. Any help is appreciated!

Product Version: UE 4.21
more ▼

asked Feb 08 '19 at 06:35 PM in C++ Programming

avatar image

3 1 3

avatar image iSpam Feb 09 '19 at 11:29 PM

In the beginning of GetBonePose(), FBoneContainer& RequiredBones = OutPose.SourcePose.GetBoneContainer().


 const FCompactPoseBoneIndex BoneIndex = RequiredBones.GetCompactPoseIndexFromSkeletonIndex(SkeletonBoneIndex);

replacing RequiredBones with an FBoneContainer initialized in GetBonePose fixes the issue.

This is only a workaround though, I don't want to be initializing a new bonecontainer each frame.

Any insight?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question