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

3D map editor unusable #2

Closed
UltraBlackLinux opened this issue Aug 12, 2024 · 17 comments
Closed

3D map editor unusable #2

UltraBlackLinux opened this issue Aug 12, 2024 · 17 comments
Assignees

Comments

@UltraBlackLinux
Copy link

whenever I try to open a map with the 3D map editor, I get this:

CRITICAL - NotImplementedError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/lib/python3.11/site-packages/amulet_map_editor/api/framework/pages/world_page.py", line 178, in _enable_page
    self.GetPage(page).enable()
  File "/app/lib/python3.11/site-packages/amulet_map_editor/programs/edit/edit.py", line 69, in enable
    self._canvas = EditCanvas(self, self._world)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/amulet_map_editor/programs/edit/api/canvas/edit_canvas.py", line 150, in __init__
    super().__init__(parent, world)
  File "/app/lib/python3.11/site-packages/amulet_map_editor/programs/edit/api/canvas/base_edit_canvas.py", line 63, in __init__
    super().__init__(parent)
  File "/app/lib/python3.11/site-packages/amulet_map_editor/api/opengl/canvas/event_canvas.py", line 15, in __init__
    super().__init__(parent)
  File "/app/lib/python3.11/site-packages/amulet_map_editor/api/opengl/canvas/canvas.py", line 41, in __init__
    display_attributes = GLAttributes()
                         ^^^^^^^^^^^^^^
SystemError: <class 'wx._glcanvas.GLAttributes'> returned a result with an exception set

Really no idea why I get this, but I hope you can fix that ;)
Thanks!

@EvilSupahFly
Copy link
Owner

Looks like I need to do more testing when I get home. I was using a virtual machine for testing different distributions, but I think I'll have to switch to physical machines. What version of Linux are you running, and what's your video card?

@EvilSupahFly EvilSupahFly self-assigned this Aug 12, 2024
@EvilSupahFly
Copy link
Owner

I believe #1 is related as it looks like the FreeGLUT libraries and headers didn't get bundled when testing on the VMs. Once this is resolved, I'll do some independent testing outside of VMs on a couple of spare rigs I'm installing different distros on and we'll go from there.

@UltraBlackLinux
Copy link
Author

What version of Linux are you running, and what's your video card?

Arch Linux, RX 6700XT, linux-lts in case it matters

@EvilSupahFly
Copy link
Owner

Well, I thought it might make a difference, and I made a bunch of changes, but it's still crashing.

See my pastebin log here if you're curious.

@gentlegiantJGC
Copy link

Looks like an implicit constructor.
I still don't know what in the C++ code would be causing an error. It is just initialising a vector and bool.

@EvilSupahFly
Copy link
Owner

I think it's related to the OpenGL implementation inside Flatpak sandboxes. I'm trying something different when I get home today, and we'll see what happens. Evidently, they've discontinued and replaced the OpenGL.Default call which is supposed to give you access to the default rendering device.

@EvilSupahFly
Copy link
Owner

Or perhaps not? The Flatpak builder uses PIP to grab Amulet and all it's assorted dependencies, so I created a new VENV and installed Amulet with PIP myself, and it fails to run (see Amulet-Team/Amulet-Map-Editor#1093), so now I don't know. I'll make a clean VENV and try running Amulet's setup.py for comparison to see what's different.

@gentlegiantJGC
Copy link

I did tweak the opengl initialisation recently so I may have broken something.
The missing symbol error is definitely not an issue with Amulet

@EvilSupahFly
Copy link
Owner

I have a post open on the wxPython forums to try and get to the bottom of this, and I'll update this as information is made available.

@EvilSupahFly
Copy link
Owner

So, I got Amulet to run from a PIP install by changing the version of Python running it, then checked the modules PIP installed with Amulet (I haven't installed anything else in this VENV):

(amulet-py-319) evilsupahfly on Black-Beast at Thu 15 Aug 2024 18:04:37 EDT
[~/Downloads/Python/Python-3.9.19] python --version
Python 3.9.19
(amulet-py-319) evilsupahfly on Black-Beast at Thu 15 Aug 2024 18:08:58 EDT
[~/Downloads/Python/Python-3.9.19] pip list
Package                 Version
----------------------- -------
amulet-core             1.9.25
amulet-leveldb          1.0.2
amulet-map-editor       0.10.35
amulet-nbt              2.1.3
lz4                     4.3.3
minecraft-resource-pack 1.4.3
mutf8                   1.0.6
numpy                   1.26.4
packaging               24.1
pillow                  10.4.0
pip                     24.2
platformdirs            3.11.0
portalocker             2.10.1
PyMCTranslate           1.2.27
PyOpenGL                3.1.7
setuptools              58.1.0
six                     1.16.0
wxPython                4.2.1

So, I'm going to try rebuilding the Flatpak using these specific packages and versions and see what happens.

@EvilSupahFly
Copy link
Owner

Installing Amulet with PIP in Python 3.11.9 (which is what Flatpak uses) and running after install: No problems

Screenshot from 2024-08-15 23-04-29

I did have to tweak requirements.txt in order to fix several "Module [blah] not found" errors, but having resolved those, it's now building the flatpack on my test machine as I type this, so I will hopefully have a useable flatpak in the morning.

@EvilSupahFly
Copy link
Owner

EvilSupahFly commented Aug 16, 2024

The Flatpak still crashes, so I'm going try using the 22.08 version of the SDK, instead of the 23.08 because it uses an older version of Python. I also feel like my OpenGL implementation is somehow incomplete even though according to the official documentation, I should only need to include --device=dri since Amulet already has OpenGL implementations included. Something is being lost in translation and I feel like it's related to the sandboxing inside the Flatpak environment.

@EvilSupahFly
Copy link
Owner

EvilSupahFly commented Aug 16, 2024

So, I've added some things to the recipe that I hope will future-proof updates while remaining (mostly) backwards compatible:

finish-args:
  - --env=GDK_BACKEND=x11
  - --env=GDK_BACKEND=wayland
(...)
modules:
  - name: python
    buildsystem: simple
    sources:
      - type: git
        url: https://github.com/python/cpython.git
        tag: v3.11.0
  - name: opengl
    buildsystem: cmake
    sources:
      - type: git
        url: https://github.com/KhronosGroup/OpenGL-Registry.git
        tag: master
  - name: opengl-extensions
    buildsystem: cmake
    sources:
      - type: git
        url: https://github.com/KhronosGroup/OpenGL-Extension-Registry.git
        tag: master
  - name: xapp-gtk3-module
    buildsystem: meson
    sources:
      - type: git
        url: https://github.com/linuxmint/xapp.git
        tag: master
  - name: wayland
    buildsystem: cmake
    sources:
      - type: git
        url: https://gitlab.freedesktop.org/wayland/wayland.git
        tag: master
  - name: x11
    buildsystem: meson
    sources:
      - type: git
        url: https://gitlab.freedesktop.org/xorg/lib/libx11.git
        tag: 1.7.0

I'm fairly sure it should pull the build instructions for the extra modules right from GitHub, but if it doesn't, I'll manually add them.

@EvilSupahFly
Copy link
Owner

I dunno, guys. Nothing works for me. Some changes prevent the project from even building, and when I fix those, something else breaks. Then when I get everything to stop breaking and actually give me a useable .flatpak file, I'm right back to this same irritatingly fatal error.

@EvilSupahFly
Copy link
Owner

I believe this should now be resolved per my comment at Amulet-Team/Amulet-Map-Editor#1070 which basically boils down to me making a rookie mistake on my first major Flatpak build.

@EvilSupahFly
Copy link
Owner

OK, after a metric f_ck tonne of trial-and-error, and some solid guidance from bbhtt on Flathub Discourse, I'm reasonably certain all the issues have resolved.

Amulet Flatpak launches on Wayland, includes a "fallback" directive for X11, and properly loads Minecraft saves in the 3D editor.

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

No branches or pull requests

3 participants