diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-23 21:38:52 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-23 21:38:52 +0400 |
commit | c658442c65a362329c6049f509b58547866fee2a (patch) | |
tree | d993bd471b208f42eac7457aabb39405f29e48ca /release/scripts/startup/bl_operators/anim.py | |
parent | c658b74db5a9b469393cb02133731fdcb01bcdf7 (diff) |
- move animsys update operator into the anim.py
- move the data into animsys_refactor.py module so its not loaded on blender start.
Diffstat (limited to 'release/scripts/startup/bl_operators/anim.py')
-rw-r--r-- | release/scripts/startup/bl_operators/anim.py | 73 |
1 files changed, 56 insertions, 17 deletions
diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py index 660194abf8c..7d1f3b8f5f0 100644 --- a/release/scripts/startup/bl_operators/anim.py +++ b/release/scripts/startup/bl_operators/anim.py @@ -25,7 +25,11 @@ if "bpy" in locals(): import bpy from bpy.types import Operator -from bpy.props import IntProperty, BoolProperty, EnumProperty +from bpy.props import (IntProperty, + BoolProperty, + EnumProperty, + StringProperty, + ) class ANIM_OT_keying_set_export(Operator): @@ -33,10 +37,24 @@ class ANIM_OT_keying_set_export(Operator): bl_idname = "anim.keying_set_export" bl_label = "Export Keying Set..." - filepath = bpy.props.StringProperty(name="File Path", description="Filepath to write file to") - filter_folder = bpy.props.BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'}) - filter_text = bpy.props.BoolProperty(name="Filter text", description="", default=True, options={'HIDDEN'}) - filter_python = bpy.props.BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'}) + filepath = StringProperty( + name="File Path", + ) + filter_folder = BoolProperty( + name="Filter folders", + default=True, + options={'HIDDEN'}, + ) + filter_text = BoolProperty( + name="Filter text", + default=True, + options={'HIDDEN'}, + ) + filter_python = BoolProperty( + name="Filter python", + default=True, + options={'HIDDEN'}, + ) def execute(self, context): if not self.filepath: @@ -52,7 +70,8 @@ class ANIM_OT_keying_set_export(Operator): f.write("# Keying Set: %s\n" % ks.name) f.write("import bpy\n\n") - f.write("scene= bpy.data.scenes[0]\n\n") # XXX, why not use the current scene? + # XXX, why not current scene? + f.write("scene= bpy.data.scenes[0]\n\n") # Add KeyingSet and set general settings f.write("# Keying Set Level declarations\n") @@ -65,8 +84,11 @@ class ANIM_OT_keying_set_export(Operator): f.write("ks.bl_options = %r\n" % ks.bl_options) f.write("\n") + # -------------------------------------------------------- # generate and write set of lookups for id's used in paths - id_to_paths_cache = {} # cache for syncing ID-blocks to bpy paths + shorthands + + # cache for syncing ID-blocks to bpy paths + shorthands + id_to_paths_cache = {} for ksp in ks.paths: if ksp.id is None: @@ -74,11 +96,14 @@ class ANIM_OT_keying_set_export(Operator): if ksp.id in id_to_paths_cache: continue - # - idtype_list is used to get the list of id-datablocks from bpy.data.* - # since this info isn't available elsewhere - # - id.bl_rna.name gives a name suitable for UI, - # with a capitalised first letter, but we need - # the plural form that's all lower case + """ + - idtype_list is used to get the list of id-datablocks from + bpy.data.* since this info isn't available elsewhere + - id.bl_rna.name gives a name suitable for UI, + with a capitalised first letter, but we need + the plural form that's all lower case + """ + idtype_list = ksp.id.bl_rna.name.lower() + "s" id_bpy_path = "bpy.data.%s[\"%s\"]" % (idtype_list, ksp.id.name) @@ -113,9 +138,11 @@ class ANIM_OT_keying_set_export(Operator): f.write(", index=%d" % ksp.array_index) # grouping settings (if applicable) - # NOTE: the current default is KEYINGSET, but if this changes, change this code too + # NOTE: the current default is KEYINGSET, but if this changes, + # change this code too if ksp.group_method == 'NAMED': - f.write(", group_method='%s', group_name=\"%s\"" % (ksp.group_method, ksp.group)) + f.write(", group_method='%s', group_name=\"%s\"" % + (ksp.group_method, ksp.group)) elif ksp.group_method != 'KEYINGSET': f.write(", group_method='%s'" % ksp.group_method) @@ -134,7 +161,7 @@ class ANIM_OT_keying_set_export(Operator): class BakeAction(Operator): - '''Bake animation to an Action''' + """Bake animation to an Action""" bl_idname = "nla.bake" bl_label = "Bake Action" bl_options = {'REGISTER', 'UNDO'} @@ -200,8 +227,8 @@ class BakeAction(Operator): class ClearUselessActions(Operator): - '''Mark actions with no F-Curves for deletion after save+reload of ''' \ - '''file preserving "action libraries"''' + """Mark actions with no F-Curves for deletion after save+reload of """ \ + """file preserving "action libraries""" bl_idname = "anim.clear_useless_actions" bl_label = "Clear Useless Actions" bl_options = {'REGISTER', 'UNDO'} @@ -233,3 +260,15 @@ class ClearUselessActions(Operator): self.report({'INFO'}, "Removed %d empty and/or fake-user only Actions" % removed) return {'FINISHED'} + + +class UpdateAnimData(Operator): + """Update data paths from 2.56 and previous versions, """ \ + """modifying data paths of drivers and fcurves""" + bl_idname = "anim.update_data_paths" + bl_label = "Update Animation Data" + + def execute(self, context): + import animsys_refactor + animsys_refactor.update_data_paths(animsys_refactor.data_2_56_to_2_59) + return {'FINISHED'} |