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:
-rw-r--r--source/blender/editors/space_clip/clip_intern.h3
-rw-r--r--source/blender/editors/space_clip/space_clip.c6
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c86
3 files changed, 95 insertions, 0 deletions
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h
index e6f1813b3a4..39af856d280 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -198,6 +198,9 @@ void CLIP_OT_paste_tracks(struct wmOperatorType *ot);
void CLIP_OT_create_plane_track(struct wmOperatorType *ot);
void CLIP_OT_slide_plane_marker(struct wmOperatorType *ot);
+void CLIP_OT_keyframe_insert(struct wmOperatorType *ot);
+void CLIP_OT_keyframe_delete(struct wmOperatorType *ot);
+
/* tracking_select.c */
void CLIP_OT_select(struct wmOperatorType *ot);
void CLIP_OT_select_all(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 8ecf9635af9..8db3a7e1525 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -523,6 +523,9 @@ static void clip_operatortypes(void)
WM_operatortype_append(CLIP_OT_create_plane_track);
WM_operatortype_append(CLIP_OT_slide_plane_marker);
+ WM_operatortype_append(CLIP_OT_keyframe_insert);
+ WM_operatortype_append(CLIP_OT_keyframe_delete);
+
/* ** clip_graph_ops.c ** */
/* graph editing */
@@ -694,6 +697,9 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
/* plane tracks */
WM_keymap_add_item(keymap, "CLIP_OT_slide_plane_marker", LEFTMOUSE, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "CLIP_OT_keyframe_insert", IKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "CLIP_OT_keyframe_delete", IKEY, KM_PRESS, KM_ALT, 0);
+
/* clean-up */
WM_keymap_add_item(keymap, "CLIP_OT_join_tracks", JKEY, KM_PRESS, KM_CTRL, 0);
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index f5fd0ffb3ad..70158c23e25 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -4069,3 +4069,89 @@ void CLIP_OT_slide_plane_marker(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_POINTER | OPTYPE_BLOCKING;
}
+
+/********************** Insert track keyframe operator *********************/
+
+static void keyframe_set_flag(bContext *C, bool set)
+{
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ MovieClip *clip = ED_space_clip_get_clip(sc);
+ MovieTracking *tracking = &clip->tracking;
+ ListBase *tracks_base = BKE_tracking_get_active_tracks(tracking);
+ ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
+ MovieTrackingTrack *track;
+ MovieTrackingPlaneTrack *plane_track;
+ int framenr = ED_space_clip_get_clip_frame_number(sc);
+
+ for (track = tracks_base->first; track; track = track->next) {
+ if (TRACK_VIEW_SELECTED(sc, track)) {
+ MovieTrackingMarker *marker = BKE_tracking_marker_get_exact(track, framenr);
+ if (marker) {
+ if (set) {
+ marker->flag &= ~MARKER_TRACKED;
+ }
+ else {
+ marker->flag |= MARKER_TRACKED;
+ }
+ }
+ }
+ }
+
+ for (plane_track = plane_tracks_base->first; plane_track; plane_track = plane_track->next) {
+ if (plane_track->flag & SELECT) {
+ MovieTrackingPlaneMarker *plane_marker = BKE_tracking_plane_marker_get_exact(plane_track, framenr);
+ if (plane_marker) {
+ if (set) {
+ plane_marker->flag &= ~PLANE_MARKER_TRACKED;
+ }
+ else {
+ plane_marker->flag |= PLANE_MARKER_TRACKED;
+ }
+ }
+ }
+ }
+}
+
+static int keyframe_insert_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ keyframe_set_flag(C, true);
+ return OPERATOR_FINISHED;
+}
+
+void CLIP_OT_keyframe_insert(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Insert keyframe";
+ ot->description = "Insert a keyframe to selected tracks at current frame";
+ ot->idname = "CLIP_OT_keyframe_insert";
+
+ /* api callbacks */
+ ot->poll = ED_space_clip_tracking_poll;
+ ot->exec = keyframe_insert_exec;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+/********************** Delete track keyframe operator *********************/
+
+static int keyframe_delete_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ keyframe_set_flag(C, false);
+ return OPERATOR_FINISHED;
+}
+
+void CLIP_OT_keyframe_delete(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Delete keyframe";
+ ot->description = "Delete a keyframe from selected tracks at current frame";
+ ot->idname = "CLIP_OT_keyframe_delete";
+
+ /* api callbacks */
+ ot->poll = ED_space_clip_tracking_poll;
+ ot->exec = keyframe_delete_exec;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}