GDShrapt.TypesMap 4.5.1

dotnet add package GDShrapt.TypesMap --version 4.5.1
                    
NuGet\Install-Package GDShrapt.TypesMap -Version 4.5.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GDShrapt.TypesMap" Version="4.5.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GDShrapt.TypesMap" Version="4.5.1" />
                    
Directory.Packages.props
<PackageReference Include="GDShrapt.TypesMap" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GDShrapt.TypesMap --version 4.5.1
                    
#r "nuget: GDShrapt.TypesMap, 4.5.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GDShrapt.TypesMap@4.5.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GDShrapt.TypesMap&version=4.5.1
                    
Install as a Cake Addin
#tool nuget:?package=GDShrapt.TypesMap&version=4.5.1
                    
Install as a Cake Tool

GDShrapt.TypesMap

NuGet License: MIT Godot .NET Ko-fi

A GDScript to C# type mapping library for Godot Engine. Part of the GDShrapt project family for GDScript static analysis.

Overview

GDShrapt.TypesMap provides comprehensive type metadata that bridges GDScript type names to their C# equivalents in Godot's GodotSharp bindings. It extracts and exposes information about:

  • Types - Class names, inheritance, namespaces
  • Methods - GDScript to C# name mapping, parameters, return types, overloads
  • Properties - Property names, types, read/write capabilities
  • Signals - Signal names and delegate information
  • Enums - Enum values and constant mappings
  • Constants - Global constants like PI, TAU, INF
  • Metadata - Godot version, data format version, extraction timestamp

Statistics (Godot 4.5.1)

Category Count
Types 1,708
Global Methods 120
Global Enums 21
Global Constants 4

Installation

dotnet add package GDShrapt.TypesMap

Or add to your .csproj:

<PackageReference Include="GDShrapt.TypesMap" Version="4.5.1.0" />

Usage

Three Data Sources

using GDShrapt.TypesMap;

// 1. Load from embedded manifest (recommended for standalone/CLI)
// Works without Godot runtime - ideal for CLI tools and LSP servers
var data = GDTypeHelper.ExtractTypeDatasFromManifest();

// 2. Load from external JSON file
var data = GDTypeHelper.ExtractTypeDatasFromFile("path/to/AssemblyData.json");

// 3. Extract from GodotSharp assembly at runtime (requires Godot)
var data = GDTypeHelper.ExtractTypeDatasFromAssembly();

Save Extracted Data

// Save to specific path
GDTypeHelper.SaveAssemblyDataToFile(data, "path/to/save.json");

// Save to default location (next to executing assembly)
GDTypeHelper.SaveAssemblyDataToFile(data);

In-Editor Extraction with Godot Node

using Godot;
using GDShrapt.TypesMap;

[Tool]
public partial class MyTypeExtractor : GDTypeExtractorNode
{
    public override void _Ready()
    {
        if (Engine.IsEditorHint())
        {
            OutputPath = "res://data/AssemblyData.json";
            ExtractAndSave();
        }
    }
}

Working with Data

var data = GDTypeHelper.ExtractTypeDatasFromManifest();

// Check metadata
Console.WriteLine($"Godot version: {data?.Metadata?.GodotVersion}");
Console.WriteLine($"Source: {data?.Metadata?.Source}");

// Access global methods
if (data?.GlobalData?.MethodDatas.TryGetValue("print", out var printMethods))
{
    foreach (var method in printMethods)
    {
        Console.WriteLine($"print -> {method.CSharpName}");
    }
}

// Access global constants
var pi = data?.GlobalData?.Constants["PI"];
Console.WriteLine($"PI constant: {pi?.Value}");

// Access type data
if (data?.TypeDatas.TryGetValue("Node2D", out var node2dVersions))
{
    var node2d = node2dVersions.Values.First();

    // Get properties
    var position = node2d.PropertyDatas?["position"];
    Console.WriteLine($"position -> {position?.CSharpName} ({position?.CSharpTypeName})");
}

Data Model

GDAssemblyData
├── Metadata                     # Version and source info
│   ├── GodotVersion             # e.g., "4.5.1"
│   ├── DataFormatVersion        # For compatibility (currently 1)
│   ├── ExtractedAt              # UTC timestamp
│   ├── Source                   # "Assembly", "File", or "Manifest"
│   └── SourcePath               # File path (when Source is "File")
├── GlobalData                   # Global scope data
│   ├── MethodDatas              # Global methods (print, lerp, abs, etc.)
│   ├── PropertyDatas            # Global properties
│   ├── Constants                # Global constants (PI, TAU, INF, NAN)
│   ├── Enums                    # Global enums (Error, Key, etc.)
│   └── GlobalTypes              # Built-in types (int, float, Vector2, etc.)
└── TypeDatas                    # Per-type data indexed by GDScript name
    └── GDTypeData
        ├── MethodDatas          # Methods with GDScript→C# name mapping
        ├── PropertyDatas        # Properties with type info
        ├── SignalDatas          # Signals with delegate info
        ├── Enums                # Nested enums
        └── Constants            # Type constants

Key Types

Type Description
GDTypeHelper Main entry point - extraction and save methods
GDTypeExtractorNode Base Node class for Godot editor extraction
GDAssemblyData Root container with metadata
GDAssemblyMetadata Version and source information
GDGlobalData Global scope metadata
GDTypeData Per-class type metadata
GDMethodData Method signature with parameters
GDPropertyData Property information with types
GDSignalData Signal/event information
GDParameterInfo Detailed parameter metadata
GDEnumTypeInfo Enum value mappings
GDConstantInfo Constant metadata
GDGlobalTypeProxyInfo Built-in type proxies

Naming Convention

Properties use clear prefixes to distinguish GDScript vs C# names:

  • GDScriptName, GDScriptTypeName - GDScript identifiers (snake_case)
  • CSharpName, CSharpTypeName, CSharpTypeFullName - C# identifiers (PascalCase)

Compatibility

  • Godot: 4.5.1
  • .NET: 6.0, 8.0
  • Dependencies: GodotSharp 4.5.1, Mono.Cecil 0.11.6

Integration with GDShrapt

This library is designed to work with:

  • GDShrapt.Reader - GDScript parser and AST
  • GDShrapt.Validator - Type inference and validation (uses IGDRuntimeProvider)
  • GDShrapt.Formatter - Auto type hints generation

Example integration with validator:

// Create runtime provider backed by TypesMap data
var assemblyData = GDTypeHelper.ExtractTypeDatasFromManifest();
var runtimeProvider = new CustomRuntimeProvider(assemblyData);

// Use with GDShrapt.Validator
var options = new GDValidationOptions
{
    RuntimeProvider = runtimeProvider
};

This library is part of the GDShrapt ecosystem:

Package Description NuGet
GDShrapt.Reader GDScript parser and AST NuGet
GDShrapt.Converter GDScript to C# converter NuGet
GDShrapt.TypesMap Type mapping library NuGet

License

MIT License - see LICENSE for details.

Author

elamaunt

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.5.1 111 1/4/2026
4.3.0.5 214 11/18/2024
4.3.0.4 196 11/7/2024
4.3.0.3 178 11/7/2024
4.3.0.2 170 11/7/2024
4.3.0.1 159 11/7/2024
4.3.0 170 11/7/2024
4.2.2.1 227 5/22/2024
4.2.2 198 5/22/2024
4.2.1 208 5/22/2024

v4.5.1.0:
- Breaking: All types renamed with GD prefix (GDTypeData, GDMethodData, etc.)
- Added GDTypeExtractorNode base class for Godot editor extraction
- Added GDAssemblyMetadata for version and source tracking
- Three data source methods: FromManifest, FromFile, FromAssembly
- Updated embedded data for Godot 4.5.1 (1708 types, 120 global methods)
- Fixed AmbiguousMatchException for GD.Load method
- Added comprehensive XML documentation
- Improved naming convention: GDScriptName vs CSharpName prefixes