Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Source/UnrealEnginePython/Private/UEPyModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,7 @@ static PyMethodDef ue_PyUObject_methods[] = {
{ "vlog_cylinder", (PyCFunction)py_ue_vlog_cylinder, METH_VARARGS, "" },

// StaticMesh
{ "get_static_mesh_bounds", (PyCFunction)py_ue_static_mesh_get_bounds, METH_VARARGS, "" },
#if WITH_EDITOR
{ "static_mesh_build", (PyCFunction)py_ue_static_mesh_build, METH_VARARGS, "" },
{ "static_mesh_create_body_setup", (PyCFunction)py_ue_static_mesh_create_body_setup, METH_VARARGS, "" },
Expand Down
19 changes: 17 additions & 2 deletions Source/UnrealEnginePython/Private/UObject/UEPyStaticMesh.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
#include "UEPyStaticMesh.h"
#include "Engine/StaticMesh.h"

PyObject *py_ue_static_mesh_get_bounds(ue_PyUObject *self, PyObject * args)
{
ue_py_check(self);
UStaticMesh *mesh = ue_py_check_type<UStaticMesh>(self);
if (!mesh)
return PyErr_Format(PyExc_Exception, "uobject is not a UStaticMesh");

FBoxSphereBounds bounds = mesh->GetBounds();
UScriptStruct *u_struct = FindObject<UScriptStruct>(ANY_PACKAGE, UTF8_TO_TCHAR("BoxSphereBounds"));
if (!u_struct)
{
return PyErr_Format(PyExc_Exception, "unable to get BoxSphereBounds struct");
}
return py_ue_new_owned_uscriptstruct(u_struct, (uint8 *)&bounds);
}

#if WITH_EDITOR

#include "Engine/StaticMesh.h"
#include "Wrappers/UEPyFRawMesh.h"
#include "Editor/UnrealEd/Private/GeomFitUtils.h"
#include "FbxMeshUtils.h"
Expand Down Expand Up @@ -137,4 +152,4 @@ PyObject *py_ue_static_mesh_import_lod(ue_PyUObject *self, PyObject * args)
Py_RETURN_FALSE;
}

#endif
#endif
4 changes: 3 additions & 1 deletion Source/UnrealEnginePython/Private/UObject/UEPyStaticMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "UEPyModule.h"

PyObject *py_ue_static_mesh_get_bounds(ue_PyUObject *self, PyObject * args);

#if WITH_EDITOR
PyObject *py_ue_static_mesh_build(ue_PyUObject *, PyObject *);
PyObject *py_ue_static_mesh_create_body_setup(ue_PyUObject *, PyObject *);
Expand All @@ -15,4 +17,4 @@ PyObject *py_ue_static_mesh_generate_kdop10z(ue_PyUObject *, PyObject *);
PyObject *py_ue_static_mesh_generate_kdop18(ue_PyUObject *, PyObject *);
PyObject *py_ue_static_mesh_generate_kdop26(ue_PyUObject *, PyObject *);
PyObject *py_ue_static_mesh_import_lod(ue_PyUObject *, PyObject *);
#endif
#endif