GDShrapt.TypesMap
4.5.1
dotnet add package GDShrapt.TypesMap --version 4.5.1
NuGet\Install-Package GDShrapt.TypesMap -Version 4.5.1
<PackageReference Include="GDShrapt.TypesMap" Version="4.5.1" />
<PackageVersion Include="GDShrapt.TypesMap" Version="4.5.1" />
<PackageReference Include="GDShrapt.TypesMap" />
paket add GDShrapt.TypesMap --version 4.5.1
#r "nuget: GDShrapt.TypesMap, 4.5.1"
#:package GDShrapt.TypesMap@4.5.1
#addin nuget:?package=GDShrapt.TypesMap&version=4.5.1
#tool nuget:?package=GDShrapt.TypesMap&version=4.5.1
GDShrapt.TypesMap
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
};
Related Projects
This library is part of the GDShrapt ecosystem:
| Package | Description | NuGet |
|---|---|---|
| GDShrapt.Reader | GDScript parser and AST | |
| GDShrapt.Converter | GDScript to C# converter | |
| GDShrapt.TypesMap | Type mapping library |
License
MIT License - see LICENSE for details.
Author
Links
- GDShrapt - Main repository with parser and converter
- NuGet Package
- Issues - Report bugs or request features
| Product | Versions 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. |
-
net8.0
- GodotSharp (>= 4.5.1)
- Mono.Cecil (>= 0.11.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
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