Skip to content

Commit c21f72d

Browse files
author
Roberto De Ioris
committed
refactored editor commands
1 parent 6cc1f1b commit c21f72d

1 file changed

Lines changed: 10 additions & 30 deletions

File tree

‎Source/UnrealEnginePython/Private/UEPyEditor.cpp‎

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -188,62 +188,42 @@ PyObject *py_unreal_engine_editor_command_build(PyObject * self, PyObject * args
188188

189189
PyObject *py_unreal_engine_editor_command_save_current_level(PyObject * self, PyObject * args)
190190
{
191-
192-
if (!GEditor)
193-
return PyErr_Format(PyExc_Exception, "no GEditor found");
194-
195191
FLevelEditorActionCallbacks::Save();
196192

197-
Py_INCREF(Py_None);
198-
return Py_None;
193+
Py_RETURN_NONE;
199194
}
200195

201196
PyObject *py_unreal_engine_editor_command_save_all_levels(PyObject * self, PyObject * args)
202197
{
203198

204-
if (!GEditor)
205-
return PyErr_Format(PyExc_Exception, "no GEditor found");
206-
207199
FLevelEditorActionCallbacks::SaveAllLevels();
208200

209-
Py_INCREF(Py_None);
210-
return Py_None;
201+
Py_RETURN_NONE;
211202
}
212203

213204
PyObject *py_unreal_engine_editor_save_all(PyObject * self, PyObject * args)
214205
{
215206

216-
if (!GEditor)
217-
return PyErr_Format(PyExc_Exception, "no GEditor found");
218-
219207
FEditorFileUtils::SaveDirtyPackages(false, true, true, false, false, false);
220208

221-
Py_INCREF(Py_None);
222-
return Py_None;
209+
Py_RETURN_NONE;
223210
}
224211

225212
PyObject *py_unreal_engine_editor_command_build_lighting(PyObject * self, PyObject * args)
226213
{
227214

228-
if (!GEditor)
229-
return PyErr_Format(PyExc_Exception, "no GEditor found");
230-
231215
FLevelEditorActionCallbacks::BuildLightingOnly_Execute();
232-
Py_INCREF(Py_None);
233-
return Py_None;
216+
217+
Py_RETURN_NONE;
234218
}
235219

236220

237221
PyObject *py_unreal_engine_editor_deselect_actors(PyObject * self, PyObject * args)
238222
{
239223

240-
if (!GEditor)
241-
return PyErr_Format(PyExc_Exception, "no GEditor found");
242-
243224
GEditor->SelectNone(true, true, false);
244225

245-
Py_INCREF(Py_None);
246-
return Py_None;
226+
Py_RETURN_NONE;
247227
}
248228

249229
PyObject *py_unreal_engine_editor_play(PyObject * self, PyObject * args)
@@ -432,7 +412,7 @@ PyObject *py_unreal_engine_import_asset(PyObject * self, PyObject * args)
432412
if (py_sync && PyObject_IsTrue(py_sync))
433413
{
434414
sync_to_browser = true;
435-
}
415+
}
436416

437417
FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked<FAssetToolsModule>("AssetTools");
438418
TArray<UObject *> objects = AssetToolsModule.Get().ImportAssets(files, UTF8_TO_TCHAR(destination), factory, sync_to_browser);
@@ -742,7 +722,7 @@ PyObject *py_unreal_engine_delete_asset(PyObject * self, PyObject * args)
742722

743723
Py_INCREF(Py_None);
744724
return Py_None;
745-
}
725+
}
746726

747727
PyObject *py_unreal_engine_delete_object(PyObject * self, PyObject * args)
748728
{
@@ -1431,7 +1411,7 @@ PyObject *py_unreal_engine_blueprint_set_variable_visibility(PyObject * self, Py
14311411
if (!PyArg_ParseTuple(args, "OsO:blueprint_set_variable_visibility", &py_blueprint, &name, &visibility))
14321412
{
14331413
return NULL;
1434-
}
1414+
}
14351415

14361416
if (!ue_is_pyuobject(py_blueprint))
14371417
{
@@ -1883,7 +1863,7 @@ PyObject *py_unreal_engine_move_selected_actors_to_level(PyObject *self, PyObjec
18831863
if (!PyArg_ParseTuple(args, "O:move_selected_actors_to_level", &py_level))
18841864
{
18851865
return NULL;
1886-
}
1866+
}
18871867

18881868
ULevel *level = ue_py_check_type<ULevel>(py_level);
18891869
if (!level)

0 commit comments

Comments
 (0)