Blender  V3.3
graph_draw.c File Reference
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "BKE_action.h"
#include "BKE_anim_data.h"
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_fcurve.h"
#include "BKE_nla.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
#include "ED_anim_api.h"
#include "graph_intern.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"

Go to the source code of this file.

Functions

FCurve Modifier Drawing
static void graph_draw_driver_debug (bAnimContext *ac, ID *id, FCurve *fcu)
 
static void draw_fcurve_modifier_controls_envelope (FModifier *fcm, View2D *v2d, AnimData *adt_nla_remap)
 
static void set_fcurve_vertex_color (FCurve *fcu, bool sel)
 
static void draw_fcurve_selected_keyframe_vertices (FCurve *fcu, View2D *v2d, bool edit, bool sel, uint pos)
 
static void draw_fcurve_active_vertex (const FCurve *fcu, const View2D *v2d, const uint pos)
 
static void draw_fcurve_keyframe_vertices (FCurve *fcu, View2D *v2d, bool edit, uint pos)
 
static void draw_fcurve_selected_handle_vertices (FCurve *fcu, View2D *v2d, bool sel, bool sel_handle_only, uint pos)
 
static void draw_fcurve_active_handle_vertices (const FCurve *fcu, const bool sel_handle_only, const uint pos)
 
static void draw_fcurve_handle_vertices (FCurve *fcu, View2D *v2d, bool sel_handle_only, uint pos)
 
static void draw_fcurve_vertices (ARegion *region, FCurve *fcu, bool do_handles, bool sel_handle_only)
 
static bool draw_fcurve_handles_check (SpaceGraph *sipo, FCurve *fcu)
 
static void draw_fcurve_handles (SpaceGraph *sipo, FCurve *fcu)
 
static void draw_fcurve_sample_control (float x, float y, float xscale, float yscale, float hsize, uint pos)
 
static void draw_fcurve_samples (SpaceGraph *sipo, ARegion *region, FCurve *fcu)
 
static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu_, View2D *v2d, uint pos, const bool use_nla_remap, const bool draw_extrapolation)
 
static void draw_fcurve_curve_samples (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, const uint shdr_pos, const bool draw_extrapolation)
 
static bool fcurve_can_use_simple_bezt_drawing (FCurve *fcu)
 
static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, uint pos, const bool draw_extrapolation)
 
static void draw_fcurve (bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAnimListElem *ale)
 
void graph_draw_ghost_curves (bAnimContext *ac, SpaceGraph *sipo, ARegion *region)
 
void graph_draw_curves (bAnimContext *ac, SpaceGraph *sipo, ARegion *region, short sel)
 
Utility Drawing Defines
static float fcurve_display_alpha (FCurve *fcu)
 
Channel List
void graph_draw_channel_names (bContext *C, bAnimContext *ac, ARegion *region)
 

Function Documentation

◆ draw_fcurve()

static void draw_fcurve ( bAnimContext ac,
SpaceGraph sipo,
ARegion region,
bAnimListElem ale 
)
static

We have to do this mapping dance since the keyframes were remapped but the Fmodifier evaluations are not.

So we undo the keyframe remapping and instead remap the evaluation time when drawing the curve itself. Afterward, we go back and redo the keyframe remapping so the controls are drawn properly.

Definition at line 1004 of file graph_draw.c.

References AGRP_MUTED, ANIM_get_normalization_flags(), ANIM_nla_mapping_apply_fcurve(), ANIM_nla_mapping_get(), ANIM_unit_mapping_get_factor(), ANIMCONT_DRIVERS, FCurve::bezt, BKE_fcurve_are_keyframes_usable(), BKE_fcurve_is_protected(), FCurve::color, bAnimContext::datatype, draw_fcurve_curve(), draw_fcurve_curve_bezts(), draw_fcurve_curve_samples(), draw_fcurve_handles(), draw_fcurve_handles_check(), draw_fcurve_modifier_controls_envelope(), draw_fcurve_samples(), draw_fcurve_vertices(), FCURVE_ACTIVE, fcurve_can_use_simple_bezt_drawing(), fcurve_display_alpha(), FCURVE_INT_VALUES, FCURVE_MUTED, FCURVE_SELECTED, find_active_fmodifier(), ListBase::first, bActionGroup::flag, FCurve::flag, SpaceGraph::flag, FMODIFIER_TYPE_ENVELOPE, FCurve::fpt, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_line_smooth(), GPU_line_width(), GPU_line_width_get(), GPU_matrix_pop(), GPU_matrix_push(), GPU_matrix_scale_2f(), GPU_matrix_translate_2f(), GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), graph_draw_driver_debug(), FCurve::grp, bAnimListElem::id, immBindBuiltinProgram(), immUnbindProgram(), immUniform1f(), immUniform1i(), immUniform2f(), immUniform2fv(), immUniformColor3fvAlpha(), immUniformThemeColorShade(), immVertexFormat(), bAnimListElem::key_data, FCurve::modifiers, offset, bAnimContext::scene, SIPO_BEAUTYDRAW_OFF, SIPO_NO_DRAW_EXTRAPOLATION, SIPO_SELCUVERTSONLY, SIPO_SELVHANDLESONLY, TH_HEADER, FCurve::totvert, UI_DPI_FAC, and ARegion::v2d.

Referenced by graph_draw_curves().

◆ draw_fcurve_active_handle_vertices()

static void draw_fcurve_active_handle_vertices ( const FCurve fcu,
const bool  sel_handle_only,
const uint  pos 
)
static

◆ draw_fcurve_active_vertex()

static void draw_fcurve_active_vertex ( const FCurve fcu,
const View2D v2d,
const uint  pos 
)
static

◆ draw_fcurve_curve()

static void draw_fcurve_curve ( bAnimContext ac,
ID id,
FCurve fcu_,
View2D v2d,
uint  pos,
const bool  use_nla_remap,
const bool  draw_extrapolation 
)
static

◆ draw_fcurve_curve_bezts()

static void draw_fcurve_curve_bezts ( bAnimContext ac,
ID id,
FCurve fcu,
View2D v2d,
uint  pos,
const bool  draw_extrapolation 
)
static

◆ draw_fcurve_curve_samples()

static void draw_fcurve_curve_samples ( bAnimContext ac,
ID id,
FCurve fcu,
View2D v2d,
const uint  shdr_pos,
const bool  draw_extrapolation 
)
static

◆ draw_fcurve_handle_vertices()

static void draw_fcurve_handle_vertices ( FCurve fcu,
View2D v2d,
bool  sel_handle_only,
uint  pos 
)
static

◆ draw_fcurve_handles()

static void draw_fcurve_handles ( SpaceGraph sipo,
FCurve fcu 
)
static

◆ draw_fcurve_handles_check()

static bool draw_fcurve_handles_check ( SpaceGraph sipo,
FCurve fcu 
)
static

◆ draw_fcurve_keyframe_vertices()

static void draw_fcurve_keyframe_vertices ( FCurve fcu,
View2D v2d,
bool  edit,
uint  pos 
)
static

◆ draw_fcurve_modifier_controls_envelope()

static void draw_fcurve_modifier_controls_envelope ( FModifier fcm,
View2D v2d,
AnimData adt_nla_remap 
)
static

◆ draw_fcurve_sample_control()

static void draw_fcurve_sample_control ( float  x,
float  y,
float  xscale,
float  yscale,
float  hsize,
uint  pos 
)
static

◆ draw_fcurve_samples()

static void draw_fcurve_samples ( SpaceGraph sipo,
ARegion region,
FCurve fcu 
)
static

◆ draw_fcurve_selected_handle_vertices()

static void draw_fcurve_selected_handle_vertices ( FCurve fcu,
View2D v2d,
bool  sel,
bool  sel_handle_only,
uint  pos 
)
static

◆ draw_fcurve_selected_keyframe_vertices()

static void draw_fcurve_selected_keyframe_vertices ( FCurve fcu,
View2D v2d,
bool  edit,
bool  sel,
uint  pos 
)
static

◆ draw_fcurve_vertices()

static void draw_fcurve_vertices ( ARegion region,
FCurve fcu,
bool  do_handles,
bool  sel_handle_only 
)
static

◆ fcurve_can_use_simple_bezt_drawing()

static bool fcurve_can_use_simple_bezt_drawing ( FCurve fcu)
static

Definition at line 805 of file graph_draw.c.

References FCurve::bezt, BEZT_IPO_BEZ, BEZT_IPO_CONST, BEZT_IPO_LIN, ELEM, and BezTriple::ipo.

Referenced by draw_fcurve().

◆ fcurve_display_alpha()

static float fcurve_display_alpha ( FCurve fcu)
static

Definition at line 52 of file graph_draw.c.

References FCURVE_SELECTED, and FCurve::flag.

Referenced by draw_fcurve(), draw_fcurve_handles(), and set_fcurve_vertex_color().

◆ graph_draw_channel_names()

void graph_draw_channel_names ( struct bContext C,
struct bAnimContext ac,
struct ARegion region 
)

◆ graph_draw_curves()

void graph_draw_curves ( struct bAnimContext ac,
struct SpaceGraph sipo,
struct ARegion region,
short  sel 
)

◆ graph_draw_driver_debug()

static void graph_draw_driver_debug ( bAnimContext ac,
ID id,
FCurve fcu 
)
static

◆ graph_draw_ghost_curves()

void graph_draw_ghost_curves ( struct bAnimContext ac,
struct SpaceGraph sipo,
struct ARegion region 
)

◆ set_fcurve_vertex_color()

static void set_fcurve_vertex_color ( FCurve fcu,
bool  sel 
)
static