Hey everyone, first post, been working on this for a week trying to navigate through blenders (To me anyways) wave of hurdles to get the information I am looking for.
So far I have a partial exporter working, however a few things I am having a hard time finding a few bits of data and a few things are (supposedly) outputting incorrectly. I have tried googling around and have visited quiet a few websites and forums looking for the answers i have been looking for but with no avail.
So last but not least, my question/s.
-
How can I get it to write a line if there is no parent to a joint? Everything I have tried comes up as a Attribute error: NoneType.
-
The model I am testing with both blender and milkshape3D(I wrote the exporter for milkshape as well) the values are coming up incorrectly. I have provided code below as a visual (Im not expecting people to write for me, wheres the fun in that)
-
Havent the slightest clue on how to get a material list as of this moment, with that said I haven’t personally looked for information so I’m not worried about an answer but one is appreciated.
try:
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
bpy.ops.mesh.quads_convert_to_tris()
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
except:
print('No Quads to transform! Good to go!')
#me = meshes, jo = joints
for obj in bpy.context.selectable_objects:
me = obj.data
if obj.type == 'ARMATURE':
fw('jointstart
')
for bone in me.bones:
getBoneRot = bone.matrix_local.to_euler()
fw(bone.name + '
')
fw('%.6f %.6f %.6f %.6f %.6f %.6f
' % (bone.vector.x, bone.vector.y, bone.vector.z, getBoneRot.x, getBoneRot.y, getBoneRot.z))
fw('jointend
')
elif obj.type == 'MESH':
for face in me.faces:
try:
uv_layer = me.uv_textures.active.data
except:
print('do nothing')
try:
u1 = uv_layer[face.index].uv1[0]
v1 = 1.0 - uv_layer[face.index].uv1[1]
except:
u1 = 0.0
v1 = 0.0
try:
u2 = uv_layer[face.index].uv2[0]
v2 = 1.0 - uv_layer[face.index].uv2[1]
except:
u2 = 0.0
v2 = 0.0
try:
u3 = uv_layer[face.index].uv3[0]
v3 = 1.0 - uv_layer[face.index].uv3[1]
except:
u3 = 0.0
v3 = 0.0
fw('
xyz=%i %.6f %.6f %.6f norm=%.6f %.6f %.6f uv=%.6f %.6f' % (me.vertices[face.vertices[0]].groups[0].group,
me.vertices[face.vertices[0]].co.x,
me.vertices[face.vertices[0]].co.y,
me.vertices[face.vertices[0]].co.z ,
me.vertices[face.vertices[0]].normal.x ,
me.vertices[face.vertices[0]].normal.y ,
me.vertices[face.vertices[0]].normal.z, u1, v1))
fw('
xyz=%i %.6f %.6f %.6f norm=%.6f %.6f %.6f uv=%.6f %.6f' % (me.vertices[face.vertices[1]].groups[0].group ,
me.vertices[face.vertices[1]].co.x,
me.vertices[face.vertices[1]].co.y,
me.vertices[face.vertices[1]].co.z ,
me.vertices[face.vertices[1]].normal.x ,
me.vertices[face.vertices[1]].normal.y ,
me.vertices[face.vertices[1]].normal.z, u2, v2))
fw('
xyz=%i %.6f %.6f %.6f norm=%.6f %.6f %.6f uv=%.6f %.6f' % (me.vertices[face.vertices[2]].groups[0].group ,
me.vertices[face.vertices[2]].co.x,
me.vertices[face.vertices[2]].co.y,
me.vertices[face.vertices[2]].co.z ,
me.vertices[face.vertices[2]].normal.x ,
me.vertices[face.vertices[2]].normal.y ,
me.vertices[face.vertices[2]].normal.z, u3, v3))
Thanks in advance for the help on my issues