[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44742] trunk/blender: Fixing several issues with keyingsets:

Bastien Montagne montagne29 at wanadoo.fr
Thu Mar 8 15:04:14 CET 2012


Revision: 44742
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44742
Author:   mont29
Date:     2012-03-08 14:04:06 +0000 (Thu, 08 Mar 2012)
Log Message:
-----------
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?\226?\128?\153t 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?\226?\128?\166).
*Fixed UI code so that it always uses (RNA) enum, and simplified menu-creation code.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_operators/anim.py
    trunk/blender/release/scripts/startup/bl_ui/properties_scene.py
    trunk/blender/release/scripts/startup/keyingsets_builtins.py
    trunk/blender/source/blender/blenkernel/BKE_animsys.h
    trunk/blender/source/blender/blenkernel/intern/anim_sys.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/animation/keyframing.c
    trunk/blender/source/blender/editors/animation/keyingsets.c
    trunk/blender/source/blender/editors/include/ED_keyframing.h
    trunk/blender/source/blender/editors/space_outliner/outliner_edit.c
    trunk/blender/source/blender/makesdna/DNA_anim_types.h
    trunk/blender/source/blender/makesrna/intern/rna_animation.c
    trunk/blender/source/blender/makesrna/intern/rna_scene.c

Modified: trunk/blender/release/scripts/startup/bl_operators/anim.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/anim.py	2012-03-08 13:20:06 UTC (rev 44741)
+++ trunk/blender/release/scripts/startup/bl_operators/anim.py	2012-03-08 14:04:06 UTC (rev 44742)
@@ -67,15 +67,16 @@
         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")

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_scene.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_scene.py	2012-03-08 13:20:06 UTC (rev 44741)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_scene.py	2012-03-08 14:04:06 UTC (rev 44742)
@@ -115,7 +115,8 @@
             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'

Modified: trunk/blender/release/scripts/startup/keyingsets_builtins.py
===================================================================
--- trunk/blender/release/scripts/startup/keyingsets_builtins.py	2012-03-08 13:20:06 UTC (rev 44741)
+++ trunk/blender/release/scripts/startup/keyingsets_builtins.py	2012-03-08 14:04:06 UTC (rev 44742)
@@ -38,8 +38,20 @@
 # 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 @@
 
 # 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 @@
     # 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 @@
     # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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)

Modified: trunk/blender/source/blender/blenkernel/BKE_animsys.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_animsys.h	2012-03-08 13:20:06 UTC (rev 44741)
+++ trunk/blender/source/blender/blenkernel/BKE_animsys.h	2012-03-08 14:04:06 UTC (rev 44742)
@@ -81,7 +81,7 @@
 /* KeyingSets API */
 
 /* Used to create a new 'custom' KeyingSet for the user, that will be automatically added to the stack */
-struct KeyingSet *BKE_keyingset_add(struct ListBase *list, const char name[], short flag, short keyingflag);
+struct KeyingSet *BKE_keyingset_add(struct ListBase *list, const char idname[], const char name[], short flag, short keyingflag);
 
 /* Add a path to a KeyingSet */
 struct KS_Path *BKE_keyingset_add_path(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode);

Modified: trunk/blender/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim_sys.c	2012-03-08 13:20:06 UTC (rev 44741)
+++ trunk/blender/source/blender/blenkernel/intern/anim_sys.c	2012-03-08 14:04:06 UTC (rev 44742)
@@ -941,24 +941,29 @@
 /* Defining Tools --------------------------- */
 
 /* Used to create a new 'custom' KeyingSet for the user, that will be automatically added to the stack */
-KeyingSet *BKE_keyingset_add (ListBase *list, const char name[], short flag, short keyingflag)
+KeyingSet *BKE_keyingset_add (ListBase *list, const char idname[], const char name[], short flag, short keyingflag)
 {
 	KeyingSet *ks;
 	
 	/* allocate new KeyingSet */
 	ks= MEM_callocN(sizeof(KeyingSet), "KeyingSet");
 
-	BLI_strncpy(ks->name, name ? name : "KeyingSet", sizeof(ks->name));
+	BLI_strncpy(ks->idname, idname ? idname : name ? name : "KeyingSet", sizeof(ks->idname));
 
+	BLI_strncpy(ks->name, name ? name : idname ? idname : "Keying Set", sizeof(ks->name));
+
 	ks->flag= flag;
 	ks->keyingflag= keyingflag;
 	
 	/* add KeyingSet to list */
 	BLI_addtail(list, ks);
 	
-	/* make sure KeyingSet has a unique name (this helps with identification) */
-	BLI_uniquename(list, ks, "KeyingSet", '.', offsetof(KeyingSet, name), sizeof(ks->name));
+	/* Make sure KeyingSet has a unique idname. */
+	BLI_uniquename(list, ks, "KeyingSet", '.', offsetof(KeyingSet, idname), sizeof(ks->idname));
 	
+	/* Make sure KeyingSet has a unique label (this helps with identification). */
+	BLI_uniquename(list, ks, "Keying Set", '.', offsetof(KeyingSet, name), sizeof(ks->name));
+	
 	/* return new KeyingSet for further editing */
 	return ks;
 }

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2012-03-08 13:20:06 UTC (rev 44741)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2012-03-08 14:04:06 UTC (rev 44742)
@@ -13245,6 +13245,20 @@
 			do_versions_nodetree_multi_file_output_format_2_62_1(NULL, ntree);
 	}
 
+	/* put compatibility code here until next subversion bump */
+	{
+		{

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list