Post #3141:
Ma
📋 Metadata
- Author: roaoao
- Date: 2020-04-04 22:46:38
- Type:
answer - Quality Score: 8/10
- Reply to: post_03134
- Replies (1): post_03142
🏷️ Tags
⚙️ Related PME Features
- 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