Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-08-25 04:12:11 +0400
committerJoshua Leung <aligorith@gmail.com>2009-08-25 04:12:11 +0400
commit4a78b9e9046567e86ed3ccada83a50c43684facd (patch)
tree405a3569ffe5d0477dfce4c2bcaded918574e240 /source
parent8ed64f785491c10467e83584caecc13ec5199aaf (diff)
2.5 - Assorted Bugfixes for Animation Editing
* Inserting keyframes now takes into account whether the F-Curve was editable or not. * Editing keyframes in animation editors now sends proper depsgraph updates instead of just tagging the relevant objects. Thanks JiriH for reporting these bugs.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/animation/keyframing.c21
-rw-r--r--source/blender/editors/space_action/action_header.c4
-rw-r--r--source/blender/editors/transform/transform_generics.c11
3 files changed, 26 insertions, 10 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 2da082a9b7c..b62c69c7b38 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -740,6 +740,12 @@ short insert_keyframe_direct (PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, fl
printf("ERROR: no F-Curve to add keyframes to \n");
return 0;
}
+ /* F-Curve not editable? */
+ if ( (fcu->flag & FCURVE_PROTECTED) || ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) ) {
+ if (G.f & G_DEBUG)
+ printf("WARNING: not inserting keyframe for locked F-Curve \n");
+ return 0;
+ }
/* if no property given yet, try to validate from F-Curve info */
if ((ptr.id.data == NULL) && (ptr.data==NULL)) {
@@ -911,8 +917,19 @@ short delete_keyframe (ID *id, bAction *act, const char group[], const char rna_
/* we don't check the validity of the path here yet, but it should be ok... */
fcu= verify_fcurve(act, group, rna_path, array_index, 0);
- /* only continue if we have an F-Curve to remove keyframes from */
- if (act && fcu) {
+ /* check if F-Curve exists and/or whether it can be edited */
+ if ELEM(NULL, act, fcu) {
+ printf("ERROR: no F-Curve and/or Action to delete keyframe from \n");
+ return 0;
+ }
+ if ( (fcu->flag & FCURVE_PROTECTED) || ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) ) {
+ if (G.f & G_DEBUG)
+ printf("WARNING: not inserting keyframe for locked F-Curve \n");
+ return 0;
+ }
+
+ /* it should be fine to continue now... */
+ {
short found = -1;
int i;
diff --git a/source/blender/editors/space_action/action_header.c b/source/blender/editors/space_action/action_header.c
index 375136d199e..33a97b5a80a 100644
--- a/source/blender/editors/space_action/action_header.c
+++ b/source/blender/editors/space_action/action_header.c
@@ -404,13 +404,13 @@ void action_header_buttons(const bContext *C, ARegion *ar)
if (saction->flag & SACTION_DRAWTIME) {
uiDefButC(block, MENU, B_REDR,
"Auto-Snap Keyframes %t|No Snap %x0|Second Step %x1|Nearest Second %x2|Nearest Marker %x3",
- xco,yco,70,YIC, &(saction->autosnap), 0, 1, 0, 0,
+ xco,yco,90,YIC, &(saction->autosnap), 0, 1, 0, 0,
"Auto-snapping mode for keyframes when transforming");
}
else {
uiDefButC(block, MENU, B_REDR,
"Auto-Snap Keyframes %t|No Snap %x0|Frame Step %x1|Nearest Frame %x2|Nearest Marker %x3",
- xco,yco,70,YIC, &(saction->autosnap), 0, 1, 0, 0,
+ xco,yco,90,YIC, &(saction->autosnap), 0, 1, 0, 0,
"Auto-snapping mode for keyframes when transforming");
}
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 168a65a2e75..edcbd858e37 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -269,7 +269,7 @@ static void editmesh_apply_to_mirror(TransInfo *t)
/* tags the given ID block for refreshes (if applicable) due to
* Animation Editor editing
*/
-static void animedit_refresh_id_tags (ID *id)
+static void animedit_refresh_id_tags (Scene *scene, ID *id)
{
if (id) {
AnimData *adt= BKE_animdata_from_id(id);
@@ -279,12 +279,11 @@ static void animedit_refresh_id_tags (ID *id)
adt->recalc |= ADT_RECALC_ANIM;
/* if ID-block is Object, set recalc flags */
- // TODO: this should probably go through the depsgraph instead... but for now, let's be lazy
switch (GS(id->name)) {
case ID_OB:
{
Object *ob= (Object *)id;
- ob->recalc |= OB_RECALC;
+ DAG_object_flush_update(scene, ob, OB_RECALC_DATA); /* sets recalc flags */
}
break;
}
@@ -384,7 +383,7 @@ void recalcData(TransInfo *t)
/* just tag these animdata-blocks to recalc, assuming that some data there changed */
for (ale= anim_data.first; ale; ale= ale->next) {
/* set refresh tags for objects using this animation */
- animedit_refresh_id_tags(ale->id);
+ animedit_refresh_id_tags(t->scene, ale->id);
}
/* now free temp channels */
@@ -432,7 +431,7 @@ void recalcData(TransInfo *t)
calchandles_fcurve(fcu);
/* set refresh tags for objects using this animation */
- animedit_refresh_id_tags(ale->id);
+ animedit_refresh_id_tags(t->scene, ale->id);
}
/* do resort and other updates? */
@@ -463,7 +462,7 @@ void recalcData(TransInfo *t)
continue;
/* set refresh tags for objects using this animation */
- animedit_refresh_id_tags(tdn->id);
+ animedit_refresh_id_tags(t->scene, tdn->id);
/* if cancelling transform, just write the values without validating, then move on */
if (t->state == TRANS_CANCEL) {