ScriptPropertiesGenerator.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using System.Text;
  4. using Microsoft.CodeAnalysis;
  5. using Microsoft.CodeAnalysis.CSharp.Syntax;
  6. using Microsoft.CodeAnalysis.Text;
  7. namespace Godot.SourceGenerators
  8. {
  9. [Generator]
  10. public class ScriptPropertiesGenerator : ISourceGenerator
  11. {
  12. public void Initialize(GeneratorInitializationContext context)
  13. {
  14. }
  15. public void Execute(GeneratorExecutionContext context)
  16. {
  17. if (context.AreGodotSourceGeneratorsDisabled())
  18. return;
  19. INamedTypeSymbol[] godotClasses = context
  20. .Compilation.SyntaxTrees
  21. .SelectMany(tree =>
  22. tree.GetRoot().DescendantNodes()
  23. .OfType<ClassDeclarationSyntax>()
  24. .SelectGodotScriptClasses(context.Compilation)
  25. // Report and skip non-partial classes
  26. .Where(x =>
  27. {
  28. if (x.cds.IsPartial())
  29. {
  30. if (x.cds.IsNested() && !x.cds.AreAllOuterTypesPartial(out var typeMissingPartial))
  31. {
  32. Common.ReportNonPartialGodotScriptOuterClass(context, typeMissingPartial!);
  33. return false;
  34. }
  35. return true;
  36. }
  37. Common.ReportNonPartialGodotScriptClass(context, x.cds, x.symbol);
  38. return false;
  39. })
  40. .Select(x => x.symbol)
  41. )
  42. .Distinct<INamedTypeSymbol>(SymbolEqualityComparer.Default)
  43. .ToArray();
  44. if (godotClasses.Length > 0)
  45. {
  46. var typeCache = new MarshalUtils.TypeCache(context.Compilation);
  47. foreach (var godotClass in godotClasses)
  48. {
  49. VisitGodotScriptClass(context, typeCache, godotClass);
  50. }
  51. }
  52. }
  53. private static void VisitGodotScriptClass(
  54. GeneratorExecutionContext context,
  55. MarshalUtils.TypeCache typeCache,
  56. INamedTypeSymbol symbol
  57. )
  58. {
  59. INamespaceSymbol namespaceSymbol = symbol.ContainingNamespace;
  60. string classNs = namespaceSymbol != null && !namespaceSymbol.IsGlobalNamespace ?
  61. namespaceSymbol.FullQualifiedNameOmitGlobal() :
  62. string.Empty;
  63. bool hasNamespace = classNs.Length != 0;
  64. bool isInnerClass = symbol.ContainingType != null;
  65. string uniqueHint = symbol.FullQualifiedNameOmitGlobal().SanitizeQualifiedNameForUniqueHint()
  66. + "_ScriptProperties.generated";
  67. var source = new StringBuilder();
  68. source.Append("using Godot;\n");
  69. source.Append("using Godot.NativeInterop;\n");
  70. source.Append("\n");
  71. if (hasNamespace)
  72. {
  73. source.Append("namespace ");
  74. source.Append(classNs);
  75. source.Append(" {\n\n");
  76. }
  77. if (isInnerClass)
  78. {
  79. var containingType = symbol.ContainingType;
  80. while (containingType != null)
  81. {
  82. source.Append("partial ");
  83. source.Append(containingType.GetDeclarationKeyword());
  84. source.Append(" ");
  85. source.Append(containingType.NameWithTypeParameters());
  86. source.Append("\n{\n");
  87. containingType = containingType.ContainingType;
  88. }
  89. }
  90. source.Append("partial class ");
  91. source.Append(symbol.NameWithTypeParameters());
  92. source.Append("\n{\n");
  93. var members = symbol.GetMembers();
  94. var propertySymbols = members
  95. .Where(s => !s.IsStatic && s.Kind == SymbolKind.Property)
  96. .Cast<IPropertySymbol>()
  97. .Where(s => !s.IsIndexer && s.ExplicitInterfaceImplementations.Length == 0);
  98. var fieldSymbols = members
  99. .Where(s => !s.IsStatic && s.Kind == SymbolKind.Field && !s.IsImplicitlyDeclared)
  100. .Cast<IFieldSymbol>();
  101. var godotClassProperties = propertySymbols.WhereIsGodotCompatibleType(typeCache).ToArray();
  102. var godotClassFields = fieldSymbols.WhereIsGodotCompatibleType(typeCache).ToArray();
  103. source.Append("#pragma warning disable CS0109 // Disable warning about redundant 'new' keyword\n");
  104. source.Append(
  105. $" public new class PropertyName : {symbol.BaseType.FullQualifiedNameIncludeGlobal()}.PropertyName {{\n");
  106. // Generate cached StringNames for methods and properties, for fast lookup
  107. foreach (var property in godotClassProperties)
  108. {
  109. string propertyName = property.PropertySymbol.Name;
  110. source.Append(" public new static readonly global::Godot.StringName ");
  111. source.Append(propertyName);
  112. source.Append(" = \"");
  113. source.Append(propertyName);
  114. source.Append("\";\n");
  115. }
  116. foreach (var field in godotClassFields)
  117. {
  118. string fieldName = field.FieldSymbol.Name;
  119. source.Append(" public new static readonly global::Godot.StringName ");
  120. source.Append(fieldName);
  121. source.Append(" = \"");
  122. source.Append(fieldName);
  123. source.Append("\";\n");
  124. }
  125. source.Append(" }\n"); // class GodotInternal
  126. if (godotClassProperties.Length > 0 || godotClassFields.Length > 0)
  127. {
  128. bool isFirstEntry;
  129. // Generate SetGodotClassPropertyValue
  130. bool allPropertiesAreReadOnly = godotClassFields.All(fi => fi.FieldSymbol.IsReadOnly) &&
  131. godotClassProperties.All(pi => pi.PropertySymbol.IsReadOnly || pi.PropertySymbol.SetMethod!.IsInitOnly);
  132. if (!allPropertiesAreReadOnly)
  133. {
  134. source.Append(" protected override bool SetGodotClassPropertyValue(in godot_string_name name, ");
  135. source.Append("in godot_variant value)\n {\n");
  136. isFirstEntry = true;
  137. foreach (var property in godotClassProperties)
  138. {
  139. if (property.PropertySymbol.IsReadOnly || property.PropertySymbol.SetMethod!.IsInitOnly)
  140. continue;
  141. GeneratePropertySetter(property.PropertySymbol.Name,
  142. property.PropertySymbol.Type, property.Type, source, isFirstEntry);
  143. isFirstEntry = false;
  144. }
  145. foreach (var field in godotClassFields)
  146. {
  147. if (field.FieldSymbol.IsReadOnly)
  148. continue;
  149. GeneratePropertySetter(field.FieldSymbol.Name,
  150. field.FieldSymbol.Type, field.Type, source, isFirstEntry);
  151. isFirstEntry = false;
  152. }
  153. source.Append(" return base.SetGodotClassPropertyValue(name, value);\n");
  154. source.Append(" }\n");
  155. }
  156. // Generate GetGodotClassPropertyValue
  157. source.Append(" protected override bool GetGodotClassPropertyValue(in godot_string_name name, ");
  158. source.Append("out godot_variant value)\n {\n");
  159. isFirstEntry = true;
  160. foreach (var property in godotClassProperties)
  161. {
  162. GeneratePropertyGetter(property.PropertySymbol.Name,
  163. property.PropertySymbol.Type, property.Type, source, isFirstEntry);
  164. isFirstEntry = false;
  165. }
  166. foreach (var field in godotClassFields)
  167. {
  168. GeneratePropertyGetter(field.FieldSymbol.Name,
  169. field.FieldSymbol.Type, field.Type, source, isFirstEntry);
  170. isFirstEntry = false;
  171. }
  172. source.Append(" return base.GetGodotClassPropertyValue(name, out value);\n");
  173. source.Append(" }\n");
  174. // Generate GetGodotPropertyList
  175. string dictionaryType = "global::System.Collections.Generic.List<global::Godot.Bridge.PropertyInfo>";
  176. source.Append(" internal new static ")
  177. .Append(dictionaryType)
  178. .Append(" GetGodotPropertyList()\n {\n");
  179. source.Append(" var properties = new ")
  180. .Append(dictionaryType)
  181. .Append("();\n");
  182. // To retain the definition order (and display categories correctly), we want to
  183. // iterate over fields and properties at the same time, sorted by line number.
  184. var godotClassPropertiesAndFields = Enumerable.Empty<GodotPropertyOrFieldData>()
  185. .Concat(godotClassProperties.Select(propertyData => new GodotPropertyOrFieldData(propertyData)))
  186. .Concat(godotClassFields.Select(fieldData => new GodotPropertyOrFieldData(fieldData)))
  187. .OrderBy(data => data.Symbol.Locations[0].Path())
  188. .ThenBy(data => data.Symbol.Locations[0].StartLine());
  189. foreach (var member in godotClassPropertiesAndFields)
  190. {
  191. foreach (var groupingInfo in DetermineGroupingPropertyInfo(member.Symbol))
  192. AppendGroupingPropertyInfo(source, groupingInfo);
  193. var propertyInfo = DeterminePropertyInfo(context, typeCache,
  194. member.Symbol, member.Type);
  195. if (propertyInfo == null)
  196. continue;
  197. AppendPropertyInfo(source, propertyInfo.Value);
  198. }
  199. source.Append(" return properties;\n");
  200. source.Append(" }\n");
  201. source.Append("#pragma warning restore CS0109\n");
  202. }
  203. source.Append("}\n"); // partial class
  204. if (isInnerClass)
  205. {
  206. var containingType = symbol.ContainingType;
  207. while (containingType != null)
  208. {
  209. source.Append("}\n"); // outer class
  210. containingType = containingType.ContainingType;
  211. }
  212. }
  213. if (hasNamespace)
  214. {
  215. source.Append("\n}\n");
  216. }
  217. context.AddSource(uniqueHint, SourceText.From(source.ToString(), Encoding.UTF8));
  218. }
  219. private static void GeneratePropertySetter(
  220. string propertyMemberName,
  221. ITypeSymbol propertyTypeSymbol,
  222. MarshalType propertyMarshalType,
  223. StringBuilder source,
  224. bool isFirstEntry
  225. )
  226. {
  227. source.Append(" ");
  228. if (!isFirstEntry)
  229. source.Append("else ");
  230. source.Append("if (name == PropertyName.")
  231. .Append(propertyMemberName)
  232. .Append(") {\n")
  233. .Append(" this.")
  234. .Append(propertyMemberName)
  235. .Append(" = ")
  236. .AppendNativeVariantToManagedExpr("value", propertyTypeSymbol, propertyMarshalType)
  237. .Append(";\n")
  238. .Append(" return true;\n")
  239. .Append(" }\n");
  240. }
  241. private static void GeneratePropertyGetter(
  242. string propertyMemberName,
  243. ITypeSymbol propertyTypeSymbol,
  244. MarshalType propertyMarshalType,
  245. StringBuilder source,
  246. bool isFirstEntry
  247. )
  248. {
  249. source.Append(" ");
  250. if (!isFirstEntry)
  251. source.Append("else ");
  252. source.Append("if (name == PropertyName.")
  253. .Append(propertyMemberName)
  254. .Append(") {\n")
  255. .Append(" value = ")
  256. .AppendManagedToNativeVariantExpr("this." + propertyMemberName,
  257. propertyTypeSymbol, propertyMarshalType)
  258. .Append(";\n")
  259. .Append(" return true;\n")
  260. .Append(" }\n");
  261. }
  262. private static void AppendGroupingPropertyInfo(StringBuilder source, PropertyInfo propertyInfo)
  263. {
  264. source.Append(" properties.Add(new(type: (global::Godot.Variant.Type)")
  265. .Append((int)VariantType.Nil)
  266. .Append(", name: \"")
  267. .Append(propertyInfo.Name)
  268. .Append("\", hint: (global::Godot.PropertyHint)")
  269. .Append((int)PropertyHint.None)
  270. .Append(", hintString: \"")
  271. .Append(propertyInfo.HintString)
  272. .Append("\", usage: (global::Godot.PropertyUsageFlags)")
  273. .Append((int)propertyInfo.Usage)
  274. .Append(", exported: true));\n");
  275. }
  276. private static void AppendPropertyInfo(StringBuilder source, PropertyInfo propertyInfo)
  277. {
  278. source.Append(" properties.Add(new(type: (global::Godot.Variant.Type)")
  279. .Append((int)propertyInfo.Type)
  280. .Append(", name: PropertyName.")
  281. .Append(propertyInfo.Name)
  282. .Append(", hint: (global::Godot.PropertyHint)")
  283. .Append((int)propertyInfo.Hint)
  284. .Append(", hintString: \"")
  285. .Append(propertyInfo.HintString)
  286. .Append("\", usage: (global::Godot.PropertyUsageFlags)")
  287. .Append((int)propertyInfo.Usage)
  288. .Append(", exported: ")
  289. .Append(propertyInfo.Exported ? "true" : "false")
  290. .Append("));\n");
  291. }
  292. private static IEnumerable<PropertyInfo> DetermineGroupingPropertyInfo(ISymbol memberSymbol)
  293. {
  294. foreach (var attr in memberSymbol.GetAttributes())
  295. {
  296. PropertyUsageFlags? propertyUsage = attr.AttributeClass?.ToString() switch
  297. {
  298. GodotClasses.ExportCategoryAttr => PropertyUsageFlags.Category,
  299. GodotClasses.ExportGroupAttr => PropertyUsageFlags.Group,
  300. GodotClasses.ExportSubgroupAttr => PropertyUsageFlags.Subgroup,
  301. _ => null
  302. };
  303. if (propertyUsage is null)
  304. continue;
  305. if (attr.ConstructorArguments.Length > 0 && attr.ConstructorArguments[0].Value is string name)
  306. {
  307. string? hintString = null;
  308. if (propertyUsage != PropertyUsageFlags.Category && attr.ConstructorArguments.Length > 1)
  309. hintString = attr.ConstructorArguments[1].Value?.ToString();
  310. yield return new PropertyInfo(VariantType.Nil, name, PropertyHint.None, hintString,
  311. propertyUsage.Value, true);
  312. }
  313. }
  314. }
  315. private static PropertyInfo? DeterminePropertyInfo(
  316. GeneratorExecutionContext context,
  317. MarshalUtils.TypeCache typeCache,
  318. ISymbol memberSymbol,
  319. MarshalType marshalType
  320. )
  321. {
  322. var exportAttr = memberSymbol.GetAttributes()
  323. .FirstOrDefault(a => a.AttributeClass?.IsGodotExportAttribute() ?? false);
  324. var propertySymbol = memberSymbol as IPropertySymbol;
  325. var fieldSymbol = memberSymbol as IFieldSymbol;
  326. if (exportAttr != null && propertySymbol != null)
  327. {
  328. if (propertySymbol.GetMethod == null)
  329. {
  330. // This should never happen, as we filtered WriteOnly properties, but just in case.
  331. Common.ReportExportedMemberIsWriteOnly(context, propertySymbol);
  332. return null;
  333. }
  334. if (propertySymbol.SetMethod == null || propertySymbol.SetMethod.IsInitOnly)
  335. {
  336. // This should never happen, as we filtered ReadOnly properties, but just in case.
  337. Common.ReportExportedMemberIsReadOnly(context, propertySymbol);
  338. return null;
  339. }
  340. }
  341. var memberType = propertySymbol?.Type ?? fieldSymbol!.Type;
  342. var memberVariantType = MarshalUtils.ConvertMarshalTypeToVariantType(marshalType)!.Value;
  343. string memberName = memberSymbol.Name;
  344. if (exportAttr == null)
  345. {
  346. return new PropertyInfo(memberVariantType, memberName, PropertyHint.None,
  347. hintString: null, PropertyUsageFlags.ScriptVariable, exported: false);
  348. }
  349. if (!TryGetMemberExportHint(typeCache, memberType, exportAttr, memberVariantType,
  350. isTypeArgument: false, out var hint, out var hintString))
  351. {
  352. var constructorArguments = exportAttr.ConstructorArguments;
  353. if (constructorArguments.Length > 0)
  354. {
  355. var hintValue = exportAttr.ConstructorArguments[0].Value;
  356. hint = hintValue switch
  357. {
  358. null => PropertyHint.None,
  359. int intValue => (PropertyHint)intValue,
  360. _ => (PropertyHint)(long)hintValue
  361. };
  362. hintString = constructorArguments.Length > 1 ?
  363. exportAttr.ConstructorArguments[1].Value?.ToString() :
  364. null;
  365. }
  366. else
  367. {
  368. hint = PropertyHint.None;
  369. }
  370. }
  371. var propUsage = PropertyUsageFlags.Default | PropertyUsageFlags.ScriptVariable;
  372. if (memberVariantType == VariantType.Nil)
  373. propUsage |= PropertyUsageFlags.NilIsVariant;
  374. return new PropertyInfo(memberVariantType, memberName,
  375. hint, hintString, propUsage, exported: true);
  376. }
  377. private static bool TryGetMemberExportHint(
  378. MarshalUtils.TypeCache typeCache,
  379. ITypeSymbol type, AttributeData exportAttr,
  380. VariantType variantType, bool isTypeArgument,
  381. out PropertyHint hint, out string? hintString
  382. )
  383. {
  384. hint = PropertyHint.None;
  385. hintString = null;
  386. if (variantType == VariantType.Nil)
  387. return true; // Variant, no export hint
  388. if (variantType == VariantType.Int &&
  389. type.IsValueType && type.TypeKind == TypeKind.Enum)
  390. {
  391. bool hasFlagsAttr = type.GetAttributes()
  392. .Any(a => a.AttributeClass?.IsSystemFlagsAttribute() ?? false);
  393. hint = hasFlagsAttr ? PropertyHint.Flags : PropertyHint.Enum;
  394. var members = type.GetMembers();
  395. var enumFields = members
  396. .Where(s => s.Kind == SymbolKind.Field && s.IsStatic &&
  397. s.DeclaredAccessibility == Accessibility.Public &&
  398. !s.IsImplicitlyDeclared)
  399. .Cast<IFieldSymbol>().ToArray();
  400. var hintStringBuilder = new StringBuilder();
  401. var nameOnlyHintStringBuilder = new StringBuilder();
  402. // True: enum Foo { Bar, Baz, Qux }
  403. // True: enum Foo { Bar = 0, Baz = 1, Qux = 2 }
  404. // False: enum Foo { Bar = 0, Baz = 7, Qux = 5 }
  405. bool usesDefaultValues = true;
  406. for (int i = 0; i < enumFields.Length; i++)
  407. {
  408. var enumField = enumFields[i];
  409. if (i > 0)
  410. {
  411. hintStringBuilder.Append(",");
  412. nameOnlyHintStringBuilder.Append(",");
  413. }
  414. string enumFieldName = enumField.Name;
  415. hintStringBuilder.Append(enumFieldName);
  416. nameOnlyHintStringBuilder.Append(enumFieldName);
  417. long val = enumField.ConstantValue switch
  418. {
  419. sbyte v => v,
  420. short v => v,
  421. int v => v,
  422. long v => v,
  423. byte v => v,
  424. ushort v => v,
  425. uint v => v,
  426. ulong v => (long)v,
  427. _ => 0
  428. };
  429. uint expectedVal = (uint)(hint == PropertyHint.Flags ? 1 << i : i);
  430. if (val != expectedVal)
  431. usesDefaultValues = false;
  432. hintStringBuilder.Append(":");
  433. hintStringBuilder.Append(val);
  434. }
  435. hintString = !usesDefaultValues ?
  436. hintStringBuilder.ToString() :
  437. // If we use the format NAME:VAL, that's what the editor displays.
  438. // That's annoying if the user is not using custom values for the enum constants.
  439. // This may not be needed in the future if the editor is changed to not display values.
  440. nameOnlyHintStringBuilder.ToString();
  441. return true;
  442. }
  443. if (variantType == VariantType.Object && type is INamedTypeSymbol memberNamedType)
  444. {
  445. if (memberNamedType.InheritsFrom("GodotSharp", "Godot.Resource"))
  446. {
  447. string nativeTypeName = memberNamedType.GetGodotScriptNativeClassName()!;
  448. hint = PropertyHint.ResourceType;
  449. hintString = nativeTypeName;
  450. return true;
  451. }
  452. if (memberNamedType.InheritsFrom("GodotSharp", "Godot.Node"))
  453. {
  454. string nativeTypeName = memberNamedType.GetGodotScriptNativeClassName()!;
  455. hint = PropertyHint.NodeType;
  456. hintString = nativeTypeName;
  457. return true;
  458. }
  459. }
  460. static bool GetStringArrayEnumHint(VariantType elementVariantType,
  461. AttributeData exportAttr, out string? hintString)
  462. {
  463. var constructorArguments = exportAttr.ConstructorArguments;
  464. if (constructorArguments.Length > 0)
  465. {
  466. var presetHintValue = exportAttr.ConstructorArguments[0].Value;
  467. PropertyHint presetHint = presetHintValue switch
  468. {
  469. null => PropertyHint.None,
  470. int intValue => (PropertyHint)intValue,
  471. _ => (PropertyHint)(long)presetHintValue
  472. };
  473. if (presetHint == PropertyHint.Enum)
  474. {
  475. string? presetHintString = constructorArguments.Length > 1 ?
  476. exportAttr.ConstructorArguments[1].Value?.ToString() :
  477. null;
  478. hintString = (int)elementVariantType + "/" + (int)PropertyHint.Enum + ":";
  479. if (presetHintString != null)
  480. hintString += presetHintString;
  481. return true;
  482. }
  483. }
  484. hintString = null;
  485. return false;
  486. }
  487. if (!isTypeArgument && variantType == VariantType.Array)
  488. {
  489. var elementType = MarshalUtils.GetArrayElementType(type);
  490. if (elementType == null)
  491. return false; // Non-generic Array, so there's no hint to add
  492. var elementMarshalType = MarshalUtils.ConvertManagedTypeToMarshalType(elementType, typeCache)!.Value;
  493. var elementVariantType = MarshalUtils.ConvertMarshalTypeToVariantType(elementMarshalType)!.Value;
  494. bool isPresetHint = false;
  495. if (elementVariantType == VariantType.String)
  496. isPresetHint = GetStringArrayEnumHint(elementVariantType, exportAttr, out hintString);
  497. if (!isPresetHint)
  498. {
  499. bool hintRes = TryGetMemberExportHint(typeCache, elementType,
  500. exportAttr, elementVariantType, isTypeArgument: true,
  501. out var elementHint, out var elementHintString);
  502. // Format: type/hint:hint_string
  503. if (hintRes)
  504. {
  505. hintString = (int)elementVariantType + "/" + (int)elementHint + ":";
  506. if (elementHintString != null)
  507. hintString += elementHintString;
  508. }
  509. else
  510. {
  511. hintString = (int)elementVariantType + "/" + (int)PropertyHint.None + ":";
  512. }
  513. }
  514. hint = PropertyHint.TypeString;
  515. return hintString != null;
  516. }
  517. if (!isTypeArgument && variantType == VariantType.PackedStringArray)
  518. {
  519. if (GetStringArrayEnumHint(VariantType.String, exportAttr, out hintString))
  520. {
  521. hint = PropertyHint.TypeString;
  522. return true;
  523. }
  524. }
  525. if (!isTypeArgument && variantType == VariantType.Dictionary)
  526. {
  527. // TODO: Dictionaries are not supported in the inspector
  528. return false;
  529. }
  530. return false;
  531. }
  532. }
  533. }