Skip to content

Commit

Permalink
Godot 4 Port (#287)
Browse files Browse the repository at this point in the history
* Temporarily removed player easteregg

* Connect signals in code

* Automatic conversion

* Fixed obvious GDScript errors/api changes

* Basic UI working

* Canvas working

* Idiomatic Godot4 signal connection

* Fixed warnings

* Fixed various stuff

* Window rework

* Removed keymapping stuff; this needs a rework later

* Removed string templating for i18n strings

* Removed old fonts; using the standard font now.

* UI redesign

* Various fixes

* Removed useless actions

* Bugfixes

* Scrollcontainers for the settings dialog

* Reimplemented keybindings

* Settings rework

* Keybindings persistence

* Various fixes & docs updates

* Updated CI

* The egg is back

* Renamed "distraction free mode" to "zen mode"

* Fixed canvas focus

* Finished Godot 4 port
  • Loading branch information
mbrlabs authored Aug 20, 2024
1 parent 2f4f189 commit 238af68
Show file tree
Hide file tree
Showing 183 changed files with 4,194 additions and 5,956 deletions.
40 changes: 20 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ on:
branches: [ main ]

env:
GODOT_VERSION: 3.5.2
GODOT_VERSION: 4.3
EXPORT_NAME: Lorien
LORIEN_VERSION: v0.6.0-dev
LORIEN_VERSION: v0.7.0-dev

jobs:
windows-export:
name: Windows Export
runs-on: ubuntu-latest
container:
image: docker://barichello/godot-ci:3.5.2
image: docker://barichello/godot-ci:4.3
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup
run: |
mkdir -v -p build/${EXPORT_NAME}_${LORIEN_VERSION}_Windows
mkdir -v -p ~/.local/share/godot/templates
mv /root/.local/share/godot/templates/${GODOT_VERSION}.stable ~/.local/share/godot/templates/${GODOT_VERSION}.stable
- name: Windows Build
mkdir -v -p ~/.local/share/godot/export_templates
mv /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
- name: Build
run: |
cd lorien
godot -v --export "Windows Desktop" ../build/${EXPORT_NAME}_${LORIEN_VERSION}_Windows/${EXPORT_NAME}_${LORIEN_VERSION}.exe
godot --headless -v --export-release "Windows Desktop" ../build/${EXPORT_NAME}_${LORIEN_VERSION}_Windows/${EXPORT_NAME}_${LORIEN_VERSION}.exe
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
Expand All @@ -40,19 +40,19 @@ jobs:
name: Linux Export
runs-on: ubuntu-latest
container:
image: docker://barichello/godot-ci:3.5.2
image: docker://barichello/godot-ci:4.3
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup
run: |
mkdir -v -p build/${EXPORT_NAME}_${LORIEN_VERSION}_Linux
mkdir -v -p ~/.local/share/godot/templates
mv /root/.local/share/godot/templates/${GODOT_VERSION}.stable ~/.local/share/godot/templates/${GODOT_VERSION}.stable
- name: Linux Build
mkdir -v -p ~/.local/share/godot/export_templates
mv /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
- name: Build
run: |
cd lorien
godot -v --export "Linux/X11" ../build/${EXPORT_NAME}_${LORIEN_VERSION}_Linux/${EXPORT_NAME}_${LORIEN_VERSION}.x86_64
godot --headless -v --export-release "Linux" ../build/${EXPORT_NAME}_${LORIEN_VERSION}_Linux/${EXPORT_NAME}_${LORIEN_VERSION}.x86_64
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
Expand All @@ -64,19 +64,19 @@ jobs:
name: Mac Export
runs-on: ubuntu-latest
container:
image: docker://barichello/godot-ci:3.5.2
image: docker://barichello/godot-ci:4.3
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup
run: |
mkdir -v -p build/${EXPORT_NAME}_${LORIEN_VERSION}_Mac
mkdir -v -p ~/.local/share/godot/templates
mv /root/.local/share/godot/templates/${GODOT_VERSION}.stable ~/.local/share/godot/templates/${GODOT_VERSION}.stable
- name: Windows Build
mkdir -v -p ~/.local/share/godot/export_templates
mv /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
- name: Build
run: |
cd lorien
godot -v --export "Mac OSX" ../build/${EXPORT_NAME}_${LORIEN_VERSION}_Mac/${EXPORT_NAME}_${LORIEN_VERSION}.zip
godot --headless -v --export-release "macOS" ../build/${EXPORT_NAME}_${LORIEN_VERSION}_Mac/${EXPORT_NAME}_${LORIEN_VERSION}.zip
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Godot-specific ignores
.import/
.godot/

# Mono-specific ignores
.mono/
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021-2022 Marcus Brummer
Copyright (c) 2021-2024 Marcus Brummer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@
</a>
</p>

Lorien is an **infinite canvas drawing/note-taking app that is focused on performance, small savefiles and simplicity**. It's not based on bitmap images like Krita, Gimp or Photoshop; it rather saves brush strokes as a collection of points and renders them at runtime (kind of like SVG). It's primarily designed to be used as a digital notebook and as brainstorming tool. While it can totally be used to make small sketches and diagrams, it is not meant to replace traditional art programs that operate on bitmap images. It is entirely written in the [Godot Game Engine](https://godotengine.org/). For an overview on how to use Lorien have a look [at the manual](docs/manuals/manual_v0.5.0.md).
Lorien is an **infinite canvas drawing/note-taking app that is focused on performance, small savefiles and simplicity**. It's not based on bitmap images like Krita, Gimp or Photoshop; it rather saves brush strokes as a collection of points and renders them at runtime (kind of like SVG). It's primarily designed to be used as a digital notebook and as brainstorming tool. While it can totally be used to make small sketches and diagrams, it is not meant to replace traditional art programs that operate on bitmap images. It is entirely written in the [Godot Game Engine](https://godotengine.org/). For an overview on how to use Lorien have a look [at the manual](docs/manuals/manual_v0.6.0.md).

![Lorien demo](https://raw.githubusercontent.com/mbrlabs/Lorien/main/images/lorien_demo.png)

**This is very much a WIP and still a bit rough around the edges** ⚠. The savefile format *might* also change in the future. Contributions (be it bug reports, code, art or [translations](docs/i18n.md)) are very welcome.

## Features as of v0.6.0:
## Features as of v0.7.0-dev:
- Infinite canvas
- Infinite undo/redo
- (Almost) Infinite zoom
- Infinite grid
- Distraction free mode (toggles the UI on/off)
- Zen mode (toggles the UI on/off)
- Extremely small savefiles ([File format specs](docs/file_format.md))
- Work on multiple documents simultaneously
- [Tools](docs/manuals/manual_v0.5.0.md): Freehand brush, eraser, line tool, rectangle tool, circle/ellipse tool, selection tool
- [Tools](docs/manuals/manual_v0.7.0.md): Freehand brush, eraser, line tool, rectangle tool, circle/ellipse tool, selection tool
- Move and delete selected brush strokes
- SVG export
- Rebindable keyboard shortcuts
- Built-in and custom color palettes
- Designed to be used with a drawing tablet (Wacom, etc.). It also supports pressure sensitivity
- A little Surprise Mechanic™ when pressing F12
- Runs on Windows, Linux & macOS
- Localizations: English, German, Italian, Korean, Russian, Spanish, Turkish, Brazilian Portuguese, Chinese
- Localizations: German, English, Spanish, French, Italian, Korean, Brasilian Portuguese, Russian, Turkish, Ukrainian, Chinese

## Download
You can download the latest stable releases on [Github](https://github.com/mbrlabs/Lorien/releases).
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [0.7.0]

### Breaking Changes
- The keybindings fromat is different, so you will need to update them again in case you changed them

### Added
- Setting to disable pressure sensitivity and always draw with a constant brush width
- Translations: Ukrainian

### Fixed

### Changed
- Migrated from Godot 3.5.x to Godot 4.3
- UI overhaul
- Improved icon resolution on Windows

## [0.6.0] - 2023-11-06
Expand Down
4 changes: 1 addition & 3 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

## General
This guide is loosly based on [Godot's contributing guidelines](https://github.com/godotengine/godot/blob/master/CONTRIBUTING.md):
- Use the latest stable release: Godot 3.5.x
- We use Godot 4.3-stable
- If you want to implement a big feature, open an issue or a [Github discussion](https://github.com/mbrlabs/Lorien/discussions) so we can talk about it first
- Format your commit messages with readability in mind


## Codestyle

- Adapt to the project's coding style
- Use C-style logical operators: `&&`, `||`, `!` instead of `and`, `or`, `not`
- Use function separators (see any `.gd` file in this repository for examples)
Expand Down
72 changes: 72 additions & 0 deletions docs/manuals/manual_v0.7.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Lorien Manual v0.7.0

Drawing tablets are supported and recommended, but you can also just use Keyboard+Mouse.

## Basic Usage
- Draw with the left mouse button (<kbd>LMB</kbd>) or with your drawing tablet's pen
- Pan/drag across the canvas with the middle mouse button (i recommend to map a button on your pen to the middle mouse button for easy navigation)
- Zoom with the mouse wheel. You can also zoom while holding <kbd>CTRL</kbd> and the middle mouse button <kbd>MMB</kbd> while moving the mose up/down. This is especially useful when using a drawing tablet with a pen.
- You can open files by dragging them into the window or by opening it via the menu (Shortcut <kbd>CTRL</kbd> + <kbd>O</kbd>)

## Tools
Lorien provides you with different tools which you can find in the toolbar. If you want to enable a tool all you have to do is click on it or use the keyboard shortcut. If you hover over the icons you can also see a short description including the keyboard shortcut.

### Brush Tool
- The brush tool is selected by default. It allows you to freely draw on the canvas with your mouse or drawing tablet.
- You can change the brush size with the adjuster in the toolbar
- The brush color can be changed by clicking on the colored button in the toolbar next to the brush size adjuster
- It is pressure sensitve

### Rectangle Tool
- You can use the rectangle tool to create perfect (unfilled) rectagles
- Not pressure sensitive

### Line Tool
- Allows you to draw perfect lines
- You can hold down <kbd>Shift</kbd> while using the line tool to snap the line in 15° increments
- Not pressure sensitve

### Circle Tool
- Allows you to draw perfect ellipses and circles
- You can hold down <kbd>Shift</kbd> while using the circle tool to draw perfect circles. Otherwise it defaults to ellipses
- Not pressure sensitve

### Eraser Tool
- Allows you to erease brush strokes by drawing over it. Once the eraser intersects with a brush stroke, the whole brush stroke will be removed
- The brush size affects the area of effect
- When using a stylus/pen that supports erasing with the other side, Lorien automatically switches into the eraser mode

### Selection Tool
- With the Selection tool you can select a number of brush strokes by dragging across the screen with your <kbd>LMB</kbd> pressed. Brush strokes which are considered inside the selection recatangle will be added to the current selection. You can add more strokes to your current selection by holding down <kbd>Shift</kbd> while dragging.
- You can deselect your current selection by pressing <kbd>RMB</kbd> or <kbd>Esc</kbd>.
- To move the selected strokes simply drag them while holding down <kbd>LMB</kbd>. If you did not move your mouse while pressing <kbd>LMB</kbd>, everything will be deselected automatically.
- Press <kbd>Delete</kbd> to delete the current selection
- Press <kbd>CTRL</kbd> + <kbd>C</kbd> to copy the current selection
- Press <kbd>CTRL</kbd> + <kbd>V</kbd> to paste the copied brush strokes
- Press <kbd>CTRL</kbd> + <kbd>D</kbd> to duplicate the current selection

## Color Palettes
- Color palettes allow you to easily switch between different pre-defined colors. To open the pallete you have to click on the colored button in the toolbar next to the brush size adjsuter.
- You can add/edit/delete custom color palettes
- The default color palette can't be edited or deleted. If you want to customize it you can can make a copy of it and edit that instead.

## Keyboard shortcuts
- <kbd>Ctrl</kbd> + <kbd>S</kbd>: Saves the current file
- <kbd>Ctrl</kbd> + <kbd>N</kbd>: Open a new file
- <kbd>Ctrl</kbd> + <kbd>O</kbd>: Open a new empty tab
- <kbd>Ctrl</kbd> + <kbd>E</kbd>: Opens the SVG export dialog
- <kbd>Ctrl</kbd> + <kbd>Z</kbd>: Undo a brush stroke
- <kbd>Ctrl</kbd> + <kbd>Y</kbd>: Redo a brush stroke
- <kbd>Ctrl</kbd> + <kbd>C</kbd>: Copy selected brush strokes
- <kbd>Ctrl</kbd> + <kbd>V</kbd>: Paste copied brush strokes
- <kbd>Ctrl</kbd> + <kbd>D</kbd>: Duplicate selected brush strokes
- <kbd>B</kbd>: Brush tool
- <kbd>R</kbd>: Rectangle tool
- <kbd>E</kbd>: Eraser tool
- <kbd>L</kbd>: Line tool
- <kbd>C</kbd>: Circle tool
- <kbd>S</kbd>: Selection tool
- <kbd>Esc</kbd> or <kbd>RMB</kbd>: Deselect everything
- <kbd>Delete</kbd>: Deletes selected brush strokes
- <kbd>Tab</kbd>: Toggle zen mode (no UI)
- <kbd>F12</kbd>: Easteregg: spwans a playable character at the mouse position who can walk/jump/crouch on brush strokes.
63 changes: 2 additions & 61 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,4 @@
# Roadmap

This file provides an overview of the direction this project is heading. There is no timeline attached to milestones, because i don't know much i'm going to work on this in the future and how much people are willing to help.

## Milestone 1 - Basic functionality and stability
There are still a lot of placeholders in the program. While i did my best to implement as much features as possible before i made the project public, there is still a lot to do. This is a list of features which i would expect from a program like this (and which are not implemented yet):

- Basic shape tools (rectangle, line, maybe a circle/oval)
- Color picker tool (picks colors from brush strokes on the canvas)
- Persist last opened projects, so you don't have to reopen files between program restarts
- Different themes (at least 1 dark and 1 light theme)
- Cleanup UI
- More settings (max zoom level, zoom speed, min/max brush size etc.)
- Improvements to project tabs (currently custom ui; maybe replace with Godot's `Tabs` to take advantage of scrolling and reordering)
- Improve the brush stroke filter and optimizer
- Improve zooming
- `Save as` functionality
- Stability across all platforms + bugfixing
- Stabilize savefile format (can still change later (before 1.0) but hopefully not as much)
- Improve the logo. I'm actually pretty proud of myself for the current logo, but i'm sure it can be improved. It's supposed to be a leaf by the way ;)
- Maybe setup unit tests? I have never done that in Godot, but it's worth checking out early on in the project
- i18n
- etc.

## Milestone 2 - Improve rendering & performance

### The problem
For the first iteration of the project i used Godot's built-in Line2D to render the brush stokes. Because of this built-in functionality i had a working prototype ready in less then a day. Line2D basically has everything i need:

- Renders lines of (almost) arbitrary length
- Variable width through the use of a Curve (useful for pressure sensitivity)
- Different colors
- Can do anti-aliasing (not ideal though; more on this later)
- Can leverage Godot's 2D batch rendering system for performance

But there are also some issues:
- Out of the 2 anti-aliasing methods provided none work perfectly:
1. Line2D's `antialiased` property uses an OpenGL hint to draw smooth edges. OpenGL drivers are not required to implement hints, and in fact most don't, so it may work on my machine but not on yours. If it works, it looks really nice, but it's also pretty slow compared to the other method.

2. Line2D has the ability to fill the rendered line with a texture. If you make a texture in a way that the edges have very low opacity, you can fake anti-aliasing. This is pretty fast and works on every system, but it looks kind of bad when you zoom in really far. This can maybe worked around with by switching between different textures based on the camera zoom level, but it's not ideal either.

- Using Line2D's `width_curve` for drawing pressure sensitive lines is kind of wonky (the line literally wobbles when it's very long (only while still drawing; i.e. adding points))

### Solution 1: GDNative plugin or custom module
Implement a custom system for:
- Line meshing (can reuse a modified version of Godot's LineBuilder which is used internally by Line2D). This should fix the `width_curve` wonkiness.
- Line rendering with custom static batching; also use the VisualServer directly (should improve performance by a lot)
- Anti aliasing. Have to research different AA algorithms and see how feasable it is to implement them in Godot
- Streaming brush strokes in/out based on view frustrum insead of keeping Line2D nodes in scene tree?

### Solution 2: ?
Something simpler than going native would be nice.


## Milestone 3 - More features (all optional)
- Implement a selection tool to select and move multiples strokes.
- Implement a brush stabilizer (can optionally be enabled for the brush tool)
- Color palettes / list of previously used colors
- Export functionality (png, jpg, svg)
- A grid
- Layers (pretty sure i'm NOT going to implement this, because you don't even have opacity (by design) and you can just create a new `.lorien` file instead)
- A ruler
- etc.
The old roadmap is for the most part implemented or obsolete.
So this needs to be updated at some point :)
31 changes: 15 additions & 16 deletions lorien/Assets/Cursors/move_cursor.png.import
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/move_cursor.png-443b66feec64cf631c7817838e2e4aaa.stex"
type="CompressedTexture2D"
uid="uid://cynvq1tyvqx67"
path="res://.godot/imported/move_cursor.png-443b66feec64cf631c7817838e2e4aaa.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Assets/Cursors/move_cursor.png"
dest_files=[ "res://.import/move_cursor.png-443b66feec64cf631c7817838e2e4aaa.stex" ]
dest_files=["res://.godot/imported/move_cursor.png-443b66feec64cf631c7817838e2e4aaa.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/hdr_compression=1
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file removed lorien/Assets/Fonts/Inter-Bold.ttf
Binary file not shown.
Binary file removed lorien/Assets/Fonts/Inter-Regular.ttf
Binary file not shown.
Binary file removed lorien/Assets/Fonts/Korean/NotoSansKR-Bold.otf
Binary file not shown.
Binary file removed lorien/Assets/Fonts/Korean/NotoSansKR-Regular.otf
Binary file not shown.
8 changes: 0 additions & 8 deletions lorien/Assets/Fonts/Korean/font_big_bold_ko.tres

This file was deleted.

8 changes: 0 additions & 8 deletions lorien/Assets/Fonts/Korean/font_big_ko.tres

This file was deleted.

8 changes: 0 additions & 8 deletions lorien/Assets/Fonts/Korean/font_normal_ko.tres

This file was deleted.

Loading

0 comments on commit 238af68

Please sign in to comment.