Animation: Move Graph Editor settings to User Preferences #104532

Merged
Christoph Lendenfeld merged 14 commits from ChrisLend/blender:user_pref_only_selected_keys into main 2023-03-09 14:15:36 +01:00
8 changed files with 16 additions and 21 deletions
Showing only changes of commit 8828733b43 - Show all commits

View File

@ -115,6 +115,7 @@ class GRAPH_MT_view(Menu):
layout.prop(st, "show_extrapolation")
layout.prop(st, "show_handles")
layout.prop(st, "use_only_selected_keyframe_handles")
layout.prop(st, "show_seconds")
layout.prop(st, "show_locked_time")

View File

@ -560,7 +560,6 @@ class USERPREF_PT_animation_fcurves(AnimationPanel, CenterAlignMixIn, Panel):
flow.prop(edit, "use_insertkey_xyz_to_rgb", text="XYZ to RGB")
flow.prop(edit, "use_anim_channel_group_colors")
flow.prop(edit, "show_only_selected_curve_keyframes")
flow.prop(edit, "show_only_selected_keyframe_handles")
# -----------------------------------------------------------------------------

View File

@ -425,7 +425,7 @@ static void draw_fcurve_handles(SpaceGraph *sipo, FCurve *fcu)
/* if only selected keyframes can get their handles shown,
* check that keyframe is selected
*/
if (U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_KEY_HANDLES) {
if (sipo->flag & SIPO_SELVHANDLESONLY) {
if (BEZT_ISSEL_ANY(bezt) == 0) {
continue;
}
@ -1150,10 +1150,7 @@ static void draw_fcurve(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAn
draw_fcurve_handles(sipo, fcu);
}
draw_fcurve_vertices(region,
fcu,
do_handles,
(U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_KEY_HANDLES));
draw_fcurve_vertices(region, fcu, do_handles, (sipo->flag & SIPO_SELVHANDLESONLY));
}
else {
/* samples: only draw two indicators at either end as indicators */

View File

@ -83,7 +83,7 @@ static bool fcurve_handle_sel_check(SpaceGraph *sipo, BezTriple *bezt)
if (sipo->flag & SIPO_NOHANDLES) {
return false;
}
if ((U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_KEY_HANDLES) && BEZT_ISSEL_ANY(bezt) == 0) {
if ((sipo->flag & SIPO_SELVHANDLESONLY) && BEZT_ISSEL_ANY(bezt) == 0) {
return false;
}
return true;
@ -541,8 +541,8 @@ static void initialize_box_select_key_editing_data(const bool incl_handles,
r_ked->data = scaled_rectf;
break;
}
if (U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_KEY_HANDLES) {
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
if (sipo->flag & SIPO_SELVHANDLESONLY) {
r_ked->iterflags |= KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE;
}
@ -952,8 +952,7 @@ static int graphkeys_lassoselect_exec(bContext *C, wmOperator *op)
{
SpaceGraph *sipo = (SpaceGraph *)ac.sl;
if (selectmode == SELECT_ADD) {
incl_handles = ((U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_KEY_HANDLES) ||
(sipo->flag & SIPO_NOHANDLES)) == 0;
incl_handles = ((sipo->flag & SIPO_SELVHANDLESONLY) || (sipo->flag & SIPO_NOHANDLES)) == 0;
}
else {
incl_handles = (sipo->flag & SIPO_NOHANDLES) == 0;
@ -1049,8 +1048,7 @@ static int graph_circle_select_exec(bContext *C, wmOperator *op)
{
SpaceGraph *sipo = (SpaceGraph *)ac.sl;
if (selectmode == SELECT_ADD) {
incl_handles = ((U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_KEY_HANDLES) ||
(sipo->flag & SIPO_NOHANDLES)) == 0;
incl_handles = ((sipo->flag & SIPO_SELVHANDLESONLY) || (sipo->flag & SIPO_NOHANDLES)) == 0;
}
else {
incl_handles = (sipo->flag & SIPO_NOHANDLES) == 0;

View File

@ -492,6 +492,8 @@ typedef enum eGraphEdit_Flag {
SIPO_SLIDERS = (1 << 7),
/* don't show the horizontal component of the cursor */
SIPO_NODRAWCURSOR = (1 << 8),
/* only show handles of selected keyframes */
SIPO_SELVHANDLESONLY = (1 << 9),
/* don't perform realtime updates */
SIPO_NOREALTIMEUPDATES = (1 << 11),
/* don't draw curves with AA ("beauty-draw") for performance */

View File

@ -1221,7 +1221,6 @@ typedef enum eAutokey_Flag {
typedef enum eUserpref_Anim_Flags {
USER_ANIM_SHOW_CHANNEL_GROUP_COLORS = (1 << 0),
USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS = (1 << 1),
USER_ANIM_ONLY_SHOW_SELECTED_KEY_HANDLES = (1 << 2),
} eUserpref_Anim_Flags;
/** #UserDef.transopts */

View File

@ -6310,6 +6310,12 @@ static void rna_def_space_graph(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Show Handles", "Show handles of Bezier control points");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
prop = RNA_def_property(srna, "use_only_selected_keyframe_handles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELVHANDLESONLY);
RNA_def_property_ui_text(
prop, "Only Selected Keyframes Handles", "Only show and edit handles of selected keyframes");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
prop = RNA_def_property(srna, "use_beauty_drawing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_BEAUTYDRAW_OFF);
RNA_def_property_ui_text(prop,

View File

@ -5155,13 +5155,6 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
"Only keyframes of selected F-Curves are visible and editable");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
prop = RNA_def_property(srna, "show_only_selected_keyframe_handles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "animation_flag", USER_ANIM_ONLY_SHOW_SELECTED_KEY_HANDLES);
RNA_def_property_ui_text(prop,
"Only Show Selected Keyframes Handles",
"Only show and edit handles of selected keyframes");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
/* grease pencil */
prop = RNA_def_property(srna, "grease_pencil_manhattan_distance", PROP_INT, PROP_PIXEL);
RNA_def_property_int_sdna(prop, NULL, "gp_manhattandist");