Skip to content

Commit a943cea

Browse files
author
Roberto De Ioris
committed
added slate file picker example
1 parent 9143890 commit a943cea

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

Source/UnrealEnginePython/Private/UObject/UEPySequencer.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ PyObject *py_ue_sequencer_find_possessable(ue_PyUObject *self, PyObject * args)
163163
return PyErr_Format(PyExc_Exception, "unable to find uobject with GUID \"%s\"", guid);
164164

165165
Py_RETURN_UOBJECT(u_obj);
166-
}
166+
}
167167

168168
PyObject *py_ue_sequencer_find_spawnable(ue_PyUObject *self, PyObject * args)
169169
{
@@ -284,7 +284,7 @@ PyObject *py_ue_sequencer_add_actor(ue_PyUObject *self, PyObject * args)
284284
}
285285

286286
return PyUnicode_FromString(TCHAR_TO_UTF8(*new_guid.ToString()));
287-
}
287+
}
288288

289289
PyObject *py_ue_sequencer_add_actor_component(ue_PyUObject *self, PyObject * args)
290290
{
@@ -702,9 +702,10 @@ PyObject *py_ue_sequencer_section_add_key(ue_PyUObject *self, PyObject * args)
702702
float time;
703703
PyObject *py_value;
704704
int interpolation = 0;
705-
if (!PyArg_ParseTuple(args, "fO|i:sequencer_section_add_key", &time, &py_value, &interpolation))
705+
PyObject *py_unwind = nullptr;
706+
if (!PyArg_ParseTuple(args, "fO|iO:sequencer_section_add_key", &time, &py_value, &interpolation, &py_unwind))
706707
{
707-
return NULL;
708+
return nullptr;
708709
}
709710

710711
if (!self->ue_object->IsA<UMovieSceneSection>())
@@ -740,7 +741,7 @@ PyObject *py_ue_sequencer_section_add_key(ue_PyUObject *self, PyObject * args)
740741
{
741742
if (ue_PyFTransform *py_transform = py_ue_is_ftransform(py_value))
742743
{
743-
bool unwind = false;
744+
bool unwind = (py_unwind && PyObject_IsTrue(py_unwind));
744745
FTransform transform = py_transform->transform;
745746

746747

@@ -751,9 +752,7 @@ PyObject *py_ue_sequencer_section_add_key(ue_PyUObject *self, PyObject * args)
751752
section_transform->AddKey(time, ty, (EMovieSceneKeyInterpolation)interpolation);
752753
section_transform->AddKey(time, tz, (EMovieSceneKeyInterpolation)interpolation);
753754

754-
/*FTransformKey rx = FTransformKey(EKey3DTransformChannel::Rotation, EAxis::X, transform.GetRotation().Rotator().Roll, unwind);
755-
FTransformKey ry = FTransformKey(EKey3DTransformChannel::Rotation, EAxis::Y, transform.GetRotation().Rotator().Pitch, unwind);
756-
FTransformKey rz = FTransformKey(EKey3DTransformChannel::Rotation, EAxis::Z, transform.GetRotation().Rotator().Yaw, unwind);*/
755+
757756
FTransformKey rx = FTransformKey(EKey3DTransformChannel::Rotation, EAxis::X, transform.GetRotation().Euler().X, unwind);
758757
FTransformKey ry = FTransformKey(EKey3DTransformChannel::Rotation, EAxis::Y, transform.GetRotation().Euler().Y, unwind);
759758
FTransformKey rz = FTransformKey(EKey3DTransformChannel::Rotation, EAxis::Z, transform.GetRotation().Euler().Z, unwind);

examples/slate_file_path_picker.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import unreal_engine as ue
2+
from unreal_engine import SFilePathPicker, SWindow, FLinearColor
3+
from unreal_engine.structs import ButtonStyle, SlateBrush, SlateColor
4+
5+
# a style is required for the file picker
6+
style = ButtonStyle(Normal=SlateBrush(TintColor=SlateColor(SpecifiedColor=FLinearColor(1, 0, 0))))
7+
8+
9+
window = SWindow(client_size=(576,576), title='Hello', modal=True)
10+
11+
def path_picked(path):
12+
print(path)
13+
window.request_destroy()
14+
15+
picker = SFilePathPicker(browse_title='Hello', browse_button_style=style, on_path_picked=path_picked)
16+
window.set_content(picker)
17+
18+
window.add_modal()

0 commit comments

Comments
 (0)