Python Tip : Toggling mesh's double sidedness
I posted this on a social network in response to a question
Let me explain the above code snippet
C.scene.objects
[obj.data for obj in C.scene.objects if obj.type in ['MESH']]
mesh.show_double_sided = False
""
Let me explain the above code snippet
C.scene.objects
is a shortcut for bpy.context.scene.objects. In Blender, bpy.context keeps track of the global/current application context, which in this case is teh list of objects in the currently set scene in Blender.
[obj.data for obj in C.scene.objects if obj.type in ['MESH']]
returns a list of mesh objects in the current scene. This syntax here is that of a Python list comprehension
mesh.show_double_sided = False
This performs the actual magic. Its self explanatory.
Interesting. one line script.
ReplyDeleteThank you!
Delete