godot icon indicating copy to clipboard operation
godot copied to clipboard

Scrolling in script editor laggy

Open Wolfyxon opened this issue 3 years ago • 4 comments

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 perfect. Applies to the scrollbar and mouse wheel.

https://user-images.githubusercontent.com/58263600/222657429-9cbab6a9-036f-4d3f-b8b7-15be5c8019ea.mp4

Steps to reproduce

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

Minimal reproduction project

N/A

Wolfyxon avatar Mar 03 '23 07:03 Wolfyxon

It doesn't lag when using arrow keys

Wolfyxon avatar Mar 03 '23 07:03 Wolfyxon

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

Wolfyxon avatar Mar 03 '23 07:03 Wolfyxon

  • Related to https://github.com/godotengine/godot/issues/71795.

Calinou avatar Mar 03 '23 09:03 Calinou

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

Chaosus avatar Mar 07 '23 05:03 Chaosus

https://github.com/godotengine/godot/blob/e5cc494fbf4f5564c16d3deadb3a83a3c58b7546/editor/code_editor.cpp#L1009-L1012

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.

Rindbee avatar Mar 15 '23 08:03 Rindbee

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 avatar Mar 15 '23 22:03 Calinou

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?

Calinou avatar Mar 23 '23 17:03 Calinou

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.

RahovDev avatar Mar 23 '23 18:03 RahovDev

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

fwsmit avatar Apr 27 '23 14:04 fwsmit

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?

Wolfyxon avatar May 26 '23 12:05 Wolfyxon

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

mackzxyz avatar Dec 22 '23 00:12 mackzxyz

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.

https://github.com/godotengine/godot/assets/2711997/1ca0e195-91e6-4350-b3aa-ba857fb53699

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

djkero avatar Feb 13 '24 19:02 djkero

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/.

https://github.com/godotengine/godot/blob/e5cc494fbf4f5564c16d3deadb3a83a3c58b7546/scene/gui/text_edit.cpp#L7258-L7259

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?

djkero avatar Feb 13 '24 20:02 djkero

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): https://github.com/godotengine/godot/issues/28385

Calinou avatar Feb 13 '24 22:02 Calinou

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.

https://github.com/godotengine/godot/assets/65500959/0f5036b2-80cb-453b-ac47-f22181f6bbc8

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

AtlasDjinn avatar Jun 07 '24 18:06 AtlasDjinn

@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.)

Calinou avatar Jun 10 '24 18:06 Calinou

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

AtlasDjinn avatar Jun 10 '24 22:06 AtlasDjinn