Skip to content

Instantly share code, notes, and snippets.

@rafaelbriet
Created January 16, 2020 18:58
Show Gist options
  • Save rafaelbriet/4c117d66a8c2ad861056cbeff7cb8e73 to your computer and use it in GitHub Desktop.
Save rafaelbriet/4c117d66a8c2ad861056cbeff7cb8e73 to your computer and use it in GitHub Desktop.
Apply a "object pass index" to multiple objects in Blender
# COPYRIGHT: https://blenderartists.org/t/applying-object-pass-index-to-multiple-objects/562689/4
# This script apply a object pass index to multiple objects in Blender
# Select all objects to be batched first; all selected objects will be batched
import bpy
selection = bpy.context.selected_objects
passNumber = 2 #change '2' to whichever pass index you choose
bpy.ops.object.select_all(action='DESELECT')
for obj in selection:
obj.select = True
obj.pass_index = passNumber
obj.select = False
for obj in selection:
obj.select = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment