Blender V4.3
anim_markers.cc File Reference
#include <cmath>
#include "MEM_guardedalloc.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLT_translation.hh"
#include "BKE_context.hh"
#include "BKE_idprop.hh"
#include "BKE_layer.hh"
#include "BKE_main.hh"
#include "BKE_report.hh"
#include "BKE_scene.hh"
#include "BKE_screen.hh"
#include "BKE_unit.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "RNA_enum_types.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "GPU_immediate.hh"
#include "GPU_matrix.hh"
#include "GPU_state.hh"
#include "UI_interface.hh"
#include "UI_interface_icons.hh"
#include "UI_resources.hh"
#include "UI_view2d.hh"
#include "ED_anim_api.hh"
#include "ED_keyframes_edit.hh"
#include "ED_markers.hh"
#include "ED_numinput.hh"
#include "ED_object.hh"
#include "ED_screen.hh"
#include "ED_select_utils.hh"
#include "ED_transform.hh"
#include "ED_util.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_build.hh"

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, const bool only_selected)
 
void ED_markers_make_cfra_list (ListBase *markers, ListBase *lb, const bool only_selected)
 
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 xmax, 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 xpos, int xmax, int flag, int region_height, bool is_elevated)
 
static void draw_markers_background (const 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 *r_rect)
 
static void get_marker_clip_frame_range (View2D *v2d, float xscale, int r_range[2])
 
static int markers_frame_sort (const void *a, const void *b)
 
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 *)
 
static void MARKER_OT_add (wmOperatorType *ot)
 
Transform Markers
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)
 
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 *)
 
static int ed_marker_delete_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
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)
 
Camera Bind Marker
static int ed_marker_camera_bind_exec (bContext *C, wmOperator *op)
 
static void MARKER_OT_camera_bind (wmOperatorType *ot)
 
Registration
void ED_operatortypes_marker ()
 
void ED_keymap_marker (wmKeyConfig *keyconf)
 

Select Left/Right of Frame

enum  eMarkers_LeftRightSelect_Mode { MARKERS_LRSEL_LEFT = 0 , MARKERS_LRSEL_RIGHT }
 
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)
 

Enumeration Type Documentation

◆ eMarkers_LeftRightSelect_Mode

Enumerator
MARKERS_LRSEL_LEFT 
MARKERS_LRSEL_RIGHT 

Definition at line 1572 of file anim_markers.cc.

Function Documentation

◆ add_marker_to_cfra_elem()

static void add_marker_to_cfra_elem ( ListBase * lb,
TimeMarker * marker,
const bool only_selected )
static

◆ context_get_markers()

◆ debug_markers_print_list()

void debug_markers_print_list ( ListBase * markers)

Debugging only: print debugging prints of list of markers.

Definition at line 356 of file anim_markers.cc.

References LISTBASE_FOREACH, markers, and printf.

◆ deselect_markers()

static void deselect_markers ( ListBase * markers)
static

◆ draw_marker()

◆ draw_marker_line()

◆ draw_marker_name()

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

◆ draw_markers_background()

◆ ED_animcontext_get_markers()

ListBase * ED_animcontext_get_markers ( const bAnimContext * ac)

Public API for getting markers from "animation" context.

Definition at line 93 of file anim_markers.cc.

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

Referenced by actkeys_select_leftright().

◆ ED_context_get_markers()

◆ ED_keymap_marker()

void ED_keymap_marker ( wmKeyConfig * keyconf)

Called in screen_ops.cc, ED_keymap_screen().

Definition at line 1944 of file anim_markers.cc.

References RGN_TYPE_WINDOW, SPACE_EMPTY, and WM_keymap_ensure().

Referenced by ED_spacetypes_keymap().

◆ ed_marker_add_exec()

◆ ed_marker_box_select_exec()

◆ ed_marker_box_select_invoke()

◆ ed_marker_camera_bind_exec()

◆ ed_marker_delete_exec()

◆ ed_marker_delete_invoke()

static int ed_marker_delete_invoke ( bContext * C,
wmOperator * op,
const wmEvent *  )
static

◆ ed_marker_duplicate_apply()

◆ ed_marker_duplicate_exec()

static int ed_marker_duplicate_exec ( bContext * C,
wmOperator * op )
static

◆ ed_marker_duplicate_invoke()

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

Definition at line 1217 of file anim_markers.cc.

References ed_marker_duplicate_apply(), and ed_marker_move_invoke().

Referenced by MARKER_OT_duplicate().

◆ ed_marker_make_links_scene_exec()

◆ ed_marker_move_apply()

◆ 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()

◆ ed_marker_move_invoke()

◆ ed_marker_move_modal()

◆ ed_marker_move_update_header()

◆ ed_marker_move_use_time()

◆ ed_marker_rename_exec()

◆ ed_marker_rename_invoke()

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

◆ ed_marker_select()

◆ ed_marker_select_all_exec()

◆ ed_marker_select_exec()

static int ed_marker_select_exec ( bContext * C,
wmOperator * op )
static

◆ ed_marker_select_leftright_exec()

◆ 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 )

Draw Scene-Markers in time window.

Set a temporary bit in the marker's flag to indicate that it should be elevated. This bit will be flipped back at the end of this function.

Draw non-elevated markers first. Note that unlike the elevated markers, these marker names will always be clipped by the proceeding marker. This is done because otherwise, the text overlaps with the icon of the marker itself.

Definition at line 565 of file anim_markers.cc.

References BLI_duplicatelist(), BLI_freelistN(), BLI_listbase_is_empty(), BLI_listbase_sort(), RenderData::cfra, CTX_data_scene(), CTX_wm_region(), draw_marker(), draw_markers_background(), ED_context_get_markers(), ListBase::first, flag, TimeMarker::flag, TimeMarker::frame, get_marker_clip_frame_range(), get_marker_region_rect(), GPU_line_width(), GPU_matrix_pop(), GPU_matrix_push(), GPU_matrix_scale_2f(), LISTBASE_FOREACH, marker_is_in_frame_range(), markers, markers_frame_sort(), next, TimeMarker::next, Scene::r, SELECT, SET_FLAG_FROM_TEST, UI_FSTYLE_WIDGET, UI_view2d_fromcontext(), and UI_view2d_scale_get().

Referenced by action_main_region_draw(), draw_timeline_markers(), graph_main_region_draw(), and nla_main_region_draw().

◆ 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.cc.

References fabsf, LISTBASE_FOREACH, and markers.

Referenced by ed_marker_camera_bind_exec(), 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 )

◆ ED_markers_get_first_selected()

◆ ED_markers_get_minmax()

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

Definition at line 169 of file anim_markers.cc.

References ELEM, float, FLT_MAX, LISTBASE_FOREACH, markers, max, min, and SELECT.

Referenced by markers_selectkeys_between(), and markers_selectkeys_between().

◆ ED_markers_make_cfra_list()

void ED_markers_make_cfra_list ( ListBase * markers,
ListBase * lb,
bool only_selected )

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 295 of file anim_markers.cc.

References add_marker_to_cfra_elem(), ListBase::first, ListBase::last, LISTBASE_FOREACH, and markers.

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

◆ ed_markers_poll_markers_exist()

◆ ed_markers_poll_selected_markers()

static bool ed_markers_poll_selected_markers ( bContext * C)
static

◆ ed_markers_poll_selected_no_locked_markers()

◆ ED_markers_post_apply_transform()

int ED_markers_post_apply_transform ( ListBase * markers,
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.cc.

References float, LISTBASE_FOREACH, markers, round_fl_to_int(), SELECT, TFM_TIME_EXTEND, TFM_TIME_SCALE, and TFM_TIME_TRANSLATE.

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()

◆ get_marker_clip_frame_range()

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

Definition at line 550 of file anim_markers.cc.

References View2D::cur, TimeMarker::name, UI_SCALE_FAC, rctf::xmax, and rctf::xmin.

Referenced by ED_markers_draw().

◆ get_marker_region_rect()

static void get_marker_region_rect ( View2D * v2d,
rctf * r_rect )
static

Definition at line 542 of file anim_markers.cc.

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 453 of file anim_markers.cc.

References TimeMarker::camera, DRAW_MARKERS_LOCAL, flag, 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 531 of file anim_markers.cc.

References TimeMarker::frame.

Referenced by ED_markers_draw().

◆ MARKER_OT_add()

◆ MARKER_OT_camera_bind()

◆ MARKER_OT_delete()

◆ MARKER_OT_duplicate()

◆ MARKER_OT_make_links_scene()

◆ MARKER_OT_move()

◆ MARKER_OT_rename()

◆ MARKER_OT_select()

◆ MARKER_OT_select_all()

◆ MARKER_OT_select_box()

◆ MARKER_OT_select_leftright()

◆ markers_frame_sort()

static int markers_frame_sort ( const void * a,
const void * b )
static

Definition at line 557 of file anim_markers.cc.

References b, and TimeMarker::frame.

Referenced by ED_markers_draw().

◆ region_position_is_over_marker()

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

◆ select_marker_camera_switch()

◆ 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, nullptr, 0, nullptr, nullptr},
}
@ MARKERS_LRSEL_RIGHT
@ MARKERS_LRSEL_LEFT

Definition at line 1577 of file anim_markers.cc.

Referenced by MARKER_OT_select_leftright().