__author__ = 'thoth'
import bpy
def mission1(obj):
lamp = obj.data
e_node = lamp.node_tree.nodes["Emission"]
data_path = 'nodes["Emission"].inputs[1].default_value'
for fr in [100, 130, 150, 200, 300]:
fr2 = fr+10
e_node.inputs[1].default_value = 20
lamp.node_tree.keyframe_insert(data_path=data_path, frame=fr)
e_node.inputs[1].default_value = 100
lamp.node_tree.keyframe_insert(data_path=data_path, frame=fr2)
for fc in lamp.node_tree.animation_data.action.fcurves:
for kp in fc.keyframe_points:
kp.interpolation = 'CONSTANT'
mission1(bpy.context.active_object)
|
Blender python API quick-start
Syntax highlighting by Pygments.