So I’m trying to create a script that will mirror all selected objects, freeze transforms, mirror their UVs, and flip their normals back. What I wrote works with one object, but with more than one it seems to work on only half of the selected objects. A little testing suggests what’s happening is that the edit mode flips are being repeated twice on some of the objects, canceling themselves out. Anyone know what I’m doing wrong to cause this? Thanks!
import bpy
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY') #sets origin to center of geometry
bpy.ops.transform.mirror(constraint_axis=(True, False, False), constraint_orientation='GLOBAL', proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.object.transform_apply(location=False, rotation=True, scale=True)
for ob in bpy.context.selected_objects:
bpy.ops.object.editmode_toggle()
bpy.context.scene.objects.active = ob
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.mesh.flip_normals()
#bpy.ops.mesh.normals_make_consistent(inside=False) #Test
bpy.context.area.type = 'PROPERTIES'
bpy.context.area.type = 'IMAGE_EDITOR'
bpy.context.space_data.pivot_point = 'CURSOR'
bpy.context.space_data.cursor_location[0] = 128
bpy.ops.transform.resize(value=(-1, 1, 1), constraint_axis=(True, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.object.editmode_toggle() #puts scene back in object mode
bpy.context.area.type = 'TEXT_EDITOR' #CHANGE THIS TO 3D BEFORE PUBLISHING