1919#include " Editor/ContentBrowser/Public/IContentBrowserSingleton.h"
2020#include " Runtime/Engine/Classes/EdGraph/EdGraphPin.h"
2121#include " Runtime/Engine/Classes/EdGraph/EdGraphSchema.h"
22+ #include " Toolkits/AssetEditorManager.h"
2223
2324
2425PyObject *py_unreal_engine_get_editor_world (PyObject * self, PyObject * args) {
@@ -554,8 +555,10 @@ PyObject *py_unreal_engine_delete_asset(PyObject * self, PyObject * args) {
554555 TArray<UObject *> objects;
555556 objects.Add (u_object);
556557
557- if (ObjectTools::ForceDeleteObjects (objects, show_confirmation) < 1 ) {
558- return PyErr_Format (PyExc_Exception, " unable to delete asset %s" , path);
558+ if (ObjectTools::DeleteObjects (objects, show_confirmation) < 1 ) {
559+ if (ObjectTools::ForceDeleteObjects (objects, show_confirmation) < 1 ) {
560+ return PyErr_Format (PyExc_Exception, " unable to delete asset %s" , path);
561+ }
559562 }
560563
561564 Py_INCREF (Py_None);
@@ -578,7 +581,7 @@ PyObject *py_unreal_engine_delete_object(PyObject * self, PyObject * args) {
578581
579582 TArray<UObject *> objects_to_delete;
580583 objects_to_delete.Add (u_object);
581-
584+
582585
583586 if (py_bool && PyObject_IsTrue (py_bool)) {
584587 if (ObjectTools::ForceDeleteObjects (objects_to_delete, false ) < 1 ) {
@@ -788,6 +791,47 @@ PyObject *py_unreal_engine_get_selected_assets(PyObject * self, PyObject * args)
788791 return assets_list;
789792}
790793
794+ PyObject *py_unreal_engine_open_editor_for_asset (PyObject * self, PyObject * args) {
795+ PyObject *py_obj;
796+
797+ if (!PyArg_ParseTuple (args, " O:open_editor_for_asset" , &py_obj)) {
798+ return NULL ;
799+ }
800+
801+ UObject *u_obj = ue_py_check_type<UObject>(py_obj);
802+ if (!u_obj)
803+ return PyErr_Format (PyExc_Exception, " argument is not a UObject" );
804+ if (FAssetEditorManager::Get ().OpenEditorForAsset (u_obj)) {
805+ Py_INCREF (Py_True);
806+ return Py_True;
807+ }
808+ Py_INCREF (Py_False);
809+ return Py_False;
810+ }
811+
812+ PyObject *py_unreal_engine_close_editor_for_asset (PyObject * self, PyObject * args) {
813+ PyObject *py_obj;
814+
815+ if (!PyArg_ParseTuple (args, " O:close_editor_for_asset" , &py_obj)) {
816+ return NULL ;
817+ }
818+
819+ UObject *u_obj = ue_py_check_type<UObject>(py_obj);
820+ if (!u_obj)
821+ return PyErr_Format (PyExc_Exception, " argument is not a UObject" );
822+ FAssetEditorManager::Get ().CloseAllEditorsForAsset (u_obj);
823+
824+ Py_INCREF (Py_None);
825+ return Py_None;
826+ }
827+
828+ PyObject *py_unreal_engine_close_all_asset_editors (PyObject * self, PyObject * args) {
829+ FAssetEditorManager::Get ().CloseAllAssetEditors ();
830+
831+ Py_INCREF (Py_None);
832+ return Py_None;
833+ }
834+
791835PyObject *py_unreal_engine_set_fbx_import_option (PyObject * self, PyObject * args) {
792836 PyObject *obj;
793837
0 commit comments