Skip to content

Commit

Permalink
2.20.2048
Browse files Browse the repository at this point in the history
* Implemented UModioSubsystem::SubmitModChangesAsync allowing you to edit mod name, description, etc
* Implemented UModioSubsystem::PrioritizeTransferForMod allowing you to request a transfer begin immediately, bumping the current transfer back to the queue
* Expose `FModioCreateModParams` and `FModioCreateModFileParams` to Blueprint
* Minor UI updates
* UE4.27 compatibility improvements
* Improve support for non-unity builds
* Update NativeSDK
  • Loading branch information
stephenwhittle committed Aug 5, 2022
1 parent f2bd144 commit 6fa50a3
Show file tree
Hide file tree
Showing 181 changed files with 1,293 additions and 730 deletions.
Binary file not shown.
125 changes: 95 additions & 30 deletions Doc/documentation.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Source/MSDFSupport/MSDFSupport.build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void AddCommonGeneratedSource(string GeneratedSourcePath)
}
public void CopyCommonGeneratedSource(string GeneratedSourcePath)
{
if (File.Exists(Path.Combine(ModuleDirectory, "../ThirdParty/msdfgen/.git")))
if (File.Exists(Path.Combine(ModuleDirectory, "../ThirdParty/msdfgen/.git")) || Directory.Exists(Path.Combine(ModuleDirectory, "../ThirdParty/msdfgen/.git")))
{
//Clean the generated source directory so that we dont have any stale files in it
if (Directory.Exists(GeneratedSourcePath))
Expand Down Expand Up @@ -101,7 +101,7 @@ public void CopyCommonGeneratedSource(string GeneratedSourcePath)
}
public void CopyCommonGeneratedHeaders(string GeneratedHeaderPath)
{
if (File.Exists(Path.Combine(ModuleDirectory, "../ThirdParty/msdfgen/.git")))
if (File.Exists(Path.Combine(ModuleDirectory, "../ThirdParty/msdfgen/.git")) || Directory.Exists(Path.Combine(ModuleDirectory, "../ThirdParty/msdfgen/.git")))
{
//Clean the generated header directory so that we dont have any stale files in it
if (Directory.Exists(GeneratedHeaderPath))
Expand Down
2 changes: 1 addition & 1 deletion Source/MSDFSupport/Public/MSDFAssetData.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ class MSDFSUPPORT_API UMSDFAssetData : public UAssetUserData
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadOnly, EditAnywhere)
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="Params")
FSVGConversionParams ImportParameters;
};
18 changes: 10 additions & 8 deletions Source/MSDFSupport/Public/SVGToSDF.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,27 @@ struct MSDFSUPPORT_API FSVGConversionParams
{
GENERATED_BODY()

UPROPERTY(BlueprintReadWrite, EditAnywhere)
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "SVGConversionParams")
int32 SVGPathIndex;

UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (AllowPreserveRatio))
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (AllowPreserveRatio), Category = "SVGConversionParams")
FVector2D OutputDimensions = FVector2D(32, 32);

UPROPERTY(BlueprintReadWrite, EditAnywhere)
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "SVGConversionParams")
bool bAutoFrame = true;

UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (EditCondition = "AutoFrame"))
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (EditCondition = "AutoFrame"), Category = "SVGConversionParams")
int32 ExtraMargin = 2;

UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (EditCondition = "!bAutoFrame"), meta = (AllowPreserveRatio))
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (EditCondition = "!bAutoFrame"), meta = (AllowPreserveRatio),
Category = "SVGConversionParams")
FVector2D Scale = FVector2D(1, 1);

UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (EditCondition = "!bAutoFrame"))
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (EditCondition = "!bAutoFrame"),
Category = "SVGConversionParams")
FVector2D Translation;

UPROPERTY(BlueprintReadWrite, EditAnywhere)
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "SVGConversionParams")
int32 FieldRangeInPixels = 8;

// For future use
Expand All @@ -51,7 +53,7 @@ class MSDFSUPPORT_API USVGToSDFFunctionLibrary : public UBlueprintFunctionLibrar
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable)
UFUNCTION(BlueprintCallable, Category="SVGToSDFFunctionLibrary")
static bool ConvertSVGToMSDFData(const FString& FilePath, const FSVGConversionParams& Params,
TArray<uint8>& Output);
};
8 changes: 5 additions & 3 deletions Source/Modio/Modio.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.

using System;
using System.IO;
using System.Collections.Generic;
using UnrealBuildTool;
Expand Down Expand Up @@ -122,7 +124,7 @@ private ModioPlatformConfigFile.PlatformConfig LoadNativePlatformConfig()
private void CopyCommonGeneratedHeaders(string GeneratedHeaderPath)
{
// Only process generated headers if we are using the NativeSDK as a git submodule
if (File.Exists(Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/.git")))
if (Directory.Exists(Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/.git")) || File.Exists(Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/.git")))
{
//Clean the generated source directory so that we dont have any stale files in it
if (Directory.Exists(GeneratedHeaderPath))
Expand Down Expand Up @@ -153,7 +155,7 @@ private void CopyCommonGeneratedHeaders(string GeneratedHeaderPath)
/// <param name="GeneratedSourcePath"> The root directory containing the platform-specific source directories </param>
private void CopyPlatformGeneratedSource(string GeneratedSourcePath)
{
if (File.Exists(Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/.git")))
if (Directory.Exists(Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/.git")) || File.Exists(Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/.git")))
{
foreach (var PlatformDirectory in Directory.EnumerateDirectories(Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/platform")))
{
Expand Down Expand Up @@ -184,7 +186,7 @@ private void CopyPlatformGeneratedSource(string GeneratedSourcePath)
private void CopyCommonGeneratedSource(string GeneratedSourcePath)
{
string CommonGeneratedSourcePath = Path.Combine(GeneratedSourcePath, "core");
if (File.Exists(Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/.git")))
if (Directory.Exists(Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/.git")) || File.Exists(Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/.git")))
{
//Clean the generated source directory so that we dont have any stale files in it
if (Directory.Exists(CommonGeneratedSourcePath))
Expand Down
7 changes: 4 additions & 3 deletions Source/Modio/Private/Internal/Convert/CreateModParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
*/

#pragma once
#include "Internal/Convert/Optional.h"
#include "Internal/Convert/Numerics.h"
#include "Internal/Convert/Optional.h"
#include "Internal/ModioConvert.h"
#include "ModioSDK.h"
#include "Types/ModioCreateModParams.h"
Expand All @@ -26,8 +26,9 @@ FORCEINLINE Modio::CreateModParams ToModio(const FModioCreateModParams& In)
Out.Description = ToModioOptional<std::string>(In.Description);
Out.HomepageURL = ToModioOptional<std::string>(In.HomepageURL);
Out.Stock = ToModioOptional<int64>(In.QuantityAvailable);
Out.MaturityRating = In.MaturityFlags.IsSet() ? static_cast<Modio::MaturityOption>(In.MaturityFlags.GetValue()): Modio::Optional<Modio::MaturityOption>{};
Out.MaturityRating = In.MaturityFlags.IsSet() ? static_cast<Modio::MaturityOption>(In.MaturityFlags.GetValue())
: Modio::Optional<Modio::MaturityOption> {};
Out.MetadataBlob = ToModioOptional<std::string>(In.MetadataBlob);
Out.Tags = ToModioOptional<std::vector<std::string>>(In.Tags);
return Out;
return Out;
}
34 changes: 34 additions & 0 deletions Source/Modio/Private/Internal/Convert/EditModParams.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (C) 2021 mod.io Pty Ltd. <https://mod.io>
*
* This file is part of the mod.io UE4 Plugin.
*
* Distributed under the MIT License. (See accompanying file LICENSE or
* view online at <https://github.com/modio/modio-ue4/blob/main/LICENSE>)
*
*/

#pragma once

#include "Internal/Convert/Numerics.h"
#include "Internal/Convert/Optional.h"
#include "Internal/ModioConvert.h"
#include "ModioSDK.h"
#include "Types/ModioEditModParams.h"

FORCEINLINE Modio::EditModParams ToModio(const FModioEditModParams& In)
{
Modio::EditModParams Out;

Out.Name = ToModioOptional<std::string>(In.Name);
Out.Summary = ToModioOptional<std::string>(In.Summary);
Out.NamePath = ToModioOptional<std::string>(In.NamePath);
Out.bVisible = ToModioOptional<bool>(In.bVisible);
Out.Description = ToModioOptional<std::string>(In.Description);
Out.HomepageURL = ToModioOptional<std::string>(In.HomepageURL);
Out.MaturityRating = In.MaturityFlags.IsSet() ? static_cast<Modio::MaturityOption>(In.MaturityFlags.GetValue())
: Modio::Optional<Modio::MaturityOption> {};
Out.MetadataBlob = ToModioOptional<std::string>(In.MetadataBlob);

return Out;
}
54 changes: 54 additions & 0 deletions Source/Modio/Private/Libraries/ModioCreateModLibrary.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Fill out your copyright notice in the Description page of Project Settings.

#include "Libraries/ModioCreateModLibrary.h"

void UModioCreateModLibrary::SetInitialVisibility(FModioCreateModParams& In, bool InitialVisibility)
{
In.bVisible = InitialVisibility;
}

void UModioCreateModLibrary::SetDescription(FModioCreateModParams& In, FString Description)
{
In.Description = Description;
}

void UModioCreateModLibrary::SetHomepageURL(FModioCreateModParams& In, FString HomepageURL)
{
In.HomepageURL = HomepageURL;
}

void UModioCreateModLibrary::SetMetadataBlob(FModioCreateModParams& In, FString MetadataBlob)
{
In.MetadataBlob = MetadataBlob;
}

void UModioCreateModLibrary::SetModFileMetadataBlob(FModioCreateModFileParams& In, FString MetadataBlob)
{
In.MetadataBlob = MetadataBlob;
}

void UModioCreateModLibrary::SetModfilePlatforms(FModioCreateModFileParams& In,
TArray<EModioModfilePlatform>& Platforms)
{
In.ModfilePlatforms = Platforms;
}

void UModioCreateModLibrary::SetTags(FModioCreateModParams& In, TArray<FString>& Tags)
{
In.Tags = Tags;
}

void UModioCreateModLibrary::SetVersionString(FModioCreateModFileParams& In, FString Version)
{
In.VersionString = Version;
}

void UModioCreateModLibrary::SetChangelogString(FModioCreateModFileParams& In, FString Changelog)
{
In.Changelog = Changelog;
}

void UModioCreateModLibrary::SetMarkAsActiveRelease(FModioCreateModFileParams& In, bool bMarkAsActiveRelease)
{
In.bSetAsActiveRelease = bMarkAsActiveRelease;
}
43 changes: 43 additions & 0 deletions Source/Modio/Private/Libraries/ModioEditModLibrary.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Fill out your copyright notice in the Description page of Project Settings.

#include "Libraries/ModioEditModLibrary.h"

void UModioEditModLibrary::SetName(FModioEditModParams& In, FString Name)
{
In.Name = Name;
}

void UModioEditModLibrary::SetSummary(FModioEditModParams& In, FString Summary)
{
In.Summary = Summary;
}

void UModioEditModLibrary::SetNamePath(FModioEditModParams& In, FString NamePath)
{
In.NamePath = NamePath;
}

void UModioEditModLibrary::SetVisibility(FModioEditModParams& In, bool Visibility)
{
In.bVisible = Visibility;
}

void UModioEditModLibrary::SetDescription(FModioEditModParams& In, FString Description)
{
In.Description = Description;
}

void UModioEditModLibrary::SetHomepageURL(FModioEditModParams& In, FString HomepageURL)
{
In.HomepageURL = HomepageURL;
}

void UModioEditModLibrary::SetMaturityFlags(FModioEditModParams& In, EModioMaturityFlags MaturityFlags)
{
In.MaturityFlags = MaturityFlags;
}

void UModioEditModLibrary::SetMetadataBlob(FModioEditModParams& In, FString MetadataBlob)
{
In.MetadataBlob = MetadataBlob;
}
68 changes: 62 additions & 6 deletions Source/Modio/Private/Modio.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,69 @@
/*
/*
* Copyright (C) 2021 mod.io Pty Ltd. <https://mod.io>
*
*
* This file is part of the mod.io UE4 Plugin.
*
* Distributed under the MIT License. (See accompanying file LICENSE or
*
* Distributed under the MIT License. (See accompanying file LICENSE or
* view online at <https://github.com/modio/modio-ue4/blob/main/LICENSE>)
*
*
*/

#include "Modio.h"
#include "HAL/PlatformMisc.h"
#include "Math/Color.h"
#include "Stats/Stats.h"
#include "Containers/Array.h"

DEFINE_LOG_CATEGORY(LogModio)
DEFINE_LOG_CATEGORY(LogModio)

DECLARE_STATS_GROUP(TEXT("Modio"), STATGROUP_Modio, STATCAT_Advanced);

#ifdef MODIO_UNREAL_PROFILING_SUPPORT

extern "C"
{
static TArray<FName>& ProfilingScopes()
{
static TArray<FName> ScopeStorage;
return ScopeStorage;
}
static TStatId& GetOrCreateStat(FName StatName) {
static TMap<FName, TStatId> StatIDs;
if (TStatId* FoundID = StatIDs.Find(StatName)) {
return *FoundID;
}
else
{
StatIDs.Add(StatName,FDynamicStats::CreateStatId<FStatGroup_STATGROUP_Modio>(StatName));
return StatIDs[StatName];
}
}
PRAGMA_DISABLE_OPTIMIZATION
void modio_profile_scope_start(const char* Name, void** Data)
{
if (FThreadStats::IsCollectingData())
{
FThreadStats::AddMessage(GetOrCreateStat(FName(Name)).GetName(), EStatOperation::CycleScopeStart);
}
FCpuProfilerTrace::OutputBeginEvent(FCpuProfilerTrace::OutputEventType(Name));
}
void modio_profile_scope_end(const char* Name, void* Data)
{
if (FThreadStats::IsCollectingData())
{
FThreadStats::AddMessage(GetOrCreateStat(FName(Name)).GetName(), EStatOperation::CycleScopeEnd);
}
FCpuProfilerTrace::OutputEndEvent();
}
void modio_profile_push(const char* Name)
{
//FCpuProfilerTrace::OutputBeginEvent(FCpuProfilerTrace::OutputEventType(Name));
}
void modio_profile_pop()
{
//FCpuProfilerTrace::OutputEndEvent();
}
PRAGMA_ENABLE_OPTIMIZATION
}

#endif
25 changes: 19 additions & 6 deletions Source/Modio/Private/ModioModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,28 @@ void FModioModule::StartupModule()
{
FileManager.DeleteFile(*ModioLogFile);
}
ModioLog =
TUniquePtr<FArchive>(IFileManager::Get().CreateFileWriter(*ModioLogFile, EFileWrite::FILEWRITE_Append));

Modio::SetLogCallback([&](Modio::LogLevel Level, std::string Message) {
UE_LOG(LogModio, Log, TEXT("%s"), UTF8_TO_TCHAR(Message.c_str()));
TRACE_CPUPROFILER_EVENT_SCOPE(ModioLogCallback);

// Append message to ModioLogFile.
// FFileHelper::SaveStringToFile() will create a new file if it does not yet exist
FFileHelper::SaveStringToFile(UTF8_TO_TCHAR(Message.c_str()), *ModioLogFile,
FFileHelper::EEncodingOptions::AutoDetect, &IFileManager::Get(),
EFileWrite::FILEWRITE_Append);
{
TRACE_CPUPROFILER_EVENT_SCOPE(ModioLogConsole);
UE_LOG(LogModio, Log, TEXT("%s"), UTF8_TO_TCHAR(Message.c_str()));
}

{
TRACE_CPUPROFILER_EVENT_SCOPE(ModioLogToFile);

if (ModioLog)
{
{
TRACE_CPUPROFILER_EVENT_SCOPE(ModioLogSerialize);
ModioLog->Serialize(const_cast<char*>(Message.c_str()), Message.size());
}
}
}
});

RegisterSettings();
Expand Down
2 changes: 2 additions & 0 deletions Source/Modio/Private/ModioModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "Misc/FileHelper.h"
#include "Misc/Paths.h"
#include "Modules/ModuleManager.h"
#include "Templates/UniquePtr.h"

class FModioModule : public IModuleInterface
{
Expand All @@ -24,6 +25,7 @@ class FModioModule : public IModuleInterface

private:
FString ModioLogFile = FPaths::ProjectLogDir() / TEXT("Modio.log");
TUniquePtr<class FArchive> ModioLog;
void RegisterSettings();
void UnregisterSettings();
};
Loading

0 comments on commit 6fa50a3

Please sign in to comment.