forked from 20tab/UnrealEnginePython
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
386 changed files
with
8,932 additions
and
4,653 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
Source/PythonAutomation/Private/PythonAutomationModule.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. | ||
|
||
#include "PythonAutomationModule.h" | ||
#include "UnrealEnginePython.h" | ||
#include "UEPyFAutomationEditorCommonUtils.h" | ||
|
||
IMPLEMENT_MODULE(FPythonAutomationModule, PythonAutomation); | ||
|
||
|
||
void FPythonAutomationModule::StartupModule() | ||
{ | ||
FScopePythonGIL gil; | ||
PyObject *py_automation_module = ue_py_register_module("unreal_engine.automation"); | ||
ue_python_init_fautomation_editor_common_utils(py_automation_module); | ||
} | ||
|
||
void FPythonAutomationModule::ShutdownModule() | ||
{ | ||
|
||
} |
90 changes: 90 additions & 0 deletions
90
Source/PythonAutomation/Private/UEPyFAutomationEditorCommonUtils.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
|
||
#include "UEPyFAutomationEditorCommonUtils.h" | ||
|
||
#include "UnrealEnginePython.h" | ||
#include "Engine/World.h" | ||
|
||
|
||
static PyObject *py_ue_fautomation_editor_common_utils_run_pie(PyObject *cls, PyObject * args) | ||
{ | ||
Py_BEGIN_ALLOW_THREADS; | ||
FAutomationEditorCommonUtils::RunPIE(); | ||
Py_END_ALLOW_THREADS; | ||
Py_RETURN_NONE; | ||
} | ||
|
||
static PyObject *py_ue_fautomation_editor_common_utils_load_map(PyObject *cls, PyObject * args) | ||
{ | ||
char *map_name; | ||
if (!PyArg_ParseTuple(args, "s:load_map", &map_name)) | ||
return nullptr; | ||
Py_BEGIN_ALLOW_THREADS; | ||
FAutomationEditorCommonUtils::LoadMap(FString(UTF8_TO_TCHAR(map_name))); | ||
Py_END_ALLOW_THREADS; | ||
Py_RETURN_NONE; | ||
} | ||
|
||
static PyObject *py_ue_fautomation_editor_common_utils_create_new_map(PyObject *cls, PyObject * args) | ||
{ | ||
Py_RETURN_UOBJECT(FAutomationEditorCommonUtils::CreateNewMap()); | ||
} | ||
|
||
static PyMethodDef ue_PyFAutomationEditorCommonUtils_methods[] = { | ||
{ "run_pie", (PyCFunction)py_ue_fautomation_editor_common_utils_run_pie, METH_VARARGS | METH_CLASS, "" }, | ||
{ "load_map", (PyCFunction)py_ue_fautomation_editor_common_utils_load_map, METH_VARARGS | METH_CLASS, "" }, | ||
{ "create_new_map", (PyCFunction)py_ue_fautomation_editor_common_utils_create_new_map, METH_VARARGS | METH_CLASS, "" }, | ||
|
||
{ NULL } /* Sentinel */ | ||
}; | ||
|
||
|
||
static PyTypeObject ue_PyFAutomationEditorCommonUtilsType = { | ||
PyVarObject_HEAD_INIT(NULL, 0) | ||
"unreal_engine.FAutomationEditorCommonUtils", /* tp_name */ | ||
sizeof(ue_PyFAutomationEditorCommonUtils), /* tp_basicsize */ | ||
0, /* tp_itemsize */ | ||
0, /* tp_dealloc */ | ||
0, /* tp_print */ | ||
0, /* tp_getattr */ | ||
0, /* tp_setattr */ | ||
0, /* tp_reserved */ | ||
0, /* tp_repr */ | ||
0, /* tp_as_number */ | ||
0, /* tp_as_sequence */ | ||
0, /* tp_as_mapping */ | ||
0, /* tp_hash */ | ||
0, /* tp_call */ | ||
0, /* tp_str */ | ||
0, /* tp_getattro */ | ||
0, /* tp_setattro */ | ||
0, /* tp_as_buffer */ | ||
Py_TPFLAGS_DEFAULT, /* tp_flags */ | ||
"Unreal Engine AutomationEditorCommonUtils", /* tp_doc */ | ||
0, /* tp_traverse */ | ||
0, /* tp_clear */ | ||
0, /* tp_richcompare */ | ||
0, /* tp_weaklistoffset */ | ||
0, /* tp_iter */ | ||
0, /* tp_iternext */ | ||
ue_PyFAutomationEditorCommonUtils_methods, /* tp_methods */ | ||
0, | ||
0, | ||
}; | ||
|
||
static int py_ue_fautomation_editor_common_utils_init(ue_PyFAutomationEditorCommonUtils *self, PyObject * args) | ||
{ | ||
PyErr_SetString(PyExc_Exception, "FAutomationEditorCommonUtils is a singleton"); | ||
return -1; | ||
} | ||
|
||
void ue_python_init_fautomation_editor_common_utils(PyObject *ue_module) | ||
{ | ||
ue_PyFAutomationEditorCommonUtilsType.tp_new = PyType_GenericNew; | ||
ue_PyFAutomationEditorCommonUtilsType.tp_init = (initproc)py_ue_fautomation_editor_common_utils_init; | ||
|
||
if (PyType_Ready(&ue_PyFAutomationEditorCommonUtilsType) < 0) | ||
return; | ||
|
||
Py_INCREF(&ue_PyFAutomationEditorCommonUtilsType); | ||
PyModule_AddObject(ue_module, "FAutomationEditorCommonUtils", (PyObject *)&ue_PyFAutomationEditorCommonUtilsType); | ||
} |
13 changes: 13 additions & 0 deletions
13
Source/PythonAutomation/Private/UEPyFAutomationEditorCommonUtils.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
|
||
#include "UnrealEnginePython.h" | ||
|
||
#include "Tests/AutomationEditorCommon.h" | ||
|
||
typedef struct | ||
{ | ||
PyObject_HEAD | ||
/* Type-specific fields go here. */ | ||
} ue_PyFAutomationEditorCommonUtils; | ||
|
||
void ue_python_init_fautomation_editor_common_utils(PyObject *); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 1998-2018 20Tab S.r.l. All Rights Reserved. | ||
|
||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
#include "ModuleInterface.h" | ||
|
||
class FPythonAutomationModule : public IModuleInterface | ||
{ | ||
public: | ||
virtual void StartupModule(); | ||
virtual void ShutdownModule(); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 1998-2018 20Tab S.r.l All Rights Reserved. | ||
|
||
using UnrealBuildTool; | ||
using System.IO; | ||
|
||
public class PythonAutomation : ModuleRules | ||
{ | ||
#if WITH_FORWARDED_MODULE_RULES_CTOR | ||
public PythonAutomation(ReadOnlyTargetRules Target) : base(Target) | ||
#else | ||
public PythonAutomation(TargetInfo Target) | ||
#endif | ||
{ | ||
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; | ||
string enableUnityBuild = System.Environment.GetEnvironmentVariable("UEP_ENABLE_UNITY_BUILD"); | ||
bFasterWithoutUnity = string.IsNullOrEmpty(enableUnityBuild); | ||
|
||
PrivateIncludePaths.AddRange( | ||
new string[] { | ||
"PythonConsole/Private", | ||
// ... add other private include paths required here ... | ||
} | ||
); | ||
|
||
PrivateDependencyModuleNames.AddRange( | ||
new string[] { | ||
"Core", | ||
"CoreUObject", // @todo Mac: for some reason it's needed to link in debug on Mac | ||
"Engine", | ||
"UnrealEd", | ||
"UnrealEnginePython" | ||
} | ||
); | ||
|
||
} | ||
} |
Oops, something went wrong.