I'm trying to run the remove_doubles edit command on multiple selected objects. This is kinda what I got so far...
import bpy
class remDoubles(bpy.types.Operator):
"""Remove Doubles on multiple objects"""
bl_label = "Remove Multiple Doubles"
bl_idname = "object.remove_doubles_multi"
bl_options = {'REGISTER', 'UNDO'}
@classmethod
def poll(cls, context):
return len(context.selected_objects) > 0
def execute(self, context):
scene = bpy.context.scene
sel = context.selected_objects
for obj in sel:
scene.objects.active = obj
#do something here
print(obj.name)
bpy.ops.mesh.remove_doubles()
return {"FINISHED"}
myobject = remDoubles()
myobject.execute()
My knowledge about classes isn't too great, please help.
My code needs some work, it just errors out giving a 'TypeError: bpy_struct.new(type): expected a single argument'
But what i intend doing is run through each object applying the remove doubles command for each.