Skip to content

Commit 080faa9

Browse files
author
ikrima
committed
BUG: Editor only animation montage composite functions need to be compiled out in non-editor builds
1 parent 4aaedc1 commit 080faa9

4 files changed

Lines changed: 36 additions & 22 deletions

File tree

‎Source/UnrealEnginePython/Private/UEPyModule.cpp‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,12 +466,11 @@ static PyMethodDef ue_PyUObject_methods[] = {
466466
{ "anim_get_skeleton", (PyCFunction)py_ue_anim_get_skeleton, METH_VARARGS, "" },
467467
{ "anim_set_skeleton", (PyCFunction)py_ue_anim_set_skeleton, METH_VARARGS, "" },
468468

469-
{ "add_anim_composite_section", (PyCFunction)py_ue_add_anim_composite_section, METH_VARARGS, "" },
470-
471469
#if WITH_EDITOR
472470
{ "get_raw_animation_data", (PyCFunction)py_ue_anim_sequence_get_raw_animation_data, METH_VARARGS, "" },
473471
{ "get_raw_animation_track", (PyCFunction)py_ue_anim_sequence_get_raw_animation_track, METH_VARARGS, "" },
474472
{ "add_new_raw_track", (PyCFunction)py_ue_anim_sequence_add_new_raw_track, METH_VARARGS, "" },
473+
{ "add_anim_composite_section", (PyCFunction)py_ue_add_anim_composite_section, METH_VARARGS, "" },
475474
#endif
476475

477476

‎Source/UnrealEnginePython/Private/UObject/UEPyAnimSequence.cpp‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,22 @@ PyObject *py_ue_anim_sequence_add_new_raw_track(ue_PyUObject * self, PyObject *
9393

9494
return PyLong_FromLong(index);
9595
}
96+
97+
PyObject *py_ue_add_anim_composite_section(ue_PyUObject * self, PyObject * args) {
98+
ue_py_check(self);
99+
100+
char *name;
101+
float time;
102+
if (!PyArg_ParseTuple(args, "sf:add_anim_composite_section", &name, &time))
103+
return nullptr;
104+
105+
UAnimMontage *anim = ue_py_check_type<UAnimMontage>(self);
106+
if (!anim)
107+
return PyErr_Format(PyExc_Exception, "UObject is not a UAnimMontage.");
108+
109+
return PyLong_FromLong(anim->AddAnimCompositeSection(FName(UTF8_TO_TCHAR(name)), time));
110+
}
111+
96112
#endif
97113

98114
PyObject *py_ue_anim_set_skeleton(ue_PyUObject * self, PyObject * args) {
@@ -113,19 +129,4 @@ PyObject *py_ue_anim_set_skeleton(ue_PyUObject * self, PyObject * args) {
113129
anim->SetSkeleton(skeleton);
114130

115131
Py_RETURN_NONE;
116-
}
117-
118-
PyObject *py_ue_add_anim_composite_section(ue_PyUObject * self, PyObject * args) {
119-
ue_py_check(self);
120-
121-
char *name;
122-
float time;
123-
if (!PyArg_ParseTuple(args, "sf:add_anim_composite_section", &name, &time))
124-
return nullptr;
125-
126-
UAnimMontage *anim = ue_py_check_type<UAnimMontage>(self);
127-
if (!anim)
128-
return PyErr_Format(PyExc_Exception, "UObject is not a UAnimMontage.");
129-
130-
return PyLong_FromLong(anim->AddAnimCompositeSection(FName(UTF8_TO_TCHAR(name)), time));
131-
}
132+
}

‎Source/UnrealEnginePython/Private/UObject/UEPyAnimSequence.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ PyObject *py_ue_anim_get_skeleton(ue_PyUObject *, PyObject *);
1010
PyObject *py_ue_anim_sequence_get_raw_animation_data(ue_PyUObject *, PyObject *);
1111
PyObject *py_ue_anim_sequence_get_raw_animation_track(ue_PyUObject *, PyObject *);
1212
PyObject *py_ue_anim_sequence_add_new_raw_track(ue_PyUObject *, PyObject *);
13+
PyObject *py_ue_add_anim_composite_section(ue_PyUObject *, PyObject *);
1314
#endif
14-
PyObject *py_ue_anim_set_skeleton(ue_PyUObject *, PyObject *);
15-
PyObject *py_ue_add_anim_composite_section(ue_PyUObject *, PyObject *);
15+
PyObject *py_ue_anim_set_skeleton(ue_PyUObject *, PyObject *);

‎Source/UnrealEnginePython/UnrealEnginePython.Build.cs‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,22 @@ public UnrealEnginePython(TargetInfo Target)
176176
string dllsDir = Path.Combine(ModuleDirectory, "../../Binaries", Target.Platform == UnrealTargetPlatform.Win32 ? "Win32" : "Win64");
177177
try
178178
{
179-
File.Copy(Path.Combine(pythonHome, "python3.dll"), Path.Combine(dllsDir, "python3.dll"), true);
180-
File.Copy(Path.Combine(pythonHome, "python36.dll"), Path.Combine(dllsDir, "python36.dll"), true);
179+
string[] dllsToCopy =
180+
{
181+
"python3.dll",
182+
"python36.dll"
183+
};
184+
foreach (string dllToCopy in dllsToCopy)
185+
{
186+
// If the dll exist, make sure to set attributes so they are actually accessible
187+
if (File.Exists(Path.Combine(dllsDir, dllToCopy)))
188+
{
189+
File.SetAttributes(Path.Combine(dllsDir, dllToCopy), FileAttributes.Normal);
190+
}
191+
192+
File.Copy(Path.Combine(pythonHome, dllToCopy), Path.Combine(dllsDir, dllToCopy), true);
193+
File.SetAttributes(Path.Combine(dllsDir, dllToCopy), FileAttributes.Normal);
194+
}
181195
}
182196
catch(System.IO.IOException) { }
183197
catch(System.UnauthorizedAccessException)

0 commit comments

Comments
 (0)