Fast OBJ importer (C++, much faster than the build-in importer)

I think a separate DLL is far more easy to debug and recompile than a whole blender, compile a DLL only need a few seconds while no need restarting blender, but compile a blender program need Dozens of minutes, developing a addon need hundreds time or thousand time to recomlie for testing.

1 Like

It is indeed, thanks!
Unfortunately, there is issue with another file: image
And I can’t close it without closing Blender itself, since it’s reappearing.
Mannequin.rar (1.4 MB)

Path of the file is F:\Scenes

And another error with this file:

UMesh_Capsule 67.rar (343.7 KB)

And another one in console:

!!! ERROR import PYLIB_curve
!!! ERROR import PYLIB_image
!!! ERROR import PYLIB_find
!!! ERROR import PYLIB_math
!!! ERROR import PYLIB_object
!!! ERROR import PYLIB_transform
!!! ERROR import PYLIB_algorithm
!!! ERROR import PYLIB_print
!!! ERROR import PYLIB_operator
Info: Deleted 3 object(s)

self.filepath== F:\Scenes\BlueWhale\BlueWhale.OBJ
í║í║í║ i?obj??
0 ┐¬╩╝¿y¿y¿y¿y¿y¿y¿y¿y¿y¿y¿y íñ ╨╨–51----i?obj??
!!!i╩ú ú╝╢■ 0 , s__=00000 íñ strlen(s__)= 5íñi╖╓╕⌠= 4 í╗í╗i?obj??
ci物数 NUM== 1
í║í║í║ ???obj ,ª╬╬∩G=0,ª╬╡πG=0,ª╬├µG=760193,ª╬╗╖╫▄G=0
Traceback (most recent call last):
File “C:\Users\ostap\AppData\Roaming\Blender Foundation\Blender\2.81\scripts\addons\IMDJS_io_obj_init_.py”, line 69, in execute
ΔΔ载入(self, context,self.filepath,self.bp用平滑组,self.bp分裂物,self.bpYasZ,self.fpSize);
File “C:\Users\ostap\AppData\Roaming\Blender Foundation\Blender\2.81\scripts\addons\IMDJS_io_obj\im_obj_cpp.py”, line 22, in ╬ö╬öΦ╜╜σàÑ
G.DLLobj.╬öµëôσ╝Çobj(filepath.encode(‘gb2312’),bpσêåΦúéτë⌐);
OSError: exception: access violation writing 0x0000000000000000

location: :-1

location: :-1

Path: F:\Scenes\BlueWhale

https://drive.google.com/open?id=1dvdRKVj0pn2BKiM1y3j0nSsQcQYaGi5m

update 20191212 fix errors of previous version.

1 Like

got error here
20191212 version

Traceback (most recent call last):
File “C:\Users\Saika\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\IMDJS_io_obj_init_.py”, line 69, in execute
ΔΔ载入(self, context,self.filepath,self.bp用平滑组,self.bp分裂物,self.bpYasZ,self.fpSize);
File “C:\Users\Saika\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\IMDJS_io_obj\im_obj_cpp.py”, line 22, in ΔΔ载入
G.DLLobj.Δ打开obj(filepath.encode(‘gb2312’),bp分裂物);
OSError: exception: access violation writing 0x0000000000000000

location: :-1

I need your obj file to test , so I can find out what’s wrong with reading file.
I have updated maybe you can try again.
you just need to replace this obj_IO64.dll file.
obj_IO64.dll (687.5 KB)

1 Like

Hm, weird, it’s crashing exactly the same way as before.
I’ve replaced DLL, CRC32 of a new one is 4F2459AB

Are you interested to use Assimp so we can get all available formats as well?

In my humble opinion we should ditch all python importers/exporters because they are inefficient.

1 Like

For me also changed DLL, It worked as expected. However when I turned off Blender and restarted when I used the addon again it turned off blender.

same here, still crashes with my subdivided test cube.

What is the path to adding assimp anything to blender? If that work could be leveraged it would be great.

Can it come in as a simple plugin that works on all platforms? or as a C library does it have to be compiled into the blender base code?

I don’t know about assimp , it seen like a library. but I don’t have much time to study it. I use my way to read obj file.

now It can import your obj UMesh_Capsule 67.rar

1 Like

That’s absolutely marvelous, thank you so much! I wasn’t able to crash it so far with the OBJ itself, great job!

Although, I have a file with the name Jüngling_Vom_Magdalensberg.obj, which actually crashed the addon and Blender as a whole. Changing ü to English u helped with that.

Btw, do you have plans to make similar addons for other formats, like FBX and STL?

Also addon doesn’t seem to preserve sharp edges at the moment and Autosmooth aren’t getting enabling right after export, as standard importer does (left)


Tower.rar (1.4 MB)

And overall something weird is with normals


CubeUV.rar (58.1 KB)

Do you plan to add vertex color support?

Nope, crashed it once more:

self.filepath== C:\Users\ostap\Desktop\PolySphere.OBJ
í║í║í║ i?obj??
!!!i╩ú ú╝╢■ 0 , s__=00000 íñ strlen(s__)= 5íñi╖╓╕⌠= 4----deque T:Q╬∩╨≥i╡π╩²G -------{ 1 }-----------------╨╨:283 -------╬─╝■:\obj_I╢┴.cpp
íñ 331506

----vector T:V╬∩╨≥str╫ΘG -------{ 1 }-----------------╨╨:283 -------╬─╝■:\obj_I╢┴.cpp
íñ

í╗í╗i?obj??
ci物数 NUM== 1
í║í║í║ ???obj ,ª╬╬∩G=0,ª╬╡πG=0,ª╬├µG=331504
í║í║í║ ??obj??? , ª╬╬∩G=-1 ,b╡┌1┤╬╙÷vG=0
í╗í╗??obj???
í╗í╗???obj
í║í║í║ ??? ,bp╖╓┴╤╬∩=1,fpSize=1.000000 ,bpYasZ=0,ª╬╬∩G=0
Traceback (most recent call last):
File “C:\Users\ostap\AppData\Roaming\Blender Foundation\Blender\2.81\scripts\addons\IMDJS_io_obj_init_.py”, line 69, in execute
ΔΔ载入(self, context,self.filepath,self.bp用平滑组,self.bp分裂物,self.bpYasZ,self.fpSize);
File “C:\Users\ostap\AppData\Roaming\Blender Foundation\Blender\2.81\scripts\addons\IMDJS_io_obj\im_obj_cpp.py”, line 26, in ╬ö╬öΦ╜╜σàÑ
G.DLLobj.Δ转换(bp分裂物,bpYasZ,c_float(fpSize),CLi点数__,CLi边数__,CLi环数__,CLi面数__,CLc物名__,CLi有UV__);
OSError: exception: access violation reading 0x000000011D1AE370

location: :-1

location: :-1

My idea would be to hack an existing import/export and change only the bits that communicate with assimp - not using Python file streams at all. Since assimp loads the entire data on it’s own internal structure.

Also if a directory contains all assimp libraries for all operating systems with bit versions etc, we would be able to load the libraries dynamically with Python, for as much systems as possible.

I have no plan to make a fbx plugin, I don’t really need this format in my jobs. the vertex color maybe support later but I don’t sure.

1 Like

IMDJS_io_obj C (20191216) version.