We made a subclass of UMovieScene3DTransformTrack that calls SetPropertyNameAndPath in its constructor. When SetPropertyNameAndPath is set to “Transform”, TDirectPropertyTraits<UE::MovieScene::FIntermediate3DTransform,1> is used to write out the value, and it correctly uses the custom accessor function FIntermediate3DTransform::ApplyTransformTo. When SetPropertyNameAndPath is set to anything else (e.g. “MyTransform”), it still uses TDirectPropertyTraits and incorrectly bitwise copies the FIntermediate3DTransform to the FTransform property MyTransform. Where is this determined? I cannot find the cause of this behavior. Ideally, it would use FIndirectPropertyTraits to convert to an FTransform, which is what UMovieScenePropertyTrack does.
Steps to Reproduce
- Create a new component “MyComponent” with a FTransform UProperty marked for Interp. Call it XForm.
- Create a subclass “My3DTransformTrack” of UMovieScene3DTransformTrack. The base UMovieScene3DTransformTrack is not exported and marked MinimalAPI, so it will either need to be edited or the subclass will need to be added to the MovieSceneTracks plugin.
- In My3DTransformTrack, add SetPropertyNameAndPath(FName(TEXT(“Xform”)), FString(TEXT(“Xform”))); to the constructor to change the property path from the default “Transform” set in the parent.
- Add one of these tracks, set some keyframes for location and rotation, and observe that the values in XForm are scrambled. It’s copying a FIntermediate3DTransform into the FTransform.
Hello!
We have two transform tracks in Sequencer: `UMovieScene3DTransformTrack` and `UMovieSceneTransformTrack`. The naming is arguably not great, but the former is specifically for a `USceneComponent` transform, while the other one is for any transform property. The reason for this is that `USceneComponent` doesn’t actually have a transform property: instead, it has three properties, `RelativeLocation`, `RelativeRotation`, and `RelativeScene3D`. We have a custom track for this to show up as one, instead of three different tracks.
So if you have a custom property of type `FTransform` to animate, use a subclass of `UMovieSceneTransformTrack` instead. In `UMovieScene3DTransformSection::BuildEntity`, this will make `bIsComponentTransform` be false, which will change the tag added to the ECS components, and which in turn will use a different traits that does handle `FTransform`.
I hope this fixes it!
Ah, so I missed two things. The existence of the other transform track and the way the tag works in the Section. That clears up a lot. Thanks!
No problem! Have fun!