Skip to content

Commit de9cafa

Browse files
author
Roberto De Ioris
committed
added get_matrix() to FTransform
1 parent b33e067 commit de9cafa

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Source/UnrealEnginePython/Private/Wrappers/UEPyFTransform.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,22 @@ static PyObject *py_ue_ftransform_get_relative_transform(ue_PyFTransform *self,
2626
return py_ue_new_ftransform(self->transform.GetRelativeTransform(py_transform->transform));
2727
}
2828

29+
static PyObject *py_ue_ftransform_get_matrix(ue_PyFTransform *self, PyObject * args)
30+
{
31+
FMatrix matrix = self->transform.ToMatrixWithScale();
32+
UScriptStruct *u_struct = FindObject<UScriptStruct>(ANY_PACKAGE, UTF8_TO_TCHAR("Matrix"));
33+
if (!u_struct)
34+
{
35+
return PyErr_Format(PyExc_Exception, "unable to get Matrix struct");
36+
}
37+
return py_ue_new_uscriptstruct(u_struct, (uint8 *)&matrix);
38+
}
39+
2940
static PyMethodDef ue_PyFTransform_methods[] = {
3041
{ "inverse", (PyCFunction)py_ue_ftransform_inverse, METH_VARARGS, "" },
3142
{ "get_relative_transform", (PyCFunction)py_ue_ftransform_get_relative_transform, METH_VARARGS, "" },
3243
{ "normalize_rotation", (PyCFunction)py_ue_ftransform_normalize_rotation, METH_VARARGS, "" },
44+
{ "get_matrix", (PyCFunction)py_ue_ftransform_get_matrix, METH_VARARGS, "" },
3345
{ NULL } /* Sentinel */
3446
};
3547

0 commit comments

Comments
 (0)