Created
January 25, 2019 20:09
-
-
Save Fintan/c85b65fdfbd0c73f7cee02b2ac0443d2 to your computer and use it in GitHub Desktop.
Randomly switch camera in the Blender viewport
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| import random | |
| objects = bpy.context.selectable_objects; | |
| cameras = [] | |
| for obj in objects: | |
| if type(obj.data) == bpy.types.Camera: | |
| cameras.append(obj) | |
| for cam in cameras: | |
| print(cam.name) | |
| rndNum = random.randint(0, len(cameras) -1) | |
| bpy.context.scene.camera = cameras[rndNum] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment