Maran23 / script-ide

Script-IDE is a plugin for Godot. It transforms the Script UI into an IDE like UI. Tabs are used for navigating between scripts. The default Outline got an overhaul and now shows all members of the script (not just methods) with unique icons for faster navigation.
MIT License
365 stars 16 forks source link

Deferring the setup of the plugin #17

Closed thygrrr closed 1 year ago

thygrrr commented 1 year ago

Partially fixes https://github.com/Maran23/script-ide/issues/16

The deferred setup, and avoiding to do work in _process before deferred setup has occurred, helps reduce the error messages seen in the described issue:

Godot Engine v4.1.2.stable.official (c) 2007-present Juan Linietsky, Ariel Manzur & Godot Contributors.
--- Debug adapter server started ---
--- GDScript language server started ---
  Timer was not added to the SceneTree. Either add it or set autostart to true.
  Parent node is busy setting up children, `add_child()` failed. Consider using `add_child.call_deferred(child)` instead.
  scene/main/window.cpp:1565 - Condition "!is_inside_tree()" is true.
Maran23 commented 1 year ago

Thanks for the PR! Yeah, the Timer issue is weird. I will test this PR soon and give feedback :)

Maran23 commented 1 year ago

One quick question: Is the deferring really needed in _exit_tree()?

thygrrr commented 1 year ago

One quick question: Is the deferring really needed in _exit_tree()?

I don't think it is necessary, with added info now I think it's 50/50 between making it better vs making it worse given recent changes in 4.2 that perform a lot of operations after some modal dialogs, such as mesh upgrading, etc.

Maran23 commented 1 year ago

I see. I only get Timer was not added to the SceneTree. Either add it or set autostart to true. in 4.2.beta3. So seems like deferring is not needed anymore?

sepTN commented 1 year ago

The

"Timer was not added to the SceneTree. Either add it or set autostart to true."

error bug is still happening to me in 4.2.beta4

Maran23 commented 1 year ago

Fixed in https://github.com/Maran23/script-ide/pull/19 Thanks @thygrrr and @hydescarf for your hints! With Godot 4.2 beta I get no errors anymore. With Godot 4.1.3, I only get the index errors, but since they are fixed in 4.2, I guess we are good to go.