Repository navigation
Interface Extractor
Godot's GDScript currently lacks native support for strict interface class constructs. For developers, this often results in the tedious, error-prone manual duplication of method signatures across complex inheritance chains.
The Interface Extractor completely automates this workflow. By utilizing a custom parser, the tool scans base class scripts and procedurally generates a group of snippets containing all overridable methods (one snippet per function, consolidated in one single folder).
The GdGistCodeExtractor evaluates a target script through deep static analysis, parsing the raw string data to construct a structural map of the class without requiring runtime instantiation.
Because GDScript lacks a native virtual keyword to enforce inheritance contracts, GDGist introduces a standardized comment-based paradigm. By tagging any method in your base class with the # @virtual annotation, you explicitly define it as part of an interface contract. The regex engine within the parser specifically hunts for this annotation, flagging the associated method for extraction.
# Example Base Class (Weapon.gd)
# @virtual
func fire_weapon(direction: Vector3, power: float = 1.0) -> bool:
return falseThe extractor is highly precise. It performs rigorous parameter analysis on the targeted methods, accurately breaking down parameter names, default values, strict type hints, and return types. This ensures that the generated snippet perfectly fulfills the base class contract, preventing silent runtime failures caused by mismatched arguments.
Once the parser maps the virtual methods, it compiles them into a unified, ready-to-deploy snippet block via the gdgist_extractor script.
To maintain architectural integrity, the extractor assumes that virtual methods in a base class often contain critical setup or teardown logic. When generating the snippet block, it automatically injects super.<method_name>() calls into the extracted function bodies. It passes along the exact parameters defined in the signature, followed by the GDGist selection marker |>pass<| for immediate cursor placement.
# Automatically Generated Snippet Output
func fire_weapon(direction: Vector3, power: float = 1.0) -> bool:
super.fire_weapon(direction, power)
!>pass<!The time-save achieved by this feature is massive. When architecting sprawling, highly decoupled systems, such as deep State Machines, modular interaction frameworks, or complex EditorPlugin tools, you no longer need to constantly switch file tabs to reference and manually type out method signatures.
You simply point the Interface Extractor at your base class, extract the definitions, and instantly deploy a perfectly formatted, contract-compliant code block directly into your inheriting script via the RAlt + . menu.
🔹 Home 🔹
Wiki Root
Getting Started
Working with GDGist
Pro Features
Settings
Workflows & Examples