Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c19c5e97e | ||
|
|
0f2fd1382f | ||
|
|
e5c27effd7 | ||
|
|
7bcb7823a6 | ||
|
|
197fbbe6ce | ||
|
|
bf9949b5cb | ||
|
|
fbe837fca9 | ||
|
|
4aac4cc1fc | ||
|
|
fa2f24a764 | ||
|
|
90c5058a4c |
No files matched your search
+34
-21
@@ -62,6 +62,15 @@ namespace SourceCodeGeneratorUbtPlugin
|
|||||||
|
|
||||||
private const string HeaderSuffix = ".header.inl";
|
private const string HeaderSuffix = ".header.inl";
|
||||||
|
|
||||||
|
private readonly HashSet<string> ClassBlacklist = new();
|
||||||
|
|
||||||
|
private const string GeneratedHeaderComment =
|
||||||
|
"/*===========================================================================\n" +
|
||||||
|
" Generated code exported from UnrealCSharp SourceCodeGenerator.\n" +
|
||||||
|
" DO NOT modify this manually!\n" +
|
||||||
|
"===========================================================================*/\n" +
|
||||||
|
"\n";
|
||||||
|
|
||||||
public SourceCodeGenerator(IUhtExportFactory factory)
|
public SourceCodeGenerator(IUhtExportFactory factory)
|
||||||
{
|
{
|
||||||
Factory = factory;
|
Factory = factory;
|
||||||
@@ -119,26 +128,37 @@ namespace SourceCodeGeneratorUbtPlugin
|
|||||||
ExportModule.Add(value);
|
ExportModule.Add(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SettingConfigHierarchySection.TryGetValues("ClassBlacklist", out var BlacklistValues))
|
||||||
|
{
|
||||||
|
foreach (var value in BlacklistValues)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(value))
|
||||||
|
{
|
||||||
|
ClassBlacklist.Add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Task?> tasks = new();
|
List<Task?> tasks = new();
|
||||||
|
|
||||||
foreach (var package in Session.Packages)
|
foreach (var module in Session.Modules)
|
||||||
{
|
{
|
||||||
if (package.Module.ModuleType != UHTModuleType.EngineRuntime &&
|
if (module.Module.ModuleType != UHTModuleType.EngineRuntime &&
|
||||||
package.Module.ModuleType != UHTModuleType.GameRuntime)
|
module.Module.ModuleType != UHTModuleType.GameRuntime)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ExportModule.All(module =>
|
if (ExportModule.All(x =>
|
||||||
string.Compare(module, package.Module.Name, StringComparison.OrdinalIgnoreCase) != 0))
|
string.Compare(x, module.Module.Name, StringComparison.OrdinalIgnoreCase) != 0))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueClassExports(package, tasks);
|
QueueClassExports(module.ScriptPackage, tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
var waitTasks = tasks.Where(Task => Task != null).Cast<Task>().ToArray();
|
var waitTasks = tasks.Where(Task => Task != null).Cast<Task>().ToArray();
|
||||||
@@ -179,7 +199,8 @@ namespace SourceCodeGeneratorUbtPlugin
|
|||||||
/// <returns>True if the class should be exported, false if not</returns>
|
/// <returns>True if the class should be exported, false if not</returns>
|
||||||
protected virtual bool CanExportClass(UhtClass classObj)
|
protected virtual bool CanExportClass(UhtClass classObj)
|
||||||
{
|
{
|
||||||
return !classObj.ClassFlags.HasAnyFlags(EClassFlags.Interface) &&
|
return !ClassBlacklist.Contains(classObj.SourceName) &&
|
||||||
|
!classObj.ClassFlags.HasAnyFlags(EClassFlags.Interface) &&
|
||||||
IsClassTypeSupported(classObj);
|
IsClassTypeSupported(classObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,14 +296,6 @@ namespace SourceCodeGeneratorUbtPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property is UhtObjectPtrProperty objectPtrProperty)
|
|
||||||
{
|
|
||||||
if (!IsClassTypeSupported(objectPtrProperty.Class))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property is UhtInterfaceProperty interfaceProperty)
|
if (property is UhtInterfaceProperty interfaceProperty)
|
||||||
{
|
{
|
||||||
if (interfaceProperty.InterfaceClass == interfaceProperty.Session.IInterface)
|
if (interfaceProperty.InterfaceClass == interfaceProperty.Session.IInterface)
|
||||||
@@ -360,6 +373,8 @@ namespace SourceCodeGeneratorUbtPlugin
|
|||||||
|
|
||||||
var builder = borrow.StringBuilder;
|
var builder = borrow.StringBuilder;
|
||||||
|
|
||||||
|
builder.Append(GeneratedHeaderComment);
|
||||||
|
|
||||||
builder.Append("#pragma once\r\n\r\n");
|
builder.Append("#pragma once\r\n\r\n");
|
||||||
|
|
||||||
foreach (var value in package.Value)
|
foreach (var value in package.Value)
|
||||||
@@ -367,7 +382,7 @@ namespace SourceCodeGeneratorUbtPlugin
|
|||||||
builder.Append(GenerateInclude($"{value}{BindingSuffix}"));
|
builder.Append(GenerateInclude($"{value}{BindingSuffix}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
var fileName = Factory.MakePath(package.Key, HeaderSuffix);
|
var fileName = Factory.MakePath(package.Key.Module, HeaderSuffix);
|
||||||
|
|
||||||
SaveIfChanged(fileName, builder);
|
SaveIfChanged(fileName, builder);
|
||||||
}
|
}
|
||||||
@@ -375,6 +390,8 @@ namespace SourceCodeGeneratorUbtPlugin
|
|||||||
|
|
||||||
private bool ExportClass(StringBuilder builder, UhtClass classObj)
|
private bool ExportClass(StringBuilder builder, UhtClass classObj)
|
||||||
{
|
{
|
||||||
|
builder.Append(GeneratedHeaderComment);
|
||||||
|
|
||||||
builder.Append("#pragma once\r\n\r\n" +
|
builder.Append("#pragma once\r\n\r\n" +
|
||||||
"PRAGMA_DISABLE_DEPRECATION_WARNINGS\r\n\r\n");
|
"PRAGMA_DISABLE_DEPRECATION_WARNINGS\r\n\r\n");
|
||||||
|
|
||||||
@@ -463,10 +480,6 @@ namespace SourceCodeGeneratorUbtPlugin
|
|||||||
DependencyClasses.Add(classProperty.MetaClass);
|
DependencyClasses.Add(classProperty.MetaClass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (property is UhtObjectPtrProperty objectPtrProperty)
|
|
||||||
{
|
|
||||||
DependencyClasses.Add(objectPtrProperty.Class);
|
|
||||||
}
|
|
||||||
else if (property is UhtObjectProperty objectProperty)
|
else if (property is UhtObjectProperty objectProperty)
|
||||||
{
|
{
|
||||||
DependencyClasses.Add(objectProperty.Class);
|
DependencyClasses.Add(objectProperty.Class);
|
||||||
@@ -759,7 +772,7 @@ namespace SourceCodeGeneratorUbtPlugin
|
|||||||
|
|
||||||
private string GetHeaderFile(UhtClass classObj)
|
private string GetHeaderFile(UhtClass classObj)
|
||||||
{
|
{
|
||||||
return Path.Combine(HeaderPath[classObj.Package.ShortName], classObj.HeaderFile.FilePath);
|
return Path.Combine(HeaderPath[classObj.Package.Module.ShortName], classObj.HeaderFile.FilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GenerateInclude(string file)
|
private static string GenerateInclude(string file)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Import Project="SourceCodeGenerator.ubtplugin.csproj.props" Condition="Exists('SourceCodeGenerator.ubtplugin.csproj.props')" />
|
<Import Project="SourceCodeGenerator.ubtplugin.csproj.props" Condition="Exists('SourceCodeGenerator.ubtplugin.csproj.props')" />
|
||||||
<Import Project="$(EngineDir)\Source\Programs\Shared\UnrealEngine.csproj.props" />
|
<Import Project="$(EngineDir)\Source\Programs\Shared\UnrealEngine.csproj.props" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Development</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Development</Configuration>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
@@ -29,9 +29,6 @@
|
|||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="EpicGames.Build">
|
<Reference Include="EpicGames.Build">
|
||||||
<HintPath>$(EngineDir)\Binaries\DotNET\UnrealBuildTool\EpicGames.Build.dll</HintPath>
|
<HintPath>$(EngineDir)\Binaries\DotNET\UnrealBuildTool\EpicGames.Build.dll</HintPath>
|
||||||
|
|||||||
Reference in new issue
Block a user