gd2cs.py
gd2cs.py is a Python script with a graphical UI plugin for the Godot Editor that automates the conversion of GDScript code to C#. While not perfect, it significantly reduces the manual effort required for code conversion.
https://github.com/kiriri/gd2cs.pyAutomating GDScript to C# Conversion with gd2cs.py
gd2cs.py is a valuable tool for Godot Engine developers seeking to transition their GDScript codebases to C#. This Python script, enhanced with a graphical user interface (GUI) plugin for the Godot Editor, provides an automated solution for converting GDScript code into its C# equivalent.
Key Features and Functionality
- Regex-Based Conversion: Employs regular expressions to analyze GDScript syntax and translate it into C#.
- GUI Plugin: Integrated directly into the Godot Editor for ease of use.
- Automated Gruntwork Reduction: Aims to alleviate the tedious aspects of manual code conversion.
- Godot 3.2 and 4.1 Compatibility: Originally developed for Godot 3.2 and tested with Godot 4.1.
Usage
The plugin can be easily integrated into Godot projects by placing it in the 'addons' folder and activating it in the Project Settings. A dedicated 'gd2cs' tool is then accessible via Project->Tools. The script can also be run from the command line using Python, specifying input and output files.
Limitations
It's important to acknowledge that gd2cs.py is not a perfect solution. Due to its regex-based approach, the converted code may require manual adjustments, particularly for formatting and type definitions. However, it can significantly reduce conversion time.