Its probably basic : For every object in the scene that has “right” in its name I need to create a copy object on the left, but mirrored relative to the origin. I tried to use the code that appear in the Info panel when I do this mirroring manually. Before I (try to ) select the object to be mirrored. No mirroring occurs.
for o in bpy.context.scene.objects: if "right" in o.name : new_left = o.copy() bpy.context.scene.collection.objects.link(new_left) new_left.name = o.name.replace("right", "left") bpy.context.view_layer.objects.active = new_left bpy.ops.transform.resize(value=(1, -1, 1), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, True, False), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=0.263331, use_proportional_connected=False, use_proportional_projected=False) bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
There were some changes since 2.8, right ?
Thank you for any advice you can give me ! Nicolas