Insert a Keyframe at the Current Frame for the Emission Value of a Material

Pretty self-explanatory thread title. I just need a one-liner that’ll set the material emission value keyframed at the current frame to a certain value.

Using the python console

The console code below inserts a keyframe for emit (set to 0.9 ) onto the material named “Material”. By default it inserts it at the current frame. Use ctrl space to autocomplete, it pops out some useful info.

>>> mat =['Material']
>>> mat['Material']

>>> mat.emit = 0.9
>>> mat.keyframe_insert(<ctrl-space>
keyframe_insert(data_path, index=-1, frame=bpy.context.scene.frame_current, group="")
.. method:: keyframe_insert(data_path, index=-1, frame=bpy.context.scene.frame_current, group="")
Insert a keyframe on the property given, adding fcurves and animation data when necessary.
:arg data_path: path to the property to key, analogous to the fcurve's data path.
:type data_path: string
:arg index: array index of the property to key. Defaults to -1 which will key all indices or a single channel if the property is not an array.
:type index: int
:arg frame: The frame on which the keyframe is inserted, defaulting to the current frame.
:type frame: float
:arg group: The name of the group the F-Curve should be added to if it doesn't exist yet.
:type group: str
:return: Success of keyframe insertion.
:rtype: boolean
>>> mat.keyframe_insert('emit',frame=10)