Skip to content

Instantly share code, notes, and snippets.

@i5ar
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save i5ar/b47123ba64ebc43da526 to your computer and use it in GitHub Desktop.

Select an option

Save i5ar/b47123ba64ebc43da526 to your computer and use it in GitHub Desktop.
Blender Flip Normals
import bpy
scene = bpy.context.scene
for ob in scene.objects:
if ob.type == 'MESH':
scene.objects.active = ob
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
# Run an edit-mode operator on every object in the scene [1]
# [1]: http://blender.stackexchange.com/a/2639/8112
bpy.ops.mesh.reveal()
bpy.ops.mesh.select_all(action='SELECT')
# Operation in edit mode
bpy.ops.mesh.flip_normals()
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
import bpy
scn = bpy.context.scene
sel = bpy.context.selected_objects
meshes = [o for o in sel if o.type == 'MESH']
for obj in meshes:
scn.objects.active = obj
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.select_all(action='SELECT')
# Just flip normals
bpy.ops.mesh.flip_normals()
bpy.ops.object.mode_set()
@i5ar
Copy link
Copy Markdown
Author

i5ar commented Dec 8, 2014

Python script fail in gistfile1.py...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment