55
66#include " UEPyFbx.h"
77
8- static PyObject *py_ue_fbx_mesh_get_polygon_count (ue_PyFbxMesh *self, PyObject *args) {
8+ static PyObject *py_ue_fbx_mesh_get_polygon_count (ue_PyFbxMesh *self, PyObject *args)
9+ {
910 return PyLong_FromLong (self->fbx_mesh ->GetPolygonCount ());
1011}
1112
12- static PyObject *py_ue_fbx_mesh_get_control_points_count (ue_PyFbxMesh *self, PyObject *args) {
13+ static PyObject *py_ue_fbx_mesh_get_control_points_count (ue_PyFbxMesh *self, PyObject *args)
14+ {
1315 return PyLong_FromLong (self->fbx_mesh ->GetControlPointsCount ());
1416}
1517
16- static PyObject *py_ue_fbx_mesh_get_polygon_vertex_count (ue_PyFbxMesh *self, PyObject *args) {
18+ static PyObject *py_ue_fbx_mesh_get_polygon_vertex_count (ue_PyFbxMesh *self, PyObject *args)
19+ {
1720 return PyLong_FromLong (self->fbx_mesh ->GetPolygonVertexCount ());
1821}
1922
20- static PyObject *py_ue_fbx_mesh_get_name (ue_PyFbxMesh *self, PyObject *args) {
23+ static PyObject *py_ue_fbx_mesh_get_name (ue_PyFbxMesh *self, PyObject *args)
24+ {
2125 return PyUnicode_FromString (self->fbx_mesh ->GetName ());
2226}
2327
24- static PyObject *py_ue_fbx_mesh_get_polygon_vertices (ue_PyFbxMesh *self, PyObject *args) {
28+ static PyObject *py_ue_fbx_mesh_get_polygon_vertices (ue_PyFbxMesh *self, PyObject *args)
29+ {
2530 PyObject *py_list = PyList_New (0 );
2631 int *indices = self->fbx_mesh ->GetPolygonVertices ();
27- for (int i = 0 ; i < self->fbx_mesh ->GetPolygonVertexCount (); i++) {
32+ for (int i = 0 ; i < self->fbx_mesh ->GetPolygonVertexCount (); i++)
33+ {
2834 PyList_Append (py_list, PyLong_FromLong (indices[i]));
2935 }
3036 return py_list;
3137}
3238
33- static PyObject *py_ue_fbx_mesh_get_control_points (ue_PyFbxMesh *self, PyObject *args) {
39+ static PyObject *py_ue_fbx_mesh_get_control_points (ue_PyFbxMesh *self, PyObject *args)
40+ {
3441 PyObject *py_list = PyList_New (0 );
3542 FbxVector4* control_points = self->fbx_mesh ->GetControlPoints ();
36- for (int i = 0 ; i < self->fbx_mesh ->GetControlPointsCount (); i++) {
43+ for (int i = 0 ; i < self->fbx_mesh ->GetControlPointsCount (); i++)
44+ {
3745 FbxVector4 vec4 = control_points[i];
3846 PyList_Append (py_list, py_ue_new_fvector (FVector (vec4[0 ], vec4[1 ], vec4[2 ])));
3947 }
4048 return py_list;
4149}
4250
43- static PyObject *py_ue_fbx_mesh_get_polygon_vertex_normals (ue_PyFbxMesh *self, PyObject *args) {
51+ static PyObject *py_ue_fbx_mesh_get_polygon_vertex_normals (ue_PyFbxMesh *self, PyObject *args)
52+ {
4453
4554 FbxArray<FbxVector4> normals;
4655
47- if (!self->fbx_mesh ->GetPolygonVertexNormals (normals)) {
56+ if (!self->fbx_mesh ->GetPolygonVertexNormals (normals))
57+ {
4858 Py_RETURN_NONE;
4959 }
5060
5161 PyObject *py_list = PyList_New (0 );
5262
53- for (int i = 0 ; i < normals.Size (); i++) {
63+ for (int i = 0 ; i < normals.Size (); i++)
64+ {
5465 FbxVector4 vec = normals.GetAt (i);
5566 PyList_Append (py_list, py_ue_new_fvector (FVector (vec[0 ], vec[1 ], vec[2 ])));
5667 }
5768
5869 return py_list;
5970}
6071
61- static PyObject *py_ue_fbx_mesh_get_uv_set_names (ue_PyFbxMesh *self, PyObject *args) {
72+ static PyObject *py_ue_fbx_mesh_get_uv_set_names (ue_PyFbxMesh *self, PyObject *args)
73+ {
6274 PyObject *py_list = PyList_New (0 );
6375 FbxStringList name_list;
6476 self->fbx_mesh ->GetUVSetNames (name_list);
6577
66- for (int i = 0 ; i < name_list.GetCount (); i++) {
78+ for (int i = 0 ; i < name_list.GetCount (); i++)
79+ {
6780 PyList_Append (py_list, PyUnicode_FromString (name_list.GetStringAt (i)));
6881 }
6982
7083 return py_list;
7184}
7285
73- static PyObject *py_ue_fbx_mesh_get_polygon_vertex_uvs (ue_PyFbxMesh *self, PyObject *args) {
86+ static PyObject *py_ue_fbx_mesh_get_polygon_vertex_uvs (ue_PyFbxMesh *self, PyObject *args)
87+ {
7488 char *uv_set;
7589 if (!PyArg_ParseTuple (args, " s" , &uv_set))
7690 return nullptr ;
7791
7892 FbxArray<FbxVector2> uvs;
7993
80- if (!self->fbx_mesh ->GetPolygonVertexUVs (uv_set, uvs)) {
94+ if (!self->fbx_mesh ->GetPolygonVertexUVs (uv_set, uvs))
95+ {
8196 Py_RETURN_NONE;
8297 }
8398
8499 PyObject *py_list = PyList_New (0 );
85-
86- for (int i = 0 ; i < uvs.Size (); i++) {
100+
101+ for (int i = 0 ; i < uvs.Size (); i++)
102+ {
87103 FbxVector2 vec = uvs.GetAt (i);
88104 PyList_Append (py_list, Py_BuildValue ((char *)" (ff)" , vec[0 ], vec[1 ]));
89105 }
90106
91107 return py_list;
92108}
93109
94- static PyObject *py_ue_fbx_mesh_remove_bad_polygons (ue_PyFbxMesh *self, PyObject *args) {
110+ static PyObject *py_ue_fbx_mesh_remove_bad_polygons (ue_PyFbxMesh *self, PyObject *args)
111+ {
95112 self->fbx_mesh ->RemoveBadPolygons ();
96113 Py_RETURN_NONE;
97114}
@@ -143,15 +160,18 @@ static PyTypeObject ue_PyFbxMeshType = {
143160 0 , /* tp_getset */
144161};
145162
146- static int py_ue_fbx_mesh_init (ue_PyFbxMesh *self, PyObject * args) {
163+ static int py_ue_fbx_mesh_init (ue_PyFbxMesh *self, PyObject * args)
164+ {
147165 PyObject *py_object;
148166 char *name;
149- if (!PyArg_ParseTuple (args, " Os" , &py_object, &name)) {
167+ if (!PyArg_ParseTuple (args, " Os" , &py_object, &name))
168+ {
150169 return -1 ;
151170 }
152171
153172 ue_PyFbxManager *py_fbx_manager = py_ue_is_fbx_manager (py_object);
154- if (!py_fbx_manager) {
173+ if (!py_fbx_manager)
174+ {
155175 PyErr_SetString (PyExc_Exception, " argument is not a FbxManager" );
156176 return -1 ;
157177 }
@@ -160,7 +180,8 @@ static int py_ue_fbx_mesh_init(ue_PyFbxMesh *self, PyObject * args) {
160180 return 0 ;
161181}
162182
163- void ue_python_init_fbx_mesh (PyObject *ue_module) {
183+ void ue_python_init_fbx_mesh (PyObject *ue_module)
184+ {
164185 ue_PyFbxMeshType.tp_new = PyType_GenericNew;;
165186 ue_PyFbxMeshType.tp_init = (initproc)py_ue_fbx_mesh_init;
166187 if (PyType_Ready (&ue_PyFbxMeshType) < 0 )
@@ -170,7 +191,8 @@ void ue_python_init_fbx_mesh(PyObject *ue_module) {
170191 PyModule_AddObject (ue_module, " FbxMesh" , (PyObject *)&ue_PyFbxMeshType);
171192}
172193
173- PyObject *py_ue_new_fbx_mesh (FbxMesh *fbx_mesh) {
194+ PyObject *py_ue_new_fbx_mesh (FbxMesh *fbx_mesh)
195+ {
174196 ue_PyFbxMesh *ret = (ue_PyFbxMesh *)PyObject_New (ue_PyFbxMesh, &ue_PyFbxMeshType);
175197 ret->fbx_mesh = fbx_mesh;
176198 return (PyObject *)ret;
0 commit comments