Compare commits
29 Commits
outliner-c
...
active-fcu
Author | SHA1 | Date | |
---|---|---|---|
baca8611e5 | |||
31705201dd | |||
ea4c327c97 | |||
e18fdef39f | |||
1fbd713265 | |||
736636ca49 | |||
ff155a6677 | |||
d2a07a0bbf | |||
b890b97b67 | |||
ce170bdd4c | |||
fc1fee9916 | |||
9d9efbb2f8 | |||
21d542d068 | |||
aa5ad440a3 | |||
3fe313b954 | |||
2a7b44e33d | |||
598cac0ce6 | |||
1fc49878f5 | |||
30a4fbf57b | |||
b49bcbe68e | |||
7ac3dc69a8 | |||
81bdaefbd7 | |||
ba1efe851e | |||
dc68db427a | |||
03a8e74405 | |||
c452c66b70 | |||
d4ddba4b59 | |||
83c9b99e76 | |||
09d9ef45c6 |
@@ -438,6 +438,7 @@ const bTheme U_theme_default = {
|
||||
.group_active = RGBA(0x368024ff),
|
||||
.vertex = RGBA(0x000000ff),
|
||||
.vertex_select = RGBA(0xff8500ff),
|
||||
.vertex_active = RGBA(0xffffffff),
|
||||
.cframe = RGBA(0x5680c2ff),
|
||||
.time_scrub_background = RGBA(0x292929e6),
|
||||
.time_marker_line = RGBA(0x00000060),
|
||||
|
@@ -233,6 +233,8 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
|
||||
* the outliner's, and it's less disruptive to just copy them. */
|
||||
copy_v4_v4_uchar(btheme->space_file.back, btheme->space_outliner.back);
|
||||
copy_v4_v4_uchar(btheme->space_file.row_alternate, btheme->space_outliner.row_alternate);
|
||||
|
||||
FROM_DEFAULT_V4_UCHAR(space_graph.vertex_active);
|
||||
}
|
||||
|
||||
#undef FROM_DEFAULT_V4_UCHAR
|
||||
|
@@ -125,6 +125,9 @@ bool delete_fcurve_keys(FCurve *fcu)
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure the active keyframe index isn't too large. */
|
||||
CLAMP_MAX(fcu->active_key, fcu->totvert - 1);
|
||||
|
||||
/* Free the array of BezTriples if there are not keyframes */
|
||||
if (fcu->totvert == 0) {
|
||||
clear_fcurve_keys(fcu);
|
||||
|
@@ -555,6 +555,9 @@ int insert_vert_fcurve(
|
||||
/* add temp beztriple to keyframes */
|
||||
a = insert_bezt_fcurve(fcu, &beztr, flag);
|
||||
|
||||
/* Set the FCurve's active keyframe to this index. */
|
||||
fcu->active_key = a;
|
||||
|
||||
/* what if 'a' is a negative index?
|
||||
* for now, just exit to prevent any segfaults
|
||||
*/
|
||||
|
@@ -92,6 +92,7 @@ typedef enum ThemeColorID {
|
||||
TH_TRANSFORM,
|
||||
TH_VERTEX,
|
||||
TH_VERTEX_SELECT,
|
||||
TH_VERTEX_ACTIVE,
|
||||
TH_VERTEX_UNREFERENCED,
|
||||
TH_VERTEX_SIZE,
|
||||
TH_OUTLINE_WIDTH,
|
||||
|
@@ -362,6 +362,9 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
|
||||
case TH_VERTEX_SELECT:
|
||||
cp = ts->vertex_select;
|
||||
break;
|
||||
case TH_VERTEX_ACTIVE:
|
||||
cp = ts->vertex_active;
|
||||
break;
|
||||
case TH_VERTEX_BEVEL:
|
||||
cp = ts->vertex_bevel;
|
||||
break;
|
||||
|
@@ -235,38 +235,30 @@ static void graph_panel_properties(const bContext *C, Panel *panel)
|
||||
/* ******************* active Keyframe ************** */
|
||||
|
||||
/* get 'active' keyframe for panel editing */
|
||||
static short get_active_fcurve_keyframe_edit(FCurve *fcu, BezTriple **bezt, BezTriple **prevbezt)
|
||||
static bool get_active_fcurve_keyframe_edit(const FCurve *fcu,
|
||||
BezTriple **r_bezt,
|
||||
BezTriple **r_prevbezt)
|
||||
{
|
||||
BezTriple *b;
|
||||
int i;
|
||||
|
||||
/* zero the pointers */
|
||||
*bezt = *prevbezt = NULL;
|
||||
*r_bezt = *r_prevbezt = NULL;
|
||||
|
||||
int active_key = fcu->active_key;
|
||||
|
||||
/* sanity checks */
|
||||
if ((fcu->bezt == NULL) || (fcu->totvert == 0)) {
|
||||
return 0;
|
||||
if ((fcu->bezt == NULL) || (fcu->totvert == 0) || (active_key > fcu->totvert) ||
|
||||
(active_key < 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* find first selected keyframe for now, and call it the active one
|
||||
* - this is a reasonable assumption, given that whenever anyone
|
||||
* wants to edit numerically, there is likely to only be 1 vert selected
|
||||
*/
|
||||
for (i = 0, b = fcu->bezt; i < fcu->totvert; i++, b++) {
|
||||
if (BEZT_ISSEL_ANY(b)) {
|
||||
/* found
|
||||
* - 'previous' is either the one before, of the keyframe itself (which is still fine)
|
||||
* XXX: we can just make this null instead if needed
|
||||
*/
|
||||
*prevbezt = (i > 0) ? b - 1 : b;
|
||||
*bezt = b;
|
||||
|
||||
return 1;
|
||||
}
|
||||
if (BEZT_ISSEL_ANY(&fcu->bezt[active_key])) {
|
||||
*r_bezt = &fcu->bezt[active_key];
|
||||
/* Previous is either one before the active, or the point itself if it's the first. */
|
||||
*r_prevbezt = &fcu->bezt[(active_key > 0) ? active_key - 1 : active_key];
|
||||
return true;
|
||||
}
|
||||
|
||||
/* not found */
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* update callback for active keyframe properties - base updates stuff */
|
||||
|
@@ -51,6 +51,8 @@
|
||||
#include "UI_resources.h"
|
||||
#include "UI_view2d.h"
|
||||
|
||||
static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu);
|
||||
|
||||
/* *************************** */
|
||||
/* Utility Drawing Defines */
|
||||
|
||||
@@ -199,6 +201,22 @@ static void draw_fcurve_selected_keyframe_vertices(
|
||||
immEnd();
|
||||
}
|
||||
|
||||
static void draw_fcurve_active_vertex(FCurve *fcu, View2D *v2d, bool edit, uint pos)
|
||||
{
|
||||
if (edit && fcu->flag & FCURVE_ACTIVE) {
|
||||
const float fac = 0.05f * BLI_rctf_size_x(&v2d->cur);
|
||||
BezTriple *bezt = &fcu->bezt[fcu->active_key];
|
||||
if (IN_RANGE(bezt->vec[1][0], (v2d->cur.xmin - fac), (v2d->cur.xmax + fac))) {
|
||||
if (bezt->f2 & SELECT) {
|
||||
immBegin(GPU_PRIM_POINTS, 1);
|
||||
immUniformThemeColor(TH_VERTEX_ACTIVE);
|
||||
immVertex2fv(pos, bezt->vec[1]);
|
||||
immEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* helper func - draw keyframe vertices only for an F-Curve */
|
||||
static void draw_fcurve_keyframe_vertices(FCurve *fcu, View2D *v2d, bool edit, uint pos)
|
||||
{
|
||||
@@ -208,6 +226,7 @@ static void draw_fcurve_keyframe_vertices(FCurve *fcu, View2D *v2d, bool edit, u
|
||||
|
||||
draw_fcurve_selected_keyframe_vertices(fcu, v2d, edit, false, pos);
|
||||
draw_fcurve_selected_keyframe_vertices(fcu, v2d, edit, true, pos);
|
||||
draw_fcurve_active_vertex(fcu, v2d, edit, pos);
|
||||
|
||||
immUnbindProgram();
|
||||
}
|
||||
@@ -258,6 +277,29 @@ static void draw_fcurve_selected_handle_vertices(
|
||||
immEnd();
|
||||
}
|
||||
|
||||
static void draw_fcurve_active_handle_vertices(FCurve *fcu, bool sel_handle_only, uint pos)
|
||||
{
|
||||
/* Draw the extra handles for active points. */
|
||||
if (fcu->flag & FCURVE_ACTIVE) {
|
||||
BezTriple *bezt = &fcu->bezt[fcu->active_key];
|
||||
if (!sel_handle_only || BEZT_ISSEL_ANY(bezt)) {
|
||||
float active_col[4];
|
||||
UI_GetThemeColor4fv(TH_VERTEX_ACTIVE, active_col);
|
||||
immUniform4fv("outlineColor", active_col);
|
||||
immUniformColor3fvAlpha(active_col, 0.01f); /* almost invisible - only keep for smoothness */
|
||||
immBeginAtMost(GPU_PRIM_POINTS, 2);
|
||||
|
||||
if ((bezt->f1 & SELECT)) {
|
||||
immVertex2fv(pos, bezt->vec[0]);
|
||||
}
|
||||
if ((bezt->f3 & SELECT)) {
|
||||
immVertex2fv(pos, bezt->vec[2]);
|
||||
}
|
||||
immEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* helper func - draw handle vertices only for an F-Curve (if it is not protected) */
|
||||
static void draw_fcurve_handle_vertices(FCurve *fcu, View2D *v2d, bool sel_handle_only, uint pos)
|
||||
{
|
||||
@@ -270,6 +312,7 @@ static void draw_fcurve_handle_vertices(FCurve *fcu, View2D *v2d, bool sel_handl
|
||||
|
||||
draw_fcurve_selected_handle_vertices(fcu, v2d, false, sel_handle_only, pos);
|
||||
draw_fcurve_selected_handle_vertices(fcu, v2d, true, sel_handle_only, pos);
|
||||
draw_fcurve_active_handle_vertices(fcu, sel_handle_only, pos);
|
||||
|
||||
immUnbindProgram();
|
||||
}
|
||||
@@ -868,6 +911,164 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
|
||||
GPU_matrix_pop();
|
||||
}
|
||||
|
||||
static void draw_fcurve(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAnimListElem *ale)
|
||||
{
|
||||
FCurve *fcu = (FCurve *)ale->key_data;
|
||||
FModifier *fcm = find_active_fmodifier(&fcu->modifiers);
|
||||
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
|
||||
|
||||
/* map keyframes for drawing if scaled F-Curve */
|
||||
if (adt) {
|
||||
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
|
||||
}
|
||||
|
||||
/* draw curve:
|
||||
* - curve line may be result of one or more destructive modifiers or just the raw data,
|
||||
* so we need to check which method should be used
|
||||
* - controls from active modifier take precedence over keyframes
|
||||
* (XXX! editing tools need to take this into account!)
|
||||
*/
|
||||
|
||||
/* 1) draw curve line */
|
||||
if (((fcu->modifiers.first) || (fcu->flag & FCURVE_INT_VALUES)) ||
|
||||
(((fcu->bezt) || (fcu->fpt)) && (fcu->totvert))) {
|
||||
/* set color/drawing style for curve itself */
|
||||
/* draw active F-Curve thicker than the rest to make it stand out */
|
||||
if (fcu->flag & FCURVE_ACTIVE) {
|
||||
GPU_line_width(2.5);
|
||||
}
|
||||
else {
|
||||
GPU_line_width(1.0);
|
||||
}
|
||||
|
||||
/* anti-aliased lines for less jagged appearance */
|
||||
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
|
||||
GPU_line_smooth(true);
|
||||
}
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
|
||||
const uint shdr_pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
|
||||
|
||||
float viewport_size[4];
|
||||
GPU_viewport_size_get_f(viewport_size);
|
||||
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
|
||||
|
||||
immUniform1i("colors_len", 0); /* Simple dashes. */
|
||||
|
||||
if (BKE_fcurve_is_protected(fcu)) {
|
||||
/* protected curves (non editable) are drawn with dotted lines */
|
||||
immUniform1f("dash_width", 4.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
}
|
||||
else {
|
||||
immUniform1f("dash_factor", 2.0f); /* solid line */
|
||||
}
|
||||
|
||||
if (((fcu->grp) && (fcu->grp->flag & AGRP_MUTED)) || (fcu->flag & FCURVE_MUTED)) {
|
||||
/* muted curves are drawn in a grayish hue */
|
||||
/* XXX should we have some variations? */
|
||||
immUniformThemeColorShade(TH_HEADER, 50);
|
||||
}
|
||||
else {
|
||||
/* set whatever color the curve has set
|
||||
* - unselected curves draw less opaque to help distinguish the selected ones
|
||||
*/
|
||||
immUniformColor3fvAlpha(fcu->color, fcurve_display_alpha(fcu));
|
||||
}
|
||||
|
||||
/* draw F-Curve */
|
||||
if ((fcu->modifiers.first) || (fcu->flag & FCURVE_INT_VALUES)) {
|
||||
/* draw a curve affected by modifiers or only allowed to have integer values
|
||||
* by sampling it at various small-intervals over the visible region
|
||||
*/
|
||||
draw_fcurve_curve(ac, ale->id, fcu, ®ion->v2d, shdr_pos);
|
||||
}
|
||||
else if (((fcu->bezt) || (fcu->fpt)) && (fcu->totvert)) {
|
||||
/* just draw curve based on defined data (i.e. no modifiers) */
|
||||
if (fcu->bezt) {
|
||||
if (fcurve_can_use_simple_bezt_drawing(fcu)) {
|
||||
draw_fcurve_curve_bezts(ac, ale->id, fcu, ®ion->v2d, shdr_pos);
|
||||
}
|
||||
else {
|
||||
draw_fcurve_curve(ac, ale->id, fcu, ®ion->v2d, shdr_pos);
|
||||
}
|
||||
}
|
||||
else if (fcu->fpt) {
|
||||
draw_fcurve_curve_samples(ac, ale->id, fcu, ®ion->v2d, shdr_pos);
|
||||
}
|
||||
}
|
||||
|
||||
immUnbindProgram();
|
||||
|
||||
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
|
||||
GPU_line_smooth(false);
|
||||
}
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
}
|
||||
|
||||
/* 2) draw handles and vertices as appropriate based on active
|
||||
* - If the option to only show controls if the F-Curve is selected is enabled,
|
||||
* we must obey this.
|
||||
*/
|
||||
if (!(sipo->flag & SIPO_SELCUVERTSONLY) || (fcu->flag & FCURVE_SELECTED)) {
|
||||
if (!BKE_fcurve_are_keyframes_usable(fcu) && !(fcu->fpt && fcu->totvert)) {
|
||||
/* only draw controls if this is the active modifier */
|
||||
if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) {
|
||||
switch (fcm->type) {
|
||||
case FMODIFIER_TYPE_ENVELOPE: /* envelope */
|
||||
draw_fcurve_modifier_controls_envelope(fcm, ®ion->v2d);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (((fcu->bezt) || (fcu->fpt)) && (fcu->totvert)) {
|
||||
short mapping_flag = ANIM_get_normalization_flags(ac);
|
||||
float offset;
|
||||
float unit_scale = ANIM_unit_mapping_get_factor(
|
||||
ac->scene, ale->id, fcu, mapping_flag, &offset);
|
||||
|
||||
/* apply unit-scaling to all values via OpenGL */
|
||||
GPU_matrix_push();
|
||||
GPU_matrix_scale_2f(1.0f, unit_scale);
|
||||
GPU_matrix_translate_2f(0.0f, offset);
|
||||
|
||||
/* Set this once and for all -
|
||||
* all handles and handle-verts should use the same thickness. */
|
||||
GPU_line_width(1.0);
|
||||
|
||||
if (fcu->bezt) {
|
||||
bool do_handles = draw_fcurve_handles_check(sipo, fcu);
|
||||
|
||||
if (do_handles) {
|
||||
/* only draw handles/vertices on keyframes */
|
||||
draw_fcurve_handles(sipo, fcu);
|
||||
}
|
||||
|
||||
draw_fcurve_vertices(region, fcu, do_handles, (sipo->flag & SIPO_SELVHANDLESONLY));
|
||||
}
|
||||
else {
|
||||
/* samples: only draw two indicators at either end as indicators */
|
||||
draw_fcurve_samples(sipo, region, fcu);
|
||||
}
|
||||
|
||||
GPU_matrix_pop();
|
||||
}
|
||||
}
|
||||
|
||||
/* 3) draw driver debugging stuff */
|
||||
if ((ac->datatype == ANIMCONT_DRIVERS) && (fcu->flag & FCURVE_ACTIVE)) {
|
||||
graph_draw_driver_debug(ac, ale->id, fcu);
|
||||
}
|
||||
|
||||
/* undo mapping of keyframes for drawing if scaled F-Curve */
|
||||
if (adt) {
|
||||
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Debugging -------------------------------- */
|
||||
|
||||
/* Draw indicators which show the value calculated from the driver,
|
||||
@@ -1055,161 +1256,20 @@ void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, shor
|
||||
* draw curve, then handle-lines, and finally vertices in this order so that
|
||||
* the data will be layered correctly
|
||||
*/
|
||||
bAnimListElem *ale_active_fcurve = NULL;
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
FCurve *fcu = (FCurve *)ale->key_data;
|
||||
FModifier *fcm = find_active_fmodifier(&fcu->modifiers);
|
||||
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
|
||||
|
||||
/* map keyframes for drawing if scaled F-Curve */
|
||||
if (adt) {
|
||||
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
|
||||
if (fcu->flag & FCURVE_ACTIVE) {
|
||||
ale_active_fcurve = ale;
|
||||
continue;
|
||||
}
|
||||
draw_fcurve(ac, sipo, region, ale);
|
||||
}
|
||||
|
||||
/* draw curve:
|
||||
* - curve line may be result of one or more destructive modifiers or just the raw data,
|
||||
* so we need to check which method should be used
|
||||
* - controls from active modifier take precedence over keyframes
|
||||
* (XXX! editing tools need to take this into account!)
|
||||
*/
|
||||
|
||||
/* 1) draw curve line */
|
||||
if (((fcu->modifiers.first) || (fcu->flag & FCURVE_INT_VALUES)) ||
|
||||
(((fcu->bezt) || (fcu->fpt)) && (fcu->totvert))) {
|
||||
/* set color/drawing style for curve itself */
|
||||
/* draw active F-Curve thicker than the rest to make it stand out */
|
||||
if (fcu->flag & FCURVE_ACTIVE) {
|
||||
GPU_line_width(2.5);
|
||||
}
|
||||
else {
|
||||
GPU_line_width(1.0);
|
||||
}
|
||||
|
||||
/* anti-aliased lines for less jagged appearance */
|
||||
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
|
||||
GPU_line_smooth(true);
|
||||
}
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
|
||||
const uint shdr_pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
|
||||
|
||||
float viewport_size[4];
|
||||
GPU_viewport_size_get_f(viewport_size);
|
||||
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
|
||||
|
||||
immUniform1i("colors_len", 0); /* Simple dashes. */
|
||||
|
||||
if (BKE_fcurve_is_protected(fcu)) {
|
||||
/* protected curves (non editable) are drawn with dotted lines */
|
||||
immUniform1f("dash_width", 4.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
}
|
||||
else {
|
||||
immUniform1f("dash_factor", 2.0f); /* solid line */
|
||||
}
|
||||
|
||||
if (((fcu->grp) && (fcu->grp->flag & AGRP_MUTED)) || (fcu->flag & FCURVE_MUTED)) {
|
||||
/* muted curves are drawn in a grayish hue */
|
||||
/* XXX should we have some variations? */
|
||||
immUniformThemeColorShade(TH_HEADER, 50);
|
||||
}
|
||||
else {
|
||||
/* set whatever color the curve has set
|
||||
* - unselected curves draw less opaque to help distinguish the selected ones
|
||||
*/
|
||||
immUniformColor3fvAlpha(fcu->color, fcurve_display_alpha(fcu));
|
||||
}
|
||||
|
||||
/* draw F-Curve */
|
||||
if ((fcu->modifiers.first) || (fcu->flag & FCURVE_INT_VALUES)) {
|
||||
/* draw a curve affected by modifiers or only allowed to have integer values
|
||||
* by sampling it at various small-intervals over the visible region
|
||||
*/
|
||||
draw_fcurve_curve(ac, ale->id, fcu, ®ion->v2d, shdr_pos);
|
||||
}
|
||||
else if (((fcu->bezt) || (fcu->fpt)) && (fcu->totvert)) {
|
||||
/* just draw curve based on defined data (i.e. no modifiers) */
|
||||
if (fcu->bezt) {
|
||||
if (fcurve_can_use_simple_bezt_drawing(fcu)) {
|
||||
draw_fcurve_curve_bezts(ac, ale->id, fcu, ®ion->v2d, shdr_pos);
|
||||
}
|
||||
else {
|
||||
draw_fcurve_curve(ac, ale->id, fcu, ®ion->v2d, shdr_pos);
|
||||
}
|
||||
}
|
||||
else if (fcu->fpt) {
|
||||
draw_fcurve_curve_samples(ac, ale->id, fcu, ®ion->v2d, shdr_pos);
|
||||
}
|
||||
}
|
||||
|
||||
immUnbindProgram();
|
||||
|
||||
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
|
||||
GPU_line_smooth(false);
|
||||
}
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
}
|
||||
|
||||
/* 2) draw handles and vertices as appropriate based on active
|
||||
* - If the option to only show controls if the F-Curve is selected is enabled,
|
||||
* we must obey this.
|
||||
*/
|
||||
if (!(sipo->flag & SIPO_SELCUVERTSONLY) || (fcu->flag & FCURVE_SELECTED)) {
|
||||
if (!BKE_fcurve_are_keyframes_usable(fcu) && !(fcu->fpt && fcu->totvert)) {
|
||||
/* only draw controls if this is the active modifier */
|
||||
if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) {
|
||||
switch (fcm->type) {
|
||||
case FMODIFIER_TYPE_ENVELOPE: /* envelope */
|
||||
draw_fcurve_modifier_controls_envelope(fcm, ®ion->v2d);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (((fcu->bezt) || (fcu->fpt)) && (fcu->totvert)) {
|
||||
short mapping_flag = ANIM_get_normalization_flags(ac);
|
||||
float offset;
|
||||
float unit_scale = ANIM_unit_mapping_get_factor(
|
||||
ac->scene, ale->id, fcu, mapping_flag, &offset);
|
||||
|
||||
/* apply unit-scaling to all values via OpenGL */
|
||||
GPU_matrix_push();
|
||||
GPU_matrix_scale_2f(1.0f, unit_scale);
|
||||
GPU_matrix_translate_2f(0.0f, offset);
|
||||
|
||||
/* Set this once and for all -
|
||||
* all handles and handle-verts should use the same thickness. */
|
||||
GPU_line_width(1.0);
|
||||
|
||||
if (fcu->bezt) {
|
||||
bool do_handles = draw_fcurve_handles_check(sipo, fcu);
|
||||
|
||||
if (do_handles) {
|
||||
/* only draw handles/vertices on keyframes */
|
||||
draw_fcurve_handles(sipo, fcu);
|
||||
}
|
||||
|
||||
draw_fcurve_vertices(region, fcu, do_handles, (sipo->flag & SIPO_SELVHANDLESONLY));
|
||||
}
|
||||
else {
|
||||
/* samples: only draw two indicators at either end as indicators */
|
||||
draw_fcurve_samples(sipo, region, fcu);
|
||||
}
|
||||
|
||||
GPU_matrix_pop();
|
||||
}
|
||||
}
|
||||
|
||||
/* 3) draw driver debugging stuff */
|
||||
if ((ac->datatype == ANIMCONT_DRIVERS) && (fcu->flag & FCURVE_ACTIVE)) {
|
||||
graph_draw_driver_debug(ac, ale->id, fcu);
|
||||
}
|
||||
|
||||
/* undo mapping of keyframes for drawing if scaled F-Curve */
|
||||
if (adt) {
|
||||
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0);
|
||||
}
|
||||
/* Draw the active FCurve last so that it (especially the active keyframe)
|
||||
* shows on top of the other curves. */
|
||||
if (ale_active_fcurve != NULL) {
|
||||
draw_fcurve(ac, sipo, region, ale_active_fcurve);
|
||||
}
|
||||
|
||||
/* free list of curves */
|
||||
|
@@ -1485,7 +1485,8 @@ static int mouse_graph_keys(bAnimContext *ac,
|
||||
/* only if there's keyframe */
|
||||
if (nvi->bezt) {
|
||||
bezt = nvi->bezt; /* Used to check `bezt` selection is set. */
|
||||
/* depends on selection mode */
|
||||
/* Only deselect keyframe if it's already active, so that shift-click activates
|
||||
* a keyframe before selecting it. */
|
||||
if (select_mode == SELECT_INVERT) {
|
||||
if (nvi->hpoint == NEAREST_HANDLE_KEY) {
|
||||
bezt->f2 ^= SELECT;
|
||||
@@ -1510,6 +1511,11 @@ static int mouse_graph_keys(bAnimContext *ac,
|
||||
bezt->f3 |= SELECT;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the curve's active keyframe. */
|
||||
if (!run_modal && BEZT_ISSEL_ANY(bezt) && !already_selected) {
|
||||
nvi->fcu->active_key = bezt - nvi->fcu->bezt;
|
||||
}
|
||||
}
|
||||
else if (nvi->fpt) {
|
||||
// TODO: need to handle sample points
|
||||
@@ -1558,7 +1564,7 @@ static int mouse_graph_keys(bAnimContext *ac,
|
||||
/* set active F-Curve (NOTE: sync the filter flags with findnearest_fcurve_vert) */
|
||||
/* needs to be called with (sipo->flag & SIPO_SELCUVERTSONLY)
|
||||
* otherwise the active flag won't be set T26452. */
|
||||
if (nvi->fcu->flag & FCURVE_SELECTED) {
|
||||
if (!run_modal && nvi->fcu->flag & FCURVE_SELECTED) {
|
||||
int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
|
||||
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nvi->fcu, nvi->ctype);
|
||||
}
|
||||
|
@@ -587,6 +587,10 @@ typedef struct FCurve {
|
||||
/** Total number of points which define the curve (i.e. size of arrays in FPoints). */
|
||||
unsigned int totvert;
|
||||
|
||||
/** Active keyframe for numerical editing in the interface. */
|
||||
unsigned int active_key;
|
||||
char _pad1[4];
|
||||
|
||||
/* value cache + settings */
|
||||
/** Value stored from last time curve was evaluated (not threadsafe, debug display only!). */
|
||||
float curval;
|
||||
|
@@ -275,7 +275,8 @@ typedef struct ThemeSpace {
|
||||
unsigned char wire[4], wire_edit[4], select[4];
|
||||
unsigned char lamp[4], speaker[4], empty[4], camera[4];
|
||||
unsigned char active[4], group[4], group_active[4], transform[4];
|
||||
unsigned char vertex[4], vertex_select[4], vertex_bevel[4], vertex_unreferenced[4];
|
||||
unsigned char vertex[4], vertex_select[4], vertex_active[4], vertex_bevel[4],
|
||||
vertex_unreferenced[4];
|
||||
unsigned char edge[4], edge_select[4];
|
||||
unsigned char edge_seam[4], edge_sharp[4], edge_facesel[4], edge_crease[4], edge_bevel[4];
|
||||
/** Solid faces. */
|
||||
@@ -357,7 +358,7 @@ typedef struct ThemeSpace {
|
||||
unsigned char path_before[4], path_after[4];
|
||||
unsigned char path_keyframe_before[4], path_keyframe_after[4];
|
||||
unsigned char camera_path[4];
|
||||
unsigned char _pad1[2];
|
||||
unsigned char _pad1[6];
|
||||
|
||||
unsigned char gp_vertex_size;
|
||||
unsigned char gp_vertex[4], gp_vertex_select[4];
|
||||
|
@@ -1896,6 +1896,11 @@ static void rna_def_userdef_theme_spaces_vertex(StructRNA *srna)
|
||||
RNA_def_property_ui_text(prop, "Vertex Select", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||
|
||||
prop = RNA_def_property(srna, "vertex_active", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Active Vertex", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||
|
||||
prop = RNA_def_property(srna, "vertex_size", PROP_INT, PROP_PIXEL);
|
||||
RNA_def_property_range(prop, 1, 32);
|
||||
RNA_def_property_ui_text(prop, "Vertex Size", "");
|
||||
|
Reference in New Issue
Block a user