Hay all, In responce to JMS Being cocky about my OBJ import and export being slow I had a look and compared Both scripts.
Obj included in 2.37- Exporter is more then Twice as fast as JMS’s but Importer was 10 times slower. (ouch)
So I have optimized my importer which is about twice as fast Jms’s (20x speedup)
I wanted to do a more comprehensive benchmark but it turns out that JMS’s script cant load half the models in My test collection.
Anyhow, now both my scripts are around twice as fast, so there.
My script also handles missing images and too many materials without stopping.
Using Python version 2.3
file length: 13635
Traceback (most recent call last):
File “<string>”, line 546, in load_obj
File “<string>”, line 188, in load_mtl
File “<string>”, line 117, in load_mat_image
NameError: global name ‘mesh’ is not defined
In fact, on a zbrush’s file of 7 mos data completely smoothed with a 13 mos
bmp image the io_obj script (it is not my script, just a script that I find useful
and I work from time to time on it) makes its work in 9
seconds … but we have to assign the material to the mesh in the
index material .
The cambo’s one takes 7 seconds but there is no smoothing (no normal),
and no uvmapped images .
Almost…
But did you know- Blender does not use the NMesh Normals for display list for display or rendering. The only Thing I have found normals used for is Dupliverts and Im guessing Particle acceleration too. - Not display or rendering tho.
So aside from smoothing mine isnt loading the image, image links in OBJ are fairly vague (Win32 Pathnames/Absolute/Relitive/usemap tag or in MTL file) - So its probably just a parth reading issue. If you show me a file that dosent work then Ill fix it.
This bug is nothing compared to yours, which crashes on ALL OBJ’s from DEEP Exploration (www.righthemisphere.com) as well as some other files mine imports fine.
Though Ill give you smoothing, mine could do better smoothing. but blenders smoothing isnt crash hot either, and dosent allow for smoothing groups or edge based smoothing.
Traceback (most recent call last):
File “Text”, line 609, in ?
WindowsError: [Errno 3] Le chemin d’accÞs spÚcifiÚ est introuvable: ‘/obj/.’
No fileselector too.
Anyway, if i remove this two problems, the script always takes 7 seconds to load the 8 mos data of a Zbrush file . Same problems (no image, no smoothed faces )
Okay, commented out testing bit and re-uploaded, it uses the fileselector.
About smoothing, the default is to have smoothing off for my importer, but if you had smoothing groups it will smooth them. - I decieded to turn smoothing off by default becasue if sombody wanted there model smoothed they’s add it to a smoothing group.
If the user dosent like this then they can turn smoothing on from Blender no biggie.
About the ZBrush import error, All I can say is- show me the file. or at least the MTL. I have got some obj examples from ZBrush, but none of them were distributed with MTL files.
If your interested in Blender working for everyone, just give me a link to this file, its stupid to have Blender 2.37a’s scripts not work as well as it could, because you are too proud to show me a bug that only you have found.
Just to say that the current obj_import works well with this file but takes hours to display the results so a great number of users think blender is freezing and try the other one . Sorry, if you are offended but these are only facts .
Well, totally useless info I’m sure, but for those that may remember my very first texture plugin, the one that ‘faked’ refraction, before I made it a texture plugin, it was a actually python script.
You see, the way it worked was by modifying the mesh normals in such a way, so that when used with environment maps, when rendering the reflection vectors used for the environment map, they would be ‘warped’ into refraction vectors. It worked very well, despite hardly anyone knowing how to use the thing (with a few notable exceptions), also saw it being claimed that it could not possibly work without actually trying it…
Just to say that the current obj_import works well with this file but takes hours to display the results so a great number of users think blender is freezing and try the other one . Sorry, if you are offended but these are only facts .[/quote]
No offence :), but are you refering to the recent obj_importer or the one distributed with 2.37/2.36- This one was very slow- and thanks for pointing out how slow it was, else I wouldent have fixed it.
So since its fixed, All I have to do is make the more compatible. Not loading images is a tricky one, I have posted a while back, but It would be good to have a generic python module with functions that Allow the user to load an image with some fuzzy logic so writers of importer writers could spend less time fiddeling with cross platform paths.
This would allow you to give Blender a file to load, by default it would look first if the file exusts. if not, see if a different case exists.
strip the path from the file and add it to the paths to look in allong with the blend files // and ano other specified.
Recursice to scan nested paths for the file,
other_format- willtry for files with same name but different extension.
Make Dummy will create a 2x2 Pixel image of the desired name in the file path and then use it.
mabe make dummy and recursive are going too far, but I think it could be a good option, this would help a lot for linux users importing win32 based 3d formats, where pathnames are often case insensitive and absolute paths are used (3ds files for eg.)
I stand corrected about normals- Blender does display Normals in the 3ds view, as long as subserf is off, but since any editing will remove custom normals, I still dont think there worth importing.
I updated my importer for faster smoothing groups… See this model
Traceback (most recent call last):
File "E:\zi^p\3DGRX\blender\blender-2.36\.blender\scripts\obj_import.py", line
602, in load_obj
File "E:\zi^p\3DGRX\blender\blender-2.36\.blender\scripts\obj_import.py", line
199, in getUniqueName
try:
AttributeError: 'module' object has no attribute 'GetNames'
Jms, if you would give the the zbrush file I could solve the problem, you know my email.
Blender crashing with a system error is serious and could be a bug in BPython, therefore affecting other importing scripts and making blender less stable.
I added NMesh.GetNames() recently and its only in 2.37, your right though, I should update the blender version in the script to 2.37.