utopia-rise/godot-kotlin-native

EntryGenerator DefaultValues (4): Support for arrays

chippmann opened this issue · 0 comments

Implement default value support for arrays. Only one dimensional array support needs to be implemented!

The user would have to write the following:

@RegisterProperty
var nodePaths = variantArrayOf(NodePath("A"), NodePath("B")) //only VariantArray is allowed!

Implementation hints:

  • Files that need to be changed: PropertyDefaultValueProvider and PropertyHintTypeMapper
  • Provide proper error messages (with Expcetions for now. MessageCollector will be implemented later)
  • Default values need to be wrapped in a Variant
  • A value type hint needs to be supplied at registration time
  • No kotlin arrays can be registered -> should fail otherwise!
  • Only VariantArray can be registered!
  • VariantArray builder should be implemented to support variantArrayOf()
  • Registration should look like:
property("nameOfProperty", TestingClass::propertyReference, STRING /*This is the püroperty type*/, Variant("defaultValue") /*This is the default value*/, true /**visible in editor/, DISABLED /*RPCMode*/, GODOT_PROPERTY_HINT_GLOBAL_DIR /*hint type*/, "" /*hint string*/)