Poikilos / io_import_x

Import/export .x files in Blender 3.0 (and some earlier versions). The *Poikilos fork* attempts to maintain compatibility with the latest stable Blender and allows install via GUI (Click "Code", "Download ZIP"--See "Install" in readme for the rest of the steps). Related project (also recently updated): https://github.com/ldo/blender-addons-orphaned
GNU General Public License v3.0
32 stars 9 forks source link

Add support for blender 2.8 and python 3.8 #1

Closed egore closed 3 years ago

egore commented 4 years ago

This branch enables io_import_x to use blender 2.8 APIs as well as bringing compatibility with python 3.8 (while being compatible with earlier python versions)

Poikilos commented 4 years ago

Hi! Thanks for the PR. Do you know anything about why I'm getting:

Traceback (most recent call last):
  File "/home/owner/.config/blender/2.83/scripts/addons/io_import_x/__init__.py", line 237, in execute
    return import_x.load(self, context, **keywords)
  File "/home/owner/.config/blender/2.83/scripts/addons/io_import_x/import_x.py", line 1015, in load
    import_dXtree(rootTokens, item_file.name)
  File "/home/owner/.config/blender/2.83/scripts/addons/io_import_x/import_x.py", line 699, in import_dXtree
    ob = [parentname, Matrix() * global_matrix, []]
TypeError: Element-wise multiplication: not supported between 'Matrix' and 'Matrix' types

when I load minetest/games/Bucket_Game/mods/codercore/default/models/ from Bucket_Game.zip under "Games and Worlds" at downloads.minetest.org? It is a hand-edited x file (2 copies of mesh with different UV maps or something like that).

See also (in same zip):

I am using Blender 2.83.1. What version do you have?

Poikilos commented 3 years ago

@egore I need more information about why it doesn't work and what version you used.

CravenWarrior3 commented 3 years ago

I was browsing around and found that this tool was still "somewhat" relevant. I'll be in need of an importer/exporter for .x files in the near future so if they never decide to show up and give any information I could try to debug the code myself if you need any help with it.

NarryG commented 3 years ago

I'm also having issues with this PR as well. I'm trying to import one of the models from BugSnax (devs provided all the models with bones & animations) and I'm getting errors. I'm on 2.9.1

Python: Traceback (most recent call last):
  File "C:\Users\Daniel\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_import_x-master\__init__.py", line 237, in execute
    return import_x.load(self, context, **keywords)
  File "C:\Users\Daniel\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_import_x-master\import_x.py", line 1015, in load
    import_dXtree(rootTokens, item_file.name)
  File "C:\Users\Daniel\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_import_x-master\import_x.py", line 708, in import_dXtree
    child = import_dXtree(getChilds(tokenname), lvl + 1)
  File "C:\Users\Daniel\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_import_x-master\import_x.py", line 658, in import_dXtree
    ob = getMesh(parentname, tokenname)
  File "C:\Users\Daniel\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\io_import_x-master\import_x.py", line 841, in getMesh
    mat.diffuse_color = diffuse_color
ValueError: bpy_struct: item.attr = val: sequences of dimension 0 should contain 4 items, not 3

location: <unknown location>:-1
Poikilos commented 3 years ago

I was browsing around and found that this tool was still "somewhat" relevant. I'll be in need of an importer/exporter for .x files in the near future so if they never decide to show up and give any information I could try to debug the code myself if you need any help with it.

@CravenWarrior3 Yes, at this point I need help. Once I start to make or fix Blender add-on, the API changes, so I'm not very familiar with Blender 2.8+ especially when it comes to materials, and I don't know whether 2.91 is similar (hopefully the API is stabilizing). If you/anyone fork his repo and offer a different PR that would be most helpful.

Poikilos commented 3 years ago

I figured out how to fix the additional issues (tested in 2.8 at least) so I'll merge then add my fixes. Thanks.