diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2012-03-08 18:04:06 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2012-03-08 18:04:06 +0400 |
commit | a80b7d612947e1d26b10165a37bb603dae527afd (patch) | |
tree | 7a575b2f99b093e43d50d9322f8d1c50477b0fa6 /release/scripts/startup | |
parent | a5f2db9992327764126ee7f275294d1f0699a26a (diff) |
Fixing several issues with keyingsets:
*Add a new idname to keyingsets, keeping name as label-only (using same string for both made lookup fail when using i18n other than english, as it tried to compare an untranslated static string id against a translated RNA name). Also adding a description string (can be helpful with custom keyingsets, imho).
*Fixed a few other bugs related to that area (namely, you can’t deselect current keyingset from the shift-ctrl-alt-I popup menu, and insert/delete key ops were using a rather strange way to get chosen custom keyingset…).
*Fixed UI code so that it always uses (RNA) enum, and simplified menu-creation code.
Diffstat (limited to 'release/scripts/startup')
-rw-r--r-- | release/scripts/startup/bl_operators/anim.py | 9 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_scene.py | 3 | ||||
-rw-r--r-- | release/scripts/startup/keyingsets_builtins.py | 49 |
3 files changed, 54 insertions, 7 deletions
diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py index d26a7728af1..2689cfda8eb 100644 --- a/release/scripts/startup/bl_operators/anim.py +++ b/release/scripts/startup/bl_operators/anim.py @@ -67,15 +67,16 @@ class ANIM_OT_keying_set_export(Operator): scene = context.scene ks = scene.keying_sets.active - f.write("# Keying Set: %s\n" % ks.name) + f.write("# Keying Set: %s\n" % ks.bl_idname) f.write("import bpy\n\n") - # XXX, why not current scene? - f.write("scene= bpy.data.scenes[0]\n\n") + f.write("scene = bpy.context.scene\n\n") # Add KeyingSet and set general settings f.write("# Keying Set Level declarations\n") - f.write("ks= scene.keying_sets.new(name=\"%s\")\n" % ks.name) + f.write("ks = scene.keying_sets.new(idname=\"%s\", name=\"%s\")\n" + "" % (ks.bl_idname, ks.bl_label)) + f.write("ks.bl_description = \"%s\"\n" % ks.bl_description) if not ks.is_path_absolute: f.write("ks.is_path_absolute = False\n") diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index 7879f15270a..1c78549c086 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -115,7 +115,8 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, Panel): row = layout.row() col = row.column() - col.prop(ks, "name") + col.prop(ks, "bl_label") + col.prop(ks, "bl_description") subcol = col.column() subcol.operator_context = 'INVOKE_DEFAULT' diff --git a/release/scripts/startup/keyingsets_builtins.py b/release/scripts/startup/keyingsets_builtins.py index 1caf7c43983..26525bd2ff2 100644 --- a/release/scripts/startup/keyingsets_builtins.py +++ b/release/scripts/startup/keyingsets_builtins.py @@ -38,8 +38,20 @@ from bpy.types import KeyingSetInfo # Built-In KeyingSets +# "Defines" +# Keep these in sync with those in ED_keyframing.h! +ANIM_KS_LOCATION_ID = "Location" +ANIM_KS_ROTATION_ID = "Rotation" +ANIM_KS_SCALING_ID = "Scaling" +ANIM_KS_LOC_ROT_SCALE_ID = "LocRotScale" +ANIM_KS_AVAILABLE_ID = "Available" +ANIM_KS_WHOLE_CHARACTER_ID = "Whole Character" + + # Location class BUILTIN_KSI_Location(KeyingSetInfo): + """Insert a keyframe on each of the three location channels""" + bl_idname = ANIM_KS_LOCATION_ID bl_label = "Location" # poll - use predefined callback for selected bones/objects @@ -54,6 +66,8 @@ class BUILTIN_KSI_Location(KeyingSetInfo): # Rotation class BUILTIN_KSI_Rotation(KeyingSetInfo): + """Insert a keyframe on each of the rotation channels""" + bl_idname = ANIM_KS_ROTATION_ID bl_label = "Rotation" # poll - use predefined callback for selected bones/objects @@ -62,12 +76,14 @@ class BUILTIN_KSI_Rotation(KeyingSetInfo): # iterator - use callback for selected bones/objects iterator = keyingsets_utils.RKS_ITER_selected_item - # generator - use callback for location + # generator - use callback for rotation generate = keyingsets_utils.RKS_GEN_rotation # Scale class BUILTIN_KSI_Scaling(KeyingSetInfo): + """Insert a keyframe on each of the scale channels""" + bl_idname = ANIM_KS_SCALING_ID bl_label = "Scaling" # poll - use predefined callback for selected bones/objects @@ -76,7 +92,7 @@ class BUILTIN_KSI_Scaling(KeyingSetInfo): # iterator - use callback for selected bones/objects iterator = keyingsets_utils.RKS_ITER_selected_item - # generator - use callback for location + # generator - use callback for scaling generate = keyingsets_utils.RKS_GEN_scaling # ------------ @@ -84,6 +100,7 @@ class BUILTIN_KSI_Scaling(KeyingSetInfo): # LocRot class BUILTIN_KSI_LocRot(KeyingSetInfo): + """Insert a keyframe on each of the location and rotation channels""" bl_label = "LocRot" # poll - use predefined callback for selected bones/objects @@ -102,6 +119,7 @@ class BUILTIN_KSI_LocRot(KeyingSetInfo): # LocScale class BUILTIN_KSI_LocScale(KeyingSetInfo): + """Insert a keyframe on each of the location and scale channels""" bl_label = "LocScale" # poll - use predefined callback for selected bones/objects @@ -120,6 +138,10 @@ class BUILTIN_KSI_LocScale(KeyingSetInfo): # LocRotScale class BUILTIN_KSI_LocRotScale(KeyingSetInfo): + """ + Insert a keyframe on each of the location, rotation and scale channels + """ + bl_idname = ANIM_KS_LOC_ROT_SCALE_ID bl_label = "LocRotScale" # poll - use predefined callback for selected bones/objects @@ -140,6 +162,7 @@ class BUILTIN_KSI_LocRotScale(KeyingSetInfo): # RotScale class BUILTIN_KSI_RotScale(KeyingSetInfo): + """Insert a keyframe on each of the rotation and scale channels""" bl_label = "RotScale" # poll - use predefined callback for selected bones/objects @@ -160,6 +183,10 @@ class BUILTIN_KSI_RotScale(KeyingSetInfo): # Location class BUILTIN_KSI_VisualLoc(KeyingSetInfo): + """ + Insert a keyframe on each of the location channels, taking into account + constraints and relationships effects + """ bl_label = "Visual Location" bl_options = {'INSERTKEY_VISUAL'} @@ -176,6 +203,10 @@ class BUILTIN_KSI_VisualLoc(KeyingSetInfo): # Rotation class BUILTIN_KSI_VisualRot(KeyingSetInfo): + """ + Insert a keyframe on each of the rotation channels, taking into account + constraints and relationships effects + """ bl_label = "Visual Rotation" bl_options = {'INSERTKEY_VISUAL'} @@ -192,6 +223,10 @@ class BUILTIN_KSI_VisualRot(KeyingSetInfo): # VisualLocRot class BUILTIN_KSI_VisualLocRot(KeyingSetInfo): + """ + Insert a keyframe on each of the location and rotation channels), + taking into account constraints and relationships effects + """ bl_label = "Visual LocRot" bl_options = {'INSERTKEY_VISUAL'} @@ -214,6 +249,8 @@ class BUILTIN_KSI_VisualLocRot(KeyingSetInfo): # Available class BUILTIN_KSI_Available(KeyingSetInfo): + """Insert a keyframe on each of the already existing F-Curves""" + bl_idname = ANIM_KS_AVAILABLE_ID bl_label = "Available" # poll - selected objects or selected object with animation data @@ -236,6 +273,11 @@ class BUILTIN_KSI_Available(KeyingSetInfo): # All properties that are likely to get animated in a character rig class BUILTIN_KSI_WholeCharacter(KeyingSetInfo): + """ + Insert a keyframe for all properties that are likely to get animated in a + character rig (useful when blocking out a shot) + """ + bl_idname = ANIM_KS_WHOLE_CHARACTER_ID bl_label = "Whole Character" # these prefixes should be avoided, as they are not really bones @@ -379,6 +421,7 @@ class BUILTIN_KSI_WholeCharacter(KeyingSetInfo): # Delta Location class BUILTIN_KSI_DeltaLocation(KeyingSetInfo): + """Insert keyframes for additional location offset""" bl_label = "Delta Location" # poll - selected objects only (and only if active object in object mode) @@ -404,6 +447,7 @@ class BUILTIN_KSI_DeltaLocation(KeyingSetInfo): # Delta Rotation class BUILTIN_KSI_DeltaRotation(KeyingSetInfo): + """Insert keyframes for additional rotation offset""" bl_label = "Delta Rotation" # poll - selected objects only (and only if active object in object mode) @@ -437,6 +481,7 @@ class BUILTIN_KSI_DeltaRotation(KeyingSetInfo): # Delta Scale class BUILTIN_KSI_DeltaScale(KeyingSetInfo): + """Insert keyframes for additional scaling factor""" bl_label = "Delta Scale" # poll - selected objects only (and only if active object in object mode) |