Blender V5.0
anim_markers.cc File Reference
#include <cmath>
#include "MEM_guardedalloc.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BLI_listbase.h"
#include "BLI_math_vector.h"
#include "BLI_string.h"
#include "BLI_string_utf8.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
ListBaseED_scene_markers_get (const bContext *C, Scene *scene)
ListBaseED_scene_markers_get_from_area (Scene *scene, ViewLayer *view_layer, const ScrArea *area)
ListBaseED_context_get_markers (const bContext *C)
ListBaseED_sequencer_context_get_markers (const bContext *C)
int ED_markers_post_apply_transform (ListBase *markers, Scene *scene, int mode, float value, char side)
TimeMarkerED_markers_find_nearest_marker (ListBase *markers, const float frame)
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 operator_markers_region_active (bContext *C)
static TimeMarkerregion_position_is_over_marker (const 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)
bool ED_markers_region_visible (const ScrArea *area, const ARegion *region)
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)
static bool ed_markers_poll_markers_exist_visible (bContext *C)
Add Markers
static wmOperatorStatus 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 wmOperatorStatus 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 wmOperatorStatus ed_marker_move_modal (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus 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 wmOperatorStatus ed_marker_duplicate_exec (bContext *C, wmOperator *op)
static wmOperatorStatus 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 void select_marker_camera_switch (bContext *C, bool camera, bool extend, ListBase *markers, int cfra)
static wmOperatorStatus ed_marker_select (bContext *C, const int mval[2], bool extend, bool deselect_all, bool camera, bool wait_to_deselect_others)
static wmOperatorStatus ed_marker_select_exec (bContext *C, wmOperator *op)
static void MARKER_OT_select (wmOperatorType *ot)
Box Select Markers
static wmOperatorStatus ed_marker_box_select_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus ed_marker_box_select_exec (bContext *C, wmOperator *op)
static void MARKER_OT_select_box (wmOperatorType *ot)
(de)select all
static wmOperatorStatus ed_marker_select_all_exec (bContext *C, wmOperator *op)
static void MARKER_OT_select_all (wmOperatorType *ot)
Remove Marker

Remove selected time-markers.

static wmOperatorStatus ed_marker_delete_exec (bContext *C, wmOperator *)
static wmOperatorStatus 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 wmOperatorStatus ed_marker_rename_exec (bContext *C, wmOperator *op)
static wmOperatorStatus ed_marker_rename_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static void MARKER_OT_rename (wmOperatorType *ot)
Make Links to Scene
static wmOperatorStatus ed_marker_make_links_scene_exec (bContext *C, wmOperator *op)
static void MARKER_OT_make_links_scene (wmOperatorType *ot)
Camera Bind Marker
static wmOperatorStatus 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 markers_select_leftright (bAnimContext *ac, const eMarkers_LeftRightSelect_Mode mode, const bool extend)
static wmOperatorStatus 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 1698 of file anim_markers.cc.

Function Documentation

◆ add_marker_to_cfra_elem()

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

◆ debug_markers_print_list()

void debug_markers_print_list ( ListBase * markers)

Debugging only: print debugging prints of list of markers.

Definition at line 423 of file anim_markers.cc.

References LISTBASE_FOREACH, and printf.

◆ deselect_markers()

void deselect_markers ( ListBase * markers)
static

Definition at line 1351 of file anim_markers.cc.

References LISTBASE_FOREACH, and SELECT.

Referenced by ed_marker_select(), and markers_select_leftright().

◆ draw_marker()

◆ draw_marker_line()

◆ draw_marker_name()

◆ draw_markers_background()

◆ ED_context_get_markers()

◆ ED_keymap_marker()

void ED_keymap_marker ( wmKeyConfig * keyconf)

Called in screen_ops.cc, ED_keymap_screen().

Definition at line 2081 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()

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

◆ ed_marker_duplicate_apply()

◆ ed_marker_duplicate_exec()

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

◆ ed_marker_duplicate_invoke()

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

Definition at line 1314 of file anim_markers.cc.

References C, 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()

void ed_marker_move_cancel ( bContext * C,
wmOperator * op )
static

◆ ed_marker_move_exec()

◆ ed_marker_move_exit()

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

◆ ed_marker_select()

◆ ed_marker_select_all_exec()

◆ ed_marker_select_exec()

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

References BLI_duplicatelist(), BLI_freelistN(), BLI_listbase_is_empty(), BLI_listbase_sort(), C, RenderData::cfra, CTX_data_scene(), CTX_wm_region(), CTX_wm_space_seq(), draw_marker(), draw_markers_background(), ED_context_get_markers(), ED_sequencer_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_frame_sort(), next, TimeMarker::next, Scene::r, SELECT, SET_FLAG_FROM_TEST, UI_FSTYLE_WIDGET, UI_view2d_fromcontext(), UI_view2d_scale_get(), and ARegion::winy.

Referenced by action_main_region_draw(), blender::ed::vse::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 frame )
Returns
the marker that is closest to frame. Non-empty markers is guaranteed to return a marker.
Note
For selecting, the caller is expected to exclude markers beyond a small threshold.

Definition at line 156 of file anim_markers.cc.

References BLI_listbase_is_empty(), fabsf, ListBase::first, TimeMarker::frame, and TimeMarker::next.

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 )

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

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

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

◆ ed_markers_poll_markers_exist()

◆ ed_markers_poll_markers_exist_visible()

bool ed_markers_poll_markers_exist_visible ( bContext * C)
static

◆ ed_markers_poll_selected_markers()

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

References RenderData::cfra, float, LISTBASE_FOREACH, ToolSettings::lock_markers, Scene::r, round_fl_to_int(), SELECT, blender::ed::transform::TFM_TIME_EXTEND, blender::ed::transform::TFM_TIME_SCALE, blender::ed::transform::TFM_TIME_TRANSLATE, and Scene::toolsettings.

Referenced by blender::ed::transform::special_aftertrans_update__actedit(), and blender::ed::transform::special_aftertrans_update__sequencer().

◆ ED_markers_region_visible()

◆ ED_operatortypes_marker()

◆ ED_scene_markers_get()

ListBase * ED_scene_markers_get ( const bContext * C,
Scene * scene )

Public API for getting markers from the scene & area.

Returns
A TimeMarker list.

Definition at line 66 of file anim_markers.cc.

References ANIM_animdata_get_context(), C, bAnimContext::markers, and Scene::markers.

Referenced by ED_context_get_markers(), and ED_sequencer_context_get_markers().

◆ ED_scene_markers_get_from_area()

◆ ED_sequencer_context_get_markers()

◆ get_marker_clip_frame_range()

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

Definition at line 614 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()

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

Definition at line 606 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()

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

◆ marker_get_icon_id()

int marker_get_icon_id ( TimeMarker * marker,
int flag )
static

Definition at line 518 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()

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

Definition at line 595 of file anim_markers.cc.

References TimeMarker::frame.

Referenced by ED_markers_draw().

◆ MARKER_OT_add()

void MARKER_OT_add ( wmOperatorType * ot)
static

◆ MARKER_OT_camera_bind()

void MARKER_OT_camera_bind ( wmOperatorType * ot)
static

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

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

Definition at line 621 of file anim_markers.cc.

References b, and TimeMarker::frame.

Referenced by ED_markers_draw().

◆ markers_select_leftright()

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

◆ operator_markers_region_active()

bool operator_markers_region_active ( bContext * C)
static

◆ region_position_is_over_marker()

◆ select_marker_camera_switch()

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

Referenced by MARKER_OT_select_leftright().