Guest User

ASC - Export Script

a guest
Aug 3rd, 2023
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. import bpy
  2.  
  3. objects = bpy.context.scene.objects
  4.  
  5. for obj in objects:
  6.     obj.select_set(obj.type == "MESH")
  7.  
  8. for obj in bpy.context.selected_objects :
  9.     for uvmap in  obj.data.uv_layers :
  10.         uvmap.name = 'UVMap'
  11. bpy.ops.object.select_all(action='DESELECT')
  12.  
  13. obj_list = []
  14.  
  15.  
  16. for mat in bpy.data.materials:
  17.     if("material_1" not in mat.name):
  18.         print("Processing {0}".format(mat.name))
  19.         bpy.ops.object.select_all(action='DESELECT')
  20.         for o in bpy.data.objects:
  21.             for m in o.material_slots:
  22.                 if mat.name in m.name:
  23.                     obj_list.append(o)
  24.                     o.select_set(True)
  25.         if(len(obj_list) > 1):
  26.             bpy.context.view_layer.objects.active = obj_list[0]
  27.             bpy.ops.object.join()
  28.         bpy.context.active_object.name = mat.name
  29.         bpy.ops.object.select_all(action='DESELECT')
  30.         obj_list.clear()
  31.         obj_list = []
  32.  
  33. bpy.ops.object.select_all(action='DESELECT')
  34. for obj in objects:
  35.     obj.select_set(obj.type == "EMPTY")
  36.     bpy.ops.object.delete()
Add Comment
Please, Sign In to add comment