From b157b2a4a60b821db7f88e69a535e679afb7baa9 Mon Sep 17 00:00:00 2001 From: Roberto De Ioris Date: Sun, 30 Jul 2017 10:39:41 +0200 Subject: [PATCH] get rid of transient properties when not needed --- .../UnrealEnginePython/Private/UObject/UEPyActor.cpp | 6 +++--- .../UnrealEnginePython/Private/UObject/UEPyObject.cpp | 11 +++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Source/UnrealEnginePython/Private/UObject/UEPyActor.cpp b/Source/UnrealEnginePython/Private/UObject/UEPyActor.cpp index 080fca230..0ccd6c006 100644 --- a/Source/UnrealEnginePython/Private/UObject/UEPyActor.cpp +++ b/Source/UnrealEnginePython/Private/UObject/UEPyActor.cpp @@ -377,7 +377,7 @@ PyObject *py_ue_add_actor_component(ue_PyUObject * self, PyObject * args) { } } - UActorComponent *component = NewObject(actor, u_class, FName(UTF8_TO_TCHAR(name))); + UActorComponent *component = NewObject(actor, u_class, FName(UTF8_TO_TCHAR(name)), RF_Public); if (!component) return PyErr_Format(PyExc_Exception, "unable to create component"); @@ -413,7 +413,7 @@ PyObject *py_ue_add_python_component(ue_PyUObject * self, PyObject * args) { return PyErr_Format(PyExc_Exception, "uobject is not an AActor"); } - UPythonComponent *component = NewObject(actor, FName(UTF8_TO_TCHAR(name))); + UPythonComponent *component = NewObject(actor, FName(UTF8_TO_TCHAR(name)), RF_Public); if (!component) return PyErr_Format(PyExc_Exception, "unable to create component"); @@ -495,7 +495,7 @@ PyObject *py_ue_add_actor_root_component(ue_PyUObject * self, PyObject * args) { return PyErr_Format(PyExc_Exception, "argument is not a class"); } - USceneComponent *component = NewObject(actor, (UClass *)py_obj->ue_object, FName(UTF8_TO_TCHAR(name))); + USceneComponent *component = NewObject(actor, (UClass *)py_obj->ue_object, FName(UTF8_TO_TCHAR(name)), RF_Public); if (!component) return PyErr_Format(PyExc_Exception, "unable to create component"); diff --git a/Source/UnrealEnginePython/Private/UObject/UEPyObject.cpp b/Source/UnrealEnginePython/Private/UObject/UEPyObject.cpp index 27db85b05..be497dafe 100644 --- a/Source/UnrealEnginePython/Private/UObject/UEPyObject.cpp +++ b/Source/UnrealEnginePython/Private/UObject/UEPyObject.cpp @@ -805,7 +805,7 @@ PyObject *py_ue_add_property(ue_PyUObject * self, PyObject * args) { } } - EObjectFlags o_flags = RF_Public | RF_MarkAsNative | RF_Transient; + EObjectFlags o_flags = RF_Public | RF_MarkAsNative;// | RF_Transient; if (ue_is_pyuobject(obj)) { ue_PyUObject *py_obj = (ue_PyUObject *)obj; @@ -854,7 +854,14 @@ PyObject *py_ue_add_property(ue_PyUObject * self, PyObject * args) { return PyErr_Format(PyExc_Exception, "unable to allocate new UProperty"); } - uint64 flags = CPF_Edit | CPF_BlueprintVisible | CPF_Transient | CPF_ZeroConstructor; + // one day we may want to support transient properties... + //uint64 flags = CPF_Edit | CPF_BlueprintVisible | CPF_Transient | CPF_ZeroConstructor; + uint64 flags = CPF_Edit | CPF_BlueprintVisible | CPF_ZeroConstructor; + + // we assumed Actor Components to be non-editable + if (u_prop_class && u_prop_class->IsChildOf()) { + flags |= ~CPF_Edit; + } // TODO manage replication /*