use defines for keying set names to avoid confusing them with text and having some...
authorCampbell Barton <ideasman42@gmail.com>
Sun, 23 Oct 2011 05:08:02 +0000 (05:08 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 23 Oct 2011 05:08:02 +0000 (05:08 +0000)
source/blender/editors/animation/keyingsets.c
source/blender/editors/armature/editarmature.c
source/blender/editors/armature/poseUtils.c
source/blender/editors/armature/poselib.c
source/blender/editors/armature/poseobject.c
source/blender/editors/include/ED_keyframing.h
source/blender/editors/interface/interface_ops.c
source/blender/editors/object/object_transform.c
source/blender/editors/space_view3d/view3d_fly.c
source/blender/editors/space_view3d/view3d_snap.c
source/blender/editors/transform/transform_conversions.c

index 7c2f969e1873028f309f07a50808d91c12a2f6f8..95324554a069c2c022f3815c276e880f778319fd 100644 (file)
@@ -552,7 +552,12 @@ KeyingSet *ANIM_builtin_keyingset_get_named (KeyingSet *prevKS, const char name[
                if (strcmp(name, ks->name) == 0)
                        return ks;
        }
-       
+
+       /* complain about missing keying sets on debug builds */
+#ifndef NDEBUG
+       printf("%s: '%s' not found\n", __func__, name);
+#endif
+
        /* no matches found */
        return NULL;
 }
@@ -687,7 +692,7 @@ KeyingSet *ANIM_get_keyingset_for_autokeying(Scene *scene, const char *tranformK
        if (IS_AUTOKEY_FLAG(scene, ONLYKEYINGSET) && (scene->active_keyingset))
                return ANIM_scene_get_active_keyingset(scene);
        else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL))
-               return ANIM_builtin_keyingset_get_named(NULL, "Available");
+               return ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_AVAILABLE_ID);
        else 
                return ANIM_builtin_keyingset_get_named(NULL, tranformKSName);
 }
index 11fd932eed6a0e98deb7fec33db2ebb688e90f4e..15c8868f9b9b97b93fb430b8e9a701f3cdc9e6f3 100644 (file)
@@ -4948,7 +4948,7 @@ static int pose_clear_transform_generic_exec(bContext *C, wmOperator *op,
 
 static int pose_clear_scale_exec(bContext *C, wmOperator *op) 
 {
-       return pose_clear_transform_generic_exec(C, op, pchan_clear_scale, "Scaling");
+       return pose_clear_transform_generic_exec(C, op, pchan_clear_scale, ANIM_KS_SCALING_ID);
 }
 
 void POSE_OT_scale_clear(wmOperatorType *ot)
@@ -4969,7 +4969,7 @@ void POSE_OT_scale_clear(wmOperatorType *ot)
 
 static int pose_clear_rot_exec(bContext *C, wmOperator *op) 
 {
-       return pose_clear_transform_generic_exec(C, op, pchan_clear_rot, "Rotation");
+       return pose_clear_transform_generic_exec(C, op, pchan_clear_rot, ANIM_KS_ROTATION_ID);
 }
 
 void POSE_OT_rot_clear(wmOperatorType *ot)
@@ -4990,7 +4990,7 @@ void POSE_OT_rot_clear(wmOperatorType *ot)
 
 static int pose_clear_loc_exec(bContext *C, wmOperator *op) 
 {
-       return pose_clear_transform_generic_exec(C, op, pchan_clear_loc, "Location");
+       return pose_clear_transform_generic_exec(C, op, pchan_clear_loc, ANIM_KS_LOCATION_ID);
 }
 
 void POSE_OT_loc_clear(wmOperatorType *ot)
@@ -5011,7 +5011,7 @@ void POSE_OT_loc_clear(wmOperatorType *ot)
 
 static int pose_clear_transforms_exec(bContext *C, wmOperator *op) 
 {
-       return pose_clear_transform_generic_exec(C, op, pchan_clear_transforms, "LocRotScale");
+       return pose_clear_transform_generic_exec(C, op, pchan_clear_transforms, ANIM_KS_LOC_ROT_SCALE_ID);
 }
 
 void POSE_OT_transforms_clear(wmOperatorType *ot)
index 4b22d76ad0b9e3b8c31bc9928bc8374a7bbbe3c5..5c98fdc08bd155d5f821a5101f5d206bcce4a781 100644 (file)
@@ -223,7 +223,7 @@ void poseAnim_mapping_autoKeyframe (bContext *C, Scene *scene, Object *ob, ListB
 {
        /* insert keyframes as necessary if autokeyframing */
        if (autokeyframe_cfra_can_key(scene, &ob->id)) {
-               KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "Whole Character");
+               KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_WHOLE_CHARACTER_ID);
                ListBase dsources = {NULL, NULL};
                tPChanFCurveLink *pfl;
                
index 8e9f5c7543c08aeaf58a043aad294551b8aa5daf..064defb1aefe2cb0b4c7a8bc43f0d2a14a64b2f5 100644 (file)
@@ -433,7 +433,7 @@ static int poselib_add_exec (bContext *C, wmOperator *op)
        bAction *act = poselib_validate(ob);
        bPose *pose= (ob) ? ob->pose : NULL;
        TimeMarker *marker;
-       KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Whole Character"); /* this includes custom props :)*/
+       KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_WHOLE_CHARACTER_ID); /* this includes custom props :)*/
        int frame= RNA_int_get(op->ptr, "frame");
        char name[64];
        
@@ -903,7 +903,7 @@ static void poselib_keytag_pose (bContext *C, Scene *scene, tPoseLib_PreviewData
        bAction *act= pld->act;
        bActionGroup *agrp;
        
-       KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "Whole Character");
+       KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_WHOLE_CHARACTER_ID);
        ListBase dsources = {NULL, NULL};
        short autokey = autokeyframe_cfra_can_key(scene, &pld->ob->id);
        
index a978f327993c8457c6b0b8bd0b2c91b13e3e37ac..beae9c12bfe7b589734d0b05411964f3ddc3ad5d 100644 (file)
@@ -1151,7 +1151,7 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
        int selOnly= RNA_boolean_get(op->ptr, "selected_mask");
 
        /* get KeyingSet to use */
-       KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "LocRotScale");
+       KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOC_ROT_SCALE_ID);
 
        /* sanity checks */
        if ELEM(NULL, ob, ob->pose)
@@ -2165,7 +2165,7 @@ static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op))
 {
        Scene *scene= CTX_data_scene(C);
        Object *ob= object_pose_armature_get(CTX_data_active_object(C));
-       KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, "LocRotScale");
+       KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOC_ROT_SCALE_ID);
        
        /* loop through all selected pchans, flipping and keying (as needed) */
        CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
index 8dd543d8f63a7126d49935a6e85074d064b5dd9b..eda84d0e7a452379cf118eef6b8bd0bbd902f008 100644 (file)
@@ -317,6 +317,14 @@ typedef enum eAnimFilterFlags {
 int ED_autokeyframe_object(struct bContext *C, struct Scene *scene, struct Object *ob, struct KeyingSet *ks);
 int ED_autokeyframe_pchan(struct bContext *C, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, struct KeyingSet *ks);
 
+/* Names for builtin keying sets so we don't confuse these with labels/text,
+ * defined in python script: keyingsets_builtins.py */
+#define ANIM_KS_LOCATION_ID         "Location"
+#define ANIM_KS_ROTATION_ID         "Rotation"
+#define ANIM_KS_SCALING_ID          "Scaling"
+#define ANIM_KS_LOC_ROT_SCALE_ID    "LocRotScale"
+#define ANIM_KS_AVAILABLE_ID        "Available"
+#define ANIM_KS_WHOLE_CHARACTER_ID  "Whole Character"
 
 #ifdef __cplusplus
 }
index ebd6150cfd0afbae82fe61a367d3cb377018d0c4..eee771cbd9357b706d3fafcb03cc8d9e48a9cd4c 100644 (file)
@@ -648,10 +648,12 @@ static int editsource_exec(bContext *C, wmOperator *op)
                ARegion *ar= CTX_wm_region(C);
                int ret;
 
+               /* needed else the active button does not get tested */
                uiFreeActiveButtons(C, CTX_wm_screen(C));
 
                // printf("%s: begin\n", __func__);
 
+               /* take care not to return before calling ui_editsource_active_but_clear */
                ui_editsource_active_but_set(but);
 
                /* redraw and get active button python info */
index 4ca7d27250365bd6e12482e5f1c3e42dc6d5dd25..6d721e828afa35348d66a6e55ff3ff4458733558 100644 (file)
@@ -252,7 +252,7 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op,
 
 static int object_location_clear_exec(bContext *C, wmOperator *op)
 {
-       return object_clear_transform_generic_exec(C, op, object_clear_loc, "Location");
+       return object_clear_transform_generic_exec(C, op, object_clear_loc, ANIM_KS_LOCATION_ID);
 }
 
 void OBJECT_OT_location_clear(wmOperatorType *ot)
@@ -272,7 +272,7 @@ void OBJECT_OT_location_clear(wmOperatorType *ot)
 
 static int object_rotation_clear_exec(bContext *C, wmOperator *op)
 {
-       return object_clear_transform_generic_exec(C, op, object_clear_rot, "Rotation");
+       return object_clear_transform_generic_exec(C, op, object_clear_rot, ANIM_KS_ROTATION_ID);
 }
 
 void OBJECT_OT_rotation_clear(wmOperatorType *ot)
@@ -292,7 +292,7 @@ void OBJECT_OT_rotation_clear(wmOperatorType *ot)
 
 static int object_scale_clear_exec(bContext *C, wmOperator *op)
 {
-       return object_clear_transform_generic_exec(C, op, object_clear_scale, "Scaling");
+       return object_clear_transform_generic_exec(C, op, object_clear_scale, ANIM_KS_SCALING_ID);
 }
 
 void OBJECT_OT_scale_clear(wmOperatorType *ot)
index b66440738b2ba6b73f5df22d438490338ae1c615..8e2a9c3019304a21712e879d29639fc0280c6620 100644 (file)
@@ -699,11 +699,11 @@ static void move_camera(bContext* C, RegionView3D* rv3d, FlyInfo* fly, int orien
                 *              TODO: need to check in future that frame changed before doing this 
                 */
                if (orientationChanged) {
-                       KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Rotation");
+                       KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_ROTATION_ID);
                        ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
                }
                if (positionChanged) {
-                       KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Location");
+                       KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID);
                        ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
                }
                
index fa3007d2fb7e39eb87b831a6bf771e8b80f33401..c69d2159ac270dda3c445274c3e0b862617d565d 100644 (file)
@@ -495,7 +495,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
        
        }
        else {
-               struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "Location");
+               struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
 
                CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
                        if(ob->mode & OB_MODE_POSE) {
@@ -625,7 +625,7 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
                
        }
        else {
-               struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "Location");
+               struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
 
                CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
                        if(ob->mode & OB_MODE_POSE) {
index 12e65e9d287e21cbab74cc4ac0e72f28356f10fe..1d28b594e57cdbf1293a9d47e980b37f21c8aedc 100644 (file)
@@ -4582,21 +4582,21 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob,
                        
                        /* insert keyframes for the affected sets of channels using the builtin KeyingSets found */
                        if (doLoc) {
-                               KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Location");
+                               KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID);
                                ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
                        }
                        if (doRot) {
-                               KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Rotation");
+                               KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_ROTATION_ID);
                                ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
                        }
                        if (doScale) {
-                               KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Scaling");
+                               KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_SCALING_ID);
                                ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
                        }
                }
                /* insert keyframe in all (transform) channels */
                else {
-                       KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "LocRotScale");
+                       KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOC_ROT_SCALE_ID);
                        ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
                }
                
@@ -4697,21 +4697,21 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o
                                        }
                                        
                                        if (doLoc) {
-                                               KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Location");
+                                               KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID);
                                                ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
                                        }
                                        if (doRot) {
-                                               KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Rotation");
+                                               KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_ROTATION_ID);
                                                ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
                                        }
                                        if (doScale) {
-                                               KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Scaling");
+                                               KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_SCALING_ID);
                                                ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
                                        }
                                }
                                /* insert keyframe in all (transform) channels */
                                else {
-                                       KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "LocRotScale");
+                                       KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOC_ROT_SCALE_ID);
                                        ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
                                }