-
Notifications
You must be signed in to change notification settings - Fork 10
Ensure fonts are loaded after _ready by triggering an empty update. #28
base: main
Are you sure you want to change the base?
Conversation
It seems the None of these are particularly important, so I will replace the rustfmt.toml with one that runs on stable rust. |
Strange 🤔 There seems to be an issue unrelated to my changes: https://github.com/setzer22/godot-egui/runs/4127143647?check_suite_focus=true
But the code compiles and builds fine on my machine. I'll try removing my local EDIT: Indeed, looks like a library bump issue. It looks like it may be updating to egui 0.15 even if we specified a hard dependency on 0.14.2 (?). Here's my old Cargo.lock file (works):
And here's the new Cargo.toml file that is generated if I remove the old one:
I don't understand the two @jacobsky Could it be |
Here's the output of cargo-tree
Turns out cargo was picking It seems cargo will not respect dependencies specified as "0.1.0" and will freely bump the revision number. The fix was to change the depencency to "=0.1.0", which temporarily fixes the issue until we bump egui here (which should be soon, anyway). |
Ah, yeah. Sorry about that! The 0.1.1 part was to update it to work with egui 0.15.x since there were some breaking changes that needed to work. I didn't realize that we could pin the "exact" version in that way. I'll make sure to do that in the future on the 0.15.0 PR. |
Egui only builds fonts at the start of the next frame, so if the theme is loaded on
_ready
, the font texture won't be updated until the firstGodotEgui::update
, which means that a GUI that draws their first frame after some time (e.g. when a menu is first shown) will cause a noticeable hiccup.This would also cause issues if you want to add some extra fonts after loading a theme. After calling
_ready
on a GodotEgui object, trying to accessegui.fonts().definitions()
would return the old value, not the one set by the theme.Triggering an empty update takes care of the problem with no noticeable side effects.