godotengine / godot-demo-projects

Demonstration and Template Projects
https://godotengine.org
MIT License
5.65k stars 1.58k forks source link

UI Mirroring Demo: ported to Godot 4.1 #974

Closed Alex2782 closed 6 months ago

Alex2782 commented 10 months ago

v4.2.dev5.official [e3e2528ba]

https://github.com/godotengine/godot-demo-projects/assets/41921395/f38e6581-fef6-41ad-ae54-37b1d586b99a

Calinou commented 10 months ago

I suggest checking what https://github.com/godotengine/godot-demo-projects/pull/930 does.

Alex2782 commented 10 months ago

I opened my Godot projects that were targeted at 4.2 with version 4.1.2. No problems. I have noticed some problems with other projects as well. Errors were issued with the files in the imported folder. e.g. the font resources I had to import again.

my .godot folder: godot.zip @Calinou does it work after that if you use the whole or only imported folder with you?

image

Godot v4.1.2.stable - macOS 13.6.0 - Vulkan (Forward+) - integrated Apple M1 - Apple M1 (8 Threads) UI Mirroring Demo also with v4.2.beta1.official [b1371806a]

image

image

Alex2782 commented 10 months ago

.gitignore

# Godot 4+ specific ignores
.godot/

.....................

# Godot-specific ignores
.import/

.....................

# Imported translations (automatically generated from CSV files)
*.translation
Alex2782 commented 10 months ago

master Godot project 4.0 after conversion to 4.1 Many errors are output, but I can start the project without errors.

image

delete all ignore files + 'master Godot project 4.0 after conversion to 4.1' again

rm -r .godot 
rm -r .import 

image

Alex2782 commented 10 months ago

If I close Godot and open the project again then everything is ok, Japanese is also displayed. v4.1.2.stable.official [399c9dc39]

Calinou commented 10 months ago

I still can't get it to work on my end, even after removing .import/ and .godot/ while the editor is closed :slightly_frowning_face: Note that I'm on Linux, so font loading behavior may differ compared to macOS.

PS: I noticed your PR adds two new files in ui_mirroring/fonts, noto_font.res and noto_font_arabic.res. Why are these files required when the existing TTF fonts could be reused?

Alex2782 commented 10 months ago

Open the scene, and in the "Fix Dependencies" dialog

I will continue later, without "Fix Dependecies" Godot crashes now. I do not know the function "Fix Dependecies" yet.

image

Alex2782 commented 10 months ago
  • Reimport all font from the editor import tab (probably optional).

I had opened Project Settings -> Import Defaults -> Importer "Font Data (Dynamic Font)" and under "Fallbacks" inserted and saved the 2 font files, after that I could not continue (Crash / Godot open Project Manager). Was that correct?

The file 'ui_mirroring.tscn' is now 7.3 MB. If I add font for Japanese, then the scene will be even bigger.

@smix8 says: https://github.com/godotengine/godot-demo-projects/pull/955#issuecomment-1729159005

If we rework and update the demo maybe we should save the NavigationPolygon resource to an external file as a binary .res file?

Right now it is stored embedded as plain text inside the navigation.tscn file, something that we should not teach to new users as it will bloat their scene files and make them super slow to load/save/update on large and complex navigation meshes.

@bruvzg does this PR work for you with binary 'res'-Fonts? Or is Japanese not displayed for you either? The label for HELLO_TEXT has normal English font, but still Arabic is displayed correctly? @Calinou

I suggest checking what #930 does. Add PO support in addition to CSV.

I think there is little point in trying to fix problems I can't reproduce.

bruvzg commented 10 months ago

does this PR work for you with binary 'res'-Fonts?

There should not be any binary (or text) font resources at all, font files should be used directly.

bruvzg commented 10 months ago

Something like this - https://github.com/bruvzg/godot-demo-projects/commit/0401f2871460370ba487d8506990aec5b5d43c09

Alex2782 commented 10 months ago

ok I'll check later, from some tutorials I know only first convert the fonts to "tres", also already with Godot 3.2

Alex2782 commented 10 months ago

Also, do we need to ship all the font with the demos? For the Mirroring and Translation demos system font fallback should be fine, neither require specific font dimensions to work.

now without 'fonts', this looks and works now like with 'fonts' (on MacOS)

Should I remove HELLO_TEXT? does not work for @Calinou with a CSV file

image

image

Calinou commented 10 months ago

Something like this - bruvzg@0401f28

I've tested that commit on 4.2.beta2 but I still can't see the CJK text (even after removing .godot/ and reopening the editor to force a reimport of everything):

image

The UI mirroring demo update works well though.