@@ -68,6 +68,51 @@ static bool magic_get_frame_number(UMovieScene *MovieScene, PyObject *py_obj, FF
68
68
}
69
69
70
70
#if WITH_EDITOR
71
+ #if ENGINE_MINOR_VERSION > 21
72
+ static void ImportTransformChannel (const FRichCurve& Source, FMovieSceneFloatChannel* Dest, FFrameRate DestFrameRate, bool bNegateTangents)
73
+ {
74
+ TMovieSceneChannelData<FMovieSceneFloatValue> ChannelData = Dest->GetData ();
75
+ ChannelData.Reset ();
76
+ double DecimalRate = DestFrameRate.AsDecimal ();
77
+ for (int32 KeyIndex = 0 ; KeyIndex < Source.Keys .Num (); ++KeyIndex)
78
+ {
79
+ float ArriveTangent = Source.Keys [KeyIndex].ArriveTangent ;
80
+ if (KeyIndex > 0 )
81
+ {
82
+ ArriveTangent = ArriveTangent / ((Source.Keys [KeyIndex].Value - Source.Keys [KeyIndex - 1 ].Value ) * DecimalRate);
83
+ }
84
+
85
+ float LeaveTangent = Source.Keys [KeyIndex].LeaveTangent ;
86
+ if (KeyIndex < Source.Keys .Num () - 1 )
87
+ {
88
+ LeaveTangent = LeaveTangent / ((Source.Keys [KeyIndex + 1 ].Value - Source.Keys [KeyIndex].Value ) * DecimalRate);
89
+ }
90
+
91
+ if (bNegateTangents)
92
+ {
93
+ ArriveTangent = -ArriveTangent;
94
+ LeaveTangent = -LeaveTangent;
95
+ }
96
+
97
+ FFrameNumber KeyTime = (Source.Keys [KeyIndex].Value * DestFrameRate).RoundToFrame ();
98
+ if (ChannelData.FindKey (KeyTime) == INDEX_NONE)
99
+ {
100
+ FMovieSceneFloatValue NewKey (Source.Keys [KeyIndex].Value );
101
+
102
+ NewKey.InterpMode = Source.Keys [KeyIndex].InterpMode ;
103
+ NewKey.TangentMode = Source.Keys [KeyIndex].TangentMode ;
104
+ NewKey.Tangent .ArriveTangent = ArriveTangent / DestFrameRate.AsDecimal ();
105
+ NewKey.Tangent .LeaveTangent = LeaveTangent / DestFrameRate.AsDecimal ();
106
+ NewKey.Tangent .TangentWeightMode = RCTWM_WeightedNone;
107
+ NewKey.Tangent .ArriveTangentWeight = 0 .0f ;
108
+ NewKey.Tangent .LeaveTangentWeight = 0 .0f ;
109
+ ChannelData.AddKey (KeyTime, NewKey);
110
+ }
111
+ }
112
+
113
+ Dest->AutoSetTangents ();
114
+ }
115
+ #else
71
116
static void ImportTransformChannel (const FInterpCurveFloat& Source, FMovieSceneFloatChannel* Dest, FFrameRate DestFrameRate, bool bNegateTangents)
72
117
{
73
118
TMovieSceneChannelData<FMovieSceneFloatValue> ChannelData = Dest->GetData ();
@@ -103,18 +148,27 @@ static void ImportTransformChannel(const FInterpCurveFloat& Source, FMovieSceneF
103
148
104
149
Dest->AutoSetTangents ();
105
150
}
151
+ #endif
106
152
107
153
static bool ImportFBXTransform (FString NodeName, UMovieScene3DTransformSection* TransformSection, UnFbx::FFbxCurvesAPI& CurveAPI)
108
154
{
109
155
110
156
111
157
// Look for transforms explicitly
158
+ FTransform DefaultTransform;
159
+
160
+ #if ENGINE_MINOR_VERSION > 21
161
+ FRichCurve Translation[3 ];
162
+ FRichCurve EulerRotation[3 ];
163
+ FRichCurve Scale[3 ];
164
+ #else
112
165
FInterpCurveFloat Translation[3 ];
113
166
FInterpCurveFloat EulerRotation[3 ];
114
167
FInterpCurveFloat Scale[3 ];
115
- FTransform DefaultTransform;
168
+ # endif
116
169
CurveAPI.GetConvertedTransformCurveData (NodeName, Translation[0 ], Translation[1 ], Translation[2 ], EulerRotation[0 ], EulerRotation[1 ], EulerRotation[2 ], Scale[0 ], Scale[1 ], Scale[2 ], DefaultTransform);
117
170
171
+
118
172
TransformSection->Modify ();
119
173
120
174
FFrameRate FrameRate = TransformSection->GetTypedOuter <UMovieScene>()->GetTickResolution ();
@@ -1594,9 +1648,15 @@ PyObject *py_ue_sequencer_import_fbx_transform(ue_PyUObject *self, PyObject * ar
1594
1648
continue ;
1595
1649
1596
1650
// Look for transforms explicitly
1651
+ #if ENGINE_MINOR_VERSION > 21
1652
+ FRichCurve Translation[3 ];
1653
+ FRichCurve EulerRotation[3 ];
1654
+ FRichCurve Scale[3 ];
1655
+ #else
1597
1656
FInterpCurveFloat Translation[3 ];
1598
1657
FInterpCurveFloat EulerRotation[3 ];
1599
1658
FInterpCurveFloat Scale[3 ];
1659
+ #endif
1600
1660
FTransform DefaultTransform;
1601
1661
#if ENGINE_MINOR_VERSION >= 18
1602
1662
CurveAPI.GetConvertedTransformCurveData (NodeName, Translation[0 ], Translation[1 ], Translation[2 ], EulerRotation[0 ], EulerRotation[1 ], EulerRotation[2 ], Scale[0 ], Scale[1 ], Scale[2 ], DefaultTransform);
0 commit comments