Skip to content

Commit

Permalink
fixed 4.13 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto De Ioris committed Feb 3, 2017
1 parent ce61942 commit 2542a72
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Source/UnrealEnginePython/Private/UEPyEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,11 @@ PyObject *py_unreal_engine_duplicate_asset(PyObject * self, PyObject * args) {

TSet<UPackage *> refused_packages;
FText error_text;
#if ENGINE_MINOR_VERSION < 14
UObject *new_asset = ObjectTools::DuplicateSingleObject(u_object, pgn, refused_packages);
#else
UObject *new_asset = ObjectTools::DuplicateSingleObject(u_object, pgn, refused_packages, false);
#endif
if (!new_asset) {
return PyErr_Format(PyExc_Exception, "unable to duplicate asset %s", path);
}
Expand Down
10 changes: 9 additions & 1 deletion Source/UnrealEnginePython/Private/UEPyIPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ static PyObject *py_ue_iplugin_to_json(ue_PyIPlugin *self, PyObject * args) {

FPluginDescriptor descriptor = self->plugin->GetDescriptor();
FString text;
#if ENGINE_MINOR_VERSION < 14
text = descriptor.ToString();
#else
descriptor.Write(text, enabled_by_default);
#endif

return PyUnicode_FromString(TCHAR_TO_UTF8(*text));
}
Expand All @@ -81,13 +85,17 @@ static PyObject *py_ue_iplugin_from_json(ue_PyIPlugin *self, PyObject * args) {
FText error;
FString text = FString(UTF8_TO_TCHAR(json));
FPluginDescriptor descriptor = self->plugin->GetDescriptor();
#if ENGINE_MINOR_VERSION < 14
if (!descriptor.Read(text, error)) {
#else
if (!descriptor.Read(text, enabled_by_default, error)) {
#endif
return PyErr_Format(PyExc_Exception, "unable to update descriptor from json");
}

Py_INCREF(Py_None);
return Py_None;
}
}

static PyMethodDef ue_PyIPlugin_methods[] = {
{ "get_name", (PyCFunction)py_ue_iplugin_get_name, METH_VARARGS, "" },
Expand Down

0 comments on commit 2542a72

Please sign in to comment.