Giter Club home page Giter Club logo

Comments (5)

nospoone avatar nospoone commented on August 12, 2024 6

@alessandrofama I realize this isn't strictly related to your addon (which is incredible by the way! thank you for it!) but I figured that I'd post here anyways since this is what started my investigation. It still does revolve around addons and importing, though!


Hello! I've decided to dive deep to try an understand why this happens (as it also seems to happen for other people on other addons as well.) I've figured out the issue and potential workarounds, as we will explore together below.

tl;dr

There's an engine "bug" that prevents Godot from properly importing resources when it first runs, but only in headless mode. It can be worked around, but other issues arise. The issue present above is actually two issues in one!

investigation

As you already know, Godot needs to import files whenever you add things to the project. In this case, it's the FMOD addon. When it does, it creates metadata in the .godot/imported folder, which Godot uses to figure out what these files are and what they do.

However, when we push our project to CI, this folder does not exist! This is because the official documentation is clear about the fact that we need to omit the .godot folder. In theory, this shouldn't be an issue because when the project is first opened (for example, on a fresh clone) the editor will run through the unimported files and import them.

For some odd reason, it seems the --headless -quit (or a permutation of these) version of the editor exits early and isn't able to properly import things (related but different issue.) The real fix for this is implementing an --import command, which has a proposal here. There were two attempts at making this work:

While none of these provide a clear resolution, we can start to see a path to a solution. I'd love to try and tackle this myself, but at only week 4 of using the engine (and my cpp skills dating back to the early 00s) I'm not sure I'll be able to figure it out alone.

The main workaround, however, is just having the editor launch one time without exporting the project, closing it, and then exporting. This works on my medium-size project without this plugin enabled, but with another non-GDExtension plugin. As soon as I add the FMOD plugin, the project stops building and the editor throws this: handle_crash: Program crashed with signal 11.

While the workaround gets the import part working, it seems that the editor has further problems with loading addons. Looking at my project's log right after the reimport reveals this:

Relevant Log Lines
   ERROR: Script does not inherit from Node: res://addons/dialogue_manager/dialogue_manager.gd.
     at: _create_autoload (editor/editor_autoload_settings.cpp:423)
  ERROR: Condition "!info->node" is true. Continuing.
     at: update_autoload (editor/editor_autoload_settings.cpp:551)
  ERROR: Script does not inherit from Node: res://addons/FMOD/runtime/fmod_runtime_manager.gd.
     at: _create_autoload (editor/editor_autoload_settings.cpp:423)
  ERROR: Condition "!info->node" is true. Continuing.
     at: update_autoload (editor/editor_autoload_settings.cpp:551)
  ERROR: Condition "nc == 0" is true. Returning: nullptr
     at: instantiate (scene/resources/packed_scene.cpp:92)
  SCRIPT ERROR: Invalid set index 'editor_plugin' (on base: 'null instance') with value of type 'EditorPlugin (plugin.gd)'.

Also, right after the project is packed (from what I understand anyways):

Relevant Log Lines
  ERROR: Condition "!named_globals.has(p_name)" is true.
     at: remove_named_global_constant (modules/gdscript/gdscript.cpp:2047)
  ERROR: Condition "!named_globals.has(p_name)" is true.
     at: remove_named_global_constant (modules/gdscript/gdscript.cpp:2047)
  ERROR: Script does not inherit from Node: res://addons/FMOD/runtime/fmod_runtime_manager.gd.
     at: _create_autoload (editor/editor_autoload_settings.cpp:423)
  ERROR: Condition "!info->node" is true. Continuing.
     at: update_autoload (editor/editor_autoload_settings.cpp:551)
  ERROR: Attempt to disconnect a nonexistent connection from 'FileSystem:FileSystemDock#573462047246'. Signal: 'files_moved', callable: 'EditorPlugin(plugin.gd)::_on_files_moved'.
     at: _disconnect (core/object/object.cpp:1355)
  ERROR: Attempt to disconnect a nonexistent connection from 'FileSystem:FileSystemDock#573462047246'. Signal: 'file_removed', callable: 'EditorPlugin(plugin.gd)::_on_file_removed'.
     at: _disconnect (core/object/object.cpp:1355)
  ERROR: Condition "!named_globals.has(p_name)" is true.
     at: remove_named_global_constant (modules/gdscript/gdscript.cpp:2047)
  WARNING: Scan thread aborted...
       at: _notification (editor/editor_file_system.cpp:1224)
  ERROR: Attempt to remove unregistered singleton: FMODStudioModule
     at: unregister_singleton (core/core_bind.cpp:1641)
  
  ================================================================
  handle_crash: Program crashed with signal 11
  Engine version: Godot Engine v4.1.1.stable.official (bd6af8e0ea69167dd0627f3bd54f9105bda0f8b5)
  Dumping the backtrace. Please include this when reporting the bug to the project developer.
  [1] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7fb84ac42520] (??:0)
  [2] unregister_fmod_types(godot::ModuleInitializationLevel) (??:0)
  [3] godot::GDExtensionBinding::deinitialize_level(void*, GDExtensionInitializationLevel) (??:0)
  [4] /home/runner/.local/share/godot/godot_executable/Godot_v4.1.1-stable_linux.x86_64() [0x47d570c] (??:0)
  [5] /home/runner/.local/share/godot/godot_executable/Godot_v4.1.1-stable_linux.x86_64() [0xe468dd] (??:0)
  [6] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7fb84ac29d90] (??:0)
  [7] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7fb84ac29e40] (??:0)
  [8] /home/runner/.local/share/godot/godot_executable/Godot_v4.1.1-stable_linux.x86_64() [0xe777ae] (??:0)
  -- END OF BACKTRACE --
  ================================================================

While this is still related to importing, we can see that the FMOD GDExtension is throwing here. Whether this is because of the actual extension or an editor bug related to the one above, I don't know. My next steps are investigation these two options! I will then open a bug if necessary on the godot repository.

reimport workarounds

I found a couple possible reimport workarounds, some uglier than others:

Funnily enough, the action you used actually has one of the workarounds in place but only for non-mono builds, it seems. However, this still fails for me because of the error mentioned above. I tried adding the timeout hack to your linked repository but couldn't make it work. I hope this can be of use to you, and I will try and implement the workarounds myself and see where this puts me.

Good luck and sorry for the essay! 🀠

from fmod-for-godot.

alessandrofama avatar alessandrofama commented on August 12, 2024 3

Hey, thanks for digging into this mess! This whole importing issue has been a real pain in the ass. I've even had to tell users to restart the editor after they copy the plugin files to the project. It's a terrible user experience, to be honest.

I'm wondering if those missing types/identifiers in the runtime manager are because Godot hasn't loaded the shared library yet. These types are registered in C++. What do you think?

I'm not sure what's up with those missing metadata in the icons (the error message doesn't say much), but I'm sure it'll be an easy fix once we figure out what's missing.

That crash with the unregistered singleton is bizarre, right? I haven't seen it when running the editor. You can check out the GDExtension classes being registered here: GitHub link. Maybe not deleting the FMOD studio module instance could help in your case.

In general, I think this is more of a Godot problem, and there's not much I can do except try to squash the bugs that are stopping exports. I'll dive into the singleton crash, which seems to be the biggest roadblock. If this is fixed trying the workaround suggested by @nospoone (opening and closing the editor once before exporting) should work?

from fmod-for-godot.

atadenizoktay avatar atadenizoktay commented on August 12, 2024 2

With Godot v4.2.2, the command-line export pipeline is improved. It now includes a --import command to properly import everything, and it is even included by default in --export-release and --export-debug commands. More information about it can be found here. Unfortunately, this still does not fix the issue mentioned above.

I would be happy to hear more about this issue. Including the .godot folder in the repository allows my project to successfully export a build. Still, as mentioned here the Godot documentation, it is not suggested.

from fmod-for-godot.

GabLeRoux avatar GabLeRoux commented on August 12, 2024

I think there's still a few things to fix on the main branch on the linked project because I see some problems about export templates, but I think the FMOD problem will still happen when these export problems get fixed.

from fmod-for-godot.

alessandrofama avatar alessandrofama commented on August 12, 2024

I'm closing this issue as I won't be able to work on this anymore. I'm sorry I couldn't look at this in more detail. Cheers.

from fmod-for-godot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.