Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrolling in script editor laggy #74274

Open
Wolfyxon opened this issue Mar 3, 2023 · 20 comments
Open

Scrolling in script editor laggy #74274

Wolfyxon opened this issue Mar 3, 2023 · 20 comments

Comments

@Wolfyxon
Copy link

Wolfyxon commented Mar 3, 2023

Godot version

4.0-stable

System information

Arch Linux 6.1.12-arch1-1 NVIDIA GeForce GTX 1650 Mobile / Max-Q

Issue description

Scrolling in script editor is very laggy while everything else works perfectly. Applies to the scrollbar and mouse wheel.

2023-03-03.08-22-16.mp4

Steps to reproduce

  1. Open a script in the script editor
  2. Make sure it's long enough
  3. Scroll

Minimal reproduction project

N/A

@Wolfyxon
Copy link
Author

Wolfyxon commented Mar 3, 2023

It doesn't lag when using arrow keys

@Wolfyxon
Copy link
Author

Wolfyxon commented Mar 3, 2023

Logs don't say anything else than "Opening project" and my GPU info

@Calinou
Copy link
Member

Calinou commented Mar 3, 2023

@Chaosus
Copy link
Member

Chaosus commented Mar 7, 2023

I see the noticeable and long lag second after zooming is performed, which is very annoying.

@Rindbee
Copy link
Contributor

Rindbee commented Mar 15, 2023

godot/editor/code_editor.cpp

Lines 1009 to 1012 in e5cc494

if (new_size != old_size) {
EditorSettings::get_singleton()->set("interface/editor/code_font_size", new_size / EDSCALE);
text_editor->add_theme_font_size_override("font_size", new_size);
}

Mainly related to this code. Although the L1010 takes much less time than the L1011, the lag is mainly caused by the aftereffect of the L1010. The after-effects of modifying editor settings can be severe.

@Calinou
Copy link
Member

Calinou commented Mar 15, 2023

Changing the script editor font size via Ctrl + mouse wheel should perhaps not persist the result, or only do so when the editor quits.

@Calinou
Copy link
Member

Calinou commented Mar 23, 2023

I can't reproduce this on 4.0.stable (Linux, GeForce RTX 4090 with NVIDIA 525.89.02).

@Wolfyxon Can you reproduce this if you force Godot to run on integrated graphics? Also, can you reproduce this when editing a project that uses the Forward+ or Mobile rendering method?

@RahovDev
Copy link

running on v4.0.1.stable.arch_linux with RTX 3070 (525.89.02)

Getting lag on all renderers. I only get lag for scripts tho - docs scroll smoothly.

@fwsmit
Copy link

fwsmit commented Apr 27, 2023

I can't reproduce this on 4.0.stable (Linux, GeForce RTX 4090 with NVIDIA 525.89.02).

@Wolfyxon Can you reproduce this if you force Godot to run on integrated graphics? Also, can you reproduce this when editing a project that uses the Forward+ or Mobile rendering method?

I can reproduced the issue as well. For me, godot already runs with integrated graphics by default. I tried forcing to dedicated GPU with DRI_PRIME=1, but wasn't able to.

The lag only occurs when scrolling with a mouse wheel or touch pad in the script editor. Not when dragging the scroll bar with the mouse or when viewing doc files.

My setup:
Godot Engine v4.0.2.stable.fedora.7a0977ce2 - https://godotengine.org
Vulkan API 1.3.238 - Forward+ - Using Vulkan Device #0: Intel - Intel(R) UHD Graphics 630 (CFL GT2)

Operating System: Fedora Linux 37
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.105.0
Qt Version: 5.15.9
Kernel Version: 6.2.12-200.fc37.x86_64 (64-bit)
Graphics Platform: X11
Processors: 12 × Intel® Core™ i7-8750H CPU @ 2.20GHz
Memory: 15,4 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 630 and Nvidia P1000M
Manufacturer: HP
Product Name: HP ZBook Studio G5

@Wolfyxon
Copy link
Author

The issue seems to be caused by the picom compositor for me.
My config: picom.txt
(Using the default config doesn't help)

@Calinou

Can you reproduce this if you force Godot to run on integrated graphics?

Lags occur with both integrated and dedicated GPU.

Also, can you reproduce this when editing a project that uses the Forward+ or Mobile rendering method?

Yes, It applies to every rendering method

@fwsmit Do you use a compositor? Can you reproduce the bug without it?

@mackzxyz
Copy link

if you go to editor settings and turn of smooth scrolling then the editor is a lot more responsive,

I have a 500 line long script and the scrolling animation lags out so bad,
only downside is that the text scrolls to the neared line instead of the nearest pixel, you don't notice it much though

@DJKero
Copy link

DJKero commented Feb 13, 2024

if you go to editor settings and turn of smooth scrolling then the editor is a lot more responsive,

I have a 500 line long script and the scrolling animation lags out so bad, only downside is that the text scrolls to the neared line instead of the nearest pixel, you don't notice it much though

Honestly if it's working as intended on Linux, smooth scrolling should be off by default, it's really sluggish. (I forgot how it worked on Windows, it's been a long time since I touched that, lol)

I have exactly the same behaviour as fwsmit but with discrete GPU:

The lag only occurs when scrolling with a mouse wheel or touch pad in the script editor. Not when dragging the scroll bar with the mouse or when viewing doc files.

My setup:
Godot Engine v4.2.1-stable_linux.x86_64
Forward+ Renderer

Operating System: Fedora Linux 39
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.113.0
Qt Version: 5.15.11
Kernel Version: 6.7.4-200.fc39.x86_64 (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor
Memory: 15.5 GiB of RAM
Graphics Processor: AMD Radeon RX 6800 XT
Manufacturer: Gigabyte Technology Co., Ltd.
Product Name: B550M AORUS ELITE

Edit:
I just found something that may serve as a lead on this?
With interface/editor/show_update_spinner ON, Smooth Scrolling seems to be messing the Update Spinner. While scrolling, if Update Continuously is ON it slows the spinner, and if its OFF it makes it go faster.

recording.mp4

On a 144hz display live the scroll feels like its stuttering constantly, by the way. The recording doesn't really capture that well.

@DJKero
Copy link

DJKero commented Feb 13, 2024

While not directly related to the issue Wolfyxon was having, the issue of this stuttering seems to be related to the interpolation steps being too big, this can be seen blatantly by setting text_editor/behavior/navigation/v_scroll_speed to a low value like 20.

I'd propose exposing the interpolation steps as an editor config in text_editor/behavior/navigation/.

godot/scene/gui/text_edit.cpp

Lines 7258 to 7259 in e5cc494

if (smooth_scroll_enabled) {
v_scroll->set_step(0.25);

If the behaviour of v_scroll_speed is what I think it is, then exposing the 0.25 so we can make it smaller could result in a smoother scroll?

@Calinou
Copy link
Member

Calinou commented Feb 13, 2024

Smooth scrolling being sluggish is an issue unrelated from the one reported by OP (as OP was scrolling using a keyboard only, while smooth scrolling only affects mouse scrolling): #28385

@AtlasDjinn
Copy link

I also have this issue, I tried to troubleshoot it without success, the only working solution i found is to create a new project and copy files from the old project into the new one.

2024-06-07.19-15-26.mp4

What I tried:

Copy - copied project folder, including .godot, .git, .gitattributes, .gitignore, project.godot and icon
Copy Without Godot - copied project folder, without the .godot folder
Copy Without Git - copied project folder, without .git folder
New Project - created a new project, copied original folder into new one, override existing files

Working solution:

New Project 2 - created a new project, copied into it only the project files i created, without copying .git .godot project.godot and without overriding files

@Calinou
Copy link
Member

Calinou commented Jun 10, 2024

@AtlasDjinn Could you upload the .godot folder from the project where the script editor is laggy? (You can remove shader_cache within this folder to make it smaller.)

@AtlasDjinn
Copy link

@Calinou here it is, without the shader_cache folder.
godot.zip

@Entsel
Copy link

Entsel commented Sep 16, 2024

I have found the a cause of this issue. In Project Settings -> Physics -> Common, I had set Physics ticks per second and Max physics steps per frame to 1, thinking my project didn't use it. Apparently scrolling uses this for some reason.
Note: You will need to restart the editor after changing this.

@Calinou
Copy link
Member

Calinou commented Sep 16, 2024

@Wolfyxon What's the value of Physics Ticks per Second in the Project Settings?

@Wolfyxon
Copy link
Author

Wolfyxon commented Sep 17, 2024

I always use the default value: 60.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants