@@ -18,6 +18,61 @@ PyObject *py_ue_anim_get_skeleton(ue_PyUObject * self, PyObject * args)
1818 Py_RETURN_UOBJECT ((UObject *)skeleton);
1919}
2020
21+ PyObject *py_ue_anim_get_bone_transform (ue_PyUObject * self, PyObject * args)
22+ {
23+ ue_py_check (self);
24+
25+ int track_index;
26+ float frame_time;
27+ PyObject *py_b_use_raw_data = nullptr ;
28+
29+ if (!PyArg_ParseTuple (args, " if|O:get_bone_transform" , &track_index, &frame_time, &py_b_use_raw_data))
30+ {
31+ return nullptr ;
32+ }
33+
34+ UAnimSequence *anim = ue_py_check_type<UAnimSequence>(self);
35+ if (!anim)
36+ return PyErr_Format (PyExc_Exception, " UObject is not a UAnimSequence." );
37+
38+ bool bUseRawData = false ;
39+ if (py_b_use_raw_data && PyObject_IsTrue (py_b_use_raw_data))
40+ bUseRawData = true ;
41+
42+ FTransform OutAtom;
43+ anim->GetBoneTransform (OutAtom, track_index, frame_time, bUseRawData);
44+
45+ return py_ue_new_ftransform (OutAtom);
46+ }
47+
48+ PyObject *py_ue_anim_extract_root_motion (ue_PyUObject * self, PyObject * args)
49+ {
50+ ue_py_check (self);
51+
52+ float start_time;
53+ float delta_time;
54+ PyObject *py_b_allow_looping = nullptr ;
55+
56+ if (!PyArg_ParseTuple (args, " ff|O:extract_root_motion" , &start_time, &delta_time, &py_b_allow_looping))
57+ {
58+ return nullptr ;
59+ }
60+
61+ UAnimSequence *anim = ue_py_check_type<UAnimSequence>(self);
62+ if (!anim)
63+ return PyErr_Format (PyExc_Exception, " UObject is not a UAnimSequence." );
64+
65+ bool bAllowLooping = false ;
66+ if (py_b_allow_looping && PyObject_IsTrue (py_b_allow_looping))
67+ bAllowLooping = true ;
68+
69+ return py_ue_new_ftransform (anim->ExtractRootMotion (start_time, delta_time, bAllowLooping));
70+ }
71+
72+
73+
74+
75+
2176
2277#if WITH_EDITOR
2378#if ENGINE_MINOR_VERSION > 13
@@ -73,6 +128,32 @@ PyObject *py_ue_anim_sequence_get_raw_animation_track(ue_PyUObject * self, PyObj
73128 return py_ue_new_fraw_anim_sequence_track (anim_seq->GetRawAnimationTrack (index));
74129}
75130
131+ PyObject *py_ue_anim_sequence_apply_raw_anim_changes (ue_PyUObject * self, PyObject * args)
132+ {
133+ ue_py_check (self);
134+
135+ UAnimSequence *anim_seq = ue_py_check_type<UAnimSequence>(self);
136+ if (!anim_seq)
137+ return PyErr_Format (PyExc_Exception, " UObject is not a UAnimSequence." );
138+
139+
140+ if (anim_seq->DoesNeedRebake ())
141+ {
142+ anim_seq->Modify (true );
143+ anim_seq->BakeTrackCurvesToRawAnimation ();
144+ }
145+
146+ if (anim_seq->DoesNeedRecompress ())
147+ {
148+ anim_seq->Modify (true );
149+ anim_seq->RequestSyncAnimRecompression (false );
150+ }
151+
152+ Py_RETURN_NONE;
153+ }
154+
155+
156+
76157PyObject *py_ue_anim_sequence_add_new_raw_track (ue_PyUObject * self, PyObject * args)
77158{
78159 ue_py_check (self);
@@ -105,14 +186,47 @@ PyObject *py_ue_anim_sequence_add_new_raw_track(ue_PyUObject * self, PyObject *
105186
106187 int32 index = anim_seq->AddNewRawTrack (FName (UTF8_TO_TCHAR (name)), rast);
107188
108- if (anim_seq->DoesNeedRebake ())
109- anim_seq->BakeTrackCurvesToRawAnimation ();
110-
111189 anim_seq->MarkRawDataAsModified ();
190+ anim_seq->MarkPackageDirty ();
112191
113192 return PyLong_FromLong (index);
114193}
115194
195+ PyObject *py_ue_anim_sequence_update_raw_track (ue_PyUObject * self, PyObject * args)
196+ {
197+ ue_py_check (self);
198+
199+ int track_index;
200+ PyObject *py_rast;
201+ if (!PyArg_ParseTuple (args, " iO:update_raw_track" , &track_index, &py_rast))
202+ return nullptr ;
203+
204+ UAnimSequence *anim_seq = ue_py_check_type<UAnimSequence>(self);
205+ if (!anim_seq)
206+ return PyErr_Format (PyExc_Exception, " UObject is not a UAnimSequence." );
207+
208+ ue_PyFRawAnimSequenceTrack *py_f_rast = py_ue_is_fraw_anim_sequence_track (py_rast);
209+ if (!py_f_rast)
210+ {
211+ return PyErr_Format (PyExc_Exception, " argument is not a FRawAnimSequenceTrack." );
212+ }
213+
214+ anim_seq->Modify ();
215+
216+ FRawAnimSequenceTrack& RawRef = anim_seq->GetRawAnimationTrack (track_index);
217+
218+ RawRef.PosKeys = py_f_rast->raw_anim_sequence_track .PosKeys ;
219+ RawRef.RotKeys = py_f_rast->raw_anim_sequence_track .RotKeys ;
220+ RawRef.ScaleKeys = py_f_rast->raw_anim_sequence_track .ScaleKeys ;
221+
222+ anim_seq->MarkRawDataAsModified ();
223+ anim_seq->MarkPackageDirty ();
224+
225+ Py_RETURN_NONE;
226+ }
227+
228+
229+
116230PyObject *py_ue_add_anim_composite_section (ue_PyUObject * self, PyObject * args)
117231{
118232 ue_py_check (self);
0 commit comments