Merging //UE4/Dev-Main @ 4448303 to Dev-Core (//UE4/Dev-Core)

#rb none

[CL 4450493 by Robert Manuszewski in Dev-Core branch]
This commit is contained in:
Robert Manuszewski
2018-10-11 08:14:26 -04:00
parent 683f0b0cda
commit 8841a31595
1238 changed files with 23555 additions and 28201 deletions

View File

@@ -169,9 +169,19 @@ FPropertyDef::FPropertyDef(const UProperty* InProperty)
, KeyDef()
, ValueDef()
{
if (const UObjectPropertyBase* ObjectProp = Cast<UObjectPropertyBase>(InProperty))
{
PropertySubType = ObjectProp->PropertyClass;
}
if (const UClassProperty* ClassProp = Cast<UClassProperty>(InProperty))
{
PropertySubType = ClassProp->PropertyClass;
PropertySubType = ClassProp->MetaClass;
}
if (const USoftClassProperty* ClassProp = Cast<USoftClassProperty>(InProperty))
{
PropertySubType = ClassProp->MetaClass;
}
if (const UStructProperty* StructProp = Cast<UStructProperty>(InProperty))
@@ -220,7 +230,7 @@ bool CalculatePropertyDef(PyTypeObject* InPyType, FPropertyDef& OutPropertyDef)
{
if (PyObject_IsSubclass((PyObject*)InPyType, (PyObject*)&PyWrapperObjectType) == 1)
{
OutPropertyDef.PropertyClass = UClassProperty::StaticClass();
OutPropertyDef.PropertyClass = UObjectProperty::StaticClass();
OutPropertyDef.PropertySubType = (UObject*)FPyWrapperObjectMetaData::GetClass(InPyType);
return true;
}
@@ -357,10 +367,24 @@ UProperty* CreateProperty(const FPropertyDef& InPropertyDef, const int32 InArray
{
Prop->ArrayDim = InArrayDim;
if (UObjectPropertyBase* ObjectProp = Cast<UObjectPropertyBase>(Prop))
{
UClass* ClassType = CastChecked<UClass>(InPropertyDef.PropertySubType);
ObjectProp->SetPropertyClass(ClassType);
}
if (UClassProperty* ClassProp = Cast<UClassProperty>(Prop))
{
UClass* ClassType = CastChecked<UClass>(InPropertyDef.PropertySubType);
ClassProp->SetPropertyClass(ClassType);
ClassProp->SetPropertyClass(UClass::StaticClass());
ClassProp->SetMetaClass(ClassType);
}
if (USoftClassProperty* ClassProp = Cast<USoftClassProperty>(Prop))
{
UClass* ClassType = CastChecked<UClass>(InPropertyDef.PropertySubType);
ClassProp->SetPropertyClass(UClass::StaticClass());
ClassProp->SetMetaClass(ClassType);
}
if (UStructProperty* StructProp = Cast<UStructProperty>(Prop))

View File

@@ -895,7 +895,15 @@ void FPyWrapperObjectMetaData::AddReferencedObjects(FPyWrapperBase* Instance, FR
UObject* OldInstance = Self->ObjectInstance;
Collector.AddReferencedObject(Self->ObjectInstance);
if (Self->ObjectInstance != OldInstance && Self->ObjectInstance != nullptr)
// Update the wrapped instance in the object factory
if (Self->ObjectInstance != OldInstance)
{
FPyWrapperObjectFactory::Get().UnmapInstance(OldInstance, Py_TYPE(Self));
}
// Update the object type
if (Self->ObjectInstance != OldInstance && Self->ObjectInstance)
{
// Object instance has been re-pointed, make sure we're still the correct type
PyTypeObject* NewPyType = FPyWrapperTypeRegistry::Get().GetWrappedClassType(Self->ObjectInstance->GetClass());
@@ -909,6 +917,12 @@ void FPyWrapperObjectMetaData::AddReferencedObjects(FPyWrapperBase* Instance, FR
}
}
// Update the wrapped instance in the object factory
if (Self->ObjectInstance != OldInstance && Self->ObjectInstance)
{
FPyWrapperObjectFactory::Get().MapInstance(Self->ObjectInstance, Self);
}
// We also need to ARO delegates on this object to catch ones that are wrapping Python callables (also recursing into nested structs and containers)
if (Self->ObjectInstance)
{