Skip to content

Commit 2ea635a

Browse files
author
Roberto De Ioris
committed
added rename_collection
1 parent 5eed906 commit 2ea635a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Source/UnrealEnginePython/Private/CollectionManager/UEPyICollectionManager.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,35 @@ static PyObject *py_ue_icollection_manager_reparent_collection(PyObject *cls, Py
6969
Py_RETURN_FALSE;
7070
}
7171

72+
static PyObject *py_ue_icollection_manager_rename_collection(PyObject *cls, PyObject * args)
73+
{
74+
char *name;
75+
int type;
76+
char *new_name;
77+
int new_type;
78+
79+
if (!PyArg_ParseTuple(args, "sisi", &name, &type, &new_name, &new_type))
80+
return nullptr;
81+
82+
ICollectionManager &CollectionManager = FCollectionManagerModule::GetModule().Get();
83+
84+
if (CollectionManager.RenameCollection(
85+
FName(UTF8_TO_TCHAR(name)),
86+
(ECollectionShareType::Type)type,
87+
FName(UTF8_TO_TCHAR(new_name)),
88+
(ECollectionShareType::Type)new_type
89+
))
90+
Py_RETURN_TRUE;
91+
Py_RETURN_FALSE;
92+
}
93+
7294

7395
static PyMethodDef ue_PyICollectionManager_methods[] = {
7496
{ "get_collections", (PyCFunction)py_ue_icollection_manager_get_collections, METH_VARARGS | METH_CLASS, "" },
7597
{ "create_static_collection", (PyCFunction)py_ue_icollection_manager_create_static_collection, METH_VARARGS | METH_CLASS, "" },
7698
{ "create_dynamic_collection", (PyCFunction)py_ue_icollection_manager_create_dynamic_collection, METH_VARARGS | METH_CLASS, "" },
7799
{ "reparent_collection", (PyCFunction)py_ue_icollection_manager_reparent_collection, METH_VARARGS | METH_CLASS, "" },
100+
{ "rename_collection", (PyCFunction)py_ue_icollection_manager_rename_collection, METH_VARARGS | METH_CLASS, "" },
78101
{ NULL } /* Sentinel */
79102
};
80103

0 commit comments

Comments
 (0)