Skip to content
Snippets Groups Projects
Commit 5db2bb4f authored by Campbell Barton's avatar Campbell Barton
Browse files

- update 3DS export for BMesh.

- pep8 edits for after effects script.
parent 9692a3e6
No related branches found
No related tags found
No related merge requests found
...@@ -331,7 +331,6 @@ def write_jsx_file(file, data, selection, include_animation, include_active_cam, ...@@ -331,7 +331,6 @@ def write_jsx_file(file, data, selection, include_animation, include_active_cam,
'orientation_anim': False, 'orientation_anim': False,
} }
# create structure for nulls # create structure for nulls
for i, obj in enumerate(selection['nulls']): # nulls representing blender's obs except cameras, lamps and solids for i, obj in enumerate(selection['nulls']): # nulls representing blender's obs except cameras, lamps and solids
if include_selected_objects: if include_selected_objects:
...@@ -461,7 +460,7 @@ def write_jsx_file(file, data, selection, include_animation, include_active_cam, ...@@ -461,7 +460,7 @@ def write_jsx_file(file, data, selection, include_animation, include_active_cam,
js_data['cameras'][name_ae]['position_static'] = position js_data['cameras'][name_ae]['position_static'] = position
js_data['cameras'][name_ae]['orientation_static'] = orientation js_data['cameras'][name_ae]['orientation_static'] = orientation
js_data['cameras'][name_ae]['zoom_static'] = zoom js_data['cameras'][name_ae]['zoom_static'] = zoom
''' '''
# keyframes for all solids. Not ready yet. Temporarily not active # keyframes for all solids. Not ready yet. Temporarily not active
for i, ob in enumerate(selection['solids']): for i, ob in enumerate(selection['solids']):
...@@ -469,7 +468,7 @@ def write_jsx_file(file, data, selection, include_animation, include_active_cam, ...@@ -469,7 +468,7 @@ def write_jsx_file(file, data, selection, include_animation, include_active_cam,
name_ae = selection['solids'][i][1] name_ae = selection['solids'][i][1]
#convert ob position to AE space #convert ob position to AE space
''' '''
# keyframes for all lights. # keyframes for all lights.
if include_selected_objects: if include_selected_objects:
for i, ob in enumerate(selection['lights']): for i, ob in enumerate(selection['lights']):
...@@ -549,7 +548,6 @@ def write_jsx_file(file, data, selection, include_animation, include_active_cam, ...@@ -549,7 +548,6 @@ def write_jsx_file(file, data, selection, include_animation, include_active_cam,
# #
# #
# #
# ---- write JSX file # ---- write JSX file
jsx_file = open(file, 'w') jsx_file = open(file, 'w')
...@@ -678,6 +676,7 @@ def write_jsx_file(file, data, selection, include_animation, include_active_cam, ...@@ -678,6 +676,7 @@ def write_jsx_file(file, data, selection, include_animation, include_active_cam,
# DO IT # DO IT
########################################## ##########################################
def main(file, context, include_animation, include_active_cam, include_selected_cams, include_selected_objects, include_cam_bundles): def main(file, context, include_animation, include_active_cam, include_selected_cams, include_selected_objects, include_cam_bundles):
data = get_comp_data(context) data = get_comp_data(context)
selection = get_selected(context) selection = get_selected(context)
...@@ -772,4 +771,3 @@ def unregister(): ...@@ -772,4 +771,3 @@ def unregister():
if __name__ == "__main__": if __name__ == "__main__":
register() register()
...@@ -525,13 +525,13 @@ def extract_triangles(mesh): ...@@ -525,13 +525,13 @@ def extract_triangles(mesh):
If the mesh contains quads, they will be split into triangles.''' If the mesh contains quads, they will be split into triangles.'''
tri_list = [] tri_list = []
do_uv = len(mesh.uv_textures) do_uv = bool(mesh.tessface_uv_textures)
img = None img = None
for i, face in enumerate(mesh.faces): for i, face in enumerate(mesh.tessfaces):
f_v = face.vertices f_v = face.vertices
uf = mesh.uv_textures.active.data[i] if do_uv else None uf = mesh.tessface_uv_textures.active.data[i] if do_uv else None
if do_uv: if do_uv:
f_uv = uf.uv f_uv = uf.uv
...@@ -638,7 +638,7 @@ def make_faces_chunk(tri_list, mesh, materialDict): ...@@ -638,7 +638,7 @@ def make_faces_chunk(tri_list, mesh, materialDict):
face_chunk = _3ds_chunk(OBJECT_FACES) face_chunk = _3ds_chunk(OBJECT_FACES)
face_list = _3ds_array() face_list = _3ds_array()
if mesh.uv_textures: if mesh.tessface_uv_textures:
# Gather materials used in this mesh - mat/image pairs # Gather materials used in this mesh - mat/image pairs
unique_mats = {} unique_mats = {}
for i, tri in enumerate(tri_list): for i, tri in enumerate(tri_list):
...@@ -725,7 +725,7 @@ def make_mesh_chunk(mesh, matrix, materialDict): ...@@ -725,7 +725,7 @@ def make_mesh_chunk(mesh, matrix, materialDict):
# Extract the triangles from the mesh: # Extract the triangles from the mesh:
tri_list = extract_triangles(mesh) tri_list = extract_triangles(mesh)
if mesh.uv_textures: if mesh.tessface_uv_textures:
# Remove the face UVs and convert it to vertex UV: # Remove the face UVs and convert it to vertex UV:
vert_array, uv_array, tri_list = remove_face_uv(mesh.vertices, tri_list) vert_array, uv_array, tri_list = remove_face_uv(mesh.vertices, tri_list)
else: else:
...@@ -963,11 +963,11 @@ def save(operator, ...@@ -963,11 +963,11 @@ def save(operator,
mat_ls_len = len(mat_ls) mat_ls_len = len(mat_ls)
# get material/image tuples. # get material/image tuples.
if data.uv_textures: if data.tessface_uv_textures:
if not mat_ls: if not mat_ls:
mat = mat_name = None mat = mat_name = None
for f, uf in zip(data.faces, data.uv_textures.active.data): for f, uf in zip(data.tessfaces, data.tessface_uv_textures.active.data):
if mat_ls: if mat_ls:
mat_index = f.material_index mat_index = f.material_index
if mat_index >= mat_ls_len: if mat_index >= mat_ls_len:
...@@ -987,7 +987,7 @@ def save(operator, ...@@ -987,7 +987,7 @@ def save(operator,
materialDict.setdefault((mat.name, None), (mat, None)) materialDict.setdefault((mat.name, None), (mat, None))
# Why 0 Why! # Why 0 Why!
for f in data.faces: for f in data.tessfaces:
if f.material_index >= mat_ls_len: if f.material_index >= mat_ls_len:
f.material_index = 0 f.material_index = 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment