Showing posts with label Blender 3D. Show all posts
Showing posts with label Blender 3D. Show all posts

Wednesday, 15 May 2019

Blender Script: Change Object Visibility Each Frame

Here's a script to make visible only one object per frame in Blender. Visibility goes on for a single object and off for the rest.


import bpy
def ani_handler(scene):
    obj_len = len(scene.objects.values())
    for i, obj in enumerate(scene.objects.values()):
        # obj.hide_set(i != ((scene.frame_current-1) % obj_len)) # Blender 2.80
        obj.hide = (i != ((scene.frame_current-1) % obj_len)) #Blender 2.79b
bpy.app.handlers.frame_change_post.append(ani_handler)



Here's a second iteration of the script, this time it only changes visibility for objects with a specific name. In this case Cube

import bpy
def ani_handler(scene):
    name = 'Cube'
    objs = [obj for obj in scene.objects.values() if name in obj.name]
    for i, obj in enumerate(objs):
        obj.hide_set(i != ((scene.frame_current-1) % len(objs))) # Blender 2.80
        # obj.hide = (i != ((scene.frame_current-1) % obj_len)) #Blender 2.79b
bpy.app.handlers.frame_change_pre.append(ani_handler) 

Wednesday, 6 September 2017

Hit Record

I recently joined HitRecord, a social network/production house create by Joseph Gordon Levitt and his brother. The prerogative is that everything you share (audio, music, video, animation, illustration, etc) can be re-used/re-mixed, and at the same time you can do the same with all the uploaded data. This is one of my first records on the platform, which is a re interpretation of Jagama's Robot