Post #415: : post_00416
š·ļø Tags
macro python-scripting intermediate solved
āļø Related PME Features
- Macro Editor
- Python Scripting
š¬ 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]