Post #2614: Single line code for for loop should look like this:
📋 Metadata
- Author: roaoao
- Date: 2019-08-12 13:08:25
- Type:
answer - Quality Score: 8/10
- Reply to: post_02613
- Replies (1): post_02615
🏷️ Tags
macro python-scripting intermediate
⚙️ Related PME Features
- Macro Editor
- Python Scripting
💬 Content
Single line code for for loop should look like this:
[setattr(ob, "show_in_front", ac.show_in_front) for ob in bpy.context.selected_objects]
Final code:
ac = bpy.context.object; ac.show_in_front = not ac.show_in_front; [setattr(ob, "show_in_front", ac.show_in_front) for ob in bpy.context.selected_objects]