Add Hidden attribute to scripting fields/properties/methods/events
This commit is contained in:
@@ -626,6 +626,8 @@ namespace Flax.Build.Bindings
|
||||
// Events
|
||||
foreach (var eventInfo in classInfo.Events)
|
||||
{
|
||||
if (eventInfo.IsHidden)
|
||||
continue;
|
||||
if (!useUnmanaged)
|
||||
throw new NotImplementedException("TODO: support events inside non-static and non-scripting API class types.");
|
||||
var paramsCount = eventInfo.Type.GenericArgs?.Count ?? 0;
|
||||
@@ -764,7 +766,7 @@ namespace Flax.Build.Bindings
|
||||
// Fields
|
||||
foreach (var fieldInfo in classInfo.Fields)
|
||||
{
|
||||
if (fieldInfo.Getter == null)
|
||||
if (fieldInfo.Getter == null || fieldInfo.IsHidden)
|
||||
continue;
|
||||
contents.AppendLine();
|
||||
|
||||
@@ -820,6 +822,8 @@ namespace Flax.Build.Bindings
|
||||
// Properties
|
||||
foreach (var propertyInfo in classInfo.Properties)
|
||||
{
|
||||
if (propertyInfo.IsHidden)
|
||||
continue;
|
||||
if (!useUnmanaged)
|
||||
throw new NotImplementedException("TODO: support properties inside non-static and non-scripting API class types.");
|
||||
|
||||
@@ -878,6 +882,8 @@ namespace Flax.Build.Bindings
|
||||
// Functions
|
||||
foreach (var functionInfo in classInfo.Functions)
|
||||
{
|
||||
if (functionInfo.IsHidden)
|
||||
continue;
|
||||
if (!useUnmanaged)
|
||||
throw new Exception($"Not supported function {functionInfo.Name} inside non-static and non-scripting class type {classInfo.Name}.");
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Flax.Build.Bindings
|
||||
partial class BindingsGenerator
|
||||
{
|
||||
private static readonly Dictionary<string, Type> TypeCache = new Dictionary<string, Type>();
|
||||
private const int CacheVersion = 10;
|
||||
private const int CacheVersion = 11;
|
||||
|
||||
internal static void Write(BinaryWriter writer, string e)
|
||||
{
|
||||
|
||||
@@ -1446,7 +1446,7 @@ namespace Flax.Build.Bindings
|
||||
// Events
|
||||
foreach (var eventInfo in classInfo.Events)
|
||||
{
|
||||
if (!useScripting)
|
||||
if (!useScripting || eventInfo.IsHidden)
|
||||
continue;
|
||||
var paramsCount = eventInfo.Type.GenericArgs?.Count ?? 0;
|
||||
CppIncludeFiles.Add("Engine/Profiler/ProfilerCPU.h");
|
||||
@@ -1575,7 +1575,7 @@ namespace Flax.Build.Bindings
|
||||
// Fields
|
||||
foreach (var fieldInfo in classInfo.Fields)
|
||||
{
|
||||
if (!useScripting || !useCSharp)
|
||||
if (!useScripting || !useCSharp || fieldInfo.IsHidden)
|
||||
continue;
|
||||
if (fieldInfo.Getter != null)
|
||||
GenerateCppWrapperFunction(buildData, contents, classInfo, fieldInfo.Getter, "{0}");
|
||||
@@ -1592,7 +1592,7 @@ namespace Flax.Build.Bindings
|
||||
// Properties
|
||||
foreach (var propertyInfo in classInfo.Properties)
|
||||
{
|
||||
if (!useScripting || !useCSharp)
|
||||
if (!useScripting || !useCSharp || propertyInfo.IsHidden)
|
||||
continue;
|
||||
if (propertyInfo.Getter != null)
|
||||
GenerateCppWrapperFunction(buildData, contents, classInfo, propertyInfo.Getter);
|
||||
@@ -1603,7 +1603,7 @@ namespace Flax.Build.Bindings
|
||||
// Functions
|
||||
foreach (var functionInfo in classInfo.Functions)
|
||||
{
|
||||
if (!useCSharp)
|
||||
if (!useCSharp || functionInfo.IsHidden)
|
||||
continue;
|
||||
if (!useScripting)
|
||||
throw new Exception($"Not supported function {functionInfo.Name} inside non-static and non-scripting class type {classInfo.Name}.");
|
||||
@@ -1646,10 +1646,14 @@ namespace Flax.Build.Bindings
|
||||
{
|
||||
foreach (var eventInfo in classInfo.Events)
|
||||
{
|
||||
if (eventInfo.IsHidden)
|
||||
continue;
|
||||
contents.AppendLine($" ADD_INTERNAL_CALL(\"{classTypeNameManagedInternalCall}::Internal_{eventInfo.Name}_Bind\", &{eventInfo.Name}_ManagedBind);");
|
||||
}
|
||||
foreach (var fieldInfo in classInfo.Fields)
|
||||
{
|
||||
if (fieldInfo.IsHidden)
|
||||
continue;
|
||||
if (fieldInfo.Getter != null)
|
||||
contents.AppendLine($" ADD_INTERNAL_CALL(\"{classTypeNameManagedInternalCall}::Internal_{fieldInfo.Getter.UniqueName}\", &{fieldInfo.Getter.UniqueName});");
|
||||
if (fieldInfo.Setter != null)
|
||||
@@ -1657,6 +1661,8 @@ namespace Flax.Build.Bindings
|
||||
}
|
||||
foreach (var propertyInfo in classInfo.Properties)
|
||||
{
|
||||
if (propertyInfo.IsHidden)
|
||||
continue;
|
||||
if (propertyInfo.Getter != null)
|
||||
contents.AppendLine($" ADD_INTERNAL_CALL(\"{classTypeNameManagedInternalCall}::Internal_{propertyInfo.Getter.UniqueName}\", &{propertyInfo.Getter.UniqueName});");
|
||||
if (propertyInfo.Setter != null)
|
||||
@@ -1664,6 +1670,8 @@ namespace Flax.Build.Bindings
|
||||
}
|
||||
foreach (var functionInfo in classInfo.Functions)
|
||||
{
|
||||
if (functionInfo.IsHidden)
|
||||
continue;
|
||||
contents.AppendLine($" ADD_INTERNAL_CALL(\"{classTypeNameManagedInternalCall}::Internal_{functionInfo.UniqueName}\", &{functionInfo.UniqueName});");
|
||||
}
|
||||
if (hasInterface)
|
||||
|
||||
@@ -760,6 +760,9 @@ namespace Flax.Build.Bindings
|
||||
case "noproxy":
|
||||
desc.NoProxy = true;
|
||||
break;
|
||||
case "hidden":
|
||||
desc.IsHidden = true;
|
||||
break;
|
||||
default:
|
||||
Log.Warning($"Unknown or not supported tag parameter {tag} used on function {desc.Name}");
|
||||
break;
|
||||
@@ -793,6 +796,7 @@ namespace Flax.Build.Bindings
|
||||
Name = propertyName,
|
||||
Comment = functionInfo.Comment,
|
||||
IsStatic = functionInfo.IsStatic,
|
||||
IsHidden = functionInfo.IsHidden,
|
||||
Access = functionInfo.Access,
|
||||
Attributes = functionInfo.Attributes,
|
||||
Type = propertyType,
|
||||
@@ -817,6 +821,7 @@ namespace Flax.Build.Bindings
|
||||
else
|
||||
propertyInfo.Setter = functionInfo;
|
||||
propertyInfo.IsDeprecated |= functionInfo.IsDeprecated;
|
||||
propertyInfo.IsHidden |= functionInfo.IsHidden;
|
||||
|
||||
if (propertyInfo.Getter != null && propertyInfo.Setter != null)
|
||||
{
|
||||
@@ -1185,6 +1190,9 @@ namespace Flax.Build.Bindings
|
||||
case "readonly":
|
||||
desc.IsReadOnly = true;
|
||||
break;
|
||||
case "hidden":
|
||||
desc.IsHidden = true;
|
||||
break;
|
||||
case "noarray":
|
||||
desc.NoArray = true;
|
||||
break;
|
||||
@@ -1247,6 +1255,9 @@ namespace Flax.Build.Bindings
|
||||
case "name":
|
||||
desc.Name = tag.Value;
|
||||
break;
|
||||
case "hidden":
|
||||
desc.IsHidden = true;
|
||||
break;
|
||||
default:
|
||||
Log.Warning($"Unknown or not supported tag parameter {tag} used on event {desc.Name} at line {context.Tokenizer.CurrentLine}");
|
||||
break;
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Flax.Build.Bindings
|
||||
|
||||
foreach (var fieldInfo in Fields)
|
||||
{
|
||||
if (fieldInfo.Access == AccessLevel.Private)
|
||||
if (fieldInfo.IsHidden)
|
||||
continue;
|
||||
|
||||
fieldInfo.Getter = new FunctionInfo
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace Flax.Build.Bindings
|
||||
public string[] Comment;
|
||||
public bool IsStatic;
|
||||
public bool IsDeprecated;
|
||||
public bool IsHidden;
|
||||
public AccessLevel Access;
|
||||
public string Attributes;
|
||||
|
||||
@@ -27,6 +28,7 @@ namespace Flax.Build.Bindings
|
||||
BindingsGenerator.Write(writer, Comment);
|
||||
writer.Write(IsStatic);
|
||||
writer.Write(IsDeprecated);
|
||||
writer.Write(IsHidden);
|
||||
writer.Write((byte)Access);
|
||||
BindingsGenerator.Write(writer, Attributes);
|
||||
}
|
||||
@@ -37,6 +39,7 @@ namespace Flax.Build.Bindings
|
||||
Comment = BindingsGenerator.Read(reader, Comment);
|
||||
IsStatic = reader.ReadBoolean();
|
||||
IsDeprecated = reader.ReadBoolean();
|
||||
IsHidden = reader.ReadBoolean();
|
||||
Access = (AccessLevel)reader.ReadByte();
|
||||
Attributes = BindingsGenerator.Read(reader, Attributes);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user