Blender
V3.3
|
#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.
|
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().
|
static |
Draw the extra handles for the active point.
Definition at line 296 of file graph_draw.c.
References FCurve::bezt, BEZT_IPO_BEZ, BEZT_ISSEL_ANY, BKE_fcurve_active_keyframe_index(), BezTriple::f1, BezTriple::f3, FCURVE_ACTIVE, FCURVE_ACTIVE_KEYFRAME_NONE, FCurve::flag, GPU_PRIM_POINTS, immBeginAtMost(), immEnd(), immUniform4fv(), immUniformColor3fvAlpha(), immVertex2fv(), BezTriple::ipo, pos, SELECT, TH_VERTEX_ACTIVE, UI_GetThemeColor4fv(), and BezTriple::vec.
Referenced by draw_fcurve_handle_vertices().
|
static |
Draw the extra indicator for the active point.
Definition at line 210 of file graph_draw.c.
References FCurve::bezt, BKE_fcurve_active_keyframe_index(), BLI_rctf_size_x(), View2D::cur, BezTriple::f2, FCURVE_ACTIVE, FCURVE_ACTIVE_KEYFRAME_NONE, FCurve::flag, GPU_PRIM_POINTS, immBegin(), immEnd(), immUniformThemeColor(), immVertex2fv(), IN_RANGE, pos, SELECT, TH_VERTEX_ACTIVE, BezTriple::vec, rctf::xmax, and rctf::xmin.
Referenced by draw_fcurve_keyframe_vertices().
|
static |
Definition at line 563 of file graph_draw.c.
References ANIM_get_normalization_flags(), ANIM_unit_mapping_get_factor(), BKE_animdata_from_id(), BKE_fcurve_calc_range(), BKE_nla_tweakedit_remap(), View2D::cur, FCurve::driver, evaluate_fcurve(), SpaceGraph::flag, GPU_PRIM_LINE_STRIP, immBegin(), immEnd(), immVertex2f(), max_ff(), min_ff(), NLATIME_CONVERT_MAP, NLATIME_CONVERT_UNMAP, NULL, offset, pos, bAnimContext::scene, SIPO_BEAUTYDRAW_OFF, bAnimContext::sl, SWAP, UI_view2d_scale_get_x(), rctf::xmax, and rctf::xmin.
Referenced by draw_fcurve().
|
static |
Definition at line 820 of file graph_draw.c.
References ANIM_get_normalization_flags(), ANIM_unit_mapping_get_factor(), usdtokens::b(), FCurve::bezt, BEZT_IPO_BEZ, BEZT_IPO_CONST, BEZT_IPO_LIN, BKE_curve_forward_diff_bezier(), BKE_fcurve_correct_bezpart(), View2D::cur, data, FCurve::driver, FCurve::extend, FCURVE_EXTRAPOLATE_CONSTANT, FCURVE_INT_VALUES, FCurve::flag, GPU_matrix_pop(), GPU_matrix_push(), GPU_matrix_scale_2f(), GPU_matrix_translate_2f(), GPU_PRIM_LINE_STRIP, immBeginAtMost(), immEnd(), immVertex2fv(), BezTriple::ipo, len_v2v2(), offset, pos, bAnimContext::scene, FCurve::totvert, v1, v2, BezTriple::vec, rctf::xmax, and rctf::xmin.
Referenced by draw_fcurve().
|
static |
Definition at line 703 of file graph_draw.c.
References ANIM_get_normalization_flags(), ANIM_unit_mapping_get_factor(), usdtokens::b(), count, View2D::cur, FCurve::extend, FCURVE_EXTRAPOLATE_CONSTANT, FCURVE_INT_VALUES, FCurve::flag, FCurve::fpt, GPU_matrix_pop(), GPU_matrix_push(), GPU_matrix_scale_2f(), GPU_matrix_translate_2f(), GPU_PRIM_LINE_STRIP, if(), immBegin(), immEnd(), immVertex2fv(), offset, bAnimContext::scene, FCurve::totvert, v, FPoint::vec, rctf::xmax, and rctf::xmin.
Referenced by draw_fcurve(), and graph_draw_ghost_curves().
|
static |
Definition at line 329 of file graph_draw.c.
References draw_fcurve_active_handle_vertices(), draw_fcurve_selected_handle_vertices(), GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA, immBindBuiltinProgram(), immUnbindProgram(), immUniform1f(), pos, TH_HANDLE_VERTEX_SIZE, and UI_GetThemeValuef().
Referenced by draw_fcurve_vertices().
|
static |
Definition at line 403 of file graph_draw.c.
References usdtokens::b(), FCurve::bezt, BEZT_IPO_BEZ, BEZT_ISSEL_ANY, col, color, BezTriple::f1, BezTriple::f2, BezTriple::f3, fcurve_display_alpha(), SpaceGraph::flag, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_COMP_U8, GPU_FETCH_FLOAT, GPU_FETCH_INT_TO_FLOAT_UNIT, GPU_line_smooth(), GPU_PRIM_LINES, GPU_SHADER_2D_FLAT_COLOR, GPU_vertformat_attr_add(), BezTriple::h1, BezTriple::h2, immAttr4ubv(), immBeginAtMost(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immVertex2fv(), immVertexFormat(), BezTriple::ipo, NULL, pos, SELECT, SIPO_BEAUTYDRAW_OFF, SIPO_SELVHANDLESONLY, TH_HANDLE_FREE, TH_HANDLE_SEL_FREE, FCurve::totvert, UI_GetThemeColor3ubv(), and BezTriple::vec.
Referenced by draw_fcurve().
|
static |
Definition at line 379 of file graph_draw.c.
References AGRP_PROTECTED, FCURVE_INT_VALUES, FCURVE_PROTECTED, bActionGroup::flag, FCurve::flag, SpaceGraph::flag, FCurve::grp, SIPO_NOHANDLES, and FCurve::totvert.
Referenced by draw_fcurve().
|
static |
Definition at line 234 of file graph_draw.c.
References draw_fcurve_active_vertex(), draw_fcurve_selected_keyframe_vertices(), GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA, immBindBuiltinProgram(), immUnbindProgram(), immUniform1f(), pos, TH_VERTEX_SIZE, and UI_GetThemeValuef().
Referenced by draw_fcurve_vertices().
|
static |
adt_nla_remap | Send NULL if no NLA remapping necessary. |
Definition at line 69 of file graph_draw.c.
References BKE_nla_tweakedit_remap(), BLI_rctf_size_x(), View2D::cur, FModifier::data, FMod_Envelope::data, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_line_width(), GPU_point_size(), GPU_PRIM_LINES, GPU_PRIM_POINTS, GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR, GPU_SHADER_2D_UNIFORM_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), immBegin(), immBeginAtMost(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniform1f(), immUniform1i(), immUniform2f(), immUniformColor3f(), immVertex2f(), immVertexFormat(), IN_RANGE, FMod_Envelope::max, FMod_Envelope::midval, FMod_Envelope::min, NLATIME_CONVERT_MAP, FMod_Envelope::totvert, UI_DPI_FAC, rctf::xmax, and rctf::xmin.
Referenced by draw_fcurve().
|
static |
Definition at line 499 of file graph_draw.c.
References GPU_matrix_pop(), GPU_matrix_push(), GPU_matrix_scale_2f(), GPU_matrix_translate_2f(), GPU_PRIM_LINES, immBegin(), immEnd(), immVertex2f(), pos, x, and y.
Referenced by draw_fcurve_samples().
|
static |
Definition at line 521 of file graph_draw.c.
References draw_fcurve_sample_control(), FCURVE_SELECTED, FCurve::flag, SpaceGraph::flag, FCurve::fpt, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_line_smooth(), GPU_SHADER_2D_UNIFORM_COLOR, GPU_vertformat_attr_add(), immBindBuiltinProgram(), immUnbindProgram(), immUniformThemeColor(), immVertexFormat(), NULL, pos, SIPO_BEAUTYDRAW_OFF, TH_TEXT, TH_TEXT_HI, TH_VERTEX_SIZE, FCurve::totvert, UI_GetThemeValuef(), UI_view2d_scale_get(), ARegion::v2d, and FPoint::vec.
Referenced by draw_fcurve().
|
static |
Definition at line 248 of file graph_draw.c.
References FCurve::bezt, BEZT_IPO_BEZ, BEZT_ISSEL_ANY, BezTriple::f1, BezTriple::f3, GPU_PRIM_POINTS, immBeginAtMost(), immEnd(), immUniform4f(), immUniformColor3fvAlpha(), immVertex2fv(), BezTriple::ipo, NULL, pos, SELECT, TH_HANDLE_VERTEX, TH_HANDLE_VERTEX_SELECT, FCurve::totvert, UI_GetThemeColor3fv(), BezTriple::vec, and void.
Referenced by draw_fcurve_handle_vertices().
|
static |
Definition at line 171 of file graph_draw.c.
References FCurve::bezt, BLI_rctf_size_x(), View2D::cur, BezTriple::f2, GPU_PRIM_POINTS, immBeginAtMost(), immEnd(), immVertex2fv(), IN_RANGE, pos, SELECT, set_fcurve_vertex_color(), FCurve::totvert, BezTriple::vec, rctf::xmax, and rctf::xmin.
Referenced by draw_fcurve_keyframe_vertices().
|
static |
Definition at line 345 of file graph_draw.c.
References draw_fcurve_handle_vertices(), draw_fcurve_keyframe_vertices(), FCURVE_PROTECTED, FCurve::flag, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_program_point_size(), GPU_vertformat_attr_add(), immVertexFormat(), pos, and ARegion::v2d.
Referenced by draw_fcurve().
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().
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().
void graph_draw_channel_names | ( | struct bContext * | C, |
struct bAnimContext * | ac, | ||
struct ARegion * | region | ||
) |
Left hand part.
Definition at line 1385 of file graph_draw.c.
References ACHANNEL_FIRST_TOP, ACHANNEL_HEIGHT, ACHANNEL_STEP, ACHANNEL_TOT_HEIGHT, ANIM_animdata_filter(), ANIM_animdata_freelist(), ANIM_channel_draw(), ANIM_channel_draw_widgets(), ANIMFILTER_DATA_VISIBLE, ANIMFILTER_FCURVESONLY, ANIMFILTER_LIST_CHANNELS, ANIMFILTER_LIST_VISIBLE, BLI_rctf_init(), C, View2D::cur, bAnimContext::data, bAnimContext::datatype, filter(), ListBase::first, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, height, IN_RANGE, bAnimListElem::next, NULL, View2D::tot, UI_block_begin(), UI_block_draw(), UI_block_end(), UI_EMBOSS, ARegion::v2d, V2D_SCROLL_WIDTH, rctf::xmax, rctf::ymax, and rctf::ymin.
Referenced by graph_channel_region_draw().
void graph_draw_curves | ( | struct bAnimContext * | ac, |
struct SpaceGraph * | sipo, | ||
struct ARegion * | region, | ||
short | sel | ||
) |
This is called twice from space_graph.c -> graph_main_region_draw() Unselected then selected F-Curves are drawn so that they do not occlude each other.
Definition at line 1344 of file graph_draw.c.
References ANIM_animdata_filter(), ANIM_animdata_freelist(), ANIMFILTER_CURVE_VISIBLE, ANIMFILTER_DATA_VISIBLE, ANIMFILTER_FCURVESONLY, ANIMFILTER_SEL, ANIMFILTER_UNSEL, bAnimContext::data, bAnimContext::datatype, draw_fcurve(), FCURVE_ACTIVE, filter(), ListBase::first, FCurve::flag, if(), bAnimListElem::key_data, bAnimListElem::next, and NULL.
Referenced by graph_main_region_draw().
|
static |
Definition at line 1183 of file graph_draw.c.
References ANIM_get_normalization_flags(), ANIM_unit_mapping_get_factor(), BLI_listbase_is_empty(), FCurve::color, View2D::cur, ChannelDriver::curval, FCurve::curval, FCurve::driver, DRIVER_FLAG_INVALID, ChannelDriver::flag, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_line_width(), GPU_point_size(), GPU_PRIM_LINES, GPU_PRIM_POINTS, GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR, GPU_SHADER_2D_UNIFORM_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniform1f(), immUniform1i(), immUniform2f(), immUniformColor3f(), immUniformColor3fv(), immVertex2f(), immVertex2fv(), immVertexFormat(), FCurve::modifiers, offset, bAnimContext::region, bAnimContext::scene, t, FCurve::totvert, UI_DPI_FAC, ARegion::v2d, x, rctf::xmax, rctf::xmin, y, and rctf::ymax.
Referenced by draw_fcurve().
void graph_draw_ghost_curves | ( | struct bAnimContext * | ac, |
struct SpaceGraph * | sipo, | ||
struct ARegion * | region | ||
) |
Draw the 'ghost' F-Curves (i.e. snapshots of the curve)
Definition at line 1297 of file graph_draw.c.
References FCurve::color, draw_fcurve_curve_samples(), ListBase::first, SpaceGraph::flag, SpaceGraph_Runtime::ghost_curves, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_line_smooth(), GPU_line_width(), GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), immBindBuiltinProgram(), immUnbindProgram(), immUniform1f(), immUniform1i(), immUniform2f(), immUniformColor3fvAlpha(), immVertexFormat(), FCurve::next, NULL, SpaceGraph::runtime, SIPO_BEAUTYDRAW_OFF, SIPO_NO_DRAW_EXTRAPOLATION, UI_DPI_FAC, and ARegion::v2d.
Referenced by graph_main_region_draw().
Definition at line 145 of file graph_draw.c.
References CLAMP, color, KDL::diff(), fcurve_display_alpha(), FCURVE_PROTECTED, FCurve::flag, immUniformColor4fv(), TH_TEXT, TH_TEXT_HI, TH_VERTEX, TH_VERTEX_SELECT, and UI_GetThemeColor3fv().
Referenced by draw_fcurve_selected_keyframe_vertices().