Skip to content

Instantly share code, notes, and snippets.

@elementbound
Created November 29, 2023 18:22
Show Gist options
  • Save elementbound/c1f9309ca61a56e99cbe2ca7ce2c3c5c to your computer and use it in GitHub Desktop.
Save elementbound/c1f9309ca61a56e99cbe2ca7ce2c3c5c to your computer and use it in GitHub Desktop.
Build UML graph from your Godot project
#!/bin/sh
classes=""
relations=""
for file in $(find . -name "*.gd"); do
class_name="$(grep "class_name" "$file" | cut -f2 -d" ")"
extends_name="$(grep "extends" "$file" | cut -f2 -d" ")"
if [ -z "$class_name" ]; then
continue
fi
classes="$classes\n$class_name\n$extends_name"
relations="$relations\n\"$class_name\" -> \"$extends_name\""
done
classes="$(echo "$classes" | grep . | sort | uniq)"
echo "@startuml"
echo
echo "digraph "$(dirname $0)" {"
echo "$relations"
echo "}"
echo
echo "@enduml"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment