Skip to content

4.24.2 Upgrade - Fixed all compiler Errors and Warnings. #833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Once the plugin is installed and enabled, you get access to the 'PythonConsole'

All of the exposed engine features are under the 'unreal_engine' virtual module (it is completely coded in c into the plugin, so do not expect to run 'import unreal_engine' from a standard python shell)

The minimal supported Unreal Engine version is 4.12, while the latest is 4.23
The minimal supported Unreal Engine version is 4.12, while the latest is 4.24

We support official python.org releases as well as IntelPython and Anaconda distributions.

Expand Down
3 changes: 1 addition & 2 deletions Source/PythonAutomation/PythonAutomation.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public PythonAutomation(TargetInfo Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
string enableUnityBuild = System.Environment.GetEnvironmentVariable("UEP_ENABLE_UNITY_BUILD");
bFasterWithoutUnity = string.IsNullOrEmpty(enableUnityBuild);

bUseUnity = string.IsNullOrEmpty(enableUnityBuild);
PrivateIncludePaths.AddRange(
new string[] {
"PythonConsole/Private",
Expand Down
2 changes: 1 addition & 1 deletion Source/PythonConsole/PythonConsole.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public PythonConsole(TargetInfo Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
string enableUnityBuild = System.Environment.GetEnvironmentVariable("UEP_ENABLE_UNITY_BUILD");
bFasterWithoutUnity = string.IsNullOrEmpty(enableUnityBuild);
bUseUnity = string.IsNullOrEmpty(enableUnityBuild);

PrivateIncludePaths.AddRange(
new string[] {
Expand Down
1 change: 1 addition & 0 deletions Source/PythonEditor/Private/PythonEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "PythonEditorStyle.h"
#include "PythonProjectEditor.h"
#include "PythonProject.h"
#include "Subsystems/AssetEditorSubsystem.h"
#include "Runtime/Slate/Public/Framework/MultiBox/MultiBoxBuilder.h"

static const FName PythonEditorTabName( TEXT( "PythonEditor" ) );
Expand Down
11 changes: 10 additions & 1 deletion Source/PythonEditor/Private/PythonProjectEditor.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.

#include "PythonProjectEditor.h"

#include "Subsystems/AssetEditorSubsystem.h"

// #include "UnrealEd.h"

#include "SPythonEditor.h"
#include "SPythonProjectEditor.h"
#include "Runtime/Slate/Public/Widgets/Docking/SDockTab.h"
Expand All @@ -13,6 +18,8 @@
#include "PythonProjectEditorCommands.h"
#include "Runtime/Core/Public/HAL/PlatformFilemanager.h"
#include "Runtime/Core/Public/Misc/MessageDialog.h"


#define LOCTEXT_NAMESPACE "PythonEditor"

TWeakPtr<FPythonProjectEditor> FPythonProjectEditor::PythonEditor;
Expand Down Expand Up @@ -209,7 +216,9 @@ void FPythonProjectEditor::RegisterToolbarTab(const TSharedRef<class FTabManager

void FPythonProjectEditor::InitPythonEditor(const EToolkitMode::Type Mode, const TSharedPtr< class IToolkitHost >& InitToolkitHost, class UPythonProject* PythonProject)
{
FAssetEditorManager::Get().CloseOtherEditors(PythonProject, this);
// UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
// GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->CloseOtherEditors(PythonProject, this);
GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->CloseOtherEditors(PythonProject, this);
PythonProjectBeingEdited = PythonProject;

TSharedPtr<FPythonProjectEditor> ThisPtr(SharedThis(this));
Expand Down
4 changes: 3 additions & 1 deletion Source/PythonEditor/PythonEditor.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public PythonEditor(TargetInfo Target)

PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
string enableUnityBuild = System.Environment.GetEnvironmentVariable("UEP_ENABLE_UNITY_BUILD");
bFasterWithoutUnity = string.IsNullOrEmpty(enableUnityBuild);
bUseUnity = string.IsNullOrEmpty(enableUnityBuild);

PrivateIncludePaths.AddRange(
new string[] {
Expand All @@ -32,11 +32,13 @@ public PythonEditor(TargetInfo Target)
"UnrealEd",
"EditorStyle",
"PropertyEditor",
"ContentBrowser",
"Kismet", // for FWorkflowCentricApplication
"InputCore",
"DirectoryWatcher",
"LevelEditor",
"Projects",
"Engine",
"UnrealEnginePython"
}
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@

#include "UEPyFMaterialEditorUtilities.h"

#if WITH_EDITOR

#include "Subsystems/AssetEditorSubsystem.h"

#include "Materials/Material.h"
#include "Runtime/Engine/Classes/EdGraph/EdGraph.h"

Expand Down Expand Up @@ -54,7 +57,9 @@ static PyObject *py_ue_command_apply(PyObject *cls, PyObject * args)
return PyErr_Format(PyExc_Exception, "argument is not a UMaterial");
}

IAssetEditorInstance *Instance = FAssetEditorManager::Get().FindEditorForAsset(Material, false);
//UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();

IAssetEditorInstance *Instance = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->FindEditorForAsset(Material, false);
if (!Instance)
{
return PyErr_Format(PyExc_Exception, "unable to retrieve editor for UMaterial");
Expand Down
11 changes: 8 additions & 3 deletions Source/UnrealEnginePython/Private/Slate/UEPyFMenuBuilder.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "UEPyFMenuBuilder.h"

#include "IAssetTools.h"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#if WITH_EDITOR

#include "Wrappers/UEPyESlateEnums.h"

static PyObject* py_ue_fmenu_builder_begin_section(ue_PyFMenuBuilder* self, PyObject* args)
Expand Down Expand Up @@ -115,6 +115,9 @@ static PyObject* py_ue_fmenu_builder_add_menu_separator(ue_PyFMenuBuilder* self,
}

#if WITH_EDITOR

#include "ContentBrowserModule.h"

static PyObject* py_ue_fmenu_builder_add_asset_actions(ue_PyFMenuBuilder* self, PyObject* args)
{
PyObject* py_assets;
Expand All @@ -140,8 +143,10 @@ static PyObject* py_ue_fmenu_builder_add_asset_actions(ue_PyFMenuBuilder* self,
Py_DECREF(py_assets);

FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked<FAssetToolsModule>(TEXT("AssetTools"));
bool addedSomething = AssetToolsModule.Get().GetAssetActions(u_objects, self->menu_builder, true);
if (addedSomething)

FContentBrowserModule& ContentBrowserModule = FModuleManager::LoadModuleChecked<FContentBrowserModule>("ContentBrowser");
TArray<FContentBrowserMenuExtender_SelectedAssets>& AssetMenuExtenderDelegates = ContentBrowserModule.GetAllAssetViewContextMenuExtenders();
if (AssetMenuExtenderDelegates.Num() > 0)
{
Py_RETURN_TRUE;
}
Expand Down
21 changes: 15 additions & 6 deletions Source/UnrealEnginePython/Private/UEPyEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "UnrealEd.h"
#include "FbxMeshUtils.h"
#include "Kismet2/BlueprintEditorUtils.h"

#include "Editor/LevelEditor/Public/LevelEditorActions.h"
#include "Editor/UnrealEd/Public/EditorLevelUtils.h"
#include "Runtime/Projects/Public/Interfaces/IPluginManager.h"
Expand Down Expand Up @@ -41,6 +42,7 @@

#include "UEPyIPlugin.h"


PyObject *py_unreal_engine_redraw_all_viewports(PyObject * self, PyObject * args)
{
FEditorSupportDelegates::RedrawAllViewports.Broadcast();
Expand Down Expand Up @@ -1140,7 +1142,9 @@ PyObject *py_unreal_engine_get_selected_assets(PyObject * self, PyObject * args)

PyObject *py_unreal_engine_get_all_edited_assets(PyObject * self, PyObject * args)
{
TArray<UObject *> assets = FAssetEditorManager::Get().GetAllEditedAssets();

//UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
TArray<UObject *> assets = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->GetAllEditedAssets();
PyObject *assets_list = PyList_New(0);

for (UObject *asset : assets)
Expand Down Expand Up @@ -1168,7 +1172,9 @@ PyObject *py_unreal_engine_open_editor_for_asset(PyObject * self, PyObject * arg
if (!u_obj)
return PyErr_Format(PyExc_Exception, "argument is not a UObject");

if (FAssetEditorManager::Get().OpenEditorForAsset(u_obj))
//UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();

if (GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->OpenEditorForAsset(u_obj))
{
Py_RETURN_TRUE;
}
Expand All @@ -1193,7 +1199,8 @@ PyObject *py_unreal_engine_find_editor_for_asset(PyObject * self, PyObject * arg
if (py_bool && PyObject_IsTrue(py_bool))
bFocus = true;

IAssetEditorInstance *instance = FAssetEditorManager::Get().FindEditorForAsset(u_obj, bFocus);
//UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
IAssetEditorInstance *instance = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->FindEditorForAsset(u_obj, bFocus);
if (!instance)
return PyErr_Format(PyExc_Exception, "no editor found for asset");

Expand All @@ -1212,14 +1219,16 @@ PyObject *py_unreal_engine_close_editor_for_asset(PyObject * self, PyObject * ar
UObject *u_obj = ue_py_check_type<UObject>(py_obj);
if (!u_obj)
return PyErr_Format(PyExc_Exception, "argument is not a UObject");
FAssetEditorManager::Get().CloseAllEditorsForAsset(u_obj);

//UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->CloseAllEditorsForAsset(u_obj);

Py_RETURN_NONE;
}

PyObject *py_unreal_engine_close_all_asset_editors(PyObject * self, PyObject * args)
{
FAssetEditorManager::Get().CloseAllAssetEditors();
GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->CloseAllAssetEditors();

Py_RETURN_NONE;
}
Expand Down Expand Up @@ -1355,7 +1364,7 @@ PyObject *py_unreal_engine_reload_blueprint(PyObject * self, PyObject * args)
UBlueprint *reloaded_bp = nullptr;

Py_BEGIN_ALLOW_THREADS
reloaded_bp = FKismetEditorUtilities::ReloadBlueprint(bp);
reloaded_bp = FKismetEditorUtilities::ReplaceBlueprint(bp, bp);
Py_END_ALLOW_THREADS

Py_RETURN_UOBJECT(reloaded_bp);
Expand Down
4 changes: 2 additions & 2 deletions Source/UnrealEnginePython/Private/UEPyModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ static PyObject* py_ue_get_py_proxy(ue_PyUObject* self, PyObject* args)
static PyObject* py_unreal_engine_shutdown(PyObject* self, PyObject* args)
{

GIsRequestingExit = true;

// GIsRequestingExit = true;
RequestEngineExit(FString(TEXT("I'm Shutting Down, Dave...")));
Py_RETURN_NONE;
}

Expand Down
2 changes: 1 addition & 1 deletion Source/UnrealEnginePython/Private/UObject/UEPyActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ PyObject *py_ue_actor_create_default_subobject(ue_PyUObject * self, PyObject * a
UObject *ret_obj = nullptr;

Py_BEGIN_ALLOW_THREADS;
ret_obj = actor->CreateDefaultSubobject(FName(UTF8_TO_TCHAR(name)), UObject::StaticClass(), u_class, false, false, true);
ret_obj = actor->CreateDefaultSubobject(FName(UTF8_TO_TCHAR(name)), UObject::StaticClass(), u_class, false, true);
Py_END_ALLOW_THREADS;

if (!ret_obj)
Expand Down
6 changes: 3 additions & 3 deletions Source/UnrealEnginePython/Private/UObject/UEPyMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ PyObject *py_ue_static_mesh_set_collision_for_lod(ue_PyUObject *self, PyObject *
FMeshSectionInfo info = mesh->SectionInfoMap.Get(lod_index, material_index);
#endif
info.bEnableCollision = enabled;
mesh->SectionInfoMap.Set(lod_index, material_index, info);
mesh->GetSectionInfoMap().Set(lod_index, material_index, info);

mesh->MarkPackageDirty();

Expand Down Expand Up @@ -545,9 +545,9 @@ PyObject *py_ue_static_mesh_set_shadow_for_lod(ue_PyUObject *self, PyObject * ar
enabled = true;
}

FMeshSectionInfo info = mesh->SectionInfoMap.Get(lod_index, material_index);
FMeshSectionInfo info = mesh->GetSectionInfoMap().Get(lod_index, material_index);
info.bCastShadow = enabled;
mesh->SectionInfoMap.Set(lod_index, material_index, info);
mesh->GetSectionInfoMap().Set(lod_index, material_index, info);

mesh->MarkPackageDirty();

Expand Down
29 changes: 20 additions & 9 deletions Source/UnrealEnginePython/Private/UObject/UEPySequencer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "Runtime/LevelSequence/Public/LevelSequence.h"

#if WITH_EDITOR
#include "Subsystems/AssetEditorSubsystem.h"
#include "Editor/Sequencer/Public/ISequencer.h"
#include "Editor/Sequencer/Public/ISequencerModule.h"
#include "Editor/UnrealEd/Public/Toolkits/AssetEditorManager.h"
Expand Down Expand Up @@ -209,9 +210,9 @@ static bool ImportFBXTransform(FString NodeName, UMovieScene3DTransformSection*
#endif

#if WITH_EDITOR

PyObject *py_ue_sequencer_changed(ue_PyUObject *self, PyObject * args)
{

ue_py_check(self);

PyObject *py_bool = nullptr;
Expand All @@ -227,13 +228,17 @@ PyObject *py_ue_sequencer_changed(ue_PyUObject *self, PyObject * args)

ULevelSequence *seq = (ULevelSequence *)self->ue_object;

//UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();

if (py_bool && PyObject_IsTrue(py_bool))
{
// try to open the editor for the asset
FAssetEditorManager::Get().OpenEditorForAsset(seq);
// FAssetEditorManager::Get().OpenEditorForAsset(seq);
GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->OpenEditorForAsset(seq);
}

IAssetEditorInstance *editor = FAssetEditorManager::Get().FindEditorForAsset(seq, true);
// IAssetEditorInstance* editor = FAssetEditorManager::Get().FindEditorForAsset(seq, true);
IAssetEditorInstance* editor = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->FindEditorForAsset(seq, true);
if (editor)
{
FLevelSequenceEditorToolkit *toolkit = (FLevelSequenceEditorToolkit *)editor;
Expand Down Expand Up @@ -464,9 +469,11 @@ PyObject *py_ue_sequencer_add_actor(ue_PyUObject *self, PyObject * args)
actors.Add((AActor *)py_ue_obj->ue_object);

// try to open the editor for the asset
FAssetEditorManager::Get().OpenEditorForAsset(seq);

IAssetEditorInstance *editor = FAssetEditorManager::Get().FindEditorForAsset(seq, true);
//UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->OpenEditorForAsset(seq);

IAssetEditorInstance *editor = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->FindEditorForAsset(seq, true);
if (editor)
{
FLevelSequenceEditorToolkit *toolkit = (FLevelSequenceEditorToolkit *)editor;
Expand Down Expand Up @@ -519,9 +526,11 @@ PyObject *py_ue_sequencer_add_actor_component(ue_PyUObject *self, PyObject * arg
UActorComponent* actorComponent = (UActorComponent *)py_ue_obj->ue_object;

// try to open the editor for the asset
FAssetEditorManager::Get().OpenEditorForAsset(seq);

IAssetEditorInstance *editor = FAssetEditorManager::Get().FindEditorForAsset(seq, true);
UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
AssetEditorSubsystem->OpenEditorForAsset(seq);

IAssetEditorInstance *editor = AssetEditorSubsystem->FindEditorForAsset(seq, true);
FGuid new_guid;
if (editor)
{
Expand Down Expand Up @@ -568,9 +577,11 @@ PyObject *py_ue_sequencer_make_new_spawnable(ue_PyUObject *self, PyObject * args
ULevelSequence *seq = (ULevelSequence *)self->ue_object;

// try to open the editor for the asset
FAssetEditorManager::Get().OpenEditorForAsset(seq);

IAssetEditorInstance *editor = FAssetEditorManager::Get().FindEditorForAsset(seq, true);
//UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->OpenEditorForAsset(seq);

IAssetEditorInstance *editor = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->FindEditorForAsset(seq, true);
if (!editor)
{
return PyErr_Format(PyExc_Exception, "unable to access sequencer");
Expand Down
4 changes: 2 additions & 2 deletions Source/UnrealEnginePython/Private/UObject/UEPyStaticMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ PyObject *py_ue_static_mesh_get_raw_mesh(ue_PyUObject *self, PyObject * args)

FRawMesh raw_mesh;

if (lod_index < 0 || lod_index >= mesh->SourceModels.Num())
if (lod_index < 0 || lod_index >= mesh->GetSourceModels().Num())
return PyErr_Format(PyExc_Exception, "invalid LOD index");

mesh->SourceModels[lod_index].RawMeshBulkData->LoadRawMesh(raw_mesh);
mesh->GetSourceModel(lod_index).RawMeshBulkData->LoadRawMesh(raw_mesh);

return py_ue_new_fraw_mesh(raw_mesh);
}
Expand Down
6 changes: 3 additions & 3 deletions Source/UnrealEnginePython/Private/UObject/UEPyTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ PyObject *py_ue_get_relative_location(ue_PyUObject *self, PyObject * args)
ue_py_check(self);
if (self->ue_object->IsA<USceneComponent>())
{
FVector vec3 = ((USceneComponent *)self->ue_object)->RelativeLocation;
FVector vec3 = ((USceneComponent *)self->ue_object)->GetRelativeLocation();
return py_ue_new_fvector(vec3);
}
return PyErr_Format(PyExc_Exception, "uobject is not a USceneComponent");
Expand All @@ -477,7 +477,7 @@ PyObject *py_ue_get_relative_rotation(ue_PyUObject *self, PyObject * args)
ue_py_check(self);
if (self->ue_object->IsA<USceneComponent>())
{
FRotator rot = ((USceneComponent *)self->ue_object)->RelativeRotation;
FRotator rot = ((USceneComponent *)self->ue_object)->GetRelativeRotation();
return py_ue_new_frotator(rot);
}
return PyErr_Format(PyExc_Exception, "uobject is not a USceneComponent");
Expand All @@ -488,7 +488,7 @@ PyObject *py_ue_get_relative_scale(ue_PyUObject *self, PyObject * args)
ue_py_check(self);
if (self->ue_object->IsA<USceneComponent>())
{
FVector vec3 = ((USceneComponent *)self->ue_object)->RelativeScale3D;
FVector vec3 = ((USceneComponent *)self->ue_object)->GetRelativeScale3D();
return py_ue_new_fvector(vec3);
}
return PyErr_Format(PyExc_Exception, "uobject is not a USceneComponent");
Expand Down
Loading