space928 / Blender-O3D-IO-Public

A plugin supporting blender 2.79.x-3.x.x for importing and exporting OMSI .sco, .cfg, and .o3d files
GNU General Public License v3.0
36 stars 5 forks source link

Matrix.invert(ed): matrix does not have an inverse #93

Open bimbim9 opened 3 months ago

bimbim9 commented 3 months ago

I try to import a model but i got some traceback error like this:

Traceback (most recent call last):
  File "C:\Users\HP\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Blender-O3D-IO-Public\__init__.py", line 133, in execute
    io_o3d_import.do_import(self.filepath, context, self.import_x, self.override_text_encoding, self.hide_lods)
  File "C:\Users\HP\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Blender-O3D-IO-Public\o3d_io\io_o3d_import.py", line 137, in do_import
    mesh_matrix = o3d_transform_matrix.inverted()
ValueError: Matrix.invert(ed): matrix does not have an inverse

any solution?

space928 commented 3 months ago

That's an interesting one... It seems that the model you're trying to import has a non invertible origin matrix. This is not something I expected, if you send me the o3d file in question I can probably manually fix the origin matrix so that it imports.

On Tue, 26 Mar 2024, 19:17 bimbim9, @.***> wrote:

I try to import a model but i got some traceback error like this:

Traceback (most recent call last): File "C:\Users\HP\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Blender-O3D-IO-Public__init__.py", line 133, in execute io_o3d_import.do_import(self.filepath, context, self.import_x, self.override_text_encoding, self.hide_lods) File "C:\Users\HP\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Blender-O3D-IO-Public\o3d_io\io_o3d_import.py", line 137, in do_import mesh_matrix = o3d_transform_matrix.inverted() ValueError: Matrix.invert(ed): matrix does not have an inverse

any solution?

— Reply to this email directly, view it on GitHub https://github.com/space928/Blender-O3D-IO-Public/issues/93, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADTN4ATI5WXP6APGJN74KKDY2HCT3AVCNFSM6AAAAABFJRNLFKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGIYDSMJRHE2DCNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

bimbim9 commented 3 months ago

That's an interesting one... It seems that the model you're trying to import has a non invertible origin matrix. This is not something I expected, if you send me the o3d file in question I can probably manually fix the origin matrix so that it imports. On Tue, 26 Mar 2024, 19:17 bimbim9, @.> wrote: I try to import a model but i got some traceback error like this: Traceback (most recent call last): File "C:\Users\HP\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Blender-O3D-IO-Public__init__.py", line 133, in execute io_o3d_import.do_import(self.filepath, context, self.import_x, self.override_text_encoding, self.hide_lods) File "C:\Users\HP\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Blender-O3D-IO-Public\o3d_io\io_o3d_import.py", line 137, in do_import mesh_matrix = o3d_transform_matrix.inverted() ValueError: Matrix.invert(ed): matrix does not have an inverse any solution? — Reply to this email directly, view it on GitHub <#93>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADTN4ATI5WXP6APGJN74KKDY2HCT3AVCNFSM6AAAAABFJRNLFKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGIYDSMJRHE2DCNQ . You are receiving this because you are subscribed to this thread.Message ID: @.>

should i send you a fullmod?

bimbim9 commented 3 months ago

https://www.mediafire.com/file/ri80qbvxnmddt43/Busscar_Vissta_Buss_e_Jum_Buss_360_By_Edsonv12.rar/file

space928 commented 3 months ago

Interesting... It seems the JB_Bone.o3d and VB_Bone.o3d files have an origin matrix with mostly zeros and only a single vertex. image

I've patched my copy of O3D-IO to fix this issue, and I'll publish this fix when I eventually get round to making another release of the plugin. In the mean time just replace the JB_Bone.o3d and VB_Bone.o3d files with these:
Busscar Vissta Buss e Jum Buss 360 By Edsonv12 - Fix.zip

Note that since Blender-O3D-IO can't import/export meshes with vertices that don't belong to triangles so the single vertex in JB_Bone.o3d and VB_Bone.o3d has been removed; I'm not sure if that will break OMSI or not...

If anyone else needs encounters this bug before I release the fix, simply patch the line that gives the ValueError to use o3d_transform_matrix.inverted_safe() instead of o3d_transform_matrix.inverted().

bimbim9 commented 3 months ago

thank you i already patch the line that gives the ValueError. but when I tried to import another mod (from the same author), Blender suddenly force closed.

So maybe I'll just wait for your correction, while maybe you add other features that might be useful in the future.

bimbim9 commented 3 months ago

and for the fix file that you sent, it can be used, but note that some models have missing textures and cannot be imported.