Skip to content

Commit 9e4ae4e

Browse files
author
Roberto De Ioris
committed
improved properties
1 parent dddbe87 commit 9e4ae4e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎Source/UnrealEnginePython/Private/UEPyModule.cpp‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ static PyObject *py_ue_get_property(ue_PyUObject *self, PyObject * args) {
350350
return py_obj;
351351
}
352352

353+
return PyErr_Format(PyExc_Exception, "unsupported value type for property %s", property_name);
354+
353355
end:
354356
Py_INCREF(Py_None);
355357
return Py_None;
@@ -376,12 +378,16 @@ static PyObject *py_ue_set_property(ue_PyUObject *self, PyObject * args) {
376378
u_float_property->SetPropertyValue(u_property->ContainerPtrToValuePtr<float>(self->ue_object), PyFloat_AsDouble(property_value));
377379
}
378380

379-
if (PyUnicode_Check(property_value)) {
381+
else if (PyUnicode_Check(property_value)) {
380382
UStrProperty *u_str_property = Cast<UStrProperty>(u_property);
381383
if (u_str_property)
382384
u_str_property->SetPropertyValue(u_property->ContainerPtrToValuePtr<FString>(self->ue_object), FString(UTF8_TO_TCHAR(PyUnicode_AsUTF8(property_value))));
383385
}
384386

387+
else {
388+
return PyErr_Format(PyExc_Exception, "unsupported property value");
389+
}
390+
385391

386392
Py_INCREF(Py_None);
387393
return Py_None;

0 commit comments

Comments
 (0)