animating datablocks

I NEED HELP! :slight_smile:
Does anyone out there know how I might be able to swap out one piece of mesh for another during animation? I’d really like to be able to call different mouth shapes out by animating the mesh datablock but that doesn’t seem to be able to be animated.

Any thoughts would be appreciated.

It’s for my thread here::


Assuming that you are not using shape keys for some reason (this is what they are for) you could write a frame_change handler that swapped datablocks on specific frames.

Here is a simple setup if you are code inclined.

import bpy
def pre_frame_change(scene):
    lst_datablocks = ['shape-1', 'shape-2','shape-3']   # Name of datablocks in memory.
    lst_frames_to_change_on = [15,45,75]                # Frame number associated datablock should be active.
    ob_to_swap_into = 'Cube'                                  # Name of your object here (swap container).
    ob =
    for i,frame_num in enumerate(lst_frames_to_change_on):
        if scene.frame_current == frame_num:
            # Time to swap datablocks.
            db =[i])
            if db != None:
       = db        # Assign new datablock to container object.
                # Name fetched from list does not exist in memory.

Shape keys don’t always have the flexibility of good ol’ replacement.

Gonna have to try that code out soon :slight_smile: