📋 Metadata
- Author: roaoao
- Date: 2016-10-31 20:39:58
- Type:
answer - Reply to: post_00413
- Replies (1): post_00416
💬 Content
Nanomanpro:
roaoao You are genius:)
I’m trying to understand this pattern but I’m too weak in python, so I have one more question.
How can I modify this code only for selected objects, and when no object is selected for all meshes?Thx
You need to find seleced meshes (selected_meshes) and use them instead of all meshes (meshes).
This code should work:
meshes = [o for o in bpy.data.objects if o.type == 'MESH']; selected_meshes = [o for o in bpy.context.selected_objects if o.type == 'MESH']; meshes = selected_meshes or meshes; global show_wire; show_wire = meshes and not meshes[0].show_wire; [setattr(m, "show_wire", show_wire) for m in meshes]