Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_clip/clip_buttons.c
| Show First 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | typedef struct { | ||||
| int compact; | int compact; | ||||
| MovieClip *clip; | MovieClip *clip; | ||||
| /** user of clip */ | /** user of clip */ | ||||
| MovieClipUser *user; | MovieClipUser *user; | ||||
| MovieTrackingTrack *track; | MovieTrackingTrack *track; | ||||
| MovieTrackingMarker *marker; | MovieTrackingMarker *marker; | ||||
| /** current frame number */ | |||||
| int framenr; | |||||
| /** position of marker in pixel coords */ | /** position of marker in pixel coords */ | ||||
| float marker_pos[2]; | float marker_pos[2]; | ||||
| /** position and dimensions of marker pattern in pixel coords */ | /** position and dimensions of marker pattern in pixel coords */ | ||||
| float marker_pat[2]; | float marker_pat[2]; | ||||
| /** offset of "parenting" point */ | /** offset of "parenting" point */ | ||||
| float track_offset[2]; | float track_offset[2]; | ||||
| /** position and dimensions of marker search in pixel coords */ | /** position and dimensions of marker search in pixel coords */ | ||||
| float marker_search_pos[2], marker_search[2]; | float marker_search_pos[2], marker_search[2]; | ||||
| Show All 11 Lines | |||||
| static void marker_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg)) | static void marker_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg)) | ||||
| { | { | ||||
| MarkerUpdateCb *cb = (MarkerUpdateCb *)arg_cb; | MarkerUpdateCb *cb = (MarkerUpdateCb *)arg_cb; | ||||
| if (!cb->compact) { | if (!cb->compact) { | ||||
| return; | return; | ||||
| } | } | ||||
| MovieTrackingMarker *marker = cb->marker; | int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(cb->clip, cb->framenr); | ||||
| MovieTrackingMarker *marker = BKE_tracking_marker_ensure(cb->track, clip_framenr); | |||||
| marker->flag = cb->marker_flag; | marker->flag = cb->marker_flag; | ||||
| WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL); | ||||
| } | } | ||||
| static void marker_block_handler(bContext *C, void *arg_cb, int event) | static void marker_block_handler(bContext *C, void *arg_cb, int event) | ||||
| { | { | ||||
| MarkerUpdateCb *cb = (MarkerUpdateCb *)arg_cb; | MarkerUpdateCb *cb = (MarkerUpdateCb *)arg_cb; | ||||
| MovieTrackingMarker *marker; | |||||
JacquesLucke: Move declaration down to where `marker` is initialized. | |||||
| int width, height; | int width, height; | ||||
| bool ok = false; | bool ok = false; | ||||
| BKE_movieclip_get_size(cb->clip, cb->user, &width, &height); | BKE_movieclip_get_size(cb->clip, cb->user, &width, &height); | ||||
| MovieTrackingMarker *marker = cb->marker; | int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(cb->clip, cb->framenr); | ||||
| marker = BKE_tracking_marker_ensure(cb->track, clip_framenr); | |||||
| if (event == B_MARKER_POS) { | if (event == B_MARKER_POS) { | ||||
| marker->pos[0] = cb->marker_pos[0] / width; | marker->pos[0] = cb->marker_pos[0] / width; | ||||
| marker->pos[1] = cb->marker_pos[1] / height; | marker->pos[1] = cb->marker_pos[1] / height; | ||||
| /* to update position of "parented" objects */ | /* to update position of "parented" objects */ | ||||
| DEG_id_tag_update(&cb->clip->id, 0); | DEG_id_tag_update(&cb->clip->id, 0); | ||||
| WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL); | WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL); | ||||
| ▲ Show 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | void uiTemplateMarker(uiLayout *layout, | ||||
| cb = MEM_callocN(sizeof(MarkerUpdateCb), "uiTemplateMarker update_cb"); | cb = MEM_callocN(sizeof(MarkerUpdateCb), "uiTemplateMarker update_cb"); | ||||
| cb->compact = compact; | cb->compact = compact; | ||||
| cb->clip = clip; | cb->clip = clip; | ||||
| cb->user = user; | cb->user = user; | ||||
| cb->track = track; | cb->track = track; | ||||
| cb->marker = marker; | cb->marker = marker; | ||||
| cb->marker_flag = marker->flag; | cb->marker_flag = marker->flag; | ||||
| cb->framenr = user->framenr; | |||||
| if (compact) { | if (compact) { | ||||
| block = uiLayoutGetBlock(layout); | block = uiLayoutGetBlock(layout); | ||||
| if (cb->marker_flag & MARKER_DISABLED) { | if (cb->marker_flag & MARKER_DISABLED) { | ||||
| tip = TIP_("Marker is disabled at current frame"); | tip = TIP_("Marker is disabled at current frame"); | ||||
| } | } | ||||
| else { | else { | ||||
| ▲ Show 20 Lines • Show All 421 Lines • Show Last 20 Lines | |||||
Move declaration down to where marker is initialized.