@@ -380,12 +380,7 @@ PyObject *py_unreal_engine_load_struct(PyObject * self, PyObject * args)
380380 if (!u_struct)
381381 return PyErr_Format (PyExc_Exception, " unable to find struct %s" , name);
382382
383- ue_PyUObject *ret = ue_get_python_wrapper (u_struct);
384- if (!ret)
385- return PyErr_Format (PyExc_Exception, " uobject is in invalid state" );
386- Py_INCREF (ret);
387- return (PyObject *)ret;
388-
383+ Py_RETURN_UOBJECT (u_struct);
389384}
390385
391386
@@ -421,11 +416,7 @@ PyObject *py_unreal_engine_load_object(PyObject * self, PyObject * args)
421416 if (!u_object)
422417 return PyErr_Format (PyExc_Exception, " unable to load object %s" , name);
423418
424- ue_PyUObject *ret = ue_get_python_wrapper (u_object);
425- if (!ret)
426- return PyErr_Format (PyExc_Exception, " uobject is in invalid state" );
427- Py_INCREF (ret);
428- return (PyObject *)ret;
419+ Py_RETURN_UOBJECT (u_object);
429420
430421}
431422
@@ -510,11 +501,7 @@ PyObject *py_unreal_engine_find_object(PyObject * self, PyObject * args)
510501 if (!u_object)
511502 return PyErr_Format (PyExc_Exception, " unable to find object %s" , name);
512503
513- ue_PyUObject *ret = ue_get_python_wrapper (u_object);
514- if (!ret)
515- return PyErr_Format (PyExc_Exception, " uobject is in invalid state" );
516- Py_INCREF (ret);
517- return (PyObject *)ret;
504+ Py_RETURN_UOBJECT (u_object);
518505}
519506
520507
@@ -569,11 +556,7 @@ PyObject *py_unreal_engine_new_object(PyObject * self, PyObject * args)
569556
570557 new_object->PostLoad ();
571558
572- ue_PyUObject *ret = ue_get_python_wrapper (new_object);
573- if (!ret)
574- return PyErr_Format (PyExc_Exception, " uobject is in invalid state" );
575- Py_INCREF (ret);
576- return (PyObject *)ret;
559+ Py_RETURN_UOBJECT (new_object);
577560}
578561
579562PyObject *py_unreal_engine_get_mutable_default (PyObject * self, PyObject * args)
@@ -601,11 +584,7 @@ PyObject *py_unreal_engine_get_mutable_default(PyObject * self, PyObject * args)
601584 if (!mutable_object)
602585 return PyErr_Format (PyExc_Exception, " unable to create object" );
603586
604- ue_PyUObject *ret = ue_get_python_wrapper (mutable_object);
605- if (!ret)
606- return PyErr_Format (PyExc_Exception, " uobject is in invalid state" );
607- Py_INCREF (ret);
608- return (PyObject *)ret;
587+ Py_RETURN_UOBJECT (mutable_object);
609588}
610589
611590
@@ -637,11 +616,7 @@ PyObject *py_unreal_engine_new_class(PyObject * self, PyObject * args)
637616 if (!new_object)
638617 return PyErr_Format (PyExc_Exception, " unable to create UClass" );
639618
640- ue_PyUObject *ret = ue_get_python_wrapper (new_object);
641- if (!ret)
642- return PyErr_Format (PyExc_Exception, " uobject is in invalid state" );
643- Py_INCREF (ret);
644- return (PyObject *)ret;
619+ Py_RETURN_UOBJECT (new_object);
645620}
646621
647622PyObject *py_unreal_engine_all_classes (PyObject * self, PyObject * args)
@@ -664,7 +639,7 @@ PyObject *py_unreal_engine_all_worlds(PyObject * self, PyObject * args)
664639 PyObject *ret = PyList_New (0 );
665640 for (TObjectIterator<UWorld> Itr; Itr; ++Itr)
666641 {
667- ue_PyUObject *py_obj = ue_get_python_wrapper (*Itr);
642+ ue_PyUObject *py_obj = ue_get_python_uobject (*Itr);
668643 if (!py_obj)
669644 continue ;
670645 PyList_Append (ret, (PyObject *)py_obj);
@@ -997,11 +972,7 @@ PyObject *py_unreal_engine_create_package(PyObject *self, PyObject * args)
997972 u_package->FullyLoad ();
998973 u_package->MarkPackageDirty ();
999974
1000- ue_PyUObject *ret = ue_get_python_wrapper (u_package);
1001- if (!ret)
1002- return PyErr_Format (PyExc_Exception, " uobject is in invalid state" );
1003- Py_INCREF (ret);
1004- return (PyObject *)ret;
975+ Py_RETURN_UOBJECT (u_package);
1005976}
1006977
1007978PyObject *py_unreal_engine_get_or_create_package (PyObject *self, PyObject * args)
@@ -1027,21 +998,12 @@ PyObject *py_unreal_engine_get_or_create_package(PyObject *self, PyObject * args
1027998 u_package->MarkPackageDirty ();
1028999 }
10291000
1030- ue_PyUObject *ret = ue_get_python_wrapper (u_package);
1031- if (!ret)
1032- return PyErr_Format (PyExc_Exception, " uobject is in invalid state" );
1033- Py_INCREF (ret);
1034- return (PyObject *)ret;
1001+ Py_RETURN_UOBJECT (u_package);
10351002}
10361003
10371004PyObject *py_unreal_engine_get_transient_package (PyObject *self, PyObject * args)
10381005{
1039-
1040- ue_PyUObject *ret = ue_get_python_wrapper (GetTransientPackage ());
1041- if (!ret)
1042- return PyErr_Format (PyExc_Exception, " uobject is in invalid state" );
1043- Py_INCREF (ret);
1044- return (PyObject *)ret;
1006+ Py_RETURN_UOBJECT (GetTransientPackage ());
10451007}
10461008
10471009PyObject *py_unreal_engine_open_file_dialog (PyObject *self, PyObject * args)
0 commit comments