I tried adding a property to AnimData.
Its a bit different.
script
import bpy
bpy.types.AnimData.my_int = bpy.props.IntProperty(default=3)
bpy.types.Scene.test = bpy.data.objects['Cube'].animation_data.my_int
console
>>> bpy.data.objects['Cube'].animation_data.my_int
(<built-in function IntProperty>, {'default': 3, 'attr': 'test'})
>>> bpy.context.scene.test
3
..
>>> bpy.data.objects['Cube'].animation_data.my_int[0]
<built-in function IntProperty>
>>> bpy.data.objects['Cube'].animation_data.my_int[1]
{'default': 3, 'attr': 'test'}
..
>>> bpy.data.objects['Cube'].animation_data.my_int(
my_int()
tuple() -> empty tuple
tuple(iterable) -> tuple initialized from iterable's items
If the argument is a tuple, the return value is the same object.
>>> bpy.data.objects['Cube'].animation_data.my_int[0](
my_int[0](name="", description="", default=0, min=-sys.maxint, max=sys.maxint, soft_min=-sys.maxint, soft_max=sys.maxint, step=1, options={'ANIMATABLE'}, subtype='NONE', update=None, get=None, set=None)
.. function:: IntProperty(name="", description="", default=0, min=-sys.maxint, max=sys.maxint, soft_min=-sys.maxint, soft_max=sys.maxint, step=1, options={'ANIMATABLE'}, subtype='NONE', update=None, get=None, set=None)
Returns a new int property definition.
:arg name: Name used in the user interface.
:type name: string
:arg description: Text used for the tooltip and api documentation.
:type description: string
:arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE', 'LIBRARY_EDITABLE'].
:type options: set
:arg subtype: Enumerator in ['UNSIGNED', 'PERCENTAGE', 'FACTOR', 'ANGLE', 'TIME', 'DISTANCE', 'NONE'].
:type subtype: string
:arg update: function to be called when this value is modified,
This function must take 2 values (self, context) and return None.
*Warning* there are no safety checks to avoid infinite recursion.
:type update: function
>>> bpy.data.objects['Cube'].animation_data.my_int[1](
my_int[1]()
dict() -> new empty dictionary
dict(mapping) -> new dictionary initialized from a mapping object's
(key, value) pairs
dict(iterable) -> new dictionary initialized as if via:
d = {}
for k, v in iterable:
d[k] = v
dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
python operator.
script
import bpy
class ANIM_OT_my_operator(bpy.types.Operator):
bl_idname = "anim.my_operator"
bl_label = "My Operator"
def execute(self, context):
# code
return{'FINISHED'}
bpy.utils.register_class(ANIM_OT_my_operator)
console
>>> bpy.ops.anim.my_operator()
{'FINISHED'}