/UMLGenerator

A tool for generating UML diagrams from C# code, designed to work seamlessly with Godot and .NET projects. UMLGenerator simplifies visualizing complex class hierarchies, and relationships through automated diagram creation.

Primary LanguageC#MIT LicenseMIT

🔀 UMLGenerator

Chickensoft Badge Discord line coverage branch coverage

A tool for generating UML diagrams from C# code, designed to work seamlessly with Godot and .NET projects. UMLGenerator simplifies visualizing complex class hierarchies, and relationships through automated diagram creation.


Chickensoft.UMLGenerator


📌 Overview

UMLGenerator produces PlantUML .puml files from your codebase, enabling easy visualization of:

  • Class inheritance trees
  • Component relationships
  • Method call dependencies

The generated diagrams are placed alongside source files with the *.g.puml extension, ready for rendering with PlantUML, VSCode extension, or the Jetbrains plugin.

🧰 Key Features

  • Automatic diagram generation from tscn and C# code
  • Integration with Godot.NET projects
  • Real-time visualization via IDE plugins

📚 Getting Started

  1. Install the UMLGenerator package from nuget
  2. (Optional) Add <AdditionalFiles Include="**/*.tscn"/> to the csproj so that all .tscn files within the project directory are found (may want to exclude addons)
  3. Add [ClassDiagram(UseVSCodePaths = true)] attribute to classes.
    1. If you use Jetbrains Rider, either remove UseVSCodePaths, or set it to false
using Chickensoft.UMLGenerator
    
public interface IGame
{
    void StartGame();
    void LoadGame();
    void SaveGame();
}
    
[ClassDiagram(UseVSCodePaths = true)] 
public class Game : Node, IGame 
{
	public IGameRepo GameRepo { get; set; } = null!;
	public IGameLogic GameLogic { get; set; } = null!;
    
    // ... (implementation details) 
}
  1. Build your project
  2. Open the generated .g.puml files

This would generate a PlantUML file showing:

  • Class relationships
  • Interface implementations
  • Method signatures

🖼️ Visualizing UML Diagrams

Generated .puml files can be visualized using PlantUML. For example:

classDiagram

  Game --> GameRepo
  Game --> GameLogic
  
  class Game {
      void StartGame()
      void LoadGame()
      void SaveGame()
  }
  
  class GameRepo {
      
  }
  
  class GameLogic {
      
  }

Loading