Skip to content

Property drawers and inspector improvements#675

Draft
Vorlias wants to merge 9 commits intomainfrom
feature/property-drawers
Draft

Property drawers and inspector improvements#675
Vorlias wants to merge 9 commits intomainfrom
feature/property-drawers

Conversation

@Vorlias
Copy link
Member

@Vorlias Vorlias commented Dec 31, 2025

This adds AirshipPropertyDrawer (The Airship parallel to PropertyDrawer) as well as improves the rendering for elements that could have different sizes (e.g. TextArea based string fields) and better accounts for these in arrays.

APIs

  • class AirshipPropertyDrawer (PropertyDrawer equiv.)
  • class AirshipDecoratorDrawer (DecoratorDrawer equiv.)
  • AirshipEditorGUI.ArrayProperty overloads to include Rect, improved handling to allow custom rects
  • AirshipEditorGUI.PropertyField overload to allow rect - this also now supports arrays
  • AirshipEditorGUI.GetPropertyHeight to get the heights for properties in Airship
  • AirshipEditorGUI.GetPropertyLabel to get default labels for properties in Airship
  • AirshipEditorGUI.GetPropertyControlRect to get the default airship rect for properties
  • AirshipEditorGUI.IntSliderProperty and AirshipEditorGUI.NumberSliderProperty for adding sliders for properties

@Vorlias
Copy link
Member Author

Vorlias commented Dec 31, 2025

Example of a "drawer" based decorator:

[CustomAirshipDecoratorDrawer("Integer")]
internal class IntegerDecorator : AirshipPropertyDrawer {
    public override void OnGUI(Rect position, AirshipSerializedValue property, GUIContent label) {
        if (property.TryGetDecorator("Range", out List<LuauMetadataDecoratorValue> list))
        {
            int min = Convert.ToInt32(list[0].value);
            int max =  Convert.ToInt32(list[1].value);
            AirshipEditorGUI.IntSliderProperty(position, label, property, min, max);
        }
        else {
            AirshipEditorGUI.IntProperty(position, label, property);
        }
    }
}

Will be able to add int constrained values to properties, also allows us to add proper implementations for the decorators instead of some of the hacky workarounds we currently have (e.g. for TextArea, Multiline, Range, Min and `Max)

Having all of this logic in @Easy/Core is better than having it deep in Airship itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant