@@ -791,12 +791,36 @@ PyObject *py_ue_sequencer_track_add_section(ue_PyUObject *self, PyObject * args)
791791
792792 ue_py_check (self);
793793
794- if (!self->ue_object ->IsA <UMovieSceneTrack>())
794+ PyObject *py_section = nullptr ;
795+ if (!PyArg_ParseTuple (args, " |O:sequencer_track_add_section" , &py_section))
796+ return nullptr ;
797+
798+
799+ UMovieSceneTrack *track = ue_py_check_type<UMovieSceneTrack>(self);
800+ if (!track)
795801 return PyErr_Format (PyExc_Exception, " uobject is not a UMovieSceneTrack" );
796802
797- UMovieSceneTrack *track = (UMovieSceneTrack *)self->ue_object ;
803+ UMovieSceneSection *new_section = nullptr ;
804+
805+ if (!py_section)
806+ {
807+ new_section = track->CreateNewSection ();
808+ }
809+ else
810+ {
811+ new_section = ue_py_check_type<UMovieSceneSection>(py_section);
812+ if (!new_section)
813+ {
814+ UClass *u_class = ue_py_check_type<UClass>(py_section);
815+ if (u_class && u_class->IsChildOf <UMovieSceneSection>())
816+ {
817+ new_section = NewObject<UMovieSceneSection>(track, u_class, NAME_None);
818+ }
819+ }
820+ }
798821
799- UMovieSceneSection *new_section = track->CreateNewSection ();
822+ if (!new_section)
823+ return PyErr_Format (PyExc_Exception, " argument is not a UMovieSceneSection" );
800824
801825 track->AddSection (*new_section);
802826
@@ -1190,7 +1214,7 @@ PyObject *py_ue_sequencer_section_add_key(ue_PyUObject *self, PyObject * args)
11901214#endif
11911215
11921216 Py_RETURN_NONE;
1193- }
1217+ }
11941218 }
11951219
11961220 return PyErr_Format (PyExc_Exception, " unsupported section type: %s" , TCHAR_TO_UTF8 (*section->GetClass ()->GetName ()));
@@ -1583,7 +1607,7 @@ PyObject *py_ue_sequencer_import_fbx_transform(ue_PyUObject *self, PyObject * ar
15831607
15841608 FMatineeImportTools::SetOrAddKey (*ChannelCurve, CurveFloat->Points [KeyIndex].InVal , CurveFloat->Points [KeyIndex].OutVal , ArriveTangent, LeaveTangent, CurveFloat->Points [KeyIndex].InterpMode );
15851609
1586- }
1610+ }
15871611
15881612 ChannelCurve->RemoveRedundantKeys (KINDA_SMALL_NUMBER);
15891613 ChannelCurve->AutoSetTangents ();
0 commit comments