Files
UnrealEngineUWP/Engine/Source/Developer/DesktopPlatform/Private/Mac/DesktopPlatformMac.cpp

716 lines
21 KiB
C++
Raw Normal View History

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3209340 on 2016/11/23 by Ben.Marsh Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h. Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms. * Every header now includes everything it needs to compile. * There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first. * There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h. * Every .cpp file includes its matching .h file first. * This helps validate that each header is including everything it needs to compile. * No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more. * You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there. * There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible. * No engine code explicitly includes a precompiled header any more. * We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies. * PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files. Tool used to generate this transform is at Engine\Source\Programs\IncludeTool. [CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
#include "Mac/DesktopPlatformMac.h"
#include "MacApplication.h"
#include "FeedbackContextMarkup.h"
#include "MacNativeFeedbackContext.h"
#include "CocoaThread.h"
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3209340 on 2016/11/23 by Ben.Marsh Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h. Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms. * Every header now includes everything it needs to compile. * There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first. * There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h. * Every .cpp file includes its matching .h file first. * This helps validate that each header is including everything it needs to compile. * No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more. * You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there. * There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible. * No engine code explicitly includes a precompiled header any more. * We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies. * PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files. Tool used to generate this transform is at Engine\Source\Programs\IncludeTool. [CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
#include "Misc/Paths.h"
#include "Misc/ConfigCacheIni.h"
#include "Misc/Guid.h"
#include "HAL/FileManager.h"
#define LOCTEXT_NAMESPACE "DesktopPlatform"
class FMacScopedSystemModalMode
{
public:
FMacScopedSystemModalMode()
{
MacApplication->SystemModalMode(true);
}
~FMacScopedSystemModalMode()
{
MacApplication->SystemModalMode(false);
}
private:
FScopedSystemModalMode SystemModalMode;
};
class FCocoaScopeContext
{
public:
FCocoaScopeContext(void)
{
SCOPED_AUTORELEASE_POOL;
PreviousContext = [NSOpenGLContext currentContext];
}
~FCocoaScopeContext( void )
{
SCOPED_AUTORELEASE_POOL;
NSOpenGLContext* NewContext = [NSOpenGLContext currentContext];
if (PreviousContext != NewContext)
{
if (PreviousContext)
{
[PreviousContext makeCurrentContext];
}
else
{
[NSOpenGLContext clearCurrentContext];
}
}
}
private:
NSOpenGLContext* PreviousContext;
};
/**
* Custom accessory view class to allow choose kind of file extension
*/
@interface FFileDialogAccessoryView : NSView
{
@private
NSPopUpButton* PopUpButton;
NSTextField* TextField;
NSSavePanel* DialogPanel;
NSMutableArray* AllowedFileTypes;
int32 SelectedExtension;
}
- (id)initWithFrame:(NSRect)frameRect dialogPanel:(NSSavePanel*) panel;
- (void)PopUpButtonAction: (id) sender;
- (void)AddAllowedFileTypes: (NSArray*) array;
- (void)SetExtensionsAtIndex: (int32) index;
- (int32)SelectedExtension;
@end
@implementation FFileDialogAccessoryView
- (id)initWithFrame:(NSRect)frameRect dialogPanel:(NSSavePanel*) panel
{
self = [super initWithFrame: frameRect];
DialogPanel = panel;
FString FieldText = LOCTEXT("FileExtension", "File extension:").ToString();
CFStringRef FieldTextCFString = FPlatformString::TCHARToCFString(*FieldText);
TextField = [[NSTextField alloc] initWithFrame: NSMakeRect(0.0, 48.0, 90.0, 25.0) ];
[TextField setStringValue:(NSString*)FieldTextCFString];
[TextField setEditable:NO];
[TextField setBordered:NO];
[TextField setBackgroundColor:[NSColor controlColor]];
PopUpButton = [[NSPopUpButton alloc] initWithFrame: NSMakeRect(88.0, 50.0, 160.0, 25.0) ];
[PopUpButton setTarget: self];
[PopUpButton setAction:@selector(PopUpButtonAction:)];
[self addSubview: TextField];
[self addSubview: PopUpButton];
return self;
}
- (void)AddAllowedFileTypes: (NSMutableArray*) array
{
check( array );
AllowedFileTypes = array;
int32 ArrayCount = [AllowedFileTypes count];
if( ArrayCount )
{
check( ArrayCount % 2 == 0 );
[PopUpButton removeAllItems];
for( int32 Index = 0; Index < ArrayCount; Index += 2 )
{
[PopUpButton addItemWithTitle: [AllowedFileTypes objectAtIndex: Index]];
}
// Set allowed extensions
[self SetExtensionsAtIndex: 0];
}
else
{
// Allow all file types
[DialogPanel setAllowedFileTypes:nil];
}
}
- (void)PopUpButtonAction: (id) sender
{
NSInteger Index = [PopUpButton indexOfSelectedItem];
[self SetExtensionsAtIndex: Index];
}
- (void)SetExtensionsAtIndex: (int32) index
{
check( [AllowedFileTypes count] >= index * 2 );
SelectedExtension = index;
NSString* ExtsToParse = [AllowedFileTypes objectAtIndex:index * 2 + 1];
if( [ExtsToParse compare:@"*.*"] == NSOrderedSame )
{
[DialogPanel setAllowedFileTypes: nil];
}
else
{
NSArray* ExtensionsWildcards = [ExtsToParse componentsSeparatedByString:@";"];
NSMutableArray* Extensions = [NSMutableArray arrayWithCapacity: [ExtensionsWildcards count]];
for( int32 Index = 0; Index < [ExtensionsWildcards count]; ++Index )
{
NSString* Temp = [[ExtensionsWildcards objectAtIndex:Index] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"*."]];
[Extensions addObject: Temp];
}
[DialogPanel setAllowedFileTypes: Extensions];
}
}
- (int32)SelectedExtension {
return SelectedExtension;
}
@end
/**
* Custom accessory view class to allow choose kind of file extension
*/
@interface FFontDialogAccessoryView : NSView
{
@private
NSButton* OKButton;
NSButton* CancelButton;
bool Result;
}
- (id)initWithFrame: (NSRect)frameRect;
- (bool)result;
- (IBAction)onCancel: (id)sender;
- (IBAction)onOK: (id)sender;
@end
@implementation FFontDialogAccessoryView : NSView
- (id)initWithFrame: (NSRect)frameRect
{
[super initWithFrame: frameRect];
CancelButton = [[NSButton alloc] initWithFrame: NSMakeRect(10, 10, 80, 24)];
[CancelButton setTitle: @"Cancel"];
[CancelButton setBezelStyle: NSRoundedBezelStyle];
[CancelButton setButtonType: NSMomentaryPushInButton];
[CancelButton setAction: @selector(onCancel:)];
[CancelButton setTarget: self];
[self addSubview: CancelButton];
OKButton = [[NSButton alloc] initWithFrame: NSMakeRect(100, 10, 80, 24)];
[OKButton setTitle: @"OK"];
[OKButton setBezelStyle: NSRoundedBezelStyle];
[OKButton setButtonType: NSMomentaryPushInButton];
[OKButton setAction: @selector(onOK:)];
[OKButton setTarget: self];
[self addSubview: OKButton];
Result = false;
return self;
}
- (bool)result
{
return Result;
}
- (IBAction)onCancel: (id)sender
{
Result = false;
[NSApp stopModal];
}
- (IBAction)onOK: (id)sender
{
Result = true;
[NSApp stopModal];
}
@end
bool FDesktopPlatformMac::OpenFileDialog(const void* ParentWindowHandle, const FString& DialogTitle, const FString& DefaultPath, const FString& DefaultFile, const FString& FileTypes, uint32 Flags, TArray<FString>& OutFilenames)
{
int32 DummyIdx = 0;
return FileDialogShared(false, ParentWindowHandle, DialogTitle, DefaultPath, DefaultFile, FileTypes, Flags, OutFilenames, DummyIdx);
}
bool FDesktopPlatformMac::OpenFileDialog(const void* ParentWindowHandle, const FString& DialogTitle, const FString& DefaultPath, const FString& DefaultFile, const FString& FileTypes, uint32 Flags, TArray<FString>& OutFilenames, int32& OutFilterIndex)
{
return FileDialogShared(false, ParentWindowHandle, DialogTitle, DefaultPath, DefaultFile, FileTypes, Flags, OutFilenames, OutFilterIndex);
}
bool FDesktopPlatformMac::SaveFileDialog(const void* ParentWindowHandle, const FString& DialogTitle, const FString& DefaultPath, const FString& DefaultFile, const FString& FileTypes, uint32 Flags, TArray<FString>& OutFilenames)
{
int32 DummyIdx = 0;
return FileDialogShared(true, ParentWindowHandle, DialogTitle, DefaultPath, DefaultFile, FileTypes, Flags, OutFilenames, DummyIdx);
}
bool FDesktopPlatformMac::OpenDirectoryDialog(const void* ParentWindowHandle, const FString& DialogTitle, const FString& DefaultPath, FString& OutFolderName)
{
MacApplication->SetCapture( NULL );
bool bSuccess = false;
{
FMacScopedSystemModalMode SystemModalScope;
bSuccess = MainThreadReturn(^{
SCOPED_AUTORELEASE_POOL;
FCocoaScopeContext ContextGuard;
NSOpenPanel* Panel = [NSOpenPanel openPanel];
[Panel setCanChooseFiles: false];
[Panel setCanChooseDirectories: true];
[Panel setAllowsMultipleSelection: false];
[Panel setCanCreateDirectories: true];
CFStringRef Title = FPlatformString::TCHARToCFString(*DialogTitle);
[Panel setTitle: (NSString*)Title];
CFRelease(Title);
CFStringRef DefaultPathCFString = FPlatformString::TCHARToCFString(*DefaultPath);
NSURL* DefaultPathURL = [NSURL fileURLWithPath: (NSString*)DefaultPathCFString];
[Panel setDirectoryURL: DefaultPathURL];
CFRelease(DefaultPathCFString);
bool bResult = false;
NSInteger Result = [Panel runModal];
if (Result == NSFileHandlingPanelOKButton)
{
NSURL *FolderURL = [[Panel URLs] objectAtIndex: 0];
TCHAR FolderPath[MAX_PATH];
FPlatformString::CFStringToTCHAR((CFStringRef)[FolderURL path], FolderPath);
OutFolderName = FolderPath;
FPaths::NormalizeFilename(OutFolderName);
bResult = true;
}
[Panel close];
return bResult;
});
}
MacApplication->ResetModifierKeys();
return bSuccess;
}
bool FDesktopPlatformMac::OpenFontDialog(const void* ParentWindowHandle, FString& OutFontName, float& OutHeight, EFontImportFlags& OutFlags)
{
MacApplication->SetCapture( NULL );
bool bSuccess = false;
{
FMacScopedSystemModalMode SystemModalScope;
bSuccess = MainThreadReturn(^{
SCOPED_AUTORELEASE_POOL;
FCocoaScopeContext ContextGuard;
NSFontPanel* Panel = [NSFontPanel sharedFontPanel];
[Panel setFloatingPanel: false];
[[Panel standardWindowButton: NSWindowCloseButton] setEnabled: false];
FFontDialogAccessoryView* AccessoryView = [[FFontDialogAccessoryView alloc] initWithFrame: NSMakeRect(0.0, 0.0, 190.0, 80.0)];
[Panel setAccessoryView: AccessoryView];
[NSApp runModalForWindow: Panel];
[Panel close];
bool bResult = [AccessoryView result];
[Panel setAccessoryView: NULL];
[AccessoryView release];
[[Panel standardWindowButton: NSWindowCloseButton] setEnabled: true];
if( bResult )
{
NSFont* Font = [Panel panelConvertFont: [NSFont userFontOfSize: 0]];
TCHAR FontName[MAX_PATH];
FPlatformString::CFStringToTCHAR((CFStringRef)[Font fontName], FontName);
OutFontName = FontName;
OutHeight = [Font pointSize];
auto FontFlags = EFontImportFlags::None;
if( [Font underlineThickness] >= 1.0 )
{
FontFlags |= EFontImportFlags::EnableUnderline;
}
OutFlags = FontFlags;
}
return bResult;
});
}
MacApplication->ResetModifierKeys();
return bSuccess;
}
bool FDesktopPlatformMac::CanOpenLauncher(bool Install)
{
FString Path;
return IsLauncherInstalled() || (Install && GetLauncherInstallerPath(Path));
}
Merging //UE4/Release-4.11 to //UE4/Main (up to CL#2835147) ========================== MAJOR FEATURES + CHANGES ========================== Change 2817214 on 2016/01/06 by mason.seay Adjusted Walkable Slope Override for mesh #jira UE-24473 Change 2817384 on 2016/01/06 by Michael.Schoell Crash fix when selecting a variable node for a variable that is not owned by a Blueprint. #jira UE-24958 - Crash when getting the sequence player in level blueprint Change 2817438 on 2016/01/06 by Max.Chen Sequencer: Add option to specify position of material name from the movie scene capture interface. For example, MovieCapture_{material}_{width}x{height}.{frame} will create files like this: MovieCapture_FinalImage_1920x1080.0010.exr #rb Andrew.Rodham #jira UE-24926 Change 2817459 on 2016/01/06 by Marc.Audy PR #1679: Move MinRespawnDelay to virtual method AController::GetMinRespawnDelay() (Contributed by bozaro) #jira UE-22309 Change 2817472 on 2016/01/06 by Ben.Marsh Always run UHT in unattended mode from UBT; we don't want it opening any dialogs. Match3 is currently missing a plugin, and it's causing builds to time out. Change 2817473 on 2016/01/06 by Marc.Audy PR #1644: Improve "SpawnActor failed because the spawned actor IsPendingKill" error message (Contributed by slonopotamus) #jira UE-21911 Change 2817533 on 2016/01/06 by Lauren.Ridge Fixing Match3 not compiling in Debug (removed two checks on TileLibrary) #jira UE-25004 Change 2817625 on 2016/01/06 by Taizyd.Korambayil #jira UE-19659 Reimported Template Animations with Proper Skeletons Change 2817647 on 2016/01/06 by Lukasz.Furman replaced ensure during initialization of blackboard based behavior tree task with log warning #ue4 #jira UE-24448 #rb Mieszko.Zielinski Change 2817648 on 2016/01/06 by Lukasz.Furman fixed broken rendering component of navmesh actor after delete-undo operation #ue4 #jira UE-24446 #rb Mieszko.Zielinski Change 2817688 on 2016/01/06 by Taizyd.Korambayil #jira UE-22347 Fixed Message Warnings on Startup Change 2817815 on 2016/01/06 by Jamie.Dale Multiple fixes when editing right-to-left text - Text is now shaped over the entire line to allow rich-text and selected text to be shaped correctly across block boundaries. - Text layout highlights are now able to correctly handle bi-directional and right-to-left text. - Text picking can now handle bi-directional and right-to-left text. - Text picking can now pick the individual characters that make up a ligature glyph. - The caret now draws on the logical (rather than visual) side of the glyph (to handle right-to-left text). - Glyph clusters (multiple glyphs produced from a single character) are now treated as a single logical glyph. - Optimized some of the FShapedGlyphSequence to allow an early out once they've found and processed the start and end glyphs. #jira UE-25013 Change 2817828 on 2016/01/06 by Nick.Darnell Editor - Fixing the OpenLauncher call to be take a structure to allow us to customize it more, and to properly handle the silent command the way we're planning to handle it in the launcher. #jira UE-24563 Change 2818052 on 2016/01/06 by Nick.Darnell Editor - Adding another application check for the launcher to catch the current app name on mac. #jira UE-24563 Change 2818149 on 2016/01/06 by Taizyd.Korambayil #jira UE-19097 Adjusted FirstPerson Pawn, so that Camera doesnt clip the Arm Mesh Change 2818360 on 2016/01/06 by Chris.Babcock Fix reading from ini sections not cached after build system changes for 4.11 #jira UE-25027 #ue4 #android Change 2818369 on 2016/01/06 by Ryan.Vance #jira UE-24976 Adding tessellation support to instanced stereo Change 2818999 on 2016/01/07 by Robert.Manuszewski UHT will no longer try to load game-only plugins. #jira UE-25032 - Changed module type RuntimeNoProgram to RuntimeAndProgram so that bu default Runtime plugin modules won't be loaded by programs - Added better error message when UHT's PreInit fails Change 2819064 on 2016/01/07 by Richard.Hinckley #jira UE-24694 Fixing array usage in 4.11 stream. Change 2819067 on 2016/01/07 by Ori.Cohen When editor tries to spawn a physics asset we automatically load the needed skeletal mesh #rb Matt.K #JIRA UE-24165
2016-01-22 08:13:18 -05:00
bool FDesktopPlatformMac::OpenLauncher(const FOpenLauncherOptions& Options)
{
Merging //UE4/Release-4.11 to //UE4/Main (up to CL#2835147) ========================== MAJOR FEATURES + CHANGES ========================== Change 2817214 on 2016/01/06 by mason.seay Adjusted Walkable Slope Override for mesh #jira UE-24473 Change 2817384 on 2016/01/06 by Michael.Schoell Crash fix when selecting a variable node for a variable that is not owned by a Blueprint. #jira UE-24958 - Crash when getting the sequence player in level blueprint Change 2817438 on 2016/01/06 by Max.Chen Sequencer: Add option to specify position of material name from the movie scene capture interface. For example, MovieCapture_{material}_{width}x{height}.{frame} will create files like this: MovieCapture_FinalImage_1920x1080.0010.exr #rb Andrew.Rodham #jira UE-24926 Change 2817459 on 2016/01/06 by Marc.Audy PR #1679: Move MinRespawnDelay to virtual method AController::GetMinRespawnDelay() (Contributed by bozaro) #jira UE-22309 Change 2817472 on 2016/01/06 by Ben.Marsh Always run UHT in unattended mode from UBT; we don't want it opening any dialogs. Match3 is currently missing a plugin, and it's causing builds to time out. Change 2817473 on 2016/01/06 by Marc.Audy PR #1644: Improve "SpawnActor failed because the spawned actor IsPendingKill" error message (Contributed by slonopotamus) #jira UE-21911 Change 2817533 on 2016/01/06 by Lauren.Ridge Fixing Match3 not compiling in Debug (removed two checks on TileLibrary) #jira UE-25004 Change 2817625 on 2016/01/06 by Taizyd.Korambayil #jira UE-19659 Reimported Template Animations with Proper Skeletons Change 2817647 on 2016/01/06 by Lukasz.Furman replaced ensure during initialization of blackboard based behavior tree task with log warning #ue4 #jira UE-24448 #rb Mieszko.Zielinski Change 2817648 on 2016/01/06 by Lukasz.Furman fixed broken rendering component of navmesh actor after delete-undo operation #ue4 #jira UE-24446 #rb Mieszko.Zielinski Change 2817688 on 2016/01/06 by Taizyd.Korambayil #jira UE-22347 Fixed Message Warnings on Startup Change 2817815 on 2016/01/06 by Jamie.Dale Multiple fixes when editing right-to-left text - Text is now shaped over the entire line to allow rich-text and selected text to be shaped correctly across block boundaries. - Text layout highlights are now able to correctly handle bi-directional and right-to-left text. - Text picking can now handle bi-directional and right-to-left text. - Text picking can now pick the individual characters that make up a ligature glyph. - The caret now draws on the logical (rather than visual) side of the glyph (to handle right-to-left text). - Glyph clusters (multiple glyphs produced from a single character) are now treated as a single logical glyph. - Optimized some of the FShapedGlyphSequence to allow an early out once they've found and processed the start and end glyphs. #jira UE-25013 Change 2817828 on 2016/01/06 by Nick.Darnell Editor - Fixing the OpenLauncher call to be take a structure to allow us to customize it more, and to properly handle the silent command the way we're planning to handle it in the launcher. #jira UE-24563 Change 2818052 on 2016/01/06 by Nick.Darnell Editor - Adding another application check for the launcher to catch the current app name on mac. #jira UE-24563 Change 2818149 on 2016/01/06 by Taizyd.Korambayil #jira UE-19097 Adjusted FirstPerson Pawn, so that Camera doesnt clip the Arm Mesh Change 2818360 on 2016/01/06 by Chris.Babcock Fix reading from ini sections not cached after build system changes for 4.11 #jira UE-25027 #ue4 #android Change 2818369 on 2016/01/06 by Ryan.Vance #jira UE-24976 Adding tessellation support to instanced stereo Change 2818999 on 2016/01/07 by Robert.Manuszewski UHT will no longer try to load game-only plugins. #jira UE-25032 - Changed module type RuntimeNoProgram to RuntimeAndProgram so that bu default Runtime plugin modules won't be loaded by programs - Added better error message when UHT's PreInit fails Change 2819064 on 2016/01/07 by Richard.Hinckley #jira UE-24694 Fixing array usage in 4.11 stream. Change 2819067 on 2016/01/07 by Ori.Cohen When editor tries to spawn a physics asset we automatically load the needed skeletal mesh #rb Matt.K #JIRA UE-24165
2016-01-22 08:13:18 -05:00
FString LauncherUriRequest = Options.GetLauncherUriRequest();
// If the launcher is already running, bring it to front
NSArray* RunningLaunchers = [NSRunningApplication runningApplicationsWithBundleIdentifier: @"com.epicgames.EpicGamesLauncher"];
if ([RunningLaunchers count] == 0)
{
RunningLaunchers = [NSRunningApplication runningApplicationsWithBundleIdentifier: @"com.epicgames.UnrealEngineLauncher"];
}
if ([RunningLaunchers count] > 0)
{
NSRunningApplication* Launcher = [RunningLaunchers objectAtIndex: 0];
Merging //UE4/Release-4.11 to //UE4/Main (up to CL#2835147) ========================== MAJOR FEATURES + CHANGES ========================== Change 2817214 on 2016/01/06 by mason.seay Adjusted Walkable Slope Override for mesh #jira UE-24473 Change 2817384 on 2016/01/06 by Michael.Schoell Crash fix when selecting a variable node for a variable that is not owned by a Blueprint. #jira UE-24958 - Crash when getting the sequence player in level blueprint Change 2817438 on 2016/01/06 by Max.Chen Sequencer: Add option to specify position of material name from the movie scene capture interface. For example, MovieCapture_{material}_{width}x{height}.{frame} will create files like this: MovieCapture_FinalImage_1920x1080.0010.exr #rb Andrew.Rodham #jira UE-24926 Change 2817459 on 2016/01/06 by Marc.Audy PR #1679: Move MinRespawnDelay to virtual method AController::GetMinRespawnDelay() (Contributed by bozaro) #jira UE-22309 Change 2817472 on 2016/01/06 by Ben.Marsh Always run UHT in unattended mode from UBT; we don't want it opening any dialogs. Match3 is currently missing a plugin, and it's causing builds to time out. Change 2817473 on 2016/01/06 by Marc.Audy PR #1644: Improve "SpawnActor failed because the spawned actor IsPendingKill" error message (Contributed by slonopotamus) #jira UE-21911 Change 2817533 on 2016/01/06 by Lauren.Ridge Fixing Match3 not compiling in Debug (removed two checks on TileLibrary) #jira UE-25004 Change 2817625 on 2016/01/06 by Taizyd.Korambayil #jira UE-19659 Reimported Template Animations with Proper Skeletons Change 2817647 on 2016/01/06 by Lukasz.Furman replaced ensure during initialization of blackboard based behavior tree task with log warning #ue4 #jira UE-24448 #rb Mieszko.Zielinski Change 2817648 on 2016/01/06 by Lukasz.Furman fixed broken rendering component of navmesh actor after delete-undo operation #ue4 #jira UE-24446 #rb Mieszko.Zielinski Change 2817688 on 2016/01/06 by Taizyd.Korambayil #jira UE-22347 Fixed Message Warnings on Startup Change 2817815 on 2016/01/06 by Jamie.Dale Multiple fixes when editing right-to-left text - Text is now shaped over the entire line to allow rich-text and selected text to be shaped correctly across block boundaries. - Text layout highlights are now able to correctly handle bi-directional and right-to-left text. - Text picking can now handle bi-directional and right-to-left text. - Text picking can now pick the individual characters that make up a ligature glyph. - The caret now draws on the logical (rather than visual) side of the glyph (to handle right-to-left text). - Glyph clusters (multiple glyphs produced from a single character) are now treated as a single logical glyph. - Optimized some of the FShapedGlyphSequence to allow an early out once they've found and processed the start and end glyphs. #jira UE-25013 Change 2817828 on 2016/01/06 by Nick.Darnell Editor - Fixing the OpenLauncher call to be take a structure to allow us to customize it more, and to properly handle the silent command the way we're planning to handle it in the launcher. #jira UE-24563 Change 2818052 on 2016/01/06 by Nick.Darnell Editor - Adding another application check for the launcher to catch the current app name on mac. #jira UE-24563 Change 2818149 on 2016/01/06 by Taizyd.Korambayil #jira UE-19097 Adjusted FirstPerson Pawn, so that Camera doesnt clip the Arm Mesh Change 2818360 on 2016/01/06 by Chris.Babcock Fix reading from ini sections not cached after build system changes for 4.11 #jira UE-25027 #ue4 #android Change 2818369 on 2016/01/06 by Ryan.Vance #jira UE-24976 Adding tessellation support to instanced stereo Change 2818999 on 2016/01/07 by Robert.Manuszewski UHT will no longer try to load game-only plugins. #jira UE-25032 - Changed module type RuntimeNoProgram to RuntimeAndProgram so that bu default Runtime plugin modules won't be loaded by programs - Added better error message when UHT's PreInit fails Change 2819064 on 2016/01/07 by Richard.Hinckley #jira UE-24694 Fixing array usage in 4.11 stream. Change 2819067 on 2016/01/07 by Ori.Cohen When editor tries to spawn a physics asset we automatically load the needed skeletal mesh #rb Matt.K #JIRA UE-24165
2016-01-22 08:13:18 -05:00
if ( !Launcher.hidden || Options.bInstall ) // If the launcher is running, but hidden, don't activate on editor startup
{
[Launcher activateWithOptions : NSApplicationActivateAllWindows | NSApplicationActivateIgnoringOtherApps];
FString Error;
Merging //UE4/Release-4.11 to //UE4/Main (up to CL#2835147) ========================== MAJOR FEATURES + CHANGES ========================== Change 2817214 on 2016/01/06 by mason.seay Adjusted Walkable Slope Override for mesh #jira UE-24473 Change 2817384 on 2016/01/06 by Michael.Schoell Crash fix when selecting a variable node for a variable that is not owned by a Blueprint. #jira UE-24958 - Crash when getting the sequence player in level blueprint Change 2817438 on 2016/01/06 by Max.Chen Sequencer: Add option to specify position of material name from the movie scene capture interface. For example, MovieCapture_{material}_{width}x{height}.{frame} will create files like this: MovieCapture_FinalImage_1920x1080.0010.exr #rb Andrew.Rodham #jira UE-24926 Change 2817459 on 2016/01/06 by Marc.Audy PR #1679: Move MinRespawnDelay to virtual method AController::GetMinRespawnDelay() (Contributed by bozaro) #jira UE-22309 Change 2817472 on 2016/01/06 by Ben.Marsh Always run UHT in unattended mode from UBT; we don't want it opening any dialogs. Match3 is currently missing a plugin, and it's causing builds to time out. Change 2817473 on 2016/01/06 by Marc.Audy PR #1644: Improve "SpawnActor failed because the spawned actor IsPendingKill" error message (Contributed by slonopotamus) #jira UE-21911 Change 2817533 on 2016/01/06 by Lauren.Ridge Fixing Match3 not compiling in Debug (removed two checks on TileLibrary) #jira UE-25004 Change 2817625 on 2016/01/06 by Taizyd.Korambayil #jira UE-19659 Reimported Template Animations with Proper Skeletons Change 2817647 on 2016/01/06 by Lukasz.Furman replaced ensure during initialization of blackboard based behavior tree task with log warning #ue4 #jira UE-24448 #rb Mieszko.Zielinski Change 2817648 on 2016/01/06 by Lukasz.Furman fixed broken rendering component of navmesh actor after delete-undo operation #ue4 #jira UE-24446 #rb Mieszko.Zielinski Change 2817688 on 2016/01/06 by Taizyd.Korambayil #jira UE-22347 Fixed Message Warnings on Startup Change 2817815 on 2016/01/06 by Jamie.Dale Multiple fixes when editing right-to-left text - Text is now shaped over the entire line to allow rich-text and selected text to be shaped correctly across block boundaries. - Text layout highlights are now able to correctly handle bi-directional and right-to-left text. - Text picking can now handle bi-directional and right-to-left text. - Text picking can now pick the individual characters that make up a ligature glyph. - The caret now draws on the logical (rather than visual) side of the glyph (to handle right-to-left text). - Glyph clusters (multiple glyphs produced from a single character) are now treated as a single logical glyph. - Optimized some of the FShapedGlyphSequence to allow an early out once they've found and processed the start and end glyphs. #jira UE-25013 Change 2817828 on 2016/01/06 by Nick.Darnell Editor - Fixing the OpenLauncher call to be take a structure to allow us to customize it more, and to properly handle the silent command the way we're planning to handle it in the launcher. #jira UE-24563 Change 2818052 on 2016/01/06 by Nick.Darnell Editor - Adding another application check for the launcher to catch the current app name on mac. #jira UE-24563 Change 2818149 on 2016/01/06 by Taizyd.Korambayil #jira UE-19097 Adjusted FirstPerson Pawn, so that Camera doesnt clip the Arm Mesh Change 2818360 on 2016/01/06 by Chris.Babcock Fix reading from ini sections not cached after build system changes for 4.11 #jira UE-25027 #ue4 #android Change 2818369 on 2016/01/06 by Ryan.Vance #jira UE-24976 Adding tessellation support to instanced stereo Change 2818999 on 2016/01/07 by Robert.Manuszewski UHT will no longer try to load game-only plugins. #jira UE-25032 - Changed module type RuntimeNoProgram to RuntimeAndProgram so that bu default Runtime plugin modules won't be loaded by programs - Added better error message when UHT's PreInit fails Change 2819064 on 2016/01/07 by Richard.Hinckley #jira UE-24694 Fixing array usage in 4.11 stream. Change 2819067 on 2016/01/07 by Ori.Cohen When editor tries to spawn a physics asset we automatically load the needed skeletal mesh #rb Matt.K #JIRA UE-24165
2016-01-22 08:13:18 -05:00
FPlatformProcess::LaunchURL(*LauncherUriRequest, nullptr, &Error);
}
return true;
}
if (IsLauncherInstalled())
{
FString Error;
Merging //UE4/Release-4.11 to //UE4/Main (up to CL#2835147) ========================== MAJOR FEATURES + CHANGES ========================== Change 2817214 on 2016/01/06 by mason.seay Adjusted Walkable Slope Override for mesh #jira UE-24473 Change 2817384 on 2016/01/06 by Michael.Schoell Crash fix when selecting a variable node for a variable that is not owned by a Blueprint. #jira UE-24958 - Crash when getting the sequence player in level blueprint Change 2817438 on 2016/01/06 by Max.Chen Sequencer: Add option to specify position of material name from the movie scene capture interface. For example, MovieCapture_{material}_{width}x{height}.{frame} will create files like this: MovieCapture_FinalImage_1920x1080.0010.exr #rb Andrew.Rodham #jira UE-24926 Change 2817459 on 2016/01/06 by Marc.Audy PR #1679: Move MinRespawnDelay to virtual method AController::GetMinRespawnDelay() (Contributed by bozaro) #jira UE-22309 Change 2817472 on 2016/01/06 by Ben.Marsh Always run UHT in unattended mode from UBT; we don't want it opening any dialogs. Match3 is currently missing a plugin, and it's causing builds to time out. Change 2817473 on 2016/01/06 by Marc.Audy PR #1644: Improve "SpawnActor failed because the spawned actor IsPendingKill" error message (Contributed by slonopotamus) #jira UE-21911 Change 2817533 on 2016/01/06 by Lauren.Ridge Fixing Match3 not compiling in Debug (removed two checks on TileLibrary) #jira UE-25004 Change 2817625 on 2016/01/06 by Taizyd.Korambayil #jira UE-19659 Reimported Template Animations with Proper Skeletons Change 2817647 on 2016/01/06 by Lukasz.Furman replaced ensure during initialization of blackboard based behavior tree task with log warning #ue4 #jira UE-24448 #rb Mieszko.Zielinski Change 2817648 on 2016/01/06 by Lukasz.Furman fixed broken rendering component of navmesh actor after delete-undo operation #ue4 #jira UE-24446 #rb Mieszko.Zielinski Change 2817688 on 2016/01/06 by Taizyd.Korambayil #jira UE-22347 Fixed Message Warnings on Startup Change 2817815 on 2016/01/06 by Jamie.Dale Multiple fixes when editing right-to-left text - Text is now shaped over the entire line to allow rich-text and selected text to be shaped correctly across block boundaries. - Text layout highlights are now able to correctly handle bi-directional and right-to-left text. - Text picking can now handle bi-directional and right-to-left text. - Text picking can now pick the individual characters that make up a ligature glyph. - The caret now draws on the logical (rather than visual) side of the glyph (to handle right-to-left text). - Glyph clusters (multiple glyphs produced from a single character) are now treated as a single logical glyph. - Optimized some of the FShapedGlyphSequence to allow an early out once they've found and processed the start and end glyphs. #jira UE-25013 Change 2817828 on 2016/01/06 by Nick.Darnell Editor - Fixing the OpenLauncher call to be take a structure to allow us to customize it more, and to properly handle the silent command the way we're planning to handle it in the launcher. #jira UE-24563 Change 2818052 on 2016/01/06 by Nick.Darnell Editor - Adding another application check for the launcher to catch the current app name on mac. #jira UE-24563 Change 2818149 on 2016/01/06 by Taizyd.Korambayil #jira UE-19097 Adjusted FirstPerson Pawn, so that Camera doesnt clip the Arm Mesh Change 2818360 on 2016/01/06 by Chris.Babcock Fix reading from ini sections not cached after build system changes for 4.11 #jira UE-25027 #ue4 #android Change 2818369 on 2016/01/06 by Ryan.Vance #jira UE-24976 Adding tessellation support to instanced stereo Change 2818999 on 2016/01/07 by Robert.Manuszewski UHT will no longer try to load game-only plugins. #jira UE-25032 - Changed module type RuntimeNoProgram to RuntimeAndProgram so that bu default Runtime plugin modules won't be loaded by programs - Added better error message when UHT's PreInit fails Change 2819064 on 2016/01/07 by Richard.Hinckley #jira UE-24694 Fixing array usage in 4.11 stream. Change 2819067 on 2016/01/07 by Ori.Cohen When editor tries to spawn a physics asset we automatically load the needed skeletal mesh #rb Matt.K #JIRA UE-24165
2016-01-22 08:13:18 -05:00
FPlatformProcess::LaunchURL(*LauncherUriRequest, nullptr, &Error);
return true;
}
// Try to install it
FString InstallerPath;
if (GetLauncherInstallerPath(InstallerPath))
{
FPlatformProcess::LaunchFileInDefaultExternalApplication(*InstallerPath);
return true;
}
return false;
}
bool FDesktopPlatformMac::FileDialogShared(bool bSave, const void* ParentWindowHandle, const FString& DialogTitle, const FString& DefaultPath, const FString& DefaultFile, const FString& FileTypes, uint32 Flags, TArray<FString>& OutFilenames, int32& OutFilterIndex)
{
MacApplication->SetCapture( NULL );
bool bSuccess = false;
{
FMacScopedSystemModalMode SystemModalScope;
bSuccess = MainThreadReturn(^{
SCOPED_AUTORELEASE_POOL;
FCocoaScopeContext ContextGuard;
NSSavePanel* Panel = bSave ? [NSSavePanel savePanel] : [NSOpenPanel openPanel];
if (!bSave)
{
NSOpenPanel* OpenPanel = (NSOpenPanel*)Panel;
[OpenPanel setCanChooseFiles: true];
[OpenPanel setCanChooseDirectories: false];
[OpenPanel setAllowsMultipleSelection: Flags & EFileDialogFlags::Multiple];
}
[Panel setCanCreateDirectories: bSave];
CFStringRef Title = FPlatformString::TCHARToCFString(*DialogTitle);
[Panel setTitle: (NSString*)Title];
CFRelease(Title);
CFStringRef DefaultPathCFString = FPlatformString::TCHARToCFString(*DefaultPath);
NSURL* DefaultPathURL = [NSURL fileURLWithPath: (NSString*)DefaultPathCFString];
[Panel setDirectoryURL: DefaultPathURL];
CFRelease(DefaultPathCFString);
CFStringRef FileNameCFString = FPlatformString::TCHARToCFString(*DefaultFile);
[Panel setNameFieldStringValue: (NSString*)FileNameCFString];
CFRelease(FileNameCFString);
FFileDialogAccessoryView* AccessoryView = [[FFileDialogAccessoryView alloc] initWithFrame: NSMakeRect( 0.0, 0.0, 250.0, 85.0 ) dialogPanel: Panel];
[Panel setAccessoryView: AccessoryView];
TArray<FString> FileTypesArray;
int32 NumFileTypes = FileTypes.ParseIntoArray(FileTypesArray, TEXT("|"), true);
NSMutableArray* AllowedFileTypes = [NSMutableArray arrayWithCapacity: NumFileTypes];
if( NumFileTypes > 0 )
{
for( int32 Index = 0; Index < NumFileTypes; ++Index )
{
CFStringRef Type = FPlatformString::TCHARToCFString(*FileTypesArray[Index]);
[AllowedFileTypes addObject: (NSString*)Type];
CFRelease(Type);
}
}
[AccessoryView AddAllowedFileTypes:AllowedFileTypes];
bool bOkPressed = false;
NSWindow* FocusWindow = [[NSApplication sharedApplication] keyWindow];
NSInteger Result = [Panel runModal];
[AccessoryView release];
if (Result == NSFileHandlingPanelOKButton)
{
if (bSave)
{
TCHAR FilePath[MAX_PATH];
FPlatformString::CFStringToTCHAR((CFStringRef)[[Panel URL] path], FilePath);
new(OutFilenames) FString(FilePath);
}
else
{
NSOpenPanel* OpenPanel = (NSOpenPanel*)Panel;
for (NSURL *FileURL in [OpenPanel URLs])
{
TCHAR FilePath[MAX_PATH];
FPlatformString::CFStringToTCHAR((CFStringRef)[FileURL path], FilePath);
new(OutFilenames) FString(FilePath);
}
OutFilterIndex = [AccessoryView SelectedExtension];
}
// Make sure all filenames gathered have their paths normalized
for (auto OutFilenameIt = OutFilenames.CreateIterator(); OutFilenameIt; ++OutFilenameIt)
{
FString& OutFilename = *OutFilenameIt;
OutFilename = IFileManager::Get().ConvertToRelativePath(*OutFilename);
FPaths::NormalizeFilename(OutFilename);
}
bOkPressed = true;
}
[Panel close];
if(FocusWindow)
{
[FocusWindow makeKeyWindow];
}
return bOkPressed;
});
}
MacApplication->ResetModifierKeys();
return bSuccess;
}
bool FDesktopPlatformMac::RegisterEngineInstallation(const FString &RootDir, FString &OutIdentifier)
{
bool bRes = false;
if (IsValidRootDirectory(RootDir))
{
FConfigFile ConfigFile;
FString ConfigPath = FString(FPlatformProcess::ApplicationSettingsDir()) / FString(TEXT("UnrealEngine")) / FString(TEXT("Install.ini"));
ConfigFile.Read(ConfigPath);
FConfigSection &Section = ConfigFile.FindOrAdd(TEXT("Installations"));
OutIdentifier = FGuid::NewGuid().ToString(EGuidFormats::DigitsWithHyphensInBraces);
Section.AddUnique(*OutIdentifier, RootDir);
ConfigFile.Dirty = true;
ConfigFile.Write(ConfigPath);
}
return bRes;
}
void FDesktopPlatformMac::EnumerateEngineInstallations(TMap<FString, FString> &OutInstallations)
{
SCOPED_AUTORELEASE_POOL;
EnumerateLauncherEngineInstallations(OutInstallations);
// Create temp .uproject file to use with LSCopyApplicationURLsForURL
FString UProjectPath = FString(FPlatformProcess::ApplicationSettingsDir()) / "Unreal.uproject";
FArchive* File = IFileManager::Get().CreateFileWriter(*UProjectPath, FILEWRITE_EvenIfReadOnly);
if (File)
{
File->Close();
delete File;
}
else
{
FPlatformMisc::MessageBoxExt(EAppMsgType::Ok, *UProjectPath, TEXT("Error"));
}
FConfigFile ConfigFile;
FString ConfigPath = FString(FPlatformProcess::ApplicationSettingsDir()) / FString(TEXT("UnrealEngine")) / FString(TEXT("Install.ini"));
ConfigFile.Read(ConfigPath);
FConfigSection &Section = ConfigFile.FindOrAdd(TEXT("Installations"));
// Remove invalid entries
TArray<FName> KeysToRemove;
for (auto It : Section)
{
Copying //UE4/Dev-Framework to Dev-Main (//UE4/Dev-Main) @ 2926658 #lockdown Nick.Penwarden ========================== MAJOR FEATURES + CHANGES ========================== Change 2821607 on 2016/01/08 by Mieszko.Zielinski Added a way to limit amount of information logged by vlog by discarding logs from classes from outside of class whitelist #UE4 This feature was followed by refactoring of functions taking FVisualLogEntry pointers to use references instead. #rb Lukasz.Furman #codereview John.Abercrombie Change 2828384 on 2016/01/14 by Mieszko.Zielinski Back out of visual log refactor done as part of CL#2821607 #UE4 Change 2910454 on 2016/03/15 by Zak.Middleton #ue4 - Properly exclude zero-distance MTD results in ComponentEncroachesBlockingGeometry_WithAdjustment() in the presense of multiple overlaps. #rb Jeff.Farris #jira UE-24327 UDN: https://udn.unrealengine.com/questions/270574/jeff-farris-hack-for-physx-mtd.html Change 2910548 on 2016/03/15 by Zak.Middleton #ue4 - Handle MTD computation returning NaN direction when there is a "contact" with zero distance. Change 2912311 on 2016/03/16 by Marc.Audy Properly handle overlaps in C++ in documentation code and UE4 to Unity doc #rb Martin.Wilson Change 2913086 on 2016/03/17 by Marc.Audy Adding ability to have 9 parameters to a dynamic delegate Change 2913101 on 2016/03/17 by Marc.Audy Fix some of the loctext error messages Change 2913102 on 2016/03/17 by Thomas.Sarkanen Console usability improvements Display console autocompletion commands from the lexicographically first element up to either the total number of commands or MAX_AUTOCOMPLETION_LINES, whichever is least. The previous behaviour started the list "in the middle" and hid the first elements if there were too many matches. Thus "[ab ac ad]" with "aa" hidden now becomes "[aa ab ac]" with "ad" hidden. To make scrolling work as expected, the input handling of the up and down arrow keys has been reversed so that the cursor iterates forward starting from the top with the down arrow key, and goes back up with the up arrow key. Command history is still accessed with the up arrow key. This commit also undoes one of the most evil uses of operator overloading I've ever seen, on par with "#define true false" but more subtle Color console autocomplete entries to denote their type: command, CVar or other (manual autocompletion entries). CVars are further divided into writeable and read-only variables. Assume that manual console autocompletion entries are commands. This makes the autocompletion list colors more consistent and less noisy Automatically select (but don't complete) a command on console character input. To prevent the autocomplete from becoming too trigger happy, no longer automatically complete commands for arbitrary key inputs that we happen to have a match for Allow cycling through console commands with the tab key Discriminate between first time and repeated tab presses and only scroll through autocomplete entries on the latter Fix off-by-one error in console: "x more matches" line was being shown when the number of autocomplete elements was equal to MAX_AUTOCOMPLETION_LINES Fix an off-by-one error that was causing the topmost console command to not be shown if there was an autocomplete scroll region Show the currently selected autocomplete entry faded out behind the user's typed input Slightly increase brightness of the normal input text colour to better distinguish between the typed and autocompleted parts of the input line Left-justify command descriptions in the console autocompletion box Detect overflow of console autocomplete lines on low resolutions and decrease the space used for description justification to compensate Make the console input, history and autocomplete colours user configurable Add console background transparency. Configurable, set to 15% by default Add missing closing quote to the console dump HTML template #github #2061: Console usability improvements from Mattiwatti Change 2913104 on 2016/03/17 by Thomas.Sarkanen Added indicator displayed on animation nodes when they use the 'fast path' Added checkbox that can be used to audit Blueprint fast-path usage. Switched almost all animation node widgets to derive from new SAnimationGraphNode. This creates the overlay widget that indicates whether this node is using a more optimal path. #doc Also added documentation tooltips and UDN doc files/images for the fast path systems. #jira UE-24698 - Add icon to pins in anim graph to indicate 'fast mode' access #rb Martin.Wilson Change 2913306 on 2016/03/17 by Marc.Audy Cleaning up GetResourceSize - Made many call Super::GetResourceSize - Removed trivial implementations - Fixed HierarchicalInstanceStaticMeshComponent double counting an array Change 2913535 on 2016/03/17 by Lukasz.Furman fixed broken behavior tree graph data after subnode undo #ue4 UE-28198 Change 2913608 on 2016/03/17 by Lukasz.Furman fixed behavior tree execution indices after undoing move in editor #ue4 UE-26705 Change 2913847 on 2016/03/17 by Lukasz.Furman added new automation test for UE-28309 #ue4 Change 2913849 on 2016/03/17 by Lukasz.Furman fixed behavior tree skipping over branch when restart request comes during AbortCurrentTask call #ue4 UE-28309 Change 2913895 on 2016/03/17 by Marc.Audy Added 'self' argument to Actor and PrimitiveComponent delegates that didn't already supply one Fixed up all C++ uses of these delegates #jira UE-23122 #rb Zak.Middleton Change 2914743 on 2016/03/18 by Thomas.Sarkanen Editing of primitive data in PhAT [CL 2926677 by Marc Audy in Main branch]
2016-03-29 16:33:59 -04:00
const FString& EngineDir = It.Value.GetValue();
if (EngineDir.Contains("Unreal Engine.app/Contents/") || EngineDir.Contains("Epic Games Launcher.app/Contents/") || EngineDir.Contains("/Users/Shared/UnrealEngine/Launcher") || !IFileManager::Get().DirectoryExists(*EngineDir))
{
KeysToRemove.Add(It.Key);
}
}
for (auto Key : KeysToRemove)
{
Section.Remove(Key);
}
CFArrayRef AllApps = LSCopyApplicationURLsForURL((__bridge CFURLRef)[NSURL fileURLWithPath:UProjectPath.GetNSString()], kLSRolesAll);
if (AllApps)
{
const CFIndex AppsCount = CFArrayGetCount(AllApps);
for (CFIndex Index = 0; Index < AppsCount; ++Index)
{
NSURL* AppURL = (NSURL*)CFArrayGetValueAtIndex(AllApps, Index);
NSBundle* AppBundle = [NSBundle bundleWithURL:AppURL];
FString EngineDir = FString([[AppBundle bundlePath] stringByDeletingLastPathComponent]);
if (([[AppBundle bundleIdentifier] isEqualToString:@"com.epicgames.UE4Editor"] || [[AppBundle bundleIdentifier] isEqualToString:@"com.epicgames.UE4EditorServices"])
&& EngineDir.RemoveFromEnd(TEXT("/Engine/Binaries/Mac")) && !EngineDir.Contains("Unreal Engine.app/Contents/") && !EngineDir.Contains("Epic Games Launcher.app/Contents/") && !EngineDir.Contains("/Users/Shared/UnrealEngine/Launcher"))
{
FString EngineId;
const FName* Key = Section.FindKey(EngineDir);
if (Key)
{
FGuid IdGuid;
FGuid::Parse(Key->ToString(), IdGuid);
EngineId = IdGuid.ToString(EGuidFormats::DigitsWithHyphensInBraces);;
}
else
{
if (!OutInstallations.FindKey(EngineDir))
{
EngineId = FGuid::NewGuid().ToString(EGuidFormats::DigitsWithHyphensInBraces);
Section.AddUnique(*EngineId, EngineDir);
ConfigFile.Dirty = true;
}
}
if (!EngineId.IsEmpty() && !OutInstallations.Find(EngineId))
{
OutInstallations.Add(EngineId, EngineDir);
}
}
}
ConfigFile.Write(ConfigPath);
CFRelease(AllApps);
}
IFileManager::Get().Delete(*UProjectPath);
}
bool FDesktopPlatformMac::VerifyFileAssociations()
{
CFURLRef GlobalDefaultAppURL = NULL;
OSStatus Status = LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator, CFSTR("uproject"), kLSRolesAll, NULL, &GlobalDefaultAppURL);
if (Status == noErr)
{
NSBundle* GlobalDefaultAppBundle = [NSBundle bundleWithURL:(__bridge NSURL*)GlobalDefaultAppURL];
CFRelease(GlobalDefaultAppURL);
if ([[GlobalDefaultAppBundle bundleIdentifier] isEqualToString:@"com.epicgames.UE4EditorServices"])
{
return true;
}
}
return false;
}
bool FDesktopPlatformMac::UpdateFileAssociations()
{
OSStatus Status = LSSetDefaultRoleHandlerForContentType(CFSTR("com.epicgames.uproject"), kLSRolesAll, CFSTR("com.epicgames.UE4EditorServices"));
return Status == noErr;
}
bool FDesktopPlatformMac::RunUnrealBuildTool(const FText& Description, const FString& RootDir, const FString& Arguments, FFeedbackContext* Warn)
{
// Get the path to UBT
FString UnrealBuildToolPath = RootDir / TEXT("Engine/Binaries/DotNET/UnrealBuildTool.exe");
if(IFileManager::Get().FileSize(*UnrealBuildToolPath) < 0)
{
Warn->Logf(ELogVerbosity::Error, TEXT("Couldn't find UnrealBuildTool at '%s'"), *UnrealBuildToolPath);
return false;
}
// On Mac we launch UBT with Mono
FString ScriptPath = FPaths::ConvertRelativePathToFull(RootDir / TEXT("Engine/Build/BatchFiles/Mac/RunMono.sh"));
FString CmdLineParams = FString::Printf(TEXT("\"%s\" \"%s\" %s"), *ScriptPath, *UnrealBuildToolPath, *Arguments);
// Spawn it
int32 ExitCode = 0;
return FFeedbackContextMarkup::PipeProcessOutput(Description, TEXT("/bin/sh"), CmdLineParams, Warn, &ExitCode) && ExitCode == 0;
}
bool FDesktopPlatformMac::IsUnrealBuildToolRunning()
{
// For now assume that if mono application is running, we're running UBT
// @todo: we need to get the commandline for the mono process and check if UBT.exe is in there.
return FPlatformProcess::IsApplicationRunning(TEXT("mono"));
}
bool FDesktopPlatformMac::IsLauncherInstalled() const
{
// Otherwise search for it...
NSWorkspace* Workspace = [NSWorkspace sharedWorkspace];
NSString* Path = [Workspace fullPathForApplication:@"Epic Games Launcher"];
if( Path )
{
return true;
}
// Otherwise search for the old Launcher...
Path = [Workspace fullPathForApplication:@"Unreal Engine"];
if( Path )
{
return true;
}
return false;
}
bool FDesktopPlatformMac::GetLauncherInstallerPath(FString& OutInstallerPath) const
{
// Check if the installer exists
FString InstallerPath = FPaths::ConvertRelativePathToFull(FPaths::Combine(*FPaths::EngineDir(), TEXT("Extras/UnrealEngineLauncher/EpicGamesLauncher.dmg")));
if (FPaths::FileExists(InstallerPath))
{
OutInstallerPath = InstallerPath;
return true;
}
InstallerPath = FPaths::ConvertRelativePathToFull(FPaths::Combine(*FPaths::EngineDir(), TEXT("Extras/UnrealEngineLauncher/UnrealEngine.dmg")));
if (FPaths::FileExists(InstallerPath))
{
OutInstallerPath = InstallerPath;
return true;
}
return false;
}
FFeedbackContext* FDesktopPlatformMac::GetNativeFeedbackContext()
{
static FMacNativeFeedbackContext Warn;
return &Warn;
}
FString FDesktopPlatformMac::GetUserTempPath()
{
return FString(FPlatformProcess::UserTempDir());
}
#undef LOCTEXT_NAMESPACE