Blender  V3.3
Classes
anim_markers.c File Reference
#include <math.h>
#include "MEM_guardedalloc.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
#include "BKE_idprop.h"
#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "BKE_unit.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "WM_api.h"
#include "WM_types.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "ED_anim_api.h"
#include "ED_markers.h"
#include "ED_numinput.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_select_utils.h"
#include "ED_transform.h"
#include "ED_types.h"
#include "ED_util.h"
#include "DEG_depsgraph.h"

Go to the source code of this file.

Classes

struct  MarkerMove
 

Functions

Marker API
static ListBasecontext_get_markers (Scene *scene, ScrArea *area)
 
ListBaseED_context_get_markers (const bContext *C)
 
ListBaseED_animcontext_get_markers (const bAnimContext *ac)
 
int ED_markers_post_apply_transform (ListBase *markers, Scene *scene, int mode, float value, char side)
 
TimeMarkerED_markers_find_nearest_marker (ListBase *markers, float x)
 
int ED_markers_find_nearest_marker_time (ListBase *markers, float x)
 
void ED_markers_get_minmax (ListBase *markers, short sel, float *r_first, float *r_last)
 
static bool ED_operator_markers_region_active (bContext *C)
 
static bool region_position_is_over_marker (View2D *v2d, ListBase *markers, float region_x)
 
static void add_marker_to_cfra_elem (ListBase *lb, TimeMarker *marker, short only_sel)
 
void ED_markers_make_cfra_list (ListBase *markers, ListBase *lb, short only_sel)
 
void ED_markers_deselect_all (ListBase *markers, int action)
 
TimeMarkerED_markers_get_first_selected (ListBase *markers)
 
void debug_markers_print_list (ListBase *markers)
 
Marker Drawing
static void marker_color_get (const TimeMarker *marker, uchar *r_text_color, uchar *r_line_color)
 
static void draw_marker_name (const uchar *text_color, const uiFontStyle *fstyle, TimeMarker *marker, float marker_x, float text_y)
 
static void draw_marker_line (const uchar *color, int xpos, int ymin, int ymax)
 
static int marker_get_icon_id (TimeMarker *marker, int flag)
 
static void draw_marker (const uiFontStyle *fstyle, TimeMarker *marker, int cfra, int xpos, int flag, int region_height)
 
static void draw_markers_background (rctf *rect)
 
static bool marker_is_in_frame_range (TimeMarker *marker, const int frame_range[2])
 
static void get_marker_region_rect (View2D *v2d, rctf *rect)
 
static void get_marker_clip_frame_range (View2D *v2d, float xscale, int r_range[2])
 
void ED_markers_draw (const bContext *C, int flag)
 
Marker Wrappers API

These wrappers allow marker operators to function within the confines of standard animation editors, such that they can coexist with the primary operations of those editors.

static bool ed_markers_poll_selected_markers (bContext *C)
 
static bool ed_markers_poll_selected_no_locked_markers (bContext *C)
 
static bool ed_markers_poll_markers_exist (bContext *C)
 
Add Markers
static int ed_marker_add_exec (bContext *C, wmOperator *UNUSED(op))
 
static void MARKER_OT_add (wmOperatorType *ot)
 
Duplicate Markers
static void ed_marker_duplicate_apply (bContext *C)
 
static int ed_marker_duplicate_exec (bContext *C, wmOperator *op)
 
static int ed_marker_duplicate_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static void MARKER_OT_duplicate (wmOperatorType *ot)
 
Pick Select Markers

Select/de-select time-marker at the current frame.

static void deselect_markers (ListBase *markers)
 
static int select_timeline_marker_frame (ListBase *markers, int frame, bool extend, bool wait_to_deselect_others)
 
static void select_marker_camera_switch (bContext *C, bool camera, bool extend, ListBase *markers, int cfra)
 
static int ed_marker_select (bContext *C, const int mval[2], bool extend, bool camera, bool wait_to_deselect_others)
 
static int ed_marker_select_exec (bContext *C, wmOperator *op)
 
static void MARKER_OT_select (wmOperatorType *ot)
 
Box Select Markers
static int ed_marker_box_select_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static int ed_marker_box_select_exec (bContext *C, wmOperator *op)
 
static void MARKER_OT_select_box (wmOperatorType *ot)
 
(de)select all
static int ed_marker_select_all_exec (bContext *C, wmOperator *op)
 
static void MARKER_OT_select_all (wmOperatorType *ot)
 
Remove Marker

Remove selected time-markers.

static int ed_marker_delete_exec (bContext *C, wmOperator *UNUSED(op))
 
static void MARKER_OT_delete (wmOperatorType *ot)
 
Rename Marker

Rename first selected time-marker.

static int ed_marker_rename_exec (bContext *C, wmOperator *op)
 
static int ed_marker_rename_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static void MARKER_OT_rename (wmOperatorType *ot)
 
Make Links to Scene
static int ed_marker_make_links_scene_exec (bContext *C, wmOperator *op)
 
static void MARKER_OT_make_links_scene (wmOperatorType *ot)
 
Registration
void ED_operatortypes_marker (void)
 
void ED_keymap_marker (wmKeyConfig *keyconf)
 

Select Left/Right of Frame

enum  eMarkers_LeftRightSelect_Mode { MARKERS_LRSEL_LEFT = 0 , MARKERS_LRSEL_RIGHT }
 
typedef enum eMarkers_LeftRightSelect_Mode eMarkers_LeftRightSelect_Mode
 
static const EnumPropertyItem prop_markers_select_leftright_modes []
 
static void ED_markers_select_leftright (bAnimContext *ac, const eMarkers_LeftRightSelect_Mode mode, const bool extend)
 
static int ed_marker_select_leftright_exec (bContext *C, wmOperator *op)
 
static void MARKER_OT_select_leftright (wmOperatorType *ot)
 

Transform Markers

typedef struct MarkerMove MarkerMove
 
static bool ed_marker_move_use_time (MarkerMove *mm)
 
static void ed_marker_move_update_header (bContext *C, wmOperator *op)
 
static bool ed_marker_move_init (bContext *C, wmOperator *op)
 
static void ed_marker_move_exit (bContext *C, wmOperator *op)
 
static int ed_marker_move_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static void ed_marker_move_apply (bContext *C, wmOperator *op)
 
static void ed_marker_move_cancel (bContext *C, wmOperator *op)
 
static int ed_marker_move_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
static int ed_marker_move_exec (bContext *C, wmOperator *op)
 
static void MARKER_OT_move (wmOperatorType *ot)
 

Typedef Documentation

◆ eMarkers_LeftRightSelect_Mode

◆ MarkerMove

typedef struct MarkerMove MarkerMove

Enumeration Type Documentation

◆ eMarkers_LeftRightSelect_Mode

Enumerator
MARKERS_LRSEL_LEFT 
MARKERS_LRSEL_RIGHT 

Definition at line 1473 of file anim_markers.c.

Function Documentation

◆ add_marker_to_cfra_elem()

static void add_marker_to_cfra_elem ( ListBase lb,
TimeMarker marker,
short  only_sel 
)
static

◆ context_get_markers()

static ListBase* context_get_markers ( Scene scene,
ScrArea area 
)
static

◆ debug_markers_print_list()

void debug_markers_print_list ( struct ListBase markers)

Debugging only: print debugging prints of list of markers.

Definition at line 361 of file anim_markers.c.

References TimeMarker::flag, TimeMarker::frame, markers, TimeMarker::name, TimeMarker::next, and NULL.

◆ deselect_markers()

static void deselect_markers ( ListBase markers)
static

◆ draw_marker()

static void draw_marker ( const uiFontStyle fstyle,
TimeMarker marker,
int  cfra,
int  xpos,
int  flag,
int  region_height 
)
static

◆ draw_marker_line()

static void draw_marker_line ( const uchar color,
int  xpos,
int  ymin,
int  ymax 
)
static

◆ draw_marker_name()

static void draw_marker_name ( const uchar text_color,
const uiFontStyle fstyle,
TimeMarker marker,
float  marker_x,
float  text_y 
)
static

◆ draw_markers_background()

static void draw_markers_background ( rctf rect)
static

◆ ED_animcontext_get_markers()

ListBase* ED_animcontext_get_markers ( const bAnimContext ac)

Definition at line 93 of file anim_markers.c.

References bAnimContext::area, context_get_markers(), NULL, and bAnimContext::scene.

Referenced by actkeys_select_leftright().

◆ ED_context_get_markers()

ListBase* ED_context_get_markers ( const bContext C)

◆ ED_keymap_marker()

void ED_keymap_marker ( struct wmKeyConfig keyconf)

Called in screen_ops.c:ED_keymap_screen().

Definition at line 1827 of file anim_markers.c.

References WM_keymap_ensure().

Referenced by ED_spacetypes_keymap().

◆ ed_marker_add_exec()

static int ed_marker_add_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ ed_marker_box_select_exec()

static int ed_marker_box_select_exec ( bContext C,
wmOperator op 
)
static

◆ ed_marker_box_select_invoke()

static int ed_marker_box_select_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ ed_marker_delete_exec()

static int ed_marker_delete_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ ed_marker_duplicate_apply()

static void ed_marker_duplicate_apply ( bContext C)
static

◆ ed_marker_duplicate_exec()

static int ed_marker_duplicate_exec ( bContext C,
wmOperator op 
)
static

Definition at line 1112 of file anim_markers.c.

References C, ed_marker_duplicate_apply(), ed_marker_move_exec(), and OPERATOR_FINISHED.

Referenced by MARKER_OT_duplicate().

◆ ed_marker_duplicate_invoke()

static int ed_marker_duplicate_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

Definition at line 1120 of file anim_markers.c.

References C, ed_marker_duplicate_apply(), and ed_marker_move_invoke().

Referenced by MARKER_OT_duplicate().

◆ ed_marker_make_links_scene_exec()

static int ed_marker_make_links_scene_exec ( bContext C,
wmOperator op 
)
static

◆ ed_marker_move_apply()

static void ed_marker_move_apply ( bContext C,
wmOperator op 
)
static

◆ ed_marker_move_cancel()

static void ed_marker_move_cancel ( bContext C,
wmOperator op 
)
static

◆ ed_marker_move_exec()

static int ed_marker_move_exec ( bContext C,
wmOperator op 
)
static

◆ ed_marker_move_exit()

static void ed_marker_move_exit ( bContext C,
wmOperator op 
)
static

◆ ed_marker_move_init()

static bool ed_marker_move_init ( bContext C,
wmOperator op 
)
static

◆ ed_marker_move_invoke()

static int ed_marker_move_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ ed_marker_move_modal()

static int ed_marker_move_modal ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ ed_marker_move_update_header()

static void ed_marker_move_update_header ( bContext C,
wmOperator op 
)
static

◆ ed_marker_move_use_time()

static bool ed_marker_move_use_time ( MarkerMove mm)
static

◆ ed_marker_rename_exec()

static int ed_marker_rename_exec ( bContext C,
wmOperator op 
)
static

◆ ed_marker_rename_invoke()

static int ed_marker_rename_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ ed_marker_select()

static int ed_marker_select ( bContext C,
const int  mval[2],
bool  extend,
bool  camera,
bool  wait_to_deselect_others 
)
static

◆ ed_marker_select_all_exec()

static int ed_marker_select_all_exec ( bContext C,
wmOperator op 
)
static

◆ ed_marker_select_exec()

static int ed_marker_select_exec ( bContext C,
wmOperator op 
)
static

◆ ed_marker_select_leftright_exec()

static int ed_marker_select_leftright_exec ( bContext C,
wmOperator op 
)
static

◆ ED_markers_deselect_all()

void ED_markers_deselect_all ( ListBase markers,
int  action 
)

◆ ED_markers_draw()

void ED_markers_draw ( const bContext C,
int  flag 
)

◆ ED_markers_find_nearest_marker()

TimeMarker* ED_markers_find_nearest_marker ( ListBase markers,
float  x 
)

Get the marker that is closest to this point. XXX: for select, the min_dist should be small.

Definition at line 144 of file anim_markers.c.

References fabsf, TimeMarker::frame, markers, TimeMarker::next, NULL, and x.

Referenced by ED_markers_find_nearest_marker_time(), and region_position_is_over_marker().

◆ ED_markers_find_nearest_marker_time()

int ED_markers_find_nearest_marker_time ( ListBase markers,
float  x 
)

Return the time of the marker that occurs on a frame closest to the given time.

Definition at line 163 of file anim_markers.c.

References ED_markers_find_nearest_marker(), TimeMarker::frame, markers, round_fl_to_int(), and x.

Referenced by ed_marker_select(), gpencil_frame_snap_nearmarker(), nlaedit_snap_exec(), snap_bezier_nearmarker(), snap_mask_layer_nearmarker(), and snapFrameTransform().

◆ ED_markers_get_first_selected()

TimeMarker* ED_markers_get_first_selected ( ListBase markers)

◆ ED_markers_get_minmax()

void ED_markers_get_minmax ( ListBase markers,
short  sel,
float r_first,
float r_last 
)

◆ ED_markers_make_cfra_list()

void ED_markers_make_cfra_list ( ListBase markers,
ListBase lb,
short  sel 
)

This function makes a list of all the markers. The only_sel argument is used to specify whether only the selected markers are added.

Definition at line 296 of file anim_markers.c.

References add_marker_to_cfra_elem(), ListBase::first, ListBase::last, markers, TimeMarker::next, and NULL.

Referenced by columnselect_action_keys(), columnselect_graph_keys(), and pose_propagate_exec().

◆ ed_markers_poll_markers_exist()

static bool ed_markers_poll_markers_exist ( bContext C)
static

◆ ed_markers_poll_selected_markers()

static bool ed_markers_poll_selected_markers ( bContext C)
static

◆ ed_markers_poll_selected_no_locked_markers()

static bool ed_markers_poll_selected_no_locked_markers ( bContext C)
static

◆ ED_markers_post_apply_transform()

int ED_markers_post_apply_transform ( ListBase markers,
struct Scene scene,
int  mode,
float  value,
char  side 
)

Apply some transformation to markers after the fact

Parameters
markersList of markers to affect - this may or may not be the scene markers list, so don't assume anything.
sceneCurrent scene (for getting current frame)
mode(TfmMode) transform mode that this transform is for
valueFrom the transform code, this is t->vec[0] (which is delta transform for grab/extend, and scale factor for scale)
side(B/L/R) for 'extend' functionality, which side of current frame to use

Definition at line 103 of file anim_markers.c.

References RenderData::cfra, TimeMarker::flag, float(), TimeMarker::frame, if(), ToolSettings::lock_markers, markers, TimeMarker::next, NULL, Scene::r, round_fl_to_int(), scene, SELECT, TFM_TIME_EXTEND, TFM_TIME_SCALE, TFM_TIME_TRANSLATE, and Scene::toolsettings.

Referenced by special_aftertrans_update__actedit(), and special_aftertrans_update__sequencer().

◆ ED_markers_select_leftright()

static void ED_markers_select_leftright ( bAnimContext ac,
const eMarkers_LeftRightSelect_Mode  mode,
const bool  extend 
)
static

◆ ED_operator_markers_region_active()

static bool ED_operator_markers_region_active ( bContext C)
static

◆ ED_operatortypes_marker()

void ED_operatortypes_marker ( void  )

◆ get_marker_clip_frame_range()

static void get_marker_clip_frame_range ( View2D v2d,
float  xscale,
int  r_range[2] 
)
static

Definition at line 528 of file anim_markers.c.

References View2D::cur, NULL, UI_DPI_FAC, rctf::xmax, and rctf::xmin.

Referenced by ED_markers_draw().

◆ get_marker_region_rect()

static void get_marker_region_rect ( View2D v2d,
rctf rect 
)
static

Definition at line 520 of file anim_markers.c.

References View2D::cur, UI_MARKER_MARGIN_Y, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.

Referenced by ED_markers_draw().

◆ marker_color_get()

static void marker_color_get ( const TimeMarker marker,
uchar r_text_color,
uchar r_line_color 
)
static

◆ marker_get_icon_id()

static int marker_get_icon_id ( TimeMarker marker,
int  flag 
)
static

Definition at line 450 of file anim_markers.c.

References ACTIVE, TimeMarker::camera, DRAW_MARKERS_LOCAL, TimeMarker::flag, and SELECT.

Referenced by draw_marker().

◆ marker_is_in_frame_range()

static bool marker_is_in_frame_range ( TimeMarker marker,
const int  frame_range[2] 
)
static

Definition at line 509 of file anim_markers.c.

References TimeMarker::frame.

Referenced by ED_markers_draw().

◆ MARKER_OT_add()

static void MARKER_OT_add ( wmOperatorType ot)
static

◆ MARKER_OT_delete()

static void MARKER_OT_delete ( wmOperatorType ot)
static

◆ MARKER_OT_duplicate()

static void MARKER_OT_duplicate ( wmOperatorType ot)
static

◆ MARKER_OT_make_links_scene()

static void MARKER_OT_make_links_scene ( wmOperatorType ot)
static

◆ MARKER_OT_move()

static void MARKER_OT_move ( wmOperatorType ot)
static

◆ MARKER_OT_rename()

static void MARKER_OT_rename ( wmOperatorType ot)
static

◆ MARKER_OT_select()

static void MARKER_OT_select ( wmOperatorType ot)
static

◆ MARKER_OT_select_all()

static void MARKER_OT_select_all ( wmOperatorType ot)
static

◆ MARKER_OT_select_box()

static void MARKER_OT_select_box ( wmOperatorType ot)
static

◆ MARKER_OT_select_leftright()

static void MARKER_OT_select_leftright ( wmOperatorType ot)
static

◆ region_position_is_over_marker()

static bool region_position_is_over_marker ( View2D v2d,
ListBase markers,
float  region_x 
)
static

◆ select_marker_camera_switch()

static void select_marker_camera_switch ( bContext C,
bool  camera,
bool  extend,
ListBase markers,
int  cfra 
)
static

◆ select_timeline_marker_frame()

static int select_timeline_marker_frame ( ListBase markers,
int  frame,
bool  extend,
bool  wait_to_deselect_others 
)
static

Variable Documentation

◆ prop_markers_select_leftright_modes

const EnumPropertyItem prop_markers_select_leftright_modes[]
static
Initial value:
= {
{MARKERS_LRSEL_LEFT, "LEFT", 0, "Before Current Frame", ""},
{MARKERS_LRSEL_RIGHT, "RIGHT", 0, "After Current Frame", ""},
{0, NULL, 0, NULL, NULL},
}
@ MARKERS_LRSEL_RIGHT
@ MARKERS_LRSEL_LEFT

Definition at line 1478 of file anim_markers.c.

Referenced by MARKER_OT_select_leftright().