Skip to content

Commit 412007d

Browse files
author
Roberto De Ioris
authored
Merge pull request 20tab#399 from HughMacdonald/allow_upropery_uobject_class
Allow Class objects to be assigned to Properties that take a UObject
2 parents dcfaf02 + 7c7402d commit 412007d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎Source/UnrealEnginePython/Private/UEPyModule.cpp‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,6 +2437,14 @@ bool ue_py_convert_pyobject(PyObject *py_obj, UProperty *prop, uint8 *buffer, in
24372437
casted_prop_weak_object->SetPropertyValue_InContainer(buffer, FWeakObjectPtr(ue_obj->ue_object), index);
24382438
return true;
24392439
}
2440+
else if (auto casted_prop = Cast<UObjectPropertyBase>(prop))
2441+
{
2442+
// ensure the object type is correct, otherwise crash could happen (soon or later)
2443+
if (!ue_obj->ue_object->IsA(casted_prop->PropertyClass))
2444+
return false;
2445+
casted_prop->SetObjectPropertyValue_InContainer(buffer, ue_obj->ue_object, index);
2446+
return true;
2447+
}
24402448

24412449
return false;
24422450
}

0 commit comments

Comments
 (0)