Skip to content

Commit 95b4136

Browse files
author
Roberto De Ioris
authored
Merge pull request #504 from heylenz/master
pyactor add function "set_actor_hidden_in_game"
2 parents 6556d36 + 9aac61e commit 95b4136

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

Source/UnrealEnginePython/Private/UEPyModule.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,7 @@ static PyMethodDef ue_PyUObject_methods[] = {
616616
{ "save_config", (PyCFunction)py_ue_save_config, METH_VARARGS, "" },
617617
{ "get_actor_label", (PyCFunction)py_ue_get_actor_label, METH_VARARGS, "" },
618618
{ "set_actor_label", (PyCFunction)py_ue_set_actor_label, METH_VARARGS, "" },
619+
{ "set_actor_hidden_in_game", (PyCFunction)py_ue_set_actor_hidden_in_game, METH_VARARGS, "" },
619620

620621
{ "get_editor_world_counterpart_actor", (PyCFunction)py_ue_get_editor_world_counterpart_actor, METH_VARARGS, "" },
621622
{ "component_type_registry_invalidate_class", (PyCFunction)py_ue_component_type_registry_invalidate_class, METH_VARARGS, "" },

Source/UnrealEnginePython/Private/UObject/UEPyActor.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,35 @@ PyObject *py_ue_set_actor_label(ue_PyUObject *self, PyObject * args)
261261
Py_RETURN_NONE;
262262
}
263263

264+
PyObject *py_ue_set_actor_hidden_in_game(ue_PyUObject *self, PyObject * args)
265+
{
266+
267+
ue_py_check(self);
268+
269+
AActor *actor = ue_get_actor(self);
270+
if (!actor)
271+
return PyErr_Format(PyExc_Exception, "cannot retrieve Actor from uobject");
272+
273+
PyObject *py_bool = nullptr;
274+
if (!PyArg_ParseTuple(args, "O:set_actor_hidden_in_game", &py_bool))
275+
{
276+
return nullptr;
277+
}
278+
279+
if (PyObject_IsTrue(py_bool))
280+
{
281+
actor->SetActorHiddenInGame(true);
282+
}
283+
else
284+
{
285+
actor->SetActorHiddenInGame(false);
286+
}
287+
288+
289+
290+
Py_RETURN_NONE;
291+
}
292+
264293
PyObject *py_ue_find_actor_by_label(ue_PyUObject * self, PyObject * args)
265294
{
266295

Source/UnrealEnginePython/Private/UObject/UEPyActor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ PyObject *py_ue_actor_set_level_sequence(ue_PyUObject *, PyObject *);
2727
#if WITH_EDITOR
2828
PyObject *py_ue_get_actor_label(ue_PyUObject *, PyObject *);
2929
PyObject *py_ue_set_actor_label(ue_PyUObject *, PyObject *);
30+
PyObject *py_ue_set_actor_hidden_in_game(ue_PyUObject *, PyObject *);
3031
PyObject *py_ue_find_actor_by_label(ue_PyUObject *, PyObject *);
3132
PyObject *py_ue_get_editor_world_counterpart_actor(ue_PyUObject *, PyObject *);
3233
PyObject *py_ue_component_type_registry_invalidate_class(ue_PyUObject *, PyObject *);

0 commit comments

Comments
 (0)