Skip to content

Commit b14cf86

Browse files
author
Roberto De Ioris
committed
added get_blueprint_components
1 parent 9f42f93 commit b14cf86

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

Source/UnrealEnginePython/Private/UEPyEditor.cpp

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ PyObject *py_unreal_engine_editor_play(PyObject * self, PyObject * args) {
233233
#else
234234
GEditor->RequestPlaySession(&v, &r, false, false);
235235
#endif
236-
236+
237237
Py_RETURN_NONE;
238238
}
239239

@@ -1111,6 +1111,31 @@ PyObject *py_unreal_engine_create_blueprint_from_actor(PyObject * self, PyObject
11111111

11121112
}
11131113

1114+
PyObject *py_unreal_engine_get_blueprint_components(PyObject * self, PyObject * args) {
1115+
1116+
PyObject *py_blueprint;
1117+
1118+
if (!PyArg_ParseTuple(args, "O|:add_component_to_blueprint", &py_blueprint)) {
1119+
return NULL;
1120+
}
1121+
1122+
UBlueprint *bp = ue_py_check_type<UBlueprint>(py_blueprint);
1123+
if (!bp)
1124+
return PyErr_Format(PyExc_Exception, "uobject is not a Blueprint");
1125+
1126+
PyObject *py_list = PyList_New(0);
1127+
1128+
for (USCS_Node *node : bp->SimpleConstructionScript->GetAllNodes()) {
1129+
1130+
ue_PyUObject *item = ue_get_python_wrapper(node->ComponentTemplate);
1131+
if (item)
1132+
PyList_Append(py_list, (PyObject *)item);
1133+
1134+
}
1135+
return py_list;
1136+
1137+
}
1138+
11141139
PyObject *py_unreal_engine_add_component_to_blueprint(PyObject * self, PyObject * args) {
11151140

11161141
PyObject *py_blueprint;
@@ -1254,7 +1279,7 @@ PyObject *py_unreal_engine_blueprint_set_variable_visibility(PyObject * self, Py
12541279

12551280
Py_INCREF(Py_None);
12561281
return Py_None;
1257-
}
1282+
}
12581283

12591284
PyObject *py_unreal_engine_blueprint_add_new_timeline(PyObject * self, PyObject * args) {
12601285

Source/UnrealEnginePython/Private/UEPyEditor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ PyObject *py_unreal_engine_blueprint_add_member_variable(PyObject *, PyObject *)
4949
PyObject *py_unreal_engine_blueprint_add_new_timeline(PyObject *, PyObject *);
5050
PyObject *py_unreal_engine_blueprint_set_variable_visibility(PyObject *, PyObject *);
5151

52+
PyObject *py_unreal_engine_get_blueprint_components(PyObject *, PyObject *);
53+
5254
PyObject *py_unreal_engine_editor_play(PyObject *, PyObject *);
5355
PyObject *py_unreal_engine_editor_on_asset_post_import(PyObject *, PyObject *);
5456

Source/UnrealEnginePython/Private/UEPyModule.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ static PyMethodDef unreal_engine_methods[] = {
255255
{ "blueprint_add_ubergraph_page", py_unreal_engine_blueprint_add_ubergraph_page, METH_VARARGS, "" },
256256
{ "blueprint_mark_as_structurally_modified", py_unreal_engine_blueprint_mark_as_structurally_modified, METH_VARARGS, "" },
257257
{ "add_component_to_blueprint", py_unreal_engine_add_component_to_blueprint, METH_VARARGS, "" },
258+
{ "get_blueprint_components", py_unreal_engine_get_blueprint_components, METH_VARARGS, "" },
258259
{ "create_material_instance", py_unreal_engine_create_material_instance, METH_VARARGS, "" },
259260
{ "message_dialog_open", py_unreal_engine_message_dialog_open, METH_VARARGS, "" },
260261
{ "create_modal_save_asset_dialog", py_unreal_engine_create_modal_save_asset_dialog, METH_VARARGS, "" },

0 commit comments

Comments
 (0)