Monday, January 6, 2014

A hint for Timeline?

I think it's one of the ideas for making timeline for an object, using 'frame'.
This code is changing the 'Ratio' of Decimate modifier from 0.005 to 1.0.

###
import bpy
import math

def my_handler(scene):
    cf = bpy.context.scene.frame_current
    r = (cf * 10)

    if (cf < 200):
        bpy.context.object.modifiers["Decimate"].ratio = cf * 0.005
    else:
        bpy.context.object.modifiers["Decimate"].ratio = 1.0
     
bpy.app.handlers.frame_change_pre.append(my_handler)

###