Skip to content

Commit b157b2a

Browse files
author
Roberto De Ioris
committed
get rid of transient properties when not needed
1 parent 166619c commit b157b2a

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Source/UnrealEnginePython/Private/UObject/UEPyActor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ PyObject *py_ue_add_actor_component(ue_PyUObject * self, PyObject * args) {
377377
}
378378
}
379379

380-
UActorComponent *component = NewObject<UActorComponent>(actor, u_class, FName(UTF8_TO_TCHAR(name)));
380+
UActorComponent *component = NewObject<UActorComponent>(actor, u_class, FName(UTF8_TO_TCHAR(name)), RF_Public);
381381
if (!component)
382382
return PyErr_Format(PyExc_Exception, "unable to create component");
383383

@@ -413,7 +413,7 @@ PyObject *py_ue_add_python_component(ue_PyUObject * self, PyObject * args) {
413413
return PyErr_Format(PyExc_Exception, "uobject is not an AActor");
414414
}
415415

416-
UPythonComponent *component = NewObject<UPythonComponent>(actor, FName(UTF8_TO_TCHAR(name)));
416+
UPythonComponent *component = NewObject<UPythonComponent>(actor, FName(UTF8_TO_TCHAR(name)), RF_Public);
417417
if (!component)
418418
return PyErr_Format(PyExc_Exception, "unable to create component");
419419

@@ -495,7 +495,7 @@ PyObject *py_ue_add_actor_root_component(ue_PyUObject * self, PyObject * args) {
495495
return PyErr_Format(PyExc_Exception, "argument is not a class");
496496
}
497497

498-
USceneComponent *component = NewObject<USceneComponent>(actor, (UClass *)py_obj->ue_object, FName(UTF8_TO_TCHAR(name)));
498+
USceneComponent *component = NewObject<USceneComponent>(actor, (UClass *)py_obj->ue_object, FName(UTF8_TO_TCHAR(name)), RF_Public);
499499
if (!component)
500500
return PyErr_Format(PyExc_Exception, "unable to create component");
501501

Source/UnrealEnginePython/Private/UObject/UEPyObject.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ PyObject *py_ue_add_property(ue_PyUObject * self, PyObject * args) {
805805
}
806806
}
807807

808-
EObjectFlags o_flags = RF_Public | RF_MarkAsNative | RF_Transient;
808+
EObjectFlags o_flags = RF_Public | RF_MarkAsNative;// | RF_Transient;
809809

810810
if (ue_is_pyuobject(obj)) {
811811
ue_PyUObject *py_obj = (ue_PyUObject *)obj;
@@ -854,7 +854,14 @@ PyObject *py_ue_add_property(ue_PyUObject * self, PyObject * args) {
854854
return PyErr_Format(PyExc_Exception, "unable to allocate new UProperty");
855855
}
856856

857-
uint64 flags = CPF_Edit | CPF_BlueprintVisible | CPF_Transient | CPF_ZeroConstructor;
857+
// one day we may want to support transient properties...
858+
//uint64 flags = CPF_Edit | CPF_BlueprintVisible | CPF_Transient | CPF_ZeroConstructor;
859+
uint64 flags = CPF_Edit | CPF_BlueprintVisible | CPF_ZeroConstructor;
860+
861+
// we assumed Actor Components to be non-editable
862+
if (u_prop_class && u_prop_class->IsChildOf<UActorComponent>()) {
863+
flags |= ~CPF_Edit;
864+
}
858865

859866
// TODO manage replication
860867
/*

0 commit comments

Comments
 (0)