Blender V4.3
graph_draw.cc File Reference
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstring>
#include "BLI_math_vector_types.hh"
#include "BLI_utildefines.h"
#include "BLI_vector.hh"
#include "DNA_anim_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
#include "BKE_anim_data.hh"
#include "BKE_curve.hh"
#include "BKE_fcurve.hh"
#include "BKE_nla.hh"
#include "GPU_immediate.hh"
#include "GPU_matrix.hh"
#include "GPU_state.hh"
#include "ED_anim_api.hh"
#include "graph_intern.hh"
#include "UI_interface.hh"
#include "UI_resources.hh"
#include "UI_view2d.hh"

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_cross (float position[2], const float scale[2], uint attr_id)
 
static void draw_fcurve_selected_keyframe_vertices (FCurve *fcu, bool sel, uint pos, const blender::IndexRange index_range)
 
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, const 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 (const SpaceGraph *sipo, const FCurve *fcu)
 
static void draw_fcurve_handles (SpaceGraph *sipo, ARegion *region, const FCurve *fcu)
 
static void draw_fcurve_samples (ARegion *region, const FCurve *fcu, const float unit_scale)
 
static void draw_fcurve_curve (bAnimContext *ac, ID *id, const 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 int calculate_bezt_draw_resolution (BezTriple *bezt, BezTriple *prevbezt, const blender::float2 pixels_per_unit)
 
static void add_bezt_vertices (BezTriple *bezt, BezTriple *prevbezt, int resolution, blender::Vector< blender::float2 > &curve_vertices)
 
static void add_extrapolation_point_left (const FCurve *fcu, const float v2d_xmin, blender::Vector< blender::float2 > &curve_vertices)
 
static void add_extrapolation_point_right (const FCurve *fcu, const float v2d_xmax, blender::Vector< blender::float2 > &curve_vertices)
 
static blender::float2 calculate_pixels_per_unit (View2D *v2d, const float unit_scale)
 
static float calculate_pixel_distance (const rctf &bounds, const blender::float2 pixels_per_unit)
 
static void expand_key_bounds (const BezTriple *left_key, const BezTriple *right_key, rctf &bounds)
 
static void draw_fcurve_curve_keys (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 (const FCurve *fcu)
 
static blender::IndexRange get_bounding_bezt_index_range (const FCurve *fcu, const float min, const float max)
 
Channel List
void graph_draw_channel_names (bContext *C, bAnimContext *ac, ARegion *region, const ListBase &anim_data)
 

Function Documentation

◆ add_bezt_vertices()

static void add_bezt_vertices ( BezTriple * bezt,
BezTriple * prevbezt,
int resolution,
blender::Vector< blender::float2 > & curve_vertices )
static

Add points on the bezier between prevbezt and bezt to curve_vertices. The amount of points added is based on the given resolution.

Definition at line 851 of file graph_draw.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), BKE_curve_forward_diff_bezier(), BKE_fcurve_correct_bezpart(), MEM_freeN(), MEM_mallocN, min_ii(), BezTriple::vec, and x.

Referenced by draw_fcurve_curve_keys().

◆ add_extrapolation_point_left()

static void add_extrapolation_point_left ( const FCurve * fcu,
const float v2d_xmin,
blender::Vector< blender::float2 > & curve_vertices )
static

◆ add_extrapolation_point_right()

◆ calculate_bezt_draw_resolution()

static int calculate_bezt_draw_resolution ( BezTriple * bezt,
BezTriple * prevbezt,
const blender::float2 pixels_per_unit )
static

Definition at line 826 of file graph_draw.cc.

References int, max_ffff(), min_ffff(), and BezTriple::vec.

Referenced by draw_fcurve_curve_keys().

◆ calculate_pixel_distance()

static float calculate_pixel_distance ( const rctf & bounds,
const blender::float2 pixels_per_unit )
static

Definition at line 991 of file graph_draw.cc.

References BLI_rctf_size_x(), BLI_rctf_size_y(), and bounds().

Referenced by draw_fcurve_curve_keys().

◆ calculate_pixels_per_unit()

static blender::float2 calculate_pixels_per_unit ( View2D * v2d,
const float unit_scale )
static

◆ draw_cross()

static void draw_cross ( float position[2],
const float scale[2],
uint attr_id )
static

◆ draw_fcurve()

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

Definition at line 1142 of file graph_draw.cc.

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_keys(), 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_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_3D_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, bAnimContext::scene, SIPO_NO_DRAW_EXTRAPOLATION, SIPO_SELVHANDLESONLY, bAnimContext::sl, TH_HEADER, FCurve::totvert, FModifier::type, UI_SCALE_FAC, USER_ANIM_HIGH_QUALITY_DRAWING, and USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS.

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

◆ draw_fcurve_curve_keys()

◆ draw_fcurve_curve_samples()

◆ draw_fcurve_handle_vertices()

◆ draw_fcurve_handles()

◆ draw_fcurve_handles_check()

static bool draw_fcurve_handles_check ( const SpaceGraph * sipo,
const FCurve * fcu )
static

◆ draw_fcurve_keyframe_vertices()

◆ draw_fcurve_modifier_controls_envelope()

◆ draw_fcurve_samples()

◆ draw_fcurve_selected_handle_vertices()

◆ draw_fcurve_selected_keyframe_vertices()

static void draw_fcurve_selected_keyframe_vertices ( FCurve * fcu,
bool sel,
uint pos,
const blender::IndexRange index_range )
static

◆ draw_fcurve_vertices()

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

◆ expand_key_bounds()

static void expand_key_bounds ( const BezTriple * left_key,
const BezTriple * right_key,
rctf & bounds )
static

◆ fcurve_display_alpha()

static float fcurve_display_alpha ( const FCurve * fcu)
static

Definition at line 50 of file graph_draw.cc.

References FCURVE_SELECTED, and FCurve::flag.

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

◆ get_bounding_bezt_index_range()

static blender::IndexRange get_bounding_bezt_index_range ( const FCurve * fcu,
const float min,
const float max )
static

Get the first and last index to the bezt array that are just outside min and max.

Definition at line 56 of file graph_draw.cc.

References FCurve::bezt, BKE_fcurve_bezt_binarysearch_index(), clamp_i(), min, and FCurve::totvert.

Referenced by draw_fcurve_curve_keys(), draw_fcurve_handles(), draw_fcurve_keyframe_vertices(), and draw_fcurve_selected_handle_vertices().

◆ graph_draw_channel_names()

◆ graph_draw_curves()

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

◆ graph_draw_driver_debug()

◆ graph_draw_ghost_curves()

◆ set_fcurve_vertex_color()