Blender V2.61 - r43446
Classes | Defines | Typedefs | Functions

tracking_ops.c File Reference

#include "MEM_guardedalloc.h"
#include "DNA_camera_types.h"
#include "DNA_constraint_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_movieclip_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BLI_rect.h"
#include "BLI_blenlib.h"
#include "BKE_main.h"
#include "BKE_context.h"
#include "BKE_constraint.h"
#include "BKE_movieclip.h"
#include "BKE_tracking.h"
#include "BKE_global.h"
#include "BKE_depsgraph.h"
#include "BKE_object.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_library.h"
#include "BKE_sound.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_screen.h"
#include "ED_clip.h"
#include "ED_keyframing.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "UI_interface.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "PIL_time.h"
#include "UI_view2d.h"
#include "clip_intern.h"

Go to the source code of this file.

Classes

struct  SlideMarkerData
struct  TrackMarkersJob
struct  SolveCameraJob

Defines

#define SLIDE_ACTION_POS   0
#define SLIDE_ACTION_SIZE   1
#define SLIDE_ACTION_OFFSET   2

Typedefs

typedef struct TrackMarkersJob TrackMarkersJob

Functions

static int space_clip_frame_poll (bContext *C)
static void add_marker (SpaceClip *sc, float x, float y)
static int add_marker_exec (bContext *C, wmOperator *op)
static int add_marker_invoke (bContext *C, wmOperator *op, wmEvent *event)
void CLIP_OT_add_marker (wmOperatorType *ot)
static int delete_track_exec (bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_delete_track (wmOperatorType *ot)
static int delete_marker_exec (bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_delete_marker (wmOperatorType *ot)
static SlideMarkerDatacreate_slide_marker_data (SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, wmEvent *event, int area, int action, int width, int height)
static int mouse_on_corner (SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, int area, float co[2], int corner, int width, int height)
static int mouse_on_offset (SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, float co[2], int width, int height)
static void hide_cursor (bContext *C)
static void show_cursor (bContext *C)
static void * slide_marker_customdata (bContext *C, wmEvent *event)
static int slide_marker_invoke (bContext *C, wmOperator *op, wmEvent *event)
static void cancel_mouse_slide (SlideMarkerData *data)
static void free_slide_data (SlideMarkerData *data)
static int slide_marker_modal (bContext *C, wmOperator *op, wmEvent *event)
void CLIP_OT_slide_marker (wmOperatorType *ot)
static int mouse_on_side (float co[2], float x1, float y1, float x2, float y2, float epsx, float epsy)
static int mouse_on_rect (float co[2], float pos[2], float min[2], float max[2], float epsx, float epsy)
static int track_mouse_area (SpaceClip *sc, float co[2], MovieTrackingTrack *track)
static float dist_to_rect (float co[2], float pos[2], float min[2], float max[2])
static MovieTrackingTrackfind_nearest_track (SpaceClip *sc, ListBase *tracksbase, float co[2])
static int mouse_select (bContext *C, float co[2], int extend)
static int select_exec (bContext *C, wmOperator *op)
static int select_invoke (bContext *C, wmOperator *op, wmEvent *event)
void CLIP_OT_select (wmOperatorType *ot)
static int border_select_exec (bContext *C, wmOperator *op)
void CLIP_OT_select_border (wmOperatorType *ot)
static int marker_inside_ellipse (MovieTrackingMarker *marker, float offset[2], float ellipse[2])
static int circle_select_exec (bContext *C, wmOperator *op)
void CLIP_OT_select_circle (wmOperatorType *ot)
static int select_all_exec (bContext *C, wmOperator *op)
void CLIP_OT_select_all (wmOperatorType *ot)
static int select_groped_exec (bContext *C, wmOperator *op)
void CLIP_OT_select_grouped (wmOperatorType *ot)
static int track_markers_testbreak (void)
static int track_count_markers (SpaceClip *sc, MovieClip *clip)
static void clear_invisible_track_selection (SpaceClip *sc, MovieClip *clip)
static void track_init_markers (SpaceClip *sc, MovieClip *clip, int *frames_limit_r)
static int track_markers_check_direction (int backwards, int curfra, int efra)
static int track_markers_initjob (bContext *C, TrackMarkersJob *tmj, int backwards)
static void track_markers_startjob (void *tmv, short *stop, short *do_update, float *progress)
static void track_markers_updatejob (void *tmv)
static void track_markers_freejob (void *tmv)
static int track_markers_exec (bContext *C, wmOperator *op)
static int track_markers_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event))
static int track_markers_modal (bContext *C, wmOperator *UNUSED(op), wmEvent *event)
void CLIP_OT_track_markers (wmOperatorType *ot)
static int solve_camera_initjob (bContext *C, SolveCameraJob *scj, wmOperator *op, char *error_msg, int max_error)
static void solve_camera_updatejob (void *scv)
static void solve_camera_startjob (void *scv, short *stop, short *do_update, float *progress)
static void solve_camera_freejob (void *scv)
static int solve_camera_exec (bContext *C, wmOperator *op)
static int solve_camera_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event))
static int solve_camera_modal (bContext *C, wmOperator *UNUSED(op), wmEvent *event)
void CLIP_OT_solve_camera (wmOperatorType *ot)
static int clear_solution_exec (bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_clear_solution (wmOperatorType *ot)
static int clear_track_path_exec (bContext *C, wmOperator *op)
void CLIP_OT_clear_track_path (wmOperatorType *ot)
static int disable_markers_exec (bContext *C, wmOperator *op)
void CLIP_OT_disable_markers (wmOperatorType *ot)
static Objectget_camera_with_movieclip (Scene *scene, MovieClip *clip)
static Objectget_orientation_object (bContext *C)
static int set_orientation_poll (bContext *C)
static int count_selected_bundles (bContext *C)
static void object_solver_inverted_matrix (Scene *scene, Object *ob, float invmat[4][4])
static Objectobject_solver_camera (Scene *scene, Object *ob)
static int set_origin_exec (bContext *C, wmOperator *op)
void CLIP_OT_set_origin (wmOperatorType *ot)
static void set_axis (Scene *scene, Object *ob, MovieClip *clip, MovieTrackingObject *tracking_object, MovieTrackingTrack *track, char axis)
static int set_floor_exec (bContext *C, wmOperator *op)
void CLIP_OT_set_floor (wmOperatorType *ot)
static int set_axis_exec (bContext *C, wmOperator *op)
void CLIP_OT_set_axis (wmOperatorType *ot)
static int do_set_scale (bContext *C, wmOperator *op, int scale_solution)
static int set_scale_exec (bContext *C, wmOperator *op)
static int set_scale_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event))
void CLIP_OT_set_scale (wmOperatorType *ot)
static int set_solution_scale_poll (bContext *C)
static int set_solution_scale_exec (bContext *C, wmOperator *op)
static int set_solution_scale_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event))
void CLIP_OT_set_solution_scale (wmOperatorType *ot)
static int set_center_principal_exec (bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_set_center_principal (wmOperatorType *ot)
static int hide_tracks_exec (bContext *C, wmOperator *op)
void CLIP_OT_hide_tracks (wmOperatorType *ot)
static int hide_tracks_clear_exec (bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_hide_tracks_clear (wmOperatorType *ot)
static bGPDlayerdetect_get_layer (MovieClip *clip)
static int detect_features_exec (bContext *C, wmOperator *op)
void CLIP_OT_detect_features (wmOperatorType *ot)
static int frame_jump_exec (bContext *C, wmOperator *op)
void CLIP_OT_frame_jump (wmOperatorType *ot)
static int join_tracks_exec (bContext *C, wmOperator *op)
void CLIP_OT_join_tracks (wmOperatorType *ot)
static int lock_tracks_exec (bContext *C, wmOperator *op)
void CLIP_OT_lock_tracks (wmOperatorType *ot)
static int track_copy_color_exec (bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_track_copy_color (wmOperatorType *ot)
static int stabilize_2d_add_exec (bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_stabilize_2d_add (wmOperatorType *ot)
static int stabilize_2d_remove_exec (bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_stabilize_2d_remove (wmOperatorType *ot)
static int stabilize_2d_select_exec (bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_stabilize_2d_select (wmOperatorType *ot)
static int stabilize_2d_set_rotation_exec (bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_stabilize_2d_set_rotation (wmOperatorType *ot)
static int is_track_clean (MovieTrackingTrack *track, int frames, int del)
static int clean_tracks_exec (bContext *C, wmOperator *op)
static int clean_tracks_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event))
void CLIP_OT_clean_tracks (wmOperatorType *ot)
static int tracking_object_new_exec (bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_tracking_object_new (wmOperatorType *ot)
static int tracking_object_remove_exec (bContext *C, wmOperator *op)
void CLIP_OT_tracking_object_remove (wmOperatorType *ot)
static int copy_tracks_exec (bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_copy_tracks (wmOperatorType *ot)
static int paste_tracks_poll (bContext *C)
static int paste_tracks_exec (bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_paste_tracks (wmOperatorType *ot)

Detailed Description

Definition in file tracking_ops.c.


Define Documentation

#define SLIDE_ACTION_OFFSET   2
#define SLIDE_ACTION_POS   0

Definition at line 263 of file tracking_ops.c.

Referenced by slide_marker_customdata().

#define SLIDE_ACTION_SIZE   1

Typedef Documentation


Function Documentation

static void add_marker ( SpaceClip sc,
float  x,
float  y 
) [static]
static int add_marker_exec ( bContext C,
wmOperator op 
) [static]
static int add_marker_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int border_select_exec ( bContext C,
wmOperator op 
) [static]
static void cancel_mouse_slide ( SlideMarkerData data) [static]
static int circle_select_exec ( bContext C,
wmOperator op 
) [static]
static int clean_tracks_exec ( bContext C,
wmOperator op 
) [static]
static int clean_tracks_invoke ( bContext C,
wmOperator op,
wmEvent UNUSEDevent 
) [static]
static void clear_invisible_track_selection ( SpaceClip sc,
MovieClip clip 
) [static]
static int clear_solution_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int clear_track_path_exec ( bContext C,
wmOperator op 
) [static]
void CLIP_OT_add_marker ( wmOperatorType ot)
void CLIP_OT_clean_tracks ( wmOperatorType ot)
void CLIP_OT_clear_solution ( wmOperatorType ot)
void CLIP_OT_clear_track_path ( wmOperatorType ot)
void CLIP_OT_copy_tracks ( wmOperatorType ot)
void CLIP_OT_delete_marker ( wmOperatorType ot)
void CLIP_OT_delete_track ( wmOperatorType ot)
void CLIP_OT_detect_features ( wmOperatorType ot)
void CLIP_OT_disable_markers ( wmOperatorType ot)
void CLIP_OT_frame_jump ( wmOperatorType ot)
void CLIP_OT_hide_tracks ( wmOperatorType ot)
void CLIP_OT_hide_tracks_clear ( wmOperatorType ot)
void CLIP_OT_join_tracks ( wmOperatorType ot)
void CLIP_OT_lock_tracks ( wmOperatorType ot)
void CLIP_OT_paste_tracks ( wmOperatorType ot)
void CLIP_OT_select ( wmOperatorType ot)
void CLIP_OT_select_all ( wmOperatorType ot)
void CLIP_OT_select_border ( wmOperatorType ot)
void CLIP_OT_select_circle ( wmOperatorType ot)
void CLIP_OT_select_grouped ( wmOperatorType ot)
void CLIP_OT_set_axis ( wmOperatorType ot)
void CLIP_OT_set_center_principal ( wmOperatorType ot)
void CLIP_OT_set_floor ( wmOperatorType ot)
void CLIP_OT_set_origin ( wmOperatorType ot)
void CLIP_OT_set_scale ( wmOperatorType ot)
void CLIP_OT_set_solution_scale ( wmOperatorType ot)
void CLIP_OT_slide_marker ( wmOperatorType ot)
void CLIP_OT_solve_camera ( wmOperatorType ot)
void CLIP_OT_stabilize_2d_add ( wmOperatorType ot)
void CLIP_OT_stabilize_2d_remove ( wmOperatorType ot)
void CLIP_OT_stabilize_2d_select ( wmOperatorType ot)
void CLIP_OT_stabilize_2d_set_rotation ( wmOperatorType ot)
void CLIP_OT_track_copy_color ( wmOperatorType ot)
void CLIP_OT_track_markers ( wmOperatorType ot)
void CLIP_OT_tracking_object_new ( wmOperatorType ot)
void CLIP_OT_tracking_object_remove ( wmOperatorType ot)
static int copy_tracks_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int count_selected_bundles ( bContext C) [static]
static SlideMarkerData* create_slide_marker_data ( SpaceClip sc,
MovieTrackingTrack track,
MovieTrackingMarker marker,
wmEvent event,
int  area,
int  action,
int  width,
int  height 
) [static]
static int delete_marker_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int delete_track_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int detect_features_exec ( bContext C,
wmOperator op 
) [static]
static bGPDlayer* detect_get_layer ( MovieClip clip) [static]
static int disable_markers_exec ( bContext C,
wmOperator op 
) [static]
static float dist_to_rect ( float  co[2],
float  pos[2],
float  min[2],
float  max[2] 
) [static]

Definition at line 694 of file tracking_ops.c.

References dist_to_line_segment_v2(), MIN4, and p.

Referenced by find_nearest_track().

static int do_set_scale ( bContext C,
wmOperator op,
int  scale_solution 
) [static]
static MovieTrackingTrack* find_nearest_track ( SpaceClip sc,
ListBase tracksbase,
float  co[2] 
) [static]
static int frame_jump_exec ( bContext C,
wmOperator op 
) [static]
static void free_slide_data ( SlideMarkerData data) [static]

Definition at line 508 of file tracking_ops.c.

References MEM_freeN(), and SlideMarkerData::smarkers.

Referenced by slide_marker_modal().

static Object* get_camera_with_movieclip ( Scene scene,
MovieClip clip 
) [static]
static Object* get_orientation_object ( bContext C) [static]
static void hide_cursor ( bContext C) [static]

Definition at line 394 of file tracking_ops.c.

References CTX_wm_window(), CURSOR_NONE, and WM_cursor_set().

Referenced by slide_marker_invoke().

static int hide_tracks_clear_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int hide_tracks_exec ( bContext C,
wmOperator op 
) [static]
static int is_track_clean ( MovieTrackingTrack track,
int  frames,
int  del 
) [static]
static int join_tracks_exec ( bContext C,
wmOperator op 
) [static]
static int lock_tracks_exec ( bContext C,
wmOperator op 
) [static]
static int marker_inside_ellipse ( MovieTrackingMarker marker,
float  offset[2],
float  ellipse[2] 
) [static]

Definition at line 925 of file tracking_ops.c.

References MovieTrackingMarker::pos.

Referenced by circle_select_exec().

static int mouse_on_corner ( SpaceClip sc,
MovieTrackingTrack track,
MovieTrackingMarker marker,
int  area,
float  co[2],
int  corner,
int  width,
int  height 
) [static]
static int mouse_on_offset ( SpaceClip sc,
MovieTrackingTrack track,
MovieTrackingMarker marker,
float  co[2],
int  width,
int  height 
) [static]
static int mouse_on_rect ( float  co[2],
float  pos[2],
float  min[2],
float  max[2],
float  epsx,
float  epsy 
) [static]

Definition at line 651 of file tracking_ops.c.

References mouse_on_side().

Referenced by track_mouse_area().

static int mouse_on_side ( float  co[2],
float  x1,
float  y1,
float  x2,
float  y2,
float  epsx,
float  epsy 
) [static]

Definition at line 643 of file tracking_ops.c.

References SWAP.

Referenced by mouse_on_rect().

static int mouse_select ( bContext C,
float  co[2],
int  extend 
) [static]
static Object* object_solver_camera ( Scene scene,
Object ob 
) [static]
static void object_solver_inverted_matrix ( Scene scene,
Object ob,
float  invmat[4][4] 
) [static]
static int paste_tracks_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int paste_tracks_poll ( bContext C) [static]

Definition at line 3559 of file tracking_ops.c.

References BKE_tracking_clipboard_has_tracks(), and ED_space_clip_poll().

Referenced by CLIP_OT_paste_tracks().

static int select_all_exec ( bContext C,
wmOperator op 
) [static]
static int select_exec ( bContext C,
wmOperator op 
) [static]

Definition at line 788 of file tracking_ops.c.

References co, mouse_select(), wmOperator::ptr, RNA_boolean_get(), and RNA_float_get_array().

Referenced by CLIP_OT_select(), and select_invoke().

static int select_groped_exec ( bContext C,
wmOperator op 
) [static]
static int select_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static void set_axis ( Scene scene,
Object ob,
MovieClip clip,
MovieTrackingObject tracking_object,
MovieTrackingTrack track,
char  axis 
) [static]
static int set_axis_exec ( bContext C,
wmOperator op 
) [static]
static int set_center_principal_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int set_floor_exec ( bContext C,
wmOperator op 
) [static]
static int set_orientation_poll ( bContext C) [static]
static int set_origin_exec ( bContext C,
wmOperator op 
) [static]
static int set_scale_exec ( bContext C,
wmOperator op 
) [static]

Definition at line 2514 of file tracking_ops.c.

References do_set_scale().

Referenced by CLIP_OT_set_scale(), and set_scale_invoke().

static int set_scale_invoke ( bContext C,
wmOperator op,
wmEvent UNUSEDevent 
) [static]
static int set_solution_scale_exec ( bContext C,
wmOperator op 
) [static]

Definition at line 2567 of file tracking_ops.c.

References do_set_scale().

Referenced by CLIP_OT_set_solution_scale(), and set_solution_scale_invoke().

static int set_solution_scale_invoke ( bContext C,
wmOperator op,
wmEvent UNUSEDevent 
) [static]
static int set_solution_scale_poll ( bContext C) [static]
static void show_cursor ( bContext C) [static]

Definition at line 401 of file tracking_ops.c.

References CTX_wm_window(), CURSOR_STD, and WM_cursor_set().

Referenced by slide_marker_modal().

static void* slide_marker_customdata ( bContext C,
wmEvent event 
) [static]
static int slide_marker_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int slide_marker_modal ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int solve_camera_exec ( bContext C,
wmOperator op 
) [static]
static void solve_camera_freejob ( void *  scv) [static]
static int solve_camera_initjob ( bContext C,
SolveCameraJob scj,
wmOperator op,
char *  error_msg,
int  max_error 
) [static]
static int solve_camera_invoke ( bContext C,
wmOperator op,
wmEvent UNUSEDevent 
) [static]
static int solve_camera_modal ( bContext C,
wmOperator UNUSEDop,
wmEvent event 
) [static]
static void solve_camera_startjob ( void *  scv,
short *  stop,
short *  do_update,
float *  progress 
) [static]
static void solve_camera_updatejob ( void *  scv) [static]
static int space_clip_frame_poll ( bContext C) [static]
static int stabilize_2d_add_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int stabilize_2d_remove_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int stabilize_2d_select_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int stabilize_2d_set_rotation_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int track_copy_color_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int track_count_markers ( SpaceClip sc,
MovieClip clip 
) [static]
static void track_init_markers ( SpaceClip sc,
MovieClip clip,
int *  frames_limit_r 
) [static]
static int track_markers_check_direction ( int  backwards,
int  curfra,
int  efra 
) [static]

Definition at line 1275 of file tracking_ops.c.

Referenced by track_markers_exec(), and track_markers_initjob().

static int track_markers_exec ( bContext C,
wmOperator op 
) [static]
static void track_markers_freejob ( void *  tmv) [static]
static int track_markers_initjob ( bContext C,
TrackMarkersJob tmj,
int  backwards 
) [static]
static int track_markers_invoke ( bContext C,
wmOperator op,
wmEvent UNUSEDevent 
) [static]
static int track_markers_modal ( bContext C,
wmOperator UNUSEDop,
wmEvent event 
) [static]
static void track_markers_startjob ( void *  tmv,
short *  stop,
short *  do_update,
float *  progress 
) [static]
static int track_markers_testbreak ( void  ) [static]

Definition at line 1196 of file tracking_ops.c.

References G.

Referenced by track_markers_startjob().

static void track_markers_updatejob ( void *  tmv) [static]

Definition at line 1376 of file tracking_ops.c.

References BKE_tracking_sync(), and TrackMarkersJob::context.

Referenced by track_markers_invoke().

static int track_mouse_area ( SpaceClip sc,
float  co[2],
MovieTrackingTrack track 
) [static]
static int tracking_object_new_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int tracking_object_remove_exec ( bContext C,
wmOperator op 
) [static]