skyslide22 / blendermania-addon

Blender addon for trackmania2020 & maniaplanet. 1 Click export & convert to .gbx.
35 stars 7 forks source link

Linux Support (Non Official) #42

Open ibaraki-douji opened 1 month ago

ibaraki-douji commented 1 month ago

Hey guys so after some times i managed to setup the Addon on a Linux Machine, so as bmx suggered in the discord (i also had the idea of making one), i'm making this issue for everyone to Share some How To and also people having issues with Linux Support.

:warning: As the title says THIS ADDON IS NOT OFFICIALY SUPPORTED FOR LINUX so if it does not work on your system don't ask everywhere for help.


How i set it up on my computer :

First i'm using Pop OS 22.04 because it was the only one i found that made Trackmania works out of the box. I'm also using an AMD GPU but it works with NVIDIA too just install the drivers before if not done already.

  1. Install Tackmania 2020 with Lutris to have a custom Wine environment for games (might work with proton but didn't try) 1.1. I downlaoded the Ubisoft Connect setup (for windows) 1.2. I Installed the Ubisoft connect through Lutris (install game from .exe) 1.3. I started the Ubisoft connect laucher and install trackmania

  2. Install blender 2.1. Downlaod the blender windows installer (v4.2 at the moment) 2.2. In lutris, select the Ubisoft connect game you installed above and click Run an exe inside winde prefix then select the blender install 2.3. Run the installer and install it 2.4. Optional: Duplicate the Ubisoft connect game (without cloning the files), and point the new game to Blender so you can start it from the menu

  3. Install Powershell 3.1. Download and run the install_pwshwrapper.exe inside the Blender wine prefix from https://github.com/PietJankbal/powershell-wrapper-for-wine 3.2. In Lutris Click Open Wine console and run powershell.exe if it works that's good and you can pass to step 4 3.3. In your Lutris games files, (default: /home/<user>/Games/<game>), go in the drive_c folder, and create a ConEmu folder. 3.4. In the ConEmu you can add the powershell64.exe file from the github (3.1.) and rename it to ConEmu64.exe 3.5. Optional: You can so the same with the 32-bit version but useless

  4. Start blender

  5. Install the addon (you can use the Z: drive to use the linux system)

  6. Locate the TM (use the C: drive since you share the same wine as Trackmania and Ubisoft connect)

  7. The Nadeoimporter should have the right version (or if you install it, it works)

  8. Try to export a cube with a material (or random thing, just export something with the addon) it should fail 8.1. By opening the HTML version you should see that at the bottom it says a xml file is missing. If this append you can continue, else you can skip to the next part. 8.2. This happen when Blender and NandoImporter don't have the same path. In the Lutris game folder run this command : find -name {user* and if you see any just make a symlink to your Documents folder inside the games files. (the symlink command for me was : ln -s /home/ibaraki/Games/ubisoft/drive_c/\{userdocs\}/ /home/ibaraki/Games/ubisoft/drive_c/users/ibaraki/Documents) 8.3. Once you fixed all the {userdocs} (i had two, one at the drive_c and one at the blender.exe folder) you should be able to use the addon

I hope this will help you to set it up on your linux systems, and feel free to reply maybe some people will help you debug your issues.

ibaraki-douji commented 1 month ago

After restarting multiple times Blender i saw a warning from the addon : image

If you also have this, a little edit of the code is needed : in the file <Lutris game>/drive_c/users/<user>/AppData/Roaming/Blender Foundation/Blender/4.2/scripts/addons/blendermania-addon/utils/Functions.py (for the <user> don't take the steamuser)

Edit the def get_documents_path() function (line 75 for me) :

def get_documents_path() -> str:
-    process = subprocess.Popen([
-        """Powershell.exe""",
-        """[environment]::getfolderpath("mydocuments")"""
-    ], stdout=subprocess.PIPE)
-    result  = process.communicate() # (b"C:\Users\User\Documents\r\n", None)

+    result = (b"C:/Users/<user>/Documents\r\n", None)
    path = result[0].decode("ascii").replace("\r\n",  "") 
    debug(path)
    return fix_slash(path)

and change <user> with yours