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

Failure to import .blend with Blender package from Arch Linux #76338

Closed
snoopdouglas opened this issue Apr 22, 2023 · 27 comments · Fixed by #81194
Closed

Failure to import .blend with Blender package from Arch Linux #76338

snoopdouglas opened this issue Apr 22, 2023 · 27 comments · Fixed by #81194

Comments

@snoopdouglas
Copy link
Contributor

snoopdouglas commented Apr 22, 2023

Godot version

4.0.2-stable

System information

Fedora 37

Issue description

This is related to #67275. I noticed my .blend imports failing after my recent upgrade from Blender 3.3.1 to 3.5.0.

Blender 3.5 hasn't yet been discussed in that issue, and so @lyuma suggested this may be a different problem to the ones we've experienced between 3.0 & 3.4.

I have also confirmed this isn't a problem with Blender 3.4.1.

Screenshot from 2023-04-22 10-05-26

As is the case with #67275, the import keeps happening on a loop, which prevents me from working because the import modal repeatedly pops up:

Screenshot from 2023-04-22 10-05-09

Aside: it'd be useful to be able to debug this from the production editor build, perhaps by dumping Blender stderr into .godot/ somewhere.

Steps to reproduce

  • Ensure Blender 3.5 is installed + configured for Godot and that imports are enabled on the current project
  • Add any .blend file to the project

You'll need to keep mashing Ctrl+Q to get the editor to quit after this.

Minimal reproduction project

src.zip

@Cthuflu
Copy link

Cthuflu commented May 5, 2023

Some additional logging (using the Overgrown Subway Scene project) and a build of master at d023e51 on Fedora 37 with Blender 3.5 reveals that the same error occurs for every model with

Blender 3.5.0 (hash unknown built 2023-04-06 00:00:00)
BLT_lang_init: 'locale' data path for translations not found, continuing
Read prefs: /home/jacob/.config/blender/3.5/config/userpref.blend
Read blend: /home/jacob/Projects/Games/Overgrown Subway Scene/outside_walls/outside_walls.blend
Error: Python: Traceback (most recent call last):
  File "<string>", line 9, in <module>
  File "/usr/share/blender/3.5/scripts/modules/bpy/ops.py", line 113, in __call__
    ret = _op_call(self.idname_py(), None, kw)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: Calling operator "bpy.ops.export_scene.gltf" error, could not be found

Blender quit
ERROR: Condition "err != OK" is true. Returning: ERR_FILE_CANT_OPEN
   at: append_from_file (modules/gltf/gltf_document.cpp:7431)                                                                                                                                                                                 
ERROR: Error importing 'res://outside_walls/outside_walls.blend'.
   at: _reimport_file (editor/editor_file_system.cpp:2033)

@Cthuflu
Copy link

Cthuflu commented May 5, 2023

Core add-ons got missed, oops. This was fixed a few days ago for Fedora 38, but it had not been fixed in Fedora 37 before I upgraded.

This is happening because godot is expecting a plugin like io_scene_gltf2 to exist and be enabled, as it's usually packaged by default. However, blender recently restructured their source repository which seems to have removed the addons git submodule; which the package maintainers missed during this update.

@MartinHaeusler
Copy link

As @lyuma asked for it in another ticket, here's a minimal Godot project which reproduces the problem. Apologies for the file size (25MB zipped, around 80MB unzipped), the bug occurred for me for this particular mesh. Everybody should be able to grab the project here:

https://drive.google.com/file/d/1x0qtp9gOUEhcNYNqRqXPATD7WDu2dPmC/view?usp=sharing

This is what the project looks like for me:

image

There are several issues with this minimal project for me:

  • "gothicWindow1.blend" imports just fine, but "grandLibrary_01.blend" does not. I've verified that the file opens correctly in Blender 3.5.1 and it is fine (some missing textures aside). I haven't been able to discern the decisive difference between these two files.
    • The error log says:

      modules/gltf/gltf_document.cpp:7431 - Condition "err != OK" is true. Returning: ERR_FILE_CANT_OPEN
      Error importing 'res://grandLibrary_01.blend'.

  • Whenever the Godot window loses focus and regains focus, it attempts to reimport the "grandLibrary_01.blend" again.

My Setup:

  • OS: Windows 10 x64
  • CPU: AMD Ryzen 7 3700X
  • GPU: RTX 3080
  • RAM: 32 GB
  • Godot: v4.0.3.stable.mono.official [5222a99]
  • Blender: 3.5.1

I do have multiple blender installations floating around on my machine, is that a problem? I specified the 3.5.1 version in the Godot settings. I had to disable and re-enable the "Blender" import plugin to make Godot recognize the *.blend files at all.

@Zireael07
Copy link
Contributor

Does the library blend import if you rename it to something w/o underscore?

@MartinHaeusler
Copy link

@Zireael07 no, haven't tried that. Would be really funny if that were the case. I can try it when I get home after work today.

@MartinHaeusler
Copy link

@Zireael07 I've tried renaming the file by removing the underscore, unfortunately the behavior is still the same. So that wasn't the cause.

@ShawkMusic
Copy link

I'm getting this error in Godot 4.1.1 with Blender 3.6.0

It seemed to be working before, although I don't know if that was because I was on Godot 4.1 or an earlier version of Blender, or something else entirely.

@nano13
Copy link

nano13 commented Jul 30, 2023

Pretty much the same issue here, the error message looks slightly different for me:

ERROR: Condition "err != OK" is true. Returning: ERR_FILE_CANT_OPEN
   at: append_from_file (modules/gltf/gltf_document.cpp:7447)
ERROR: Error importing 'res://Models/suzuki_motorbike_wheel_front.blend'.
   at: _reimport_file (editor/editor_file_system.cpp:2044)
Blender 3.6.0 (hash c7fc78b81ecb built 2023-07-07 13:20:07)
Read prefs: "/home/samuel/.config/blender/3.6/config/userpref.blend"
Read blend: "/home/samuel/programmierung/godot/GodotFirstPersonController/Models/suzuki_motorbike_wheel_rear.blend"
Error: Python: Traceback (most recent call last):
  File "<string>", line 9, in <module>
  File "/usr/share/blender/3.6/scripts/modules/bpy/ops.py", line 113, in __call__
    ret = _op_call(self.idname_py(), None, kw)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Converting py args to operator properties: : keyword "export_nla_strips" unrecognized

Blender quit

Godot version

v4.2.dev.custom_build [https://github.com/godotengine/godot/commit/75f9c97deaa8378477441e07ea1782ecab6d2eca]
System information

Godot v4.2.dev (75f9c97) - Arch Linux #1 SMP PREEMPT_DYNAMIC Mon, 24 Jul 2023 20:19:38 +0000 - X11 - Vulkan (Forward+) - dedicated AMD Radeon RX 5500 XT () - AMD Ryzen 7 2700X Eight-Core Processor (16 Threads)

@ShawkMusic
Copy link

Testing this, I was previously using Blender through pacman (v3.6.0), but the Blender flatpak (v3.6.1) seems to not have this issue. I wonder if this is because of the slightly newer version or because of the packaging format. (flatpak vs system package manager)

@nano13 If you want to solve this issue now and don't mind using flatpak, install the org.blender.Blender flatpak and set the "Blender 3 Path" in Godot's editor settings to /var/lib/flatpak/app/org.blender.Blender/x86_64/stable/active/files/blender/

@cg9999
Copy link
Contributor

cg9999 commented Aug 1, 2023

Arch linux blender package currently in testing (3.6.1-1) doesn't have this issue anymore. Earlier version had the
keyword "export_nla_strips" unrecognized error message printed.

@rcorre
Copy link
Contributor

rcorre commented Aug 26, 2023

On blender 3.6.2-1 on ArchLinux (from extra, not testing), I still get:

  File "/usr/share/blender/3.6/scripts/modules/bpy/ops.py", line 113, in __call__
    ret = _op_call(self.idname_py(), None, kw)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Converting py args to operator properties: : keyword "export_nla_strips" unrecognized

This happens in a loop, and each re-import opens a new external editor instance, filling the screen with windows.

@akien-mga akien-mga changed the title Failure to import .blend with Blender 3.5 Failure to import .blend with Blender package from Arch Linux Aug 28, 2023
@akien-mga
Copy link
Member

See #79881. So far all reports point to the Blender package from Arch Linux being problematic.
One of you should report a bug to the Arch Linux maintainers so they can fix their package.

The workaround is to download Blender from blender.org, which works fine.

@snoopdouglas
Copy link
Contributor Author

Just mentioning - my original report was from Fedora 37. Unsure whether these share the RPM source somehow though, or whether this issue was repurposed.

@akien-mga
Copy link
Member

My bad, I overlooked this. I guess this ticket is now being repurposed :P

The problem with Arch is likely similar to the problem Fedora 37 briefly had, where they were not including all core addons. Arch and Fedora don't share package sources but it might be that a missing build dependency or build option leads to not compiling all Blender addons we need (here notably glTF export stuff I suppose).

@rcorre
Copy link
Contributor

rcorre commented Aug 28, 2023

here notably glTF export stuff I suppose

FWIW, the GLTF plugin is installed and I can manually export GLTF from the blender UI. I can also export with a minimized version of the script Godot uses:

import bpy, sys
if bpy.app.version < (3, 0, 0):
  print('Blender 3.0 or higher is required.', file=sys.stderr)
bpy.ops.wm.open_mainfile(filepath='/tmp/Club.blend')
bpy.ops.export_scene.gltf(filepath='/tmp/out.glb')
[rcorre@junon agos]$ blender -b -P  /tmp/export.py 
Blender 3.6.2 (hash ffe93138751e built 2023-08-16 20:14:29)
Read prefs: "/home/rcorre/.config/blender/3.6/config/userpref.blend"
Failed to open dir (No such file or directory): /run/user/1000/gvfs/
Read blend: "/tmp/Club.blend"
15:13:27 | INFO: Draco mesh compression is available, use library at /usr/lib/python3.11/site-packages/libextern_draco.so
15:13:27 | INFO: Starting glTF 2.0 export
15:13:27 | INFO: Extracting primitive: Cylinder.001
15:13:27 | INFO: Primitives created: 2
15:13:27 | INFO: Finished glTF 2.0 export in 0.009274721145629883 s


Blender quit
[rcorre@junon agos]$ file /tmp/out.glb 
/tmp/out.glb: glTF binary model, version 2, length 36356 bytes

However, the following fails:

import bpy, sys
if bpy.app.version < (3, 0, 0):
  print('Blender 3.0 or higher is required.', file=sys.stderr)
bpy.ops.wm.open_mainfile(filepath='/tmp/Club.blend')
bpy.ops.export_scene.gltf(filepath='/tmp/out.glb',export_nla_strips=True)
TypeError: Converting py args to operator properties: : keyword "export_nla_strips" unrecognized

The docs do list export_nla_strips as a parameter, so I'm not sure what the issue is.

@rcorre
Copy link
Contributor

rcorre commented Aug 29, 2023

Aha! Found this in https://projects.blender.org/blender/blender-addons:

commit 96a73cb664bca687b7ea2e464c4d08f8082d5012
Author: Julien Duroure <julien.duroure@gmail.com>
Date:   Tue May 23 16:12:03 2023 +0200

    glTF exporter: keep backward compatibility for export options

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 0d50f4ad..a469c81e 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -4,7 +4,7 @@
 bl_info = {
     'name': 'glTF 2.0 format',
     'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
-    "version": (3, 6, 21),
+    "version": (3, 6, 22),
     'blender': (3, 5, 0),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
@@ -601,6 +601,19 @@ class ExportGLTF2_Base(ConvertGLTF2_Base):
         default=False
     )
 
+    # This parameter is only here for backward compatibility, as this option is removed in 3.6
+    # This option does nothing, and is not displayed in UI
+    # What you are looking for is probably "export_animation_mode"
+    export_nla_strips: BoolProperty(
+        name='Group by NLA Track',
+        description=(
+            "When on, multiple actions become part of the same glTF animation if "
+            "they're pushed onto NLA tracks with the same name. "
+            "When off, all the currently assigned actions become one glTF animation"
+        ),
+        default=True
+    )
+
     will_save_settings: BoolProperty(
         name='Remember Export Settings',
         description='Store glTF export settings in the Blender project',

The parameter was removed recently, but re-added in even more recent addon versions for backwards compat.
I think we want export_animation_mode=NLA_TRACKS going forward. I can open a PR.

@telmotrooper
Copy link

In line with @ShawkMusic's suggestion, a simple workaround on Arch Linux is to download Blender 3.6.2 directly from their website, extract the "tar.xz" file with tar xfv blender-3.6.2-linux-x64.tar.xz and point Godot to that folder (in "Editor > Editor Settings... > FileSystem > Import > Blender 3 Path").

@marcinn1
Copy link

marcinn1 commented Sep 24, 2023

See #79881. So far all reports point to the Blender package from Arch Linux being problematic.

Regardless, Godot should not try to import these in a infinite loop.

EDIT: This issue is not related to .blend files only. Any file, for which the import fails, is getting into loop.

@MartinHaeusler
Copy link

One more insight: the model that didn't import for me in Godot is using the Blender Asset Library feature. Could this be the cause?

@rcorre
Copy link
Contributor

rcorre commented Sep 24, 2023

The comment in #81194 explains more, but to clarify, this is not specific to ArchLinux. This is specific to a certain range of blender versions that removed the export_nla_strips parameter. Arch happened to package a version within that range.

More recent versions add that back for "backwards compatibility", but the re-added parameter does nothing (so it's not really backwards compatible).

the model that didn't import for me in Godot is using the Blender Asset Library feature. Could this be the cause?

If you see keyword "export_nla_strips" unrecognized, then no. Blender import will fail on all blend files.

@akien-mga akien-mga added this to the 4.2 milestone Oct 2, 2023
@TheIndiv
Copy link

TheIndiv commented Oct 2, 2023

image
I'm having the same issue.
I've tried with Blender 3.3.0, 3.4.1, 3.5.0, 3.6.4
Always the same problem.

Godot v4.1.1.stable - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 Laptop GPU (NVIDIA; 31.0.15.3667) - 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz (16 Threads)

@rcorre
Copy link
Contributor

rcorre commented Oct 3, 2023

@TheIndiv can you try master as of 7e64c6c? If that doesn't work, can you open a new issue with an example project?

mandryskowski pushed a commit to mandryskowski/godot that referenced this issue Oct 11, 2023
Fixes godotengine#76338.

Blender 3.6 imports fail with:

```
TypeError: Converting py args to operator properties: : keyword "export_nla_strips" unrecognized
```

The `export_nla_strips` flag was removed and replaced with `export_animation_mode`.
In 3.6.0-3.6.21, this option does not exist at all and causes the failure above.
In 3.6.22, this option was re-added, but does nothing.
See https://projects.blender.org/blender/blender-addons/commit/96a73cb664bca687b7ea2e464c4d08f8082d5012.

We now need to check the blender version to determine what flags to use.
This adds an additional shell command before every import.
We might consider caching the version, but we'd have to invalidate the cache if the blender version or path changes.

As an aside, the "group animations" setting in Godot does the opposite of what I'd expect.
When `group_tracks=true`, each animation is exported individually.
When `group_tracks=false`, all animations are exported as a single track.
This seems backwards, but I've kept the 3.6 behavior consistent with 3.5.

From https://docs.blender.org/api/3.6/bpy.ops.export_scene.html:

> ACTIONS Actions – Export actions (actives and on NLA tracks) as separate animations.
> ACTIVE_ACTIONS Active actions merged – All the currently assigned actions become one glTF animation.

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
@felipejoribeiro
Copy link

felipejoribeiro commented Oct 22, 2023

I'm having the same problem.

Godot version= 4.1.2-1
blender version=3.6.4

The logs are these, repeating in loop:

Blender 3.6.4 (hash 21bfc5e7fe3f built 2023-09-27 00:27:16)
Read prefs: "/home/fejori/.config/blender/3.6/config/userpref.blend"
Exception in module register(): /usr/share/blender/3.6/scripts/addons/amaranth/__init__.py
Traceback (most recent call last):
  File "/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 369, in enable
    mod.register()
  File "/usr/share/blender/3.6/scripts/addons/amaranth/__init__.py", line 92, in register
    _call_globals("register")
  File "/usr/share/blender/3.6/scripts/addons/amaranth/__init__.py", line 88, in _call_globals
    getattr(m, attr_name)()
  File "/usr/share/blender/3.6/scripts/addons/amaranth/scene/refresh.py", line 53, in register
    km = kc.keymaps.new(name="Window")
         ^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'keymaps'
Read blend: "/home/user/project/assets/environment/lacume_castle.blend"
Error: Python: Traceback (most recent call last):
  File "<string>", line 9, in <module>
  File "/usr/share/blender/3.6/scripts/modules/bpy/ops.py", line 113, in __call__
    ret = _op_call(self.idname_py(), None, kw)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Converting py args to operator properties: : keyword "export_nla_strips" unrecognized

Blender quit
ERROR: Condition "err != OK" is true. Returning: ERR_FILE_CANT_OPEN
   at: append_from_file (modules/gltf/gltf_document.cpp:7433)
ERROR: Error importing 'res://assets/environment/lacume_castle.blend'.
   at: _reimport_file (editor/editor_file_system.cpp:2044)

@felipejoribeiro
Copy link

I was able to get it working with Godot 4.1.2-1 by:

  • Downloading blender version 3.6.1 from this link;
  • Extracting it somewhere and making godot use this version when importing .blend files, by adding the path to the extracted files in the Godot import configurations;

Not a real solution though. This new blender's version keeps crashing Godot.

@rcorre
Copy link
Contributor

rcorre commented Oct 22, 2023

@akien-mga any chance this can get backported to 4.1? Are there plans for another 4.1 patch before 4.2 comes out?

@akien-mga
Copy link
Member

Yes, that's what the cherrypick:4.1 label means on the PR.

@rcorre
Copy link
Contributor

rcorre commented Oct 22, 2023

Ah, sorry! I saw the 4.2 milestone on the issue and assumed it was just 4.2. Thanks!

ProbablyWorks pushed a commit to ProbablyWorks/godot that referenced this issue Oct 22, 2023
Fixes godotengine#76338.

Blender 3.6 imports fail with:

```
TypeError: Converting py args to operator properties: : keyword "export_nla_strips" unrecognized
```

The `export_nla_strips` flag was removed and replaced with `export_animation_mode`.
In 3.6.0-3.6.21, this option does not exist at all and causes the failure above.
In 3.6.22, this option was re-added, but does nothing.
See https://projects.blender.org/blender/blender-addons/commit/96a73cb664bca687b7ea2e464c4d08f8082d5012.

We now need to check the blender version to determine what flags to use.
This adds an additional shell command before every import.
We might consider caching the version, but we'd have to invalidate the cache if the blender version or path changes.

As an aside, the "group animations" setting in Godot does the opposite of what I'd expect.
When `group_tracks=true`, each animation is exported individually.
When `group_tracks=false`, all animations are exported as a single track.
This seems backwards, but I've kept the 3.6 behavior consistent with 3.5.

From https://docs.blender.org/api/3.6/bpy.ops.export_scene.html:

> ACTIONS Actions – Export actions (actives and on NLA tracks) as separate animations.
> ACTIVE_ACTIONS Active actions merged – All the currently assigned actions become one glTF animation.

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
YuriSizov pushed a commit to YuriSizov/godot that referenced this issue Oct 24, 2023
Fixes godotengine#76338.

Blender 3.6 imports fail with:

```
TypeError: Converting py args to operator properties: : keyword "export_nla_strips" unrecognized
```

The `export_nla_strips` flag was removed and replaced with `export_animation_mode`.
In 3.6.0-3.6.21, this option does not exist at all and causes the failure above.
In 3.6.22, this option was re-added, but does nothing.
See https://projects.blender.org/blender/blender-addons/commit/96a73cb664bca687b7ea2e464c4d08f8082d5012.

We now need to check the blender version to determine what flags to use.
This adds an additional shell command before every import.
We might consider caching the version, but we'd have to invalidate the cache if the blender version or path changes.

As an aside, the "group animations" setting in Godot does the opposite of what I'd expect.
When `group_tracks=true`, each animation is exported individually.
When `group_tracks=false`, all animations are exported as a single track.
This seems backwards, but I've kept the 3.6 behavior consistent with 3.5.

From https://docs.blender.org/api/3.6/bpy.ops.export_scene.html:

> ACTIONS Actions – Export actions (actives and on NLA tracks) as separate animations.
> ACTIVE_ACTIONS Active actions merged – All the currently assigned actions become one glTF animation.

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
(cherry picked from commit 7e64c6c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.