def _import_vertices_mod156(mod, mesh): box_width = abs(mod.box_min_x) + abs(mod.box_max_x) box_height = abs(mod.box_min_y) + abs(mod.box_max_y) box_length = abs(mod.box_min_z) + abs(mod.box_max_z) vertices_array = get_vertices_array(mod, mesh) if mesh.vertex_format != 0: vertices = (transform_vertices_from_bbox(vf, box_width, box_height, box_length) for vf in vertices_array) else: vertices = ((vf.position_x, vf.position_y, vf.position_z) for vf in vertices_array) vertices = (y_up_to_z_up(vertex_tuple) for vertex_tuple in vertices) vertices = ((x / 100, y / 100, z / 100) for x, y, z in vertices) # TODO: investigate why uvs don't appear above the image in the UV editor list_of_tuples = [(unpack_half_float(v.uv_x), unpack_half_float(v.uv_y) * -1) for v in vertices_array] return { 'locations': list(vertices), 'uvs': list(chain.from_iterable(list_of_tuples)), 'weights_per_bone': _get_weights_per_bone(mod, mesh, vertices_array) }
def _import_vertices_mod210(mod, mesh): vertices_array = get_vertices_array(mod, mesh) vertices = ((vf.position_x / 32767, vf.position_y / 32767, vf.position_z / 32767) for vf in vertices_array) vertices = (y_up_to_z_up(vertex_tuple) for vertex_tuple in vertices) # TODO: investigate why uvs don't appear above the image in the UV editor list_of_tuples = [(unpack_half_float(v.uv_x), unpack_half_float(v.uv_y) * -1) for v in vertices_array] return {'locations': list(vertices), 'uvs': list(chain.from_iterable(list_of_tuples)), 'weights_per_bone': {} }
def _import_vertices_mod210(mod, mesh): vertices_array = get_vertices_array(mod, mesh) vertices = ((vf.position_x / 32767, vf.position_y / 32767, vf.position_z / 32767) for vf in vertices_array) vertices = (y_up_to_z_up(vertex_tuple) for vertex_tuple in vertices) # TODO: investigate why uvs don't appear above the image in the UV editor list_of_tuples = [(unpack_half_float(v.uv_x), unpack_half_float(v.uv_y) * -1) for v in vertices_array] return { 'locations': list(vertices), 'uvs': list(chain.from_iterable(list_of_tuples)), 'weights_per_bone': {} }
def _import_vertices_mod156(mod, mesh): box_width = abs(mod.box_min_x) + abs(mod.box_max_x) box_height = abs(mod.box_min_y) + abs(mod.box_max_y) box_length = abs(mod.box_min_z) + abs(mod.box_max_z) vertices_array = get_vertices_array(mod, mesh) if mesh.vertex_format != 0: vertices = (transform_vertices_from_bbox(vf, box_width, box_height, box_length) for vf in vertices_array) else: vertices = ((vf.position_x, vf.position_y, vf.position_z) for vf in vertices_array) vertices = (y_up_to_z_up(vertex_tuple) for vertex_tuple in vertices) vertices = ((x / 100, y / 100, z / 100) for x, y, z in vertices) # TODO: investigate why uvs don't appear above the image in the UV editor list_of_tuples = [(unpack_half_float(v.uv_x), unpack_half_float(v.uv_y) * -1) for v in vertices_array] return {'locations': list(vertices), 'uvs': list(chain.from_iterable(list_of_tuples)), 'weights_per_bone': _get_weights_per_bone(mod, mesh, vertices_array) }