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