Skip to content

A tool to help with generating UML class diagrams from code with minimal changes.

License

Notifications You must be signed in to change notification settings

Relintai/uml_generator

Repository files navigation

UML Generator

Small UML generator using the pandemonium engine.

It's designed to generate UML diagrams from header-like code with minimal changes to it.

Should work with godot 3.x aswell, but you will need to create the project file.

Note that the image generation algorithm relies on the app's window being able to be resized, so the thing will only work on dekstop platforms.

Some example outputs

Directory class FileCache class PlayField class

The example input files themselves can be found here.

Usage

Grab the editor for the platform of your choice, and the app project itself. (project folder in this repository).

Open the project folder with the engine.

  1. Copy your input files into the data (next to the examples folder) folder. (Create it if doesn't exists). [Example files]
  2. Run the app from the engine (F5).
  3. It will generate the output images into the output folder. (Next to the data folder.)

Input file syntax

It's very similar to c++ headers. These files are read and processed line-by-line like a script.

If you start from a c++ header:

  • Remove method implementations.
  • Remove includes, macro implementations etc.
  • Use class <name> or struct <name> keyword to start a class. Like: class Object
  • Use the inherit keyword to add an arrow below your current class.
  • By default the thing uses c++ style access modifiers. public:, protected:, private: is interpreted as expected.
  • If you use a class you start with everything being private, with structs you start with everything being public.
  • Starting a line with -- will add a HSeparator to a class
  • Lines starting with # are comments.
  • ;s get removed automatically
  • Using keyword new_column and then adding a class will add that class next to the previously added classes like here.

Access modifiers

By default the thing uses c++ style access modifiers. This can be changed when parsing a file.

  • If you want to use java / c# sytle access modifiers use the access_modifier_parse_type INDIVIDUAL keyword.
  • If you want to switch back to c++ style access modifiers you can use the access_modifier_parse_type GROUPED keyword.
  • If you want to turn off access modifiers you can use the access_modifier_parse_type IGNORE keyword.

Examples

I recommend looking at the provided example files available here.

Editing the project

Grab the engine itself, and then open the project inside the project folder.

Compiling the engine

For convenience my project setup script is provided to simplify the workflow, however I recommend just downloading the prebuilt executables. This project is not expected to change much.

You can also get prebuilt engine executables form the engine's repo's actions tab [here].

First make sure, that you have everything installed to be able to compile the engine. See the official docs for compiling Godot for more info. My setup/compile script uses the same tools, so you don't need to install anything else.

Even though the project doesn't use godot anymore, their docs are still sufficient.

Now let's clone this repository:

git clone https://github.com/Relintai/uml_generator

cd into the new folder:

cd uml_generator

Now let's run the project's setup script, by calling scons without arguments.

scons

This will clone and setup the engine, and all of the required modules into a new engine folder inside the project, using http.

(If you want to use the github's ssh links append repository_type=ssh like scons repository_type=ssh)

Once it is done you can compile the engine.

To build the editor on windows with 4 threads run the following command:

scons bew -j4

To build the editor on linux with 4 threads run the following command:

scons bel -j4

I call this feature of the setup script build words. See.

Once the build finishes you can find the editor executable inside the ./engine/bin/ folder.

For convenience there is a provided editor.sh, or editor.bat for running it from the project's folder. These will create a copy, so you can even compile while the editor is running.

Alternatively if you don't want to use build words, you can also just go into the engine folder:

cd engine

And compile godot as per the official docs.

Build words

The project's setup script contains support for "build words". These can be used from the root of this project.

For example to build the editor for windows with 4 threads you can use:

scons bew -j4

The first argument must start with b (build), then it needs to be followed by a few abbreviations (the order does not matters)

The rest of the arguments will be passed directly to godot's scons script.

Editor

Append e to build with tools=yes a.k.a. the editor.

scons bew -j4

if you omit e, the system will build the export template for you. For example:

scons bw -j4

This will be the release_debug windows export template.

Platform abbreviations

l: linux
w: windows
a: android
j: Javascript
i: iphone (Not yet finished, use build_ios.sh, and build_ios_release.sh)
Mac OSX: Not yet finished, use build_osx.sh

Target abbreviations

By default the system builds in release_debug.

Append d for debug, or r for release.

scons bewd -j4

build editor windows debug

scons bwr -j4

build windows release (this will build the windows release export template)

Shared modules

Note: This only works on linux!

append s to the build string.

Optionally you can also make the build system only build a target module, by appending one of these:

E: Entity Spell System
T: Texture Packer
V: Voxelman
W: World Generator
P: Procedural Animations

Example:

scons belsE -j4

build editor linux shared (Entity Spell System) with 4 threads

Note: to easily run the editor you can use the editor.sh or editor.bat in the root of the project.

Other

Append v to pass the vsproj=yes parameter to the build script. This will generate Visual Studio project files.
Append c to pass the compiledb=yes parameter to the build script. This is a new feature in 3.x to have this disabled by default to lessen compile times.

Postfixes

There are a few postfixes for the build words. These are more complex options. You have to append them to your build word with an underscore.

You can use as many as you want.

For example:

scons bel_slim_latomic -j4

slim

With this postfix you can build a slimmed down version of the engine. This disables quite a few unneeded modules.

scons bel_slim -j4

latomic

If you get linker errors while building the game/editor about undefined referenced with atomic related functions you can use this postfix. It will add the -latomic command line switch to the linker flags.

I ran into this issue while building on a raspberry pi 4 with the x11 platform. It might be related to the recent reworks to threading.

scons bel_latomic -j4

strip

Appends debug_symbols=no to the build command, which will strip the resulting binary from debug symbols.

scons bel_strip -j4

threads

Appends threads_enabled=yes to the build command. Useful for building the editor for html.

scons bej_threads -j4

Scons cache, and sdk locations

In order to use scons cache and to tell the build system where some of the required sdks are located you usually have to use environment variables. Most of the time you might just want to add them globally, howewer this is sometimes unfeasible (e.g. you don't have administrator access, or you just want to have multiple sdk versions installed).

In order to solve this a build config file was added.

If you want to use the config simply rename the provided build.config.example to build.config, and customize the settings inside.

Manual Setup

If you you don't want to use the setup script (or just want to know what it actually does), this section will explain how to set everything up manually.

First clone the engine:

git clone https://github.com/Relintai/pandemonium_engine

Now if you look at the HEADS file.

It contains the commit hashes for that particular revision for every module and the engine. The engine now contains all the modules, so at the moment only worry about the engine's commit hash.

You need to go and checkout the proper commit for it.

Now you can go ahead and compile the engine normally.

Pulling upstream changes

First pull the changes by calling

git pull orgin master

Then just run scons, to will update the modules.

Upgrading the modules

Note: this is how to update the HEADS file. Normally you don't need to do this.

If you want to update the modules, and the engine to the latest, you can use (action=update):

scons a=u

You can also update different targets: all, engine, modules, all_addons, addons, third_party_addons

For example to update the engine to the latest: scons a=u target=engine

About

A tool to help with generating UML class diagrams from code with minimal changes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published