Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c19c5e97e | ||
|
|
0f2fd1382f | ||
|
|
e5c27effd7 | ||
|
|
7bcb7823a6 | ||
|
|
197fbbe6ce | ||
|
|
bf9949b5cb | ||
|
|
fbe837fca9 | ||
|
|
4aac4cc1fc | ||
|
|
4a3273ec31 | ||
|
|
fa2f24a764 | ||
|
|
90c5058a4c |
No files matched your search
@@ -74,3 +74,4 @@ Plugins/**/Intermediate/*
|
||||
DerivedDataCache/*
|
||||
|
||||
obj/*
|
||||
SourceCodeGenerator.ubtplugin.csproj.props
|
||||
+35
-22
@@ -62,6 +62,15 @@ namespace SourceCodeGeneratorUbtPlugin
|
||||
|
||||
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)
|
||||
{
|
||||
Factory = factory;
|
||||
@@ -119,26 +128,37 @@ namespace SourceCodeGeneratorUbtPlugin
|
||||
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();
|
||||
|
||||
foreach (var package in Session.Packages)
|
||||
foreach (var module in Session.Modules)
|
||||
{
|
||||
if (package.Module.ModuleType != UHTModuleType.EngineRuntime &&
|
||||
package.Module.ModuleType != UHTModuleType.GameRuntime)
|
||||
if (module.Module.ModuleType != UHTModuleType.EngineRuntime &&
|
||||
module.Module.ModuleType != UHTModuleType.GameRuntime)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ExportModule.All(module =>
|
||||
string.Compare(module, package.Module.Name, StringComparison.OrdinalIgnoreCase) != 0))
|
||||
if (ExportModule.All(x =>
|
||||
string.Compare(x, module.Module.Name, StringComparison.OrdinalIgnoreCase) != 0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QueueClassExports(package, tasks);
|
||||
QueueClassExports(module.ScriptPackage, tasks);
|
||||
}
|
||||
|
||||
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>
|
||||
protected virtual bool CanExportClass(UhtClass classObj)
|
||||
{
|
||||
return !classObj.ClassFlags.HasAnyFlags(EClassFlags.Interface) &&
|
||||
return !ClassBlacklist.Contains(classObj.SourceName) &&
|
||||
!classObj.ClassFlags.HasAnyFlags(EClassFlags.Interface) &&
|
||||
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 (interfaceProperty.InterfaceClass == interfaceProperty.Session.IInterface)
|
||||
@@ -359,7 +372,9 @@ namespace SourceCodeGeneratorUbtPlugin
|
||||
var borrow = new BorrowStringBuilder(StringBuilderCache.Big);
|
||||
|
||||
var builder = borrow.StringBuilder;
|
||||
|
||||
|
||||
builder.Append(GeneratedHeaderComment);
|
||||
|
||||
builder.Append("#pragma once\r\n\r\n");
|
||||
|
||||
foreach (var value in package.Value)
|
||||
@@ -367,7 +382,7 @@ namespace SourceCodeGeneratorUbtPlugin
|
||||
builder.Append(GenerateInclude($"{value}{BindingSuffix}"));
|
||||
}
|
||||
|
||||
var fileName = Factory.MakePath(package.Key, HeaderSuffix);
|
||||
var fileName = Factory.MakePath(package.Key.Module, HeaderSuffix);
|
||||
|
||||
SaveIfChanged(fileName, builder);
|
||||
}
|
||||
@@ -375,6 +390,8 @@ namespace SourceCodeGeneratorUbtPlugin
|
||||
|
||||
private bool ExportClass(StringBuilder builder, UhtClass classObj)
|
||||
{
|
||||
builder.Append(GeneratedHeaderComment);
|
||||
|
||||
builder.Append("#pragma once\r\n\r\n" +
|
||||
"PRAGMA_DISABLE_DEPRECATION_WARNINGS\r\n\r\n");
|
||||
|
||||
@@ -463,10 +480,6 @@ namespace SourceCodeGeneratorUbtPlugin
|
||||
DependencyClasses.Add(classProperty.MetaClass);
|
||||
}
|
||||
}
|
||||
else if (property is UhtObjectPtrProperty objectPtrProperty)
|
||||
{
|
||||
DependencyClasses.Add(objectPtrProperty.Class);
|
||||
}
|
||||
else if (property is UhtObjectProperty objectProperty)
|
||||
{
|
||||
DependencyClasses.Add(objectProperty.Class);
|
||||
@@ -759,7 +772,7 @@ namespace SourceCodeGeneratorUbtPlugin
|
||||
|
||||
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)
|
||||
|
||||
@@ -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="$(EngineDir)\Source\Programs\Shared\UnrealEngine.csproj.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Development</Configuration>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
@@ -29,9 +29,6 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EpicGames.Build">
|
||||
<HintPath>$(EngineDir)\Binaries\DotNET\UnrealBuildTool\EpicGames.Build.dll</HintPath>
|
||||
|
||||
Reference in new issue
Block a user