2011-01-11 11:25:24 +00:00
|
|
|
import bpy
|
|
|
|
|
2011-01-26 07:54:27 +00:00
|
|
|
|
2011-01-11 11:25:24 +00:00
|
|
|
class BUILTIN_KSI_hello(bpy.types.KeyingSetInfo):
|
|
|
|
bl_label = "Hello World KeyingSet"
|
|
|
|
|
|
|
|
# poll - test for whether Keying Set can be used at all
|
|
|
|
def poll(ksi, context):
|
2011-02-27 15:25:24 +00:00
|
|
|
return context.active_object or context.selected_objects
|
2011-01-26 07:54:27 +00:00
|
|
|
|
2011-01-11 11:25:24 +00:00
|
|
|
# iterator - go over all relevant data, calling generate()
|
|
|
|
def iterator(ksi, context, ks):
|
|
|
|
for ob in context.selected_objects:
|
|
|
|
ksi.generate(context, ks, ob)
|
2011-01-26 07:54:27 +00:00
|
|
|
|
2011-01-11 11:25:24 +00:00
|
|
|
# generator - populate Keying Set with property paths to use
|
|
|
|
def generate(ksi, context, ks, data):
|
|
|
|
id_block = data.id_data
|
2011-01-26 07:54:27 +00:00
|
|
|
|
2011-01-11 11:25:24 +00:00
|
|
|
ks.paths.add(id_block, "location")
|
2011-01-26 07:54:27 +00:00
|
|
|
|
2011-01-11 11:25:24 +00:00
|
|
|
for i in range(5):
|
|
|
|
ks.paths.add(id_block, "layers", i, group_method='NAMED', group_name="5x Hello Layers")
|
2011-01-26 07:54:27 +00:00
|
|
|
|
2011-01-11 11:25:24 +00:00
|
|
|
ks.paths.add(id_block, "show_x_ray", group_method='NONE')
|
2011-01-26 07:54:27 +00:00
|
|
|
|
2011-02-12 08:04:32 +00:00
|
|
|
|
|
|
|
def register():
|
|
|
|
bpy.utils.register_class(BUILTIN_KSI_hello)
|
|
|
|
|
|
|
|
|
|
|
|
def unregister():
|
|
|
|
bpy.utils.unregister_class(BUILTIN_KSI_hello)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
register()
|