Post #3141: Ma

📋 Metadata

🏷️ Tags

macro advanced solved

  • Macro Editor
  • Python Scripting
  • Command tab

💬 Content

MatsuikoHiroka:

id like to request if its possible to create smart extract of maya using pie menu editor

at the end of separate or extract it goes to object mode and it select the extracted mesh

Hi @MatsuikoHiroka,
Try this code in Command tab:

obj_names = {o.name for o in D.objects}; bpy.ops.mesh.separate(type='SELECTED'); bpy.ops.object.mode_set(mode='EDIT', toggle=True); bpy.ops.object.select_all(action='DESELECT'); new_obj_names = {o.name for o in D.objects} - obj_names; new_obj = D.objects[new_obj_names.pop()]; new_obj.select_set(True); C.view_layer.objects.active = new_obj

❤️ 3 likes


🔗 View on Blender Artists