Blender  V3.3
nla_edit.c File Reference
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BKE_action.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_nla.h"
#include "BKE_report.h"
#include "BKE_screen.h"
#include "ED_anim_api.h"
#include "ED_keyframes_edit.h"
#include "ED_markers.h"
#include "ED_screen.h"
#include "ED_transform.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "RNA_prototypes.h"
#include "WM_api.h"
#include "WM_types.h"
#include "DEG_depsgraph_build.h"
#include "UI_interface.h"
#include "UI_view2d.h"
#include "nla_intern.h"
#include "nla_private.h"

Go to the source code of this file.

Functions

Public Utilities
void ED_nla_postop_refresh (bAnimContext *ac)
 
Enable Tweak-Mode Operator
static int nlaedit_enable_tweakmode_exec (bContext *C, wmOperator *op)
 
void NLA_OT_tweakmode_enter (wmOperatorType *ot)
 
Disable Tweak-Mode Operator
bool nlaedit_disable_tweakmode (bAnimContext *ac, bool do_solo)
 
static int nlaedit_disable_tweakmode_exec (bContext *C, wmOperator *op)
 
void NLA_OT_tweakmode_exit (wmOperatorType *ot)
 
Calculate NLA Strip Range
static void get_nlastrip_extents (bAnimContext *ac, float *min, float *max, const bool only_sel)
 
Automatic Preview-Range Operator
static int nlaedit_previewrange_exec (bContext *C, wmOperator *UNUSED(op))
 
void NLA_OT_previewrange_set (wmOperatorType *ot)
 
View-All Operator
static bool nla_channels_get_selected_extents (bAnimContext *ac, float *r_min, float *r_max)
 
static int nlaedit_viewall (bContext *C, const bool only_sel)
 
static int nlaedit_viewall_exec (bContext *C, wmOperator *UNUSED(op))
 
static int nlaedit_viewsel_exec (bContext *C, wmOperator *UNUSED(op))
 
void NLA_OT_view_all (wmOperatorType *ot)
 
void NLA_OT_view_selected (wmOperatorType *ot)
 
View-Frame Operator
static int nlaedit_viewframe_exec (bContext *C, wmOperator *op)
 
void NLA_OT_view_frame (wmOperatorType *ot)
 
Add Action-Clip Operator

Add a new Action-Clip strip to the active track (or the active block if no space in the track).

static int nlaedit_add_actionclip_exec (bContext *C, wmOperator *op)
 
void NLA_OT_actionclip_add (wmOperatorType *ot)
 
Add Transition Operator

Add a new transition strip between selected strips.

static int nlaedit_add_transition_exec (bContext *C, wmOperator *op)
 
void NLA_OT_transition_add (wmOperatorType *ot)
 
Add Sound Clip Operator
static int nlaedit_add_sound_exec (bContext *C, wmOperator *UNUSED(op))
 
void NLA_OT_soundclip_add (wmOperatorType *ot)
 
Add Meta-Strip Operator

Add new meta-strips incorporating the selected strips.

static int nlaedit_add_meta_exec (bContext *C, wmOperator *UNUSED(op))
 
void NLA_OT_meta_add (wmOperatorType *ot)
 
Remove Meta-Strip Operator

Separate out the strips held by the selected meta-strips.

static int nlaedit_remove_meta_exec (bContext *C, wmOperator *UNUSED(op))
 
void NLA_OT_meta_remove (wmOperatorType *ot)
 
Duplicate Strips Operator

Duplicates the selected NLA-Strips, putting them on new tracks above the one the originals were housed in.

static int nlaedit_duplicate_exec (bContext *C, wmOperator *op)
 
static int nlaedit_duplicate_invoke (bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
 
void NLA_OT_duplicate (wmOperatorType *ot)
 
Delete Strips Operator

Deletes the selected NLA-Strips.

static int nlaedit_delete_exec (bContext *C, wmOperator *UNUSED(op))
 
void NLA_OT_delete (wmOperatorType *ot)
 
Split Strips Operator

Splits the selected NLA-Strips into two strips at the midpoint of the strip.

TODO's?

  • multiple splits
  • variable-length splits?
static void nlaedit_split_strip_actclip (Main *bmain, AnimData *adt, NlaTrack *nlt, NlaStrip *strip, float cfra)
 
static void nlaedit_split_strip_meta (NlaTrack *nlt, NlaStrip *strip)
 
static int nlaedit_split_exec (bContext *C, wmOperator *UNUSED(op))
 
void NLA_OT_split (wmOperatorType *ot)
 
Toggle Muting Operator

Toggles whether strips are muted or not.

static int nlaedit_toggle_mute_exec (bContext *C, wmOperator *UNUSED(op))
 
void NLA_OT_mute_toggle (wmOperatorType *ot)
 
Swap Strips Operator

Tries to exchange strips within their owner tracks.

static int nlaedit_swap_exec (bContext *C, wmOperator *op)
 
void NLA_OT_swap (wmOperatorType *ot)
 
Move Strips Up Operator

Tries to move the selected strips into the track above if possible.

static int nlaedit_move_up_exec (bContext *C, wmOperator *UNUSED(op))
 
void NLA_OT_move_up (wmOperatorType *ot)
 
Move Strips Down Operator

Tries to move the selected strips into the track above if possible.

static int nlaedit_move_down_exec (bContext *C, wmOperator *UNUSED(op))
 
void NLA_OT_move_down (wmOperatorType *ot)
 
Sync Action Length Operator

Recalculate the extents of the action ranges used for the selected strips.

static int nlaedit_sync_actlen_exec (bContext *C, wmOperator *op)
 
void NLA_OT_action_sync_length (wmOperatorType *ot)
 
Make Single User

Ensure that each strip has its own action.

static int nlaedit_make_single_user_exec (bContext *C, wmOperator *UNUSED(op))
 
void NLA_OT_make_single_user (wmOperatorType *ot)
 
Apply Scale Operator

Reset the scaling of the selected strips to 1.0f.

static short bezt_apply_nlamapping (KeyframeEditData *ked, BezTriple *bezt)
 
static int nlaedit_apply_scale_exec (bContext *C, wmOperator *UNUSED(op))
 
void NLA_OT_apply_scale (wmOperatorType *ot)
 
Clear Scale Operator

Reset the scaling of the selected strips to 1.0f.

static int nlaedit_clear_scale_exec (bContext *C, wmOperator *UNUSED(op))
 
void NLA_OT_clear_scale (wmOperatorType *ot)
 
Add F-Modifier Operator
static const EnumPropertyItemnla_fmodifier_itemf (bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
 
static int nla_fmodifier_add_exec (bContext *C, wmOperator *op)
 
void NLA_OT_fmodifier_add (wmOperatorType *ot)
 
Copy F-Modifiers Operator
static int nla_fmodifier_copy_exec (bContext *C, wmOperator *op)
 
void NLA_OT_fmodifier_copy (wmOperatorType *ot)
 
Paste F-Modifiers Operator
static int nla_fmodifier_paste_exec (bContext *C, wmOperator *op)
 
void NLA_OT_fmodifier_paste (wmOperatorType *ot)
 

Snap Strips Operator

Moves the start-point of the selected strips to the specified places.

static const EnumPropertyItem prop_nlaedit_snap_types []
 
static int nlaedit_snap_exec (bContext *C, wmOperator *op)
 
void NLA_OT_snap (wmOperatorType *ot)
 

Function Documentation

◆ bezt_apply_nlamapping()

static short bezt_apply_nlamapping ( KeyframeEditData ked,
BezTriple bezt 
)
static

◆ ED_nla_postop_refresh()

void ED_nla_postop_refresh ( bAnimContext ac)

◆ get_nlastrip_extents()

static void get_nlastrip_extents ( bAnimContext ac,
float min,
float max,
const bool  only_sel 
)
static

◆ nla_channels_get_selected_extents()

static bool nla_channels_get_selected_extents ( bAnimContext ac,
float r_min,
float r_max 
)
static

◆ nla_fmodifier_add_exec()

static int nla_fmodifier_add_exec ( bContext C,
wmOperator op 
)
static

◆ nla_fmodifier_copy_exec()

static int nla_fmodifier_copy_exec ( bContext C,
wmOperator op 
)
static

◆ nla_fmodifier_itemf()

static const EnumPropertyItem* nla_fmodifier_itemf ( bContext C,
PointerRNA UNUSEDptr,
PropertyRNA UNUSEDprop,
bool r_free 
)
static

◆ nla_fmodifier_paste_exec()

static int nla_fmodifier_paste_exec ( bContext C,
wmOperator op 
)
static

◆ NLA_OT_action_sync_length()

void NLA_OT_action_sync_length ( wmOperatorType ot)

◆ NLA_OT_actionclip_add()

void NLA_OT_actionclip_add ( wmOperatorType ot)

◆ NLA_OT_apply_scale()

void NLA_OT_apply_scale ( wmOperatorType ot)

◆ NLA_OT_clear_scale()

void NLA_OT_clear_scale ( wmOperatorType ot)

◆ NLA_OT_delete()

void NLA_OT_delete ( wmOperatorType ot)

◆ NLA_OT_duplicate()

void NLA_OT_duplicate ( wmOperatorType ot)

◆ NLA_OT_fmodifier_add()

void NLA_OT_fmodifier_add ( wmOperatorType ot)

◆ NLA_OT_fmodifier_copy()

void NLA_OT_fmodifier_copy ( wmOperatorType ot)

◆ NLA_OT_fmodifier_paste()

void NLA_OT_fmodifier_paste ( wmOperatorType ot)

◆ NLA_OT_make_single_user()

void NLA_OT_make_single_user ( wmOperatorType ot)

◆ NLA_OT_meta_add()

void NLA_OT_meta_add ( wmOperatorType ot)

◆ NLA_OT_meta_remove()

void NLA_OT_meta_remove ( wmOperatorType ot)

◆ NLA_OT_move_down()

void NLA_OT_move_down ( wmOperatorType ot)

◆ NLA_OT_move_up()

void NLA_OT_move_up ( wmOperatorType ot)

◆ NLA_OT_mute_toggle()

void NLA_OT_mute_toggle ( wmOperatorType ot)

◆ NLA_OT_previewrange_set()

void NLA_OT_previewrange_set ( wmOperatorType ot)

◆ NLA_OT_snap()

void NLA_OT_snap ( wmOperatorType ot)

◆ NLA_OT_soundclip_add()

void NLA_OT_soundclip_add ( wmOperatorType ot)

◆ NLA_OT_split()

void NLA_OT_split ( wmOperatorType ot)

◆ NLA_OT_swap()

void NLA_OT_swap ( wmOperatorType ot)

◆ NLA_OT_transition_add()

void NLA_OT_transition_add ( wmOperatorType ot)

◆ NLA_OT_tweakmode_enter()

void NLA_OT_tweakmode_enter ( wmOperatorType ot)

◆ NLA_OT_tweakmode_exit()

void NLA_OT_tweakmode_exit ( wmOperatorType ot)

◆ NLA_OT_view_all()

void NLA_OT_view_all ( wmOperatorType ot)

◆ NLA_OT_view_frame()

void NLA_OT_view_frame ( wmOperatorType ot)

◆ NLA_OT_view_selected()

void NLA_OT_view_selected ( wmOperatorType ot)

◆ nlaedit_add_actionclip_exec()

static int nlaedit_add_actionclip_exec ( bContext C,
wmOperator op 
)
static

◆ nlaedit_add_meta_exec()

static int nlaedit_add_meta_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ nlaedit_add_sound_exec()

static int nlaedit_add_sound_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ nlaedit_add_transition_exec()

static int nlaedit_add_transition_exec ( bContext C,
wmOperator op 
)
static

◆ nlaedit_apply_scale_exec()

static int nlaedit_apply_scale_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ nlaedit_clear_scale_exec()

static int nlaedit_clear_scale_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ nlaedit_delete_exec()

static int nlaedit_delete_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ nlaedit_disable_tweakmode()

bool nlaedit_disable_tweakmode ( bAnimContext ac,
bool  do_solo 
)

◆ nlaedit_disable_tweakmode_exec()

static int nlaedit_disable_tweakmode_exec ( bContext C,
wmOperator op 
)
static

◆ nlaedit_duplicate_exec()

static int nlaedit_duplicate_exec ( bContext C,
wmOperator op 
)
static

◆ nlaedit_duplicate_invoke()

static int nlaedit_duplicate_invoke ( bContext C,
wmOperator op,
const wmEvent UNUSEDevent 
)
static

Definition at line 1219 of file nla_edit.c.

References C, nlaedit_duplicate_exec(), and OPERATOR_FINISHED.

Referenced by NLA_OT_duplicate().

◆ nlaedit_enable_tweakmode_exec()

static int nlaedit_enable_tweakmode_exec ( bContext C,
wmOperator op 
)
static

◆ nlaedit_make_single_user_exec()

static int nlaedit_make_single_user_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ nlaedit_move_down_exec()

static int nlaedit_move_down_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ nlaedit_move_up_exec()

static int nlaedit_move_up_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ nlaedit_previewrange_exec()

static int nlaedit_previewrange_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ nlaedit_remove_meta_exec()

static int nlaedit_remove_meta_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ nlaedit_snap_exec()

static int nlaedit_snap_exec ( bContext C,
wmOperator op 
)
static

◆ nlaedit_split_exec()

static int nlaedit_split_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ nlaedit_split_strip_actclip()

static void nlaedit_split_strip_actclip ( Main bmain,
AnimData adt,
NlaTrack nlt,
NlaStrip strip,
float  cfra 
)
static

◆ nlaedit_split_strip_meta()

static void nlaedit_split_strip_meta ( NlaTrack nlt,
NlaStrip strip 
)
static

Definition at line 1420 of file nla_edit.c.

References BKE_nlastrips_clear_metastrip(), and NlaTrack::strips.

Referenced by nlaedit_split_exec().

◆ nlaedit_swap_exec()

static int nlaedit_swap_exec ( bContext C,
wmOperator op 
)
static

◆ nlaedit_sync_actlen_exec()

static int nlaedit_sync_actlen_exec ( bContext C,
wmOperator op 
)
static

◆ nlaedit_toggle_mute_exec()

static int nlaedit_toggle_mute_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ nlaedit_viewall()

static int nlaedit_viewall ( bContext C,
const bool  only_sel 
)
static

◆ nlaedit_viewall_exec()

static int nlaedit_viewall_exec ( bContext C,
wmOperator UNUSEDop 
)
static

Definition at line 528 of file nla_edit.c.

References C, and nlaedit_viewall().

Referenced by NLA_OT_view_all().

◆ nlaedit_viewframe_exec()

static int nlaedit_viewframe_exec ( bContext C,
wmOperator op 
)
static

Definition at line 576 of file nla_edit.c.

References ANIM_center_frame(), C, OPERATOR_FINISHED, and WM_operator_smooth_viewtx_get().

Referenced by NLA_OT_view_frame().

◆ nlaedit_viewsel_exec()

static int nlaedit_viewsel_exec ( bContext C,
wmOperator UNUSEDop 
)
static

Definition at line 534 of file nla_edit.c.

References C, and nlaedit_viewall().

Referenced by NLA_OT_view_selected().

Variable Documentation

◆ prop_nlaedit_snap_types

const EnumPropertyItem prop_nlaedit_snap_types[]
static
Initial value:
= {
{NLAEDIT_SNAP_CFRA, "CFRA", 0, "Selection to Current Frame", ""},
{NLAEDIT_SNAP_NEAREST_FRAME, "NEAREST_FRAME", 0, "Selection to Nearest Frame", ""},
{NLAEDIT_SNAP_NEAREST_SECOND, "NEAREST_SECOND", 0, "Selection to Nearest Second", ""},
{NLAEDIT_SNAP_NEAREST_MARKER, "NEAREST_MARKER", 0, "Selection to Nearest Marker", ""},
{0, NULL, 0, NULL, NULL},
}
@ NLAEDIT_SNAP_NEAREST_MARKER
Definition: nla_intern.h:57
@ NLAEDIT_SNAP_NEAREST_SECOND
Definition: nla_intern.h:56
@ NLAEDIT_SNAP_NEAREST_FRAME
Definition: nla_intern.h:55
@ NLAEDIT_SNAP_CFRA
Definition: nla_intern.h:54

Definition at line 2348 of file nla_edit.c.

Referenced by NLA_OT_snap().