module Lapis::Docs::C_GAMEPLAY_AND_DECLARATIVE_DSL::B_EXPORTS_AND_INSPECTOR

Overview

Export System & Inspector Integration

Comprehensive guide to exposing Crystal properties to the Godot Editor Inspector using the @Export annotation family.

Executive Summary & Key Topics

Topic Method / Anchor Description
Supported Export Annotations .topic_00_export_types Listing of ranges, enums, flags, files, directories, and buttons.
Numeric Ranges & Sliders .topic_01_numeric_ranges Configuring slider ranges, increments, and easing curves.
Enums & Bitmask Flags .topic_02_enums_and_flags Exposing dropdown menus and multi-select checkboxes.
File & Directory Pickers .topic_03_file_and_asset_pickers Exposing resource path selectors with filter extensions.

Related Guides & Source References

Defined in:

libgodot/docs/c_gameplay_and_declarative_dsl/b_exports_and_inspector.cr

Class Method Summary

Class Method Detail

def self.topic_00_export_types : Nil #

Supported Export Annotations: Listing of ranges, enums, flags, files, directories, and buttons.

Key Topics & Information

  • @[Export]: Standard property export for numbers, strings, colors, vectors
  • @[Export(range: min..max, step: n)]: Number slider or range constraint
  • @[Export(enum: Type)]: Dropdown enum selector
  • @[Export(flags: Type)]: Bitmask flag checkbox list
  • @[ExportFile] / @[ExportDir]: Interactive file and directory pickers
  • @[ExportToolButton]: Interactive clickable button in editor inspector

def self.topic_01_numeric_ranges : Nil #

Numeric Ranges & Sliders: Configuring slider ranges, increments, and easing curves.

node PlayerStats < Node do
  # Integer range slider from 1 to 100 with step 1
  @[Export(range: 1..100, step: 1)]
  property health : Int32 = 100

  # Float slider from 0.0 to 10.0 with step 0.1
  @[Export(range: 0.0_f32..10.0_f32, step: 0.1_f32)]
  property move_multiplier : Float32 = 1.0_f32

  # Exponential easing curve slider for audio/visual ramps
  @[ExportExpEasing]
  property falloff : Float32 = 0.5_f32
end

def self.topic_02_enums_and_flags : Nil #

Enums & Bitmask Flags: Exposing dropdown menus and multi-select checkboxes.

enum WeaponType
  Sword
  Bow
  Staff
end

@[Flags]
enum CollisionLayers
  World  = 1
  Player = 2
  Enemy  = 4
end

node CombatEntity < Node do
  # Renders as a clean dropdown in Godot Inspector
  @[ExportEnum]
  property weapon : WeaponType = WeaponType::Sword

  # Renders as multi-select bitmask flags
  @[ExportFlags]
  property collision_mask : CollisionLayers = CollisionLayers::World | CollisionLayers::Player
end

def self.topic_03_file_and_asset_pickers : Nil #

File & Directory Pickers: Exposing resource path selectors with filter extensions.

node SoundPlayer < AudioStreamPlayer do
  # File selector filtered to audio formats
  @[ExportFile(filter: "*.wav,*.ogg,*.mp3")]
  property audio_file : String = ""

  # Directory selector
  @[ExportDir]
  property asset_directory : String = "res://assets"
end