Vahera/godot-orchestrator

Support additional variable types beyond basic types

Closed this issue · 0 comments

Description

The way variables are presently defined, they're associated to a specific Variant::Type, which is very limiting. For example, if you wanted to assign a newly created Button to a variable, you'd need to select the Object type; however, when you place a Get or Set of that variable on the graph, it doesn't have the sufficient context that its a Button, so it gets treated simply as an Object.

Now as a workaround, users can drop a TypeCast node into the graph; however this is less than ideal.

Variables should not only support basic types, but they should support enumerations (global and class-specific), and various object types, allowing a variable to specifically refer to a Node3D, an Area3D, a CollisionShape2D, etc. Additionally, they should be capable of holding resources, etc.

Implementation ideas

Variables will include a new option in the Inspector view called Classification, which stores the encoded type of the variable. This includes whether its a basic type, a class reference, an enumeration or bitfield, or a nested class enum or bitfield.

image

When clicking into the Classification area, a new dialog should be shown that allows the user to search and pick the variable type associated with the variable definition, i.e.:

image

The top left houses a set of favorites that are associated to the "Variable Type" search scope. Any favorites picked while working with the variable type dialog will be stored and persisted in the .godot folder. Similarly the bottom left holds a list of recently chosen items, up to a max of 15. These too will be stored in a .godot folder file associated with the "Variable Type" scope.

Users will be able to use the ⭐ button to favorite/unfavorite items, just like they do in the "Create Node" dialog. In addition, the drop down at the top right provides a list of several filter-options to scope the results to categories such as:

  • All types
  • Basic types
  • Bitfields
  • Enumerations
  • Nodes
  • Objects
  • Resources

The search algorithm will use a scoring approach, taking into account how relevant/close a tree item's text is to the searched criteria, boosting those recently used or that are favorites, lowering things like non-created types such as ClassDB .

As an added bonus:

  • The variable type icon in the Variable component panel view should open this dialog.
  • The variable visibility icon in the Variable component panel view should toggle between exported and not exported.