Could people please test these scripts. They are In blender 2.41 and are better then the previous but Id like to hear of any problems sooner then later.
Youll need to run Blender CVS as of 1 day ago for the exporter. 2.4 should work with the importer still.
Also. Please post any problems here. I have it set up to email me whenever somebody posts. so I wont miss your message.
Try the exporter, some new UI options and features. export animation. all scenes. copy images to dir etc.
I Tried it with 10 Objects which are working in all other programs I have,
everytime I get the following answer:
Error:Unable to parse Material file
it happens everytime when it tries to load the first texture
do want to recieve a zipped or rared object for you reference?
Traceback (most recent call last):
File “<string>”, line 515, in save_obj_ui
AttributeError: ‘module’ object has no attribute ‘PupBlock’
Using Python version 2.4
Blender quit
I got this error when exporting my object. I am still using Blender version 2.40 instead of the CVS one, because I couldn’t figure out how to install the CVS version.
I got the 2.41RC for OSX and I am trying to export an obj seq, but every time that I try blender shut down on me.Am I doing something wrong?What are the steps to export a obj animation?
I’ve been trying to use obj_import to import Poser and DAZ Studio models. The geometry comes in just fine, but none of the textures are imported. OK, that’s not exactly true – the textures are imported, but not connected to the materials. Am I doing something wrong? Or just expecting too much from the script? In order to get to the point where I am now, I have to edit the MTL file to give the proper paths to the image files, but that’s a couple quick global replaces; not a problem. Once I do that, the script gives me plenty of messages that say, “Found the image as expected,” and if I look at the Outliner, there are blocks for all the images, but they’re not connected to the materials.
I’m not sure the problem is with the obj_import.py. I have been looking into daz/poser imports for a while, here are a few things I found out.
The materials do not come into blender as a texture. They are there, UV face mapped. If you select a body part then in the Material tab select TexFace it will render correctly. I have traced the script, looks like line 326-328 set the TexFace. I have verified that code is excuted. I found several other posts on this forum and the Blender Python forum that seem to show there is a problem with a python script doing something like :
f.mode |= TEX_ON_FLAG
I re-tested with this new obj_import.py and blender 2.40, problem still exists.
What does end up as a texture is type Kd and D (types in the .mtl file). What is interesting, when you look at the texture list in the Material Texture panels they show up after 5 empty slots.
I’m not sure if the next two items are related to obj_import or not.
Some parts seem to have the UV mapping incorrect after import. For example every model I have tried the eyebrows are wrong. In the UV mapper they are the correct shape and size but at the wrong position on the image.
It also appears that after the import/export you have a different number of vertex than the original so obj_import and obj_export cannot be used to make a morph target in poser.
I know poser it not popular among the blender community but for some of us it’s the only practical way to get a good humanoid figure. I would like to help work on getting a cleaner import from poser/daz if there is any interest.
Tried the script with blender-2.41 and it works for some off my simpler models. With my, very few since I am a Blender newbie, higher poly models I get the following errors.
This one when I try to export a selected object
Using Python version 2.4
Traceback (most recent call last):
File “<string>”, line 564, in save_obj_ui
NameError: global name ‘Object’ is not defined
Traceback (most recent call last):
File “/opt/blender/release/scripts/obj_export.py”, line 564, in save_obj_ui
export_objects = Object.GetSelected() # Export Context
NameError: global name ‘Object’ is not defined
OBJ Export path: “/home/joey/Documenten/Blender/ribbertest3_1.obj”
Traceback (most recent call last):
File “/opt/blender/release/scripts/obj_export.py”, line 569, in save_obj_ui
save_obj(‘’.join(context_name), export_objects, EXPORT_EDGES, EXPORT_NORMALS, EXPORT_MTL, EXPORT_COPY_IMAGES, EXPORT_APPLY_MODIFIERS)
File “/opt/blender/release/scripts/obj_export.py”, line 276, in save_obj
m = getMeshFromObject(ob, temp_mesh_name, containerMesh)
File “/opt/blender/release/scripts/obj_export.py”, line 101, in getMeshFromObject
mesh.mode = tempMe.mode
ValueError: invalid bit(s) set in mask
After this I am left with my model rotated 90 degrees on the x-axis.
This is the error I get when I turn off all the options in the script.
OBJ Export path: “/home/joey/Documenten/Blender/ribbertest4.obj”
Traceback (most recent call last):
File “<string>”, line 569, in save_obj_ui
File “<string>”, line 276, in save_obj
UnboundLocalError: local variable ‘containerMesh’ referenced before assignment
As far as I can tell there’s nothing special about these models.
The ones that I am able to export, I can also use with cgkit.
I have the same problem on a simple mesh with 2.4.1
mesh.mode = tempMe.mode
ValueError: invalid bit(s) set in mask
According to DNA_mesh_types.h
ME_TWOSIDED = 4
ME_AUTOSMOOTH = 32
ME_NOPUNOFLIP = 2
What is currently in the tempMe.mode is off by one. I set each mode one by one in the ui and did the export with a print of the tmpMe.mode to see them.
If you change the code mesh.mode = tempMe.mode to mesh.mode = tempMe.mode - 1 it works.
It’s not off by one; tempMe apparently has some other bits set which are not recognized by the setter for mesh.mode, so it’s complaining. For now, you need to mask off the other bits:
I was going to fix this tonight, but it looks like all the other mode codes are unused at this point. Could you print out the contents of tempMe.mode and post a comment either here or attach to the bug report below:
I tested the scripts come with Blender 2.41. The following is my finding:
I create a box, which has 8 vertices and 6 faces.
The contents of OBJ file:
mtllib t1.mtl
o Cube_Cube
v 1.000000 1.000000 -1.000000
v 1.000000 -1.000000 -1.000000
v -1.000000 -1.000000 -1.000000
v -1.000000 1.000000 -1.000000
v 1.000000 0.999999 1.000000
v 0.999999 -1.000001 1.000000
v -1.000000 -1.000000 1.000000
v -1.000000 1.000000 1.000000
usemtl Material
s off
f 1 2 3 4
f 5 8 7 6
f 1 5 6 2
f 2 6 7 3
f 3 7 8 4
f 5 1 4 8
Then, I import the file in Blender 2.41. The imported mesh has 9 vertices!!! I export the mesh as OBJ to see why it got an extra vertex, here is the contents of the exported file:
mtllib t2.mtl
o Cube_Cube_Cube_Cube
v 1.000000 1.000000 -1.000000
v 1.000000 -1.000000 -1.000000
v -1.000000 -1.000000 -1.000000
v -1.000000 1.000000 -1.000000
v 1.000000 0.999999 1.000000
v -1.000000 1.000000 1.000000
v -1.000000 -1.000000 1.000000
v 0.999999 -1.000001 1.000000
v 1.000000 1.000000 -1.000000
vt 0.000000 1.000000 0.0
vt 0.000000 0.000000 0.0
vt 1.000000 0.000000 0.0
vt 1.000000 1.000000 0.0
usemtl Material.001
s off
f 9/1 2/2 3/3 4/4
f 5/1 6/2 7/3 8/4
f 9/1 5/2 8/3 2/4
f 2/1 8/2 7/3 3/4
f 3/1 7/2 6/3 4/4
f 5/1 9/2 4/3 6/4
There is an extra vertex “v 1.000000 1.000000 -1.000000”. It seems that the import script insert an extra vertex to the mesh. The export script works fine.