feat: 新增blacklist和删除报错属性

pull/6/head
yawn831831 1 year ago
parent 4aac4cc1fc
commit ca92cee10e
  1. 31
      SourceCodeGenerator.cs

@ -62,6 +62,8 @@ namespace SourceCodeGeneratorUbtPlugin
private const string HeaderSuffix = ".header.inl"; private const string HeaderSuffix = ".header.inl";
private readonly HashSet<string> ClassNameBlacklist = new();
public SourceCodeGenerator(IUhtExportFactory factory) public SourceCodeGenerator(IUhtExportFactory factory)
{ {
Factory = factory; Factory = factory;
@ -119,6 +121,18 @@ namespace SourceCodeGeneratorUbtPlugin
ExportModule.Add(value); ExportModule.Add(value);
} }
} }
if (SettingConfigHierarchySection.TryGetValues("ClassBlacklist", out var blacklistValues))
{
foreach (var className in blacklistValues)
{
if (!string.IsNullOrEmpty(className))
{
ClassNameBlacklist.Add(className);
Console.WriteLine($"[BlackList] {className} will be skipped.");
}
}
}
} }
} }
@ -179,6 +193,11 @@ 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)
{ {
if (ClassNameBlacklist.Contains(classObj.SourceName))
{
return false;
}
return !classObj.ClassFlags.HasAnyFlags(EClassFlags.Interface) && return !classObj.ClassFlags.HasAnyFlags(EClassFlags.Interface) &&
IsClassTypeSupported(classObj); IsClassTypeSupported(classObj);
} }
@ -275,14 +294,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)
@ -463,10 +474,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);

Loading…
Cancel
Save