Blender V4.5
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_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 (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, 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)
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, const float alpha)
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 1612 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 365 of file anim_markers.cc.

References debug_markers_print_list(), LISTBASE_FOREACH, and printf.

Referenced by debug_markers_print_list().

◆ deselect_markers()

void deselect_markers ( ListBase * markers)
static

◆ draw_marker()

◆ draw_marker_line()

◆ draw_marker_name()

◆ draw_markers_background()

◆ ED_animcontext_get_markers()

ListBase * ED_animcontext_get_markers ( const bAnimContext * ac)

Public API for getting markers from "animation" context.

Returns
A TimeMarker list.

Definition at line 94 of file anim_markers.cc.

References bAnimContext::area, ED_animcontext_get_markers(), ED_scene_markers_get(), and bAnimContext::scene.

Referenced by actkeys_select_leftright(), and ED_animcontext_get_markers().

◆ ED_context_get_markers()

◆ ED_keymap_marker()

void ED_keymap_marker ( wmKeyConfig * keyconf)

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

◆ 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

◆ ed_marker_make_links_scene_exec()

◆ ed_marker_move_apply()

◆ ed_marker_move_cancel()

◆ ed_marker_move_exec()

◆ ed_marker_move_exit()

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

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

References BLI_duplicatelist(), BLI_freelistN(), BLI_listbase_is_empty(), BLI_listbase_sort(), BLI_rctf_size_y(), C, RenderData::cfra, CTX_data_scene(), CTX_wm_region(), draw_marker(), draw_markers_background(), ED_context_get_markers(), ED_markers_draw(), fade(), ListBase::first, 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(), TimeMarker::next, Scene::r, SELECT, SET_FLAG_FROM_TEST, UI_ANIM_MINY, 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(), ED_markers_draw(), 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 145 of file anim_markers.cc.

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

Referenced by ed_marker_camera_bind_exec(), ED_markers_find_nearest_marker(), ED_markers_find_nearest_marker_time(), and region_position_is_over_marker().

◆ ED_markers_find_nearest_marker_time()

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

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

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

◆ ed_markers_poll_markers_exist()

◆ ed_markers_poll_markers_exist_visible()

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

References RenderData::cfra, ED_markers_post_apply_transform(), 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 ED_markers_post_apply_transform(), blender::ed::transform::special_aftertrans_update__actedit(), and blender::ed::transform::special_aftertrans_update__sequencer().

◆ ED_operatortypes_marker()

◆ ED_scene_markers_get()

◆ get_marker_clip_frame_range()

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

◆ get_marker_region_rect()

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

◆ 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

◆ marker_is_in_frame_range()

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

Definition at line 537 of file anim_markers.cc.

References TimeMarker::frame, and marker_is_in_frame_range().

Referenced by ED_markers_draw(), and marker_is_in_frame_range().

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

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

Definition at line 563 of file anim_markers.cc.

References b, TimeMarker::frame, and markers_frame_sort().

Referenced by ED_markers_draw(), and markers_frame_sort().

◆ markers_select_leftright()

◆ operator_markers_region_active()

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

Referenced by MARKER_OT_select_leftright().