Cleanup: use staticmethod where appropriate
[blender.git] / release / scripts / templates_py / builtin_keyingset.py
1 import bpy
2
3
4 class BUILTIN_KSI_hello(bpy.types.KeyingSetInfo):
5     bl_label = "Hello World KeyingSet"
6
7     # poll - test for whether Keying Set can be used at all
8     def poll(ksi, context):
9         return context.active_object or context.selected_objects
10
11     # iterator - go over all relevant data, calling generate()
12     def iterator(ksi, context, ks):
13         for ob in context.selected_objects:
14             ksi.generate(context, ks, ob)
15
16     # generator - populate Keying Set with property paths to use
17     def generate(ksi, context, ks, data):
18         id_block = data.id_data
19
20         ks.paths.add(id_block, "location")
21
22         for i in range(5):
23             ks.paths.add(id_block, "layers", i, group_method='NAMED', group_name="5x Hello Layers")
24
25         ks.paths.add(id_block, "show_in_front", group_method='NONE')
26
27
28 def register():
29     bpy.utils.register_class(BUILTIN_KSI_hello)
30
31
32 def unregister():
33     bpy.utils.unregister_class(BUILTIN_KSI_hello)
34
35
36 if __name__ == '__main__':
37     register()