I'd like to set animation keys from python script (for automatization). In this particular case can't find command for outliner context. I need command to set keys for 'TOGVIZ' and 'TOGREN'. (Not by picking that pictograms.)


The little camera and eye icons you use to change visibility in the outliner are toggling object properties.

The eye icon links to the hide property, while the camera icon links to the hide_render property and the cursor is the hide_select property.

To insert keyframes using python you set the property and then use keyframe_insert to create a keyframe with that value.

obj = bpy.context.object

obj.hide = True
obj.keyframe_insert('hide', frame=1)
obj.hide = False
obj.keyframe_insert('hide', frame=10)

obj.hide_render = True
obj.keyframe_insert('hide_render', frame=1)
obj.hide_render = False
obj.keyframe_insert('hide_render', frame=10)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.