Blender  V2.93
Classes | Typedefs
transform_convert_graph.c File Reference
#include "DNA_anim_types.h"
#include "DNA_space_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
#include "BKE_nla.h"
#include "BKE_report.h"
#include "ED_anim_api.h"
#include "ED_keyframes_edit.h"
#include "ED_markers.h"
#include "UI_view2d.h"
#include "transform.h"
#include "transform_convert.h"

Go to the source code of this file.

Classes

struct  TransDataGraph
 
struct  BeztMap
 

Typedefs

typedef struct TransDataGraph TransDataGraph
 

Functions

Graph Editor Transform Creation
static void bezt_to_transdata (TransData *td, TransData2D *td2d, TransDataGraph *tdg, AnimData *adt, BezTriple *bezt, int bi, bool selected, bool ishandle, bool intvals, const float mtx[3][3], const float smtx[3][3], float unit_scale, float offset)
 
static bool graph_edit_is_translation_mode (TransInfo *t)
 
static bool graph_edit_use_local_center (TransInfo *t)
 
static void graph_bezt_get_transform_selection (const TransInfo *t, const BezTriple *bezt, const bool use_handle, bool *r_left_handle, bool *r_key, bool *r_right_handle)
 
static void graph_key_shortest_dist (TransInfo *t, FCurve *fcu, TransData *td_start, TransData *td, int cfra, bool use_handle)
 
void createTransGraphEditData (bContext *C, TransInfo *t)
 
Special After Transform Graph
void special_aftertrans_update__graph (bContext *C, TransInfo *t)
 

Graph Editor Transform Flush

typedef struct BeztMap BeztMap
 
static bool fcu_test_selected (FCurve *fcu)
 
static void flushTransGraphData (TransInfo *t)
 
static BeztMapbezt_to_beztmaps (BezTriple *bezts, int totvert)
 
static void sort_time_beztmaps (BeztMap *bezms, int totvert)
 
static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totvert)
 
static void remake_graph_transdata (TransInfo *t, ListBase *anim_data)
 
void recalcData_graphedit (TransInfo *t)
 

Typedef Documentation

◆ BeztMap

typedef struct BeztMap BeztMap

◆ TransDataGraph

Function Documentation

◆ bezt_to_beztmaps()

static BeztMap* bezt_to_beztmaps ( BezTriple bezts,
int  totvert 
)
static

◆ bezt_to_transdata()

static void bezt_to_transdata ( TransData td,
TransData2D td2d,
TransDataGraph tdg,
AnimData adt,
BezTriple bezt,
int  bi,
bool  selected,
bool  ishandle,
bool  intvals,
const float  mtx[3][3],
const float  smtx[3][3],
float  unit_scale,
float  offset 
)
static

◆ beztmap_to_data()

static void beztmap_to_data ( TransInfo t,
FCurve fcu,
BeztMap bezms,
int  totvert 
)
static

◆ createTransGraphEditData()

void createTransGraphEditData ( bContext C,
TransInfo t 
)

It is important to note that this doesn't always act on the selection (like it's usually done), it acts on a subset of it. E.g. the selection code may leave a hint that we just dragged on a left or right handle (SIPO_RUNTIME_FLAG_TWEAK_HANDLES_LEFT/RIGHT) and then we only transform the selected left or right handles accordingly. The points to be transformed are tagged with BEZT_FLAG_TEMP_TAG; some lower level curve functions may need to be made aware of this. It's ugly that these act based on selection state anyway.

Definition at line 225 of file transform_convert_graph.c.

References NULL, scene, and t.

Referenced by createTransData().

◆ fcu_test_selected()

static bool fcu_test_selected ( FCurve fcu)
static

Definition at line 636 of file transform_convert_graph.c.

References FCurve::bezt, BEZT_ISSEL_ANY, NULL, and FCurve::totvert.

◆ flushTransGraphData()

static void flushTransGraphData ( TransInfo t)
static

Time-stepping auto-snapping modes don't get applied for Graph Editor transforms, as these use the generic transform modes which don't account for this sort of thing. These ones aren't affected by NLA mapping, so we do this after the conversion...

Note
We also have to apply to td->loc, as that's what the handle-adjustment step below looks to, otherwise we get "swimming handles".
We don't do this when canceling transforms, or else these changes don't go away.

Definition at line 657 of file transform_convert_graph.c.

References Freestyle::a, SpaceGraph::autosnap, BKE_nla_tweakedit_remap(), TransDataContainer::custom, TransCustomData::data, TransDataContainer::data, TransDataContainer::data_2d, ED_markers_find_nearest_marker_time(), ELEM, float(), floor(), floorf, FPS, if(), NLATIME_CONVERT_UNMAP, SACTSNAP_FRAME, SACTSNAP_MARKER, SACTSNAP_SECOND, SACTSNAP_STEP, SACTSNAP_TSTEP, scene, t, TD_INTVALUES, TD_MOVEHANDLE1, TD_MOVEHANDLE2, TD_NOTIMESNAP, TRANS_CANCEL, TRANS_DATA_CONTAINER_FIRST_SINGLE, and TransCustomDataContainer::type.

◆ graph_bezt_get_transform_selection()

static void graph_bezt_get_transform_selection ( const TransInfo t,
const BezTriple bezt,
const bool  use_handle,
bool *  r_left_handle,
bool *  r_key,
bool *  r_right_handle 
)
static

Get the effective selection of a triple for transform, i.e. return if the left handle, right handle and/or the center point should be affected by transform.

Definition at line 163 of file transform_convert_graph.c.

References BezTriple::f1, BezTriple::f2, BezTriple::f3, SpaceGraph_Runtime::flag, left, right, SpaceGraph::runtime, SELECT, SIPO_RUNTIME_FLAG_TWEAK_HANDLES_LEFT, SIPO_RUNTIME_FLAG_TWEAK_HANDLES_RIGHT, and t.

Referenced by graph_key_shortest_dist().

◆ graph_edit_is_translation_mode()

static bool graph_edit_is_translation_mode ( TransInfo t)
static

◆ graph_edit_use_local_center()

static bool graph_edit_use_local_center ( TransInfo t)
static

◆ graph_key_shortest_dist()

static void graph_key_shortest_dist ( TransInfo t,
FCurve fcu,
TransData td_start,
TransData td,
int  cfra,
bool  use_handle 
)
static

◆ recalcData_graphedit()

void recalcData_graphedit ( TransInfo t)

Definition at line 961 of file transform_convert_graph.c.

References NULL, and t.

Referenced by recalcData().

◆ remake_graph_transdata()

static void remake_graph_transdata ( TransInfo t,
ListBase anim_data 
)
static

◆ sort_time_beztmaps()

static void sort_time_beztmaps ( BeztMap bezms,
int  totvert 
)
static

◆ special_aftertrans_update__graph()

void special_aftertrans_update__graph ( bContext C,
TransInfo t 
)