main sync #3

Merged
Patrick Busch merged 318 commits from blender/blender:main into main 2023-03-17 15:52:21 +01:00
14 changed files with 58 additions and 62 deletions
Showing only changes of commit 3b900048f1 - Show all commits

View File

@ -157,6 +157,7 @@ const UserDef U_default = {
.glalphaclip = 0.004,
.autokey_mode = (AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON),
.autokey_flag = AUTOKEY_FLAG_XYZ2RGB,
.animation_flag = USER_ANIM_HIGH_QUALITY_DRAWING,
.text_render = 0,
.navigation_mode = VIEW_NAVIGATION_WALK,
.view_rotate_sensitivity_turntable = DEG2RAD(0.4),

View File

@ -107,16 +107,9 @@ class GRAPH_MT_view(Menu):
layout.separator()
layout.prop(st, "show_markers")
layout.separator()
layout.prop(st, "use_beauty_drawing")
layout.separator()
layout.prop(st, "show_extrapolation")
layout.prop(st, "show_handles")
layout.prop(st, "use_only_selected_curves_handles")
layout.prop(st, "use_only_selected_keyframe_handles")
layout.prop(st, "show_seconds")

View File

@ -559,6 +559,8 @@ class USERPREF_PT_animation_fcurves(AnimationPanel, CenterAlignMixIn, Panel):
flow.prop(edit, "keyframe_new_handle_type", text="Default Handles")
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, "use_fcurve_high_quality_drawing")
# -----------------------------------------------------------------------------

View File

@ -25,7 +25,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 1
#define BLENDER_FILE_SUBVERSION 2
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file

View File

@ -783,6 +783,10 @@ void blo_do_versions_userdef(UserDef *userdef)
}
}
if (!USER_VERSION_ATLEAST(306, 2)) {
userdef->animation_flag |= USER_ANIM_HIGH_QUALITY_DRAWING;
}
/**
* Versioning code until next subversion bump goes here.
*

View File

@ -264,7 +264,7 @@ static bool graphedit_get_context(bAnimContext *ac, SpaceGraph *sipo)
ac->ads = sipo->ads;
/* set settings for Graph Editor - "Selected = Editable" */
if (sipo->flag & SIPO_SELCUVERTSONLY) {
if (U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) {
sipo->ads->filterflag |= ADS_FILTER_SELEDIT;
}
else {

View File

@ -406,7 +406,7 @@ static void draw_fcurve_handles(SpaceGraph *sipo, FCurve *fcu)
uint color = GPU_vertformat_attr_add(
format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(true);
}
GPU_blend(GPU_BLEND_ALPHA);
@ -482,7 +482,7 @@ static void draw_fcurve_handles(SpaceGraph *sipo, FCurve *fcu)
immEnd();
immUnbindProgram();
GPU_blend(GPU_BLEND_NONE);
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(false);
}
}
@ -515,7 +515,7 @@ static void draw_fcurve_sample_control(
}
/* helper func - draw keyframe vertices only for an F-Curve */
static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *region, FCurve *fcu)
static void draw_fcurve_samples(ARegion *region, FCurve *fcu)
{
FPoint *first, *last;
float hsize, xscale, yscale;
@ -531,7 +531,7 @@ static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *region, FCurve *fcu)
/* draw */
if (first && last) {
/* anti-aliased lines for more consistent appearance */
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(true);
}
GPU_blend(GPU_BLEND_ALPHA);
@ -547,7 +547,7 @@ static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *region, FCurve *fcu)
immUnbindProgram();
GPU_blend(GPU_BLEND_NONE);
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(false);
}
}
@ -565,7 +565,6 @@ static void draw_fcurve_curve(bAnimContext *ac,
const bool use_nla_remap,
const bool draw_extrapolation)
{
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
short mapping_flag = ANIM_get_normalization_flags(ac);
/* when opening a blend file on a different sized screen or while dragging the toolbar this can
@ -601,7 +600,7 @@ static void draw_fcurve_curve(bAnimContext *ac,
float pixels_per_sample = 1.5f;
float samplefreq = pixels_per_sample / UI_view2d_scale_get_x(v2d);
if (sipo->flag & SIPO_BEAUTYDRAW_OFF) {
if (!(U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING)) {
/* Low Precision = coarse lower-bound clamping
*
* Although the "Beauty Draw" flag was originally for AA'd
@ -1030,7 +1029,7 @@ static void draw_fcurve(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAn
}
/* anti-aliased lines for less jagged appearance */
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(true);
}
GPU_blend(GPU_BLEND_ALPHA);
@ -1105,7 +1104,7 @@ static void draw_fcurve(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAn
immUnbindProgram();
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(false);
}
GPU_blend(GPU_BLEND_NONE);
@ -1115,7 +1114,8 @@ static void draw_fcurve(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAn
* - 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 (!(U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) ||
(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)) {
@ -1153,7 +1153,7 @@ static void draw_fcurve(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAn
}
else {
/* samples: only draw two indicators at either end as indicators */
draw_fcurve_samples(sipo, region, fcu);
draw_fcurve_samples(region, fcu);
}
GPU_matrix_pop();
@ -1300,7 +1300,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region
GPU_line_width(3.0f);
/* anti-aliased lines for less jagged appearance */
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(true);
}
GPU_blend(GPU_BLEND_ALPHA);
@ -1333,7 +1333,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region
immUnbindProgram();
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(false);
}
GPU_blend(GPU_BLEND_NONE);

View File

@ -172,8 +172,9 @@ static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], L
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FCURVESONLY |
ANIMFILTER_NODUPLIS | ANIMFILTER_FCURVESONLY);
if (sipo->flag &
SIPO_SELCUVERTSONLY) { /* FIXME: this should really be check for by the filtering code... */
if (U.animation_flag &
USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) { /* FIXME: this should really be check for by the
filtering code... */
filter |= ANIMFILTER_SEL;
}
mapping_flag |= ANIM_get_normalization_flags(ac);
@ -336,7 +337,6 @@ void deselect_graph_keys(bAnimContext *ac, bool test, short sel, bool do_channel
bAnimListElem *ale;
int filter;
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
KeyframeEditData ked = {{NULL}};
KeyframeEditFunc test_cb, sel_cb;
@ -374,7 +374,7 @@ void deselect_graph_keys(bAnimContext *ac, bool test, short sel, bool do_channel
if (do_channels) {
/* Only change selection of channel when the visibility of keyframes
* doesn't depend on this. */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
if ((U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) == 0) {
/* deactivate the F-Curve, and deselect if deselecting keyframes.
* otherwise select the F-Curve too since we've selected all the keyframes
*/
@ -496,11 +496,11 @@ static rctf initialize_box_select_coords(const bAnimContext *ac, const rctf *rec
return rectf;
}
static int initialize_animdata_selection_filter(const SpaceGraph *sipo)
static int initialize_animdata_selection_filter(void)
{
int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FCURVESONLY |
ANIMFILTER_NODUPLIS);
if (sipo->flag & SIPO_SELCUVERTSONLY) {
if (U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) {
filter |= ANIMFILTER_FOREDIT | ANIMFILTER_SELEDIT;
}
return filter;
@ -513,8 +513,7 @@ static ListBase initialize_box_select_anim_data(const int filter, bAnimContext *
return anim_data;
}
static void initialize_box_select_key_editing_data(const SpaceGraph *sipo,
const bool incl_handles,
static void initialize_box_select_key_editing_data(const bool incl_handles,
const short mode,
bAnimContext *ac,
void *data,
@ -540,7 +539,7 @@ static void initialize_box_select_key_editing_data(const SpaceGraph *sipo,
r_ked->data = scaled_rectf;
break;
}
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
if (sipo->flag & SIPO_SELVHANDLESONLY) {
r_ked->iterflags |= KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE;
}
@ -574,14 +573,13 @@ static bool box_select_graphkeys(bAnimContext *ac,
void *data)
{
const rctf rectf = initialize_box_select_coords(ac, rectf_view);
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
const int filter = initialize_animdata_selection_filter(sipo);
const int filter = initialize_animdata_selection_filter();
ListBase anim_data = initialize_box_select_anim_data(filter, ac);
rctf scaled_rectf;
KeyframeEditData ked;
int mapping_flag;
initialize_box_select_key_editing_data(
sipo, incl_handles, mode, ac, data, &scaled_rectf, &ked, &mapping_flag);
incl_handles, mode, ac, data, &scaled_rectf, &ked, &mapping_flag);
/* Get beztriple editing/validation functions. */
const KeyframeEditFunc select_cb = ANIM_editkeyframes_select(selectmode);
@ -633,7 +631,7 @@ static bool box_select_graphkeys(bAnimContext *ac,
any_key_selection_changed = true;
/* Only change selection of channel when the visibility of keyframes
* doesn't depend on this. */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
if ((U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) == 0) {
/* select the curve too now that curve will be touched */
if (selectmode == SELECT_ADD) {
fcu->flag |= FCURVE_SELECTED;
@ -733,14 +731,13 @@ static void box_select_graphcurves(bAnimContext *ac,
const bool incl_handles,
void *data)
{
const SpaceGraph *sipo = (SpaceGraph *)ac->sl;
const int filter = initialize_animdata_selection_filter(sipo);
const int filter = initialize_animdata_selection_filter();
ListBase anim_data = initialize_box_select_anim_data(filter, ac);
rctf scaled_rectf;
KeyframeEditData ked;
int mapping_flag;
initialize_box_select_key_editing_data(
sipo, incl_handles, mode, ac, data, &scaled_rectf, &ked, &mapping_flag);
incl_handles, mode, ac, data, &scaled_rectf, &ked, &mapping_flag);
FCurve *last_selected_curve = NULL;
@ -1707,7 +1704,7 @@ static int mouse_graph_keys(bAnimContext *ac,
/* Deselect other channels too, but only do this if selection of channel
* when the visibility of keyframes doesn't depend on this. */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
if ((U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) == 0) {
ANIM_anim_channels_select_set(ac, ACHANNEL_SETFLAG_CLEAR);
}
}
@ -1780,7 +1777,7 @@ static int mouse_graph_keys(bAnimContext *ac,
}
/* only change selection of channel when the visibility of keyframes doesn't depend on this */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
if ((U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) == 0) {
/* select or deselect curve? */
if (bezt) {
/* take selection status from item that got hit, to prevent flip/flop on channel

View File

@ -49,7 +49,6 @@ void get_graph_keyframe_extents(bAnimContext *ac,
const bool include_handles)
{
Scene *scene = ac->scene;
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@ -58,7 +57,7 @@ void get_graph_keyframe_extents(bAnimContext *ac,
/* Get data to filter, from Dopesheet. */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FCURVESONLY |
ANIMFILTER_NODUPLIS);
if (sipo->flag & SIPO_SELCUVERTSONLY) {
if (U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) {
filter |= ANIMFILTER_SEL;
}

View File

@ -68,7 +68,7 @@ static SpaceLink *graph_create(const ScrArea *UNUSED(area), const Scene *scene)
/* settings for making it easier by default to just see what you're interested in tweaking */
sipo->ads->filterflag |= ADS_FILTER_ONLYSEL;
sipo->flag |= SIPO_SELVHANDLESONLY | SIPO_SHOW_MARKERS;
sipo->flag |= SIPO_SHOW_MARKERS;
/* header */
region = MEM_callocN(sizeof(ARegion), "header for graphedit");

View File

@ -488,8 +488,6 @@ typedef enum eGraphEdit_Flag {
/* SIPO_NODRAWCFRANUM = (1 << 3), DEPRECATED */
/* show timing in seconds instead of frames */
SIPO_DRAWTIME = (1 << 4),
/* only show keyframes for selected F-Curves */
SIPO_SELCUVERTSONLY = (1 << 5),
/* draw names of F-Curves beside the respective curves */
/* NOTE: currently not used */
/* SIPO_DRAWNAMES = (1 << 6), */ /* UNUSED */
@ -501,8 +499,6 @@ typedef enum eGraphEdit_Flag {
SIPO_SELVHANDLESONLY = (1 << 9),
/* don't perform realtime updates */
SIPO_NOREALTIMEUPDATES = (1 << 11),
/* don't draw curves with AA ("beauty-draw") for performance */
SIPO_BEAUTYDRAW_OFF = (1 << 12),
/* draw grouped channels with colors set in group */
/* SIPO_NODRAWGCOLORS = (1 << 13), DEPRECATED */
/* normalize curves on display */

View File

@ -1220,6 +1220,8 @@ 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_HIGH_QUALITY_DRAWING = (1 << 2),
} eUserpref_Anim_Flags;
/** #UserDef.transopts */

View File

@ -6329,27 +6329,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_curves_handles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELCUVERTSONLY);
RNA_def_property_ui_text(prop,
"Only Selected Curve Keyframes",
"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, "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,
"Use High Quality Display",
"Display F-Curves using Anti-Aliasing and other fancy effects "
"(disable for better performance)");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
prop = RNA_def_property(srna, "show_markers", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SHOW_MARKERS);
RNA_def_property_ui_text(

View File

@ -5175,6 +5175,23 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
"background of the Graph Editor");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
/* FCurve keyframe visibility. */
prop = RNA_def_property(srna, "show_only_selected_curve_keyframes", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(
prop, NULL, "animation_flag", USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS);
RNA_def_property_ui_text(prop,
"Only Show Selected F-Curve Keyframes",
"Only keyframes of selected F-Curves are visible and editable");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
/* Graph Editor line drawing quality. */
prop = RNA_def_property(srna, "use_fcurve_high_quality_drawing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "animation_flag", USER_ANIM_HIGH_QUALITY_DRAWING);
RNA_def_property_ui_text(prop,
"F-Curve High Quality Drawing",
"Draw F-Curves using Anti-Aliasing (disable for better performance)");
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");