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
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/animation/keyframing.c')
-rw-r--r--source/blender/editors/animation/keyframing.c125
1 files changed, 25 insertions, 100 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 0454e88e320..1791d84d90b 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1186,9 +1186,10 @@ static int modify_key_op_poll(bContext *C)
/* if Outliner, don't allow in some views */
if (so) {
- if (ELEM5(so->outlinevis, SO_GROUPS, SO_LIBRARIES, SO_SEQUENCE, SO_USERDEF, SO_KEYMAP)) {
+ if (ELEM4(so->outlinevis, SO_GROUPS, SO_LIBRARIES, SO_VERSE_SESSION, SO_VERSE_SESSION))
+ return 0;
+ if (ELEM3(so->outlinevis, SO_SEQUENCE, SO_USERDEF, SO_KEYMAP))
return 0;
- }
}
/* TODO: checks for other space types can be added here */
@@ -1439,122 +1440,46 @@ void ANIM_OT_keyframe_delete(wmOperatorType *ot)
}
/* Delete Key Operator ------------------------ */
-/* NOTE: Although this version is simpler than the more generic version for KeyingSets,
- * it is more useful for animators working in the 3D view.
+
+/* XXX WARNING:
+ * This is currently just a basic operator, which work in 3d-view context on objects only.
+ * Should this be kept? It does have advantages over a version which requires selecting a keyingset to use...
+ * -- Joshua Leung, Jan 2009
*/
-static int clear_anim_v3d_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Main *bmain = CTX_data_main(C);
-
- CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
- {
- /* just those in active action... */
- if ((ob->adt) && (ob->adt->action)) {
- AnimData *adt = ob->adt;
- bAction *act = adt->action;
- FCurve *fcu, *fcn;
-
- for (fcu = act->curves.first; fcu; fcu = fcn) {
- short can_delete = FALSE;
-
- fcn = fcu->next;
-
- /* in pose mode, only delete the F-Curve if it belongs to a selected bone */
- if (ob->mode & OB_MODE_POSE) {
- if ((fcu->rna_path) && strstr(fcu->rna_path, "pose.bones[")) {
- bPoseChannel *pchan;
- char *bone_name;
-
- /* get bone-name, and check if this bone is selected */
- bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
- pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
- if (bone_name) MEM_freeN(bone_name);
-
- /* delete if bone is selected*/
- if ((pchan) && (pchan->bone)) {
- if (pchan->bone->flag & BONE_SELECTED)
- can_delete = TRUE;
- }
- }
- }
- else {
- /* object mode - all of Object's F-Curves are affected */
- can_delete = TRUE;
- }
-
- /* delete F-Curve completely */
- if (can_delete) {
- ANIM_fcurve_delete_from_animdata(NULL, adt, fcu);
- }
- }
- }
-
- /* update... */
- ob->recalc |= OB_RECALC_OB;
- }
- CTX_DATA_END;
-
- /* send updates */
- DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-void ANIM_OT_keyframe_clear_v3d(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Remove Animation";
- ot->description = "Remove all keyframe animation for selected objects";
- ot->idname = "ANIM_OT_keyframe_clear_v3d";
-
- /* callbacks */
- ot->invoke = WM_operator_confirm;
- ot->exec = clear_anim_v3d_exec;
-
- ot->poll = ED_operator_areaactive;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-
static int delete_key_v3d_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- float cfra = (float)CFRA;
+ float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
+ // XXX more comprehensive tests will be needed
CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
{
- ID *id = &ob->id;
- int success = 0;
+ ID *id = (ID *)ob;
+ FCurve *fcu, *fcn;
+ short success = 0;
- /* just those in active action... */
+ /* loop through all curves in animdata and delete keys on this frame */
if ((ob->adt) && (ob->adt->action)) {
AnimData *adt = ob->adt;
bAction *act = adt->action;
- FCurve *fcu, *fcn;
for (fcu = act->curves.first; fcu; fcu = fcn) {
fcn = fcu->next;
-
- /* delete keyframes on current frame
- * WARNING: this can delete the next F-Curve, hence the "fcn" copying
- */
success += delete_keyframe(op->reports, id, NULL, NULL, fcu->rna_path, fcu->array_index, cfra, 0);
}
}
- /* report success (or failure) */
- BKE_reportf(op->reports, RPT_INFO, "Object '%s' successfully had %d keyframes removed", id->name + 2, success);
+ BKE_reportf(op->reports, RPT_INFO, "Ob '%s' - Successfully had %d keyframes removed", id->name + 2, success);
+
ob->recalc |= OB_RECALC_OB;
}
CTX_DATA_END;
/* send updates */
DAG_ids_flush_update(bmain, 0);
+
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL);
return OPERATOR_FINISHED;
@@ -1564,7 +1489,7 @@ void ANIM_OT_keyframe_delete_v3d(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Keyframe";
- ot->description = "Remove keyframes on current frame for selected objects";
+ ot->description = "Remove keyframes on current frame for selected object";
ot->idname = "ANIM_OT_keyframe_delete_v3d";
/* callbacks */
@@ -1587,7 +1512,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
PointerRNA ptr = {{NULL}};
PropertyRNA *prop = NULL;
char *path;
- float cfra = (float)CFRA;
+ float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
short success = 0;
int a, index, length, all = RNA_boolean_get(op->ptr, "all");
short flag = 0;
@@ -1758,20 +1683,20 @@ static int clear_key_button_exec(bContext *C, wmOperator *op)
if (ptr.id.data && ptr.data && prop) {
path = RNA_path_from_ID_to_property(&ptr, prop);
-
+
if (path) {
if (all) {
length = RNA_property_array_length(&ptr, prop);
-
+
if (length) index = 0;
else length = 1;
}
else
length = 1;
-
+
for (a = 0; a < length; a++)
success += clear_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index + a, 0);
-
+
MEM_freeN(path);
}
else if (G.debug & G_DEBUG)
@@ -1785,9 +1710,9 @@ static int clear_key_button_exec(bContext *C, wmOperator *op)
if (success) {
/* send updates */
uiContextAnimUpdate(C);
-
+
DAG_ids_flush_update(bmain, 0);
-
+
/* send notifiers that keyframes have been changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}