From 6e7acb41ac4ebbc3892b7df4c1f4f8c99409b167 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 23 Nov 2023 11:26:32 +0100 Subject: [PATCH 01/18] wip --- .../blender/animrig/intern/keyframing_auto.cc | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/source/blender/animrig/intern/keyframing_auto.cc b/source/blender/animrig/intern/keyframing_auto.cc index da9db082a7e..9c7f928980e 100644 --- a/source/blender/animrig/intern/keyframing_auto.cc +++ b/source/blender/animrig/intern/keyframing_auto.cc @@ -32,6 +32,38 @@ namespace blender::animrig { +static eInsertKeyFlags get_keyframing_flags(Scene *scene) +{ + eInsertKeyFlags flag = INSERTKEY_NOFLAGS; + + /* Visual keying. */ + if (is_autokey_flag(scene, AUTOKEY_FLAG_AUTOMATKEY)) { + flag |= INSERTKEY_MATRIX; + } + + /* Only needed. */ + if (is_autokey_flag(scene, AUTOKEY_FLAG_INSERTNEEDED)) { + flag |= INSERTKEY_NEEDED; + } + + /* Default F-Curve color mode - RGB from XYZ indices. */ + if (is_autokey_flag(scene, AUTOKEY_FLAG_XYZ2RGB)) { + flag |= INSERTKEY_XYZ2RGB; + } + + /* Keyframing mode - only replace existing keyframes. */ + if (is_autokey_mode(scene, AUTOKEY_MODE_EDITKEYS)) { + flag |= INSERTKEY_REPLACE; + } + + /* Cycle-aware keyframe insertion - preserve cycle period and flow. */ + if (is_autokey_flag(scene, AUTOKEY_FLAG_CYCLEAWARE)) { + flag |= INSERTKEY_CYCLE_AWARE; + } + + return flag; +} + bool is_autokey_on(const Scene *scene) { if (scene) { -- 2.30.2 From 4f5e5b5f1b92278364d9c65943e5367b14cd11d8 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 23 Nov 2023 16:45:40 +0100 Subject: [PATCH 02/18] wip --- source/blender/animrig/intern/keyframing_auto.cc | 2 +- source/blender/makesdna/DNA_userdef_types.h | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/source/blender/animrig/intern/keyframing_auto.cc b/source/blender/animrig/intern/keyframing_auto.cc index 1a1a93433c3..9f3f4f1f3fd 100644 --- a/source/blender/animrig/intern/keyframing_auto.cc +++ b/source/blender/animrig/intern/keyframing_auto.cc @@ -37,7 +37,7 @@ static eInsertKeyFlags get_keyframing_flags(Scene *scene) eInsertKeyFlags flag = INSERTKEY_NOFLAGS; /* Visual keying. */ - if (is_autokey_flag(scene, AUTOKEY_FLAG_AUTOMATKEY)) { + if (is_autokey_flag(scene, AUTOKEY_FLAG_VISUALKEY)) { flag |= INSERTKEY_MATRIX; } diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 90f53d4a652..23f00d83bed 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -1283,18 +1283,24 @@ typedef enum eZoomFrame_Mode { /** * Defines how keyframes are inserted. * Used for regular keying and auto-keying. + * Not all of those flags are stored in the user preferences (U.autokey_flag). + * Some are stored on the scene (toolsettings.autokey_flag). */ typedef enum eKeyInsert_Flag { - AUTOKEY_FLAG_INSERTAVAILABLE = (1 << 0), - AUTOKEY_FLAG_INSERTNEEDED = (1 << 1), + /* Settings used across manual and auto-keying. */ AUTOKEY_FLAG_VISUALKEY = (1 << 2), AUTOKEY_FLAG_XYZ2RGB = (1 << 3), + AUTOKEY_FLAG_CYCLEAWARE = (1 << 8), - /* toolsettings->autokey_flag */ + /* Autokey options. */ + AUTOKEY_FLAG_INSERTAVAILABLE = (1 << 0), + AUTOKEY_FLAG_INSERTNEEDED = (1 << 1), AUTOKEY_FLAG_ONLYKEYINGSET = (1 << 6), AUTOKEY_FLAG_NOWARNING = (1 << 7), - AUTOKEY_FLAG_CYCLEAWARE = (1 << 8), AUTOKEY_FLAG_LAYERED_RECORD = (1 << 10), + + /* Manual Keying options. */ + KEYING_FLAG_INSERTNEEDED = (1 << 11), } eKeyInsert_Flag; typedef enum eKeyInsertChannels { -- 2.30.2 From 87392564fe2862dfba4d31f252226b5f026b311b Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 23 Nov 2023 16:51:43 +0100 Subject: [PATCH 03/18] rename enum vars --- release/datafiles/userdef/userdef_default.c | 2 +- source/blender/animrig/intern/keyframing_auto.cc | 6 +++--- source/blender/editors/animation/keyframing.cc | 6 +++--- source/blender/editors/animation/keyingsets.cc | 2 +- source/blender/makesdna/DNA_userdef_types.h | 8 ++++---- source/blender/makesrna/intern/rna_scene.cc | 2 +- source/blender/makesrna/intern/rna_userdef.cc | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/release/datafiles/userdef/userdef_default.c b/release/datafiles/userdef/userdef_default.c index 1cc3e7c59cb..5503bb9a955 100644 --- a/release/datafiles/userdef/userdef_default.c +++ b/release/datafiles/userdef/userdef_default.c @@ -164,7 +164,7 @@ const UserDef U_default = { .image_draw_method = IMAGE_DRAW_METHOD_AUTO, .glalphaclip = 0.004, .autokey_mode = (AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON), - .autokey_flag = AUTOKEY_FLAG_XYZ2RGB, + .autokey_flag = KEYING_FLAG_XYZ2RGB, .key_insert_channels = USER_ANIM_KEY_CHANNEL_LOCATION, .animation_flag = USER_ANIM_HIGH_QUALITY_DRAWING, .text_render = 0, diff --git a/source/blender/animrig/intern/keyframing_auto.cc b/source/blender/animrig/intern/keyframing_auto.cc index 9f3f4f1f3fd..6aaaee395c1 100644 --- a/source/blender/animrig/intern/keyframing_auto.cc +++ b/source/blender/animrig/intern/keyframing_auto.cc @@ -37,7 +37,7 @@ static eInsertKeyFlags get_keyframing_flags(Scene *scene) eInsertKeyFlags flag = INSERTKEY_NOFLAGS; /* Visual keying. */ - if (is_autokey_flag(scene, AUTOKEY_FLAG_VISUALKEY)) { + if (is_autokey_flag(scene, KEYING_FLAG_VISUALKEY)) { flag |= INSERTKEY_MATRIX; } @@ -47,7 +47,7 @@ static eInsertKeyFlags get_keyframing_flags(Scene *scene) } /* Default F-Curve color mode - RGB from XYZ indices. */ - if (is_autokey_flag(scene, AUTOKEY_FLAG_XYZ2RGB)) { + if (is_autokey_flag(scene, KEYING_FLAG_XYZ2RGB)) { flag |= INSERTKEY_XYZ2RGB; } @@ -57,7 +57,7 @@ static eInsertKeyFlags get_keyframing_flags(Scene *scene) } /* Cycle-aware keyframe insertion - preserve cycle period and flow. */ - if (is_autokey_flag(scene, AUTOKEY_FLAG_CYCLEAWARE)) { + if (is_autokey_flag(scene, KEYING_FLAG_CYCLEAWARE)) { flag |= INSERTKEY_CYCLE_AWARE; } diff --git a/source/blender/editors/animation/keyframing.cc b/source/blender/editors/animation/keyframing.cc index 7189abf2562..32b0470475c 100644 --- a/source/blender/editors/animation/keyframing.cc +++ b/source/blender/editors/animation/keyframing.cc @@ -83,7 +83,7 @@ eInsertKeyFlags ANIM_get_keyframing_flags(Scene *scene, const bool use_autokey_m /* standard flags */ { /* visual keying */ - if (is_autokey_flag(scene, AUTOKEY_FLAG_VISUALKEY)) { + if (is_autokey_flag(scene, KEYING_FLAG_VISUALKEY)) { flag |= INSERTKEY_MATRIX; } @@ -93,7 +93,7 @@ eInsertKeyFlags ANIM_get_keyframing_flags(Scene *scene, const bool use_autokey_m } /* default F-Curve color mode - RGB from XYZ indices */ - if (is_autokey_flag(scene, AUTOKEY_FLAG_XYZ2RGB)) { + if (is_autokey_flag(scene, KEYING_FLAG_XYZ2RGB)) { flag |= INSERTKEY_XYZ2RGB; } } @@ -109,7 +109,7 @@ eInsertKeyFlags ANIM_get_keyframing_flags(Scene *scene, const bool use_autokey_m } /* cycle-aware keyframe insertion - preserve cycle period and flow */ - if (is_autokey_flag(scene, AUTOKEY_FLAG_CYCLEAWARE)) { + if (is_autokey_flag(scene, KEYING_FLAG_CYCLEAWARE)) { flag |= INSERTKEY_CYCLE_AWARE; } } diff --git a/source/blender/editors/animation/keyingsets.cc b/source/blender/editors/animation/keyingsets.cc index 9ae16a191e6..926518a8fcf 100644 --- a/source/blender/editors/animation/keyingsets.cc +++ b/source/blender/editors/animation/keyingsets.cc @@ -294,7 +294,7 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op) keyingflag |= ANIM_get_keyframing_flags(scene, false); - if (blender::animrig::is_autokey_flag(scene, AUTOKEY_FLAG_XYZ2RGB)) { + if (blender::animrig::is_autokey_flag(scene, KEYING_FLAG_XYZ2RGB)) { keyingflag |= INSERTKEY_XYZ2RGB; } diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 23f00d83bed..71a27cc1be9 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -1288,9 +1288,9 @@ typedef enum eZoomFrame_Mode { */ typedef enum eKeyInsert_Flag { /* Settings used across manual and auto-keying. */ - AUTOKEY_FLAG_VISUALKEY = (1 << 2), - AUTOKEY_FLAG_XYZ2RGB = (1 << 3), - AUTOKEY_FLAG_CYCLEAWARE = (1 << 8), + KEYING_FLAG_VISUALKEY = (1 << 2), + KEYING_FLAG_XYZ2RGB = (1 << 3), + KEYING_FLAG_CYCLEAWARE = (1 << 8), /* Autokey options. */ AUTOKEY_FLAG_INSERTAVAILABLE = (1 << 0), @@ -1300,7 +1300,7 @@ typedef enum eKeyInsert_Flag { AUTOKEY_FLAG_LAYERED_RECORD = (1 << 10), /* Manual Keying options. */ - KEYING_FLAG_INSERTNEEDED = (1 << 11), + MANUALKEY_FLAG_INSERTNEEDED = (1 << 11), } eKeyInsert_Flag; typedef enum eKeyInsertChannels { diff --git a/source/blender/makesrna/intern/rna_scene.cc b/source/blender/makesrna/intern/rna_scene.cc index 6aa9d1f1bdd..7c46e94862a 100644 --- a/source/blender/makesrna/intern/rna_scene.cc +++ b/source/blender/makesrna/intern/rna_scene.cc @@ -3814,7 +3814,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0); prop = RNA_def_property(srna, "use_keyframe_cycle_aware", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, nullptr, "autokey_flag", AUTOKEY_FLAG_CYCLEAWARE); + RNA_def_property_boolean_sdna(prop, nullptr, "autokey_flag", KEYING_FLAG_CYCLEAWARE); RNA_def_property_ui_text( prop, "Cycle-Aware Keying", diff --git a/source/blender/makesrna/intern/rna_userdef.cc b/source/blender/makesrna/intern/rna_userdef.cc index 5200b227dfe..fa4bdb9f7df 100644 --- a/source/blender/makesrna/intern/rna_userdef.cc +++ b/source/blender/makesrna/intern/rna_userdef.cc @@ -5449,12 +5449,12 @@ static void rna_def_userdef_edit(BlenderRNA *brna) prop, "Keyframe Insert Needed", "Keyframe insertion only when keyframe needed"); prop = RNA_def_property(srna, "use_visual_keying", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, nullptr, "autokey_flag", AUTOKEY_FLAG_VISUALKEY); + RNA_def_property_boolean_sdna(prop, nullptr, "autokey_flag", KEYING_FLAG_VISUALKEY); RNA_def_property_ui_text( prop, "Visual Keying", "Use Visual keying automatically for constrained objects"); prop = RNA_def_property(srna, "use_insertkey_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, nullptr, "autokey_flag", AUTOKEY_FLAG_XYZ2RGB); + RNA_def_property_boolean_sdna(prop, nullptr, "autokey_flag", KEYING_FLAG_XYZ2RGB); RNA_def_property_ui_text( prop, "New F-Curve Colors - XYZ to RGB", -- 2.30.2 From 872f653f965ed0cf0c2b65d23ea22ae27d741d82 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 23 Nov 2023 16:58:27 +0100 Subject: [PATCH 04/18] rename enum again --- source/blender/animrig/ANIM_keyframing.hh | 2 +- source/blender/animrig/intern/keyframing_auto.cc | 2 +- source/blender/makesdna/DNA_userdef_types.h | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/animrig/ANIM_keyframing.hh b/source/blender/animrig/ANIM_keyframing.hh index 7a92252c3c8..52656d162d4 100644 --- a/source/blender/animrig/ANIM_keyframing.hh +++ b/source/blender/animrig/ANIM_keyframing.hh @@ -132,7 +132,7 @@ bool is_autokey_on(const Scene *scene); bool is_autokey_mode(const Scene *scene, eAutokey_Mode mode); /** Check if a flag is set for auto-key-framing (per scene takes precedence). */ -bool is_autokey_flag(const Scene *scene, eKeyInsert_Flag flag); +bool is_autokey_flag(const Scene *scene, eKeying_Flag flag); /** * Auto-keyframing feature - checks for whether anything should be done for the current frame. diff --git a/source/blender/animrig/intern/keyframing_auto.cc b/source/blender/animrig/intern/keyframing_auto.cc index 6aaaee395c1..cf1a1a2639f 100644 --- a/source/blender/animrig/intern/keyframing_auto.cc +++ b/source/blender/animrig/intern/keyframing_auto.cc @@ -80,7 +80,7 @@ bool is_autokey_mode(const Scene *scene, const eAutokey_Mode mode) return U.autokey_mode == mode; } -bool is_autokey_flag(const Scene *scene, const eKeyInsert_Flag flag) +bool is_autokey_flag(const Scene *scene, const eKeying_Flag flag) { if (scene) { return (scene->toolsettings->autokey_flag & flag) || (U.autokey_flag & flag); diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 71a27cc1be9..c21023d72a4 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -1286,7 +1286,7 @@ typedef enum eZoomFrame_Mode { * Not all of those flags are stored in the user preferences (U.autokey_flag). * Some are stored on the scene (toolsettings.autokey_flag). */ -typedef enum eKeyInsert_Flag { +typedef enum eKeying_Flag { /* Settings used across manual and auto-keying. */ KEYING_FLAG_VISUALKEY = (1 << 2), KEYING_FLAG_XYZ2RGB = (1 << 3), @@ -1301,7 +1301,7 @@ typedef enum eKeyInsert_Flag { /* Manual Keying options. */ MANUALKEY_FLAG_INSERTNEEDED = (1 << 11), -} eKeyInsert_Flag; +} eKeying_Flag; typedef enum eKeyInsertChannels { USER_ANIM_KEY_CHANNEL_LOCATION = (1 << 0), @@ -1314,7 +1314,7 @@ typedef enum eKeyInsertChannels { /** * Animation flags * #UserDef.animation_flag, used for animation flags that aren't covered by more specific flags - * (like eKeyInsert_Flag). + * (like eKeying_Flag). */ typedef enum eUserpref_Anim_Flags { USER_ANIM_SHOW_CHANNEL_GROUP_COLORS = (1 << 0), -- 2.30.2 From 4086eae115762fd43732936de3578fcedac6b440 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 23 Nov 2023 17:23:30 +0100 Subject: [PATCH 05/18] rename function --- source/blender/animrig/intern/keyframing_auto.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/blender/animrig/intern/keyframing_auto.cc b/source/blender/animrig/intern/keyframing_auto.cc index cf1a1a2639f..d0aa03fbe6f 100644 --- a/source/blender/animrig/intern/keyframing_auto.cc +++ b/source/blender/animrig/intern/keyframing_auto.cc @@ -32,7 +32,7 @@ namespace blender::animrig { -static eInsertKeyFlags get_keyframing_flags(Scene *scene) +static eInsertKeyFlags get_autokey_flags(Scene *scene) { eInsertKeyFlags flag = INSERTKEY_NOFLAGS; @@ -128,10 +128,9 @@ void autokeyframe_object( Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct( depsgraph, BKE_scene_frame_get(scene)); - eInsertKeyFlags flag = eInsertKeyFlags(0); /* Get flags used for inserting keyframes. */ - flag = ANIM_get_keyframing_flags(scene, true); + const eInsertKeyFlags flag = get_autokey_flags(scene); /* Add data-source override for the object. */ blender::Vector sources; @@ -288,7 +287,7 @@ void autokeyframe_pose(bContext *C, Scene *scene, Object *ob, int tmode, short t * visual keyframes even if flag not set, as it's not that useful otherwise * (for quick animation recording) */ - flag = ANIM_get_keyframing_flags(scene, true); + flag = get_autokey_flags(scene); if (targetless_ik) { flag |= INSERTKEY_MATRIX; @@ -468,7 +467,7 @@ bool autokeyframe_property(bContext *C, if (autokeyframe_cfra_can_key(scene, id)) { ReportList *reports = CTX_wm_reports(C); ToolSettings *ts = scene->toolsettings; - const eInsertKeyFlags flag = ANIM_get_keyframing_flags(scene, true); + const eInsertKeyFlags flag = get_autokey_flags(scene); char *path = RNA_path_from_ID_to_property(ptr, prop); if (only_if_property_keyed) { -- 2.30.2 From e14fae6870ac742766d50d5558e80c7b21c99079 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 23 Nov 2023 17:35:27 +0100 Subject: [PATCH 06/18] remove bool argument, was always true --- .../animation/anim_channels_defines.cc | 6 +-- .../blender/editors/animation/keyframing.cc | 50 +++++++------------ .../blender/editors/animation/keyingsets.cc | 6 +-- .../blender/editors/include/ED_keyframing.hh | 2 +- .../editors/space_action/action_edit.cc | 2 +- .../blender/editors/space_graph/graph_edit.cc | 2 +- 6 files changed, 26 insertions(+), 42 deletions(-) diff --git a/source/blender/editors/animation/anim_channels_defines.cc b/source/blender/editors/animation/anim_channels_defines.cc index 3c1327a09ad..4cdbe1f7132 100644 --- a/source/blender/editors/animation/anim_channels_defines.cc +++ b/source/blender/editors/animation/anim_channels_defines.cc @@ -5025,7 +5025,7 @@ static void achannel_setting_slider_cb(bContext *C, void *id_poin, void *fcu_poi cfra = BKE_nla_tweakedit_remap(adt, float(scene->r.cfra), NLATIME_CONVERT_UNMAP); /* Get flags for keyframing. */ - flag = ANIM_get_keyframing_flags(scene, true); + flag = ANIM_get_keyframing_flags(scene); /* try to resolve the path stored in the F-Curve */ if (RNA_path_resolve_property(&id_ptr, fcu->rna_path, &ptr, &prop)) { @@ -5088,7 +5088,7 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi key->adt, anim_eval_context.eval_time, NLATIME_CONVERT_UNMAP); /* get flags for keyframing */ - flag = ANIM_get_keyframing_flags(scene, true); + flag = ANIM_get_keyframing_flags(scene); /* try to resolve the path stored in the F-Curve */ if (RNA_path_resolve_property(&id_ptr, rna_path, &ptr, &prop)) { @@ -5148,7 +5148,7 @@ static void achannel_setting_slider_nla_curve_cb(bContext *C, void * /*id_poin*/ cfra = float(scene->r.cfra); /* get flags for keyframing */ - flag = ANIM_get_keyframing_flags(scene, true); + flag = ANIM_get_keyframing_flags(scene); /* Get pointer and property from the slider - * this should all match up with the NlaStrip required. */ diff --git a/source/blender/editors/animation/keyframing.cc b/source/blender/editors/animation/keyframing.cc index 32b0470475c..85ae166e4e7 100644 --- a/source/blender/editors/animation/keyframing.cc +++ b/source/blender/editors/animation/keyframing.cc @@ -75,43 +75,28 @@ static int delete_key_using_keying_set(bContext *C, wmOperator *op, KeyingSet *k /* ************************************************** */ /* Keyframing Setting Wrangling */ -eInsertKeyFlags ANIM_get_keyframing_flags(Scene *scene, const bool use_autokey_mode) +eInsertKeyFlags ANIM_get_keyframing_flags(Scene *scene) { using namespace blender::animrig; eInsertKeyFlags flag = INSERTKEY_NOFLAGS; - /* standard flags */ - { - /* visual keying */ - if (is_autokey_flag(scene, KEYING_FLAG_VISUALKEY)) { - flag |= INSERTKEY_MATRIX; - } - - /* only needed */ - if (is_autokey_flag(scene, AUTOKEY_FLAG_INSERTNEEDED)) { - flag |= INSERTKEY_NEEDED; - } - - /* default F-Curve color mode - RGB from XYZ indices */ - if (is_autokey_flag(scene, KEYING_FLAG_XYZ2RGB)) { - flag |= INSERTKEY_XYZ2RGB; - } + /* Visual keying. */ + if (is_autokey_flag(scene, KEYING_FLAG_VISUALKEY)) { + flag |= INSERTKEY_MATRIX; } - /* only if including settings from the autokeying mode... */ - /* TODO: The fact that this flag needs to be passed as true is confusing because it is not clear - * why those two flags would be exclusive to autokeying. Refactor flags so they are separate - * between normal keying and autokeying. */ - if (use_autokey_mode) { - /* keyframing mode - only replace existing keyframes */ - if (is_autokey_mode(scene, AUTOKEY_MODE_EDITKEYS)) { - flag |= INSERTKEY_REPLACE; - } + /* Cycle-aware keyframe insertion - preserve cycle period and flow. */ + if (is_autokey_flag(scene, KEYING_FLAG_CYCLEAWARE)) { + flag |= INSERTKEY_CYCLE_AWARE; + } - /* cycle-aware keyframe insertion - preserve cycle period and flow */ - if (is_autokey_flag(scene, KEYING_FLAG_CYCLEAWARE)) { - flag |= INSERTKEY_CYCLE_AWARE; - } + if (is_autokey_flag(scene, MANUALKEY_FLAG_INSERTNEEDED)) { + flag |= INSERTKEY_NEEDED; + } + + /* Default F-Curve color mode - RGB from XYZ indices. */ + if (is_autokey_flag(scene, KEYING_FLAG_XYZ2RGB)) { + flag |= INSERTKEY_XYZ2RGB; } return flag; @@ -509,8 +494,7 @@ static int insert_key(bContext *C, wmOperator *op) const float scene_frame = BKE_scene_frame_get(scene); /* Passing autokey mode as true because that is needed to get the cycle aware keying flag. */ - const bool use_autokey_mode = true; - const eInsertKeyFlags insert_key_flags = ANIM_get_keyframing_flags(scene, use_autokey_mode); + const eInsertKeyFlags insert_key_flags = ANIM_get_keyframing_flags(scene); const eBezTriple_KeyframeType key_type = eBezTriple_KeyframeType( scene->toolsettings->keyframe_type); @@ -1043,7 +1027,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) eInsertKeyFlags flag = INSERTKEY_NOFLAGS; /* flags for inserting keyframes */ - flag = ANIM_get_keyframing_flags(scene, true); + flag = ANIM_get_keyframing_flags(scene); if (!(but = UI_context_active_but_prop_get(C, &ptr, &prop, &index))) { /* pass event on if no active button found */ diff --git a/source/blender/editors/animation/keyingsets.cc b/source/blender/editors/animation/keyingsets.cc index 926518a8fcf..5ba631ba3df 100644 --- a/source/blender/editors/animation/keyingsets.cc +++ b/source/blender/editors/animation/keyingsets.cc @@ -104,7 +104,7 @@ static int add_default_keyingset_exec(bContext *C, wmOperator * /*op*/) flag |= KEYINGSET_ABSOLUTE; /* 2nd arg is 0 to indicate that we don't want to include autokeying mode related settings */ - keyingflag = ANIM_get_keyframing_flags(scene, false); + keyingflag = ANIM_get_keyframing_flags(scene); /* call the API func, and set the active keyingset index */ BKE_keyingset_add(&scene->keyingsets, nullptr, nullptr, flag, keyingflag); @@ -292,7 +292,7 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op) */ flag |= KEYINGSET_ABSOLUTE; - keyingflag |= ANIM_get_keyframing_flags(scene, false); + keyingflag |= ANIM_get_keyframing_flags(scene); if (blender::animrig::is_autokey_flag(scene, KEYING_FLAG_XYZ2RGB)) { keyingflag |= INSERTKEY_XYZ2RGB; @@ -1028,7 +1028,7 @@ int ANIM_apply_keyingset( /* get flags to use */ Scene *scene = CTX_data_scene(C); - const eInsertKeyFlags base_kflags = ANIM_get_keyframing_flags(scene, true); + const eInsertKeyFlags base_kflags = ANIM_get_keyframing_flags(scene); eInsertKeyFlags kflag = INSERTKEY_NOFLAGS; if (mode == MODIFYKEY_MODE_INSERT) { /* use context settings as base */ diff --git a/source/blender/editors/include/ED_keyframing.hh b/source/blender/editors/include/ED_keyframing.hh index 4c3d9b365b9..3100d22cd06 100644 --- a/source/blender/editors/include/ED_keyframing.hh +++ b/source/blender/editors/include/ED_keyframing.hh @@ -44,7 +44,7 @@ struct NlaKeyframingContext; * \param use_autokey_mode: include settings from key-framing mode in the result * (i.e. replace only). */ -eInsertKeyFlags ANIM_get_keyframing_flags(Scene *scene, bool use_autokey_mode); +eInsertKeyFlags ANIM_get_keyframing_flags(Scene *scene); /* -------- */ diff --git a/source/blender/editors/space_action/action_edit.cc b/source/blender/editors/space_action/action_edit.cc index d5780ae040e..bbbe9f61b4a 100644 --- a/source/blender/editors/space_action/action_edit.cc +++ b/source/blender/editors/space_action/action_edit.cc @@ -894,7 +894,7 @@ static void insert_action_keys(bAnimContext *ac, short mode) ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype)); /* Init keyframing flag. */ - flag = ANIM_get_keyframing_flags(scene, true); + flag = ANIM_get_keyframing_flags(scene); /* GPLayers specific flags */ if (ts->gpencil_flags & GP_TOOL_FLAG_RETAIN_LAST) { diff --git a/source/blender/editors/space_graph/graph_edit.cc b/source/blender/editors/space_graph/graph_edit.cc index 2ccc61f77cd..c16aa9b4283 100644 --- a/source/blender/editors/space_graph/graph_edit.cc +++ b/source/blender/editors/space_graph/graph_edit.cc @@ -146,7 +146,7 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode) } /* Init key-framing flag. */ - flag = ANIM_get_keyframing_flags(scene, true); + flag = ANIM_get_keyframing_flags(scene); /* Insert keyframes. */ if (mode & GRAPHKEYS_INSERTKEY_CURSOR) { -- 2.30.2 From 241e025512652c122cc1c1f56d44b2caebea7352 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Fri, 24 Nov 2023 10:36:24 +0100 Subject: [PATCH 07/18] split flags --- scripts/startup/bl_ui/properties_scene.py | 2 +- scripts/startup/bl_ui/space_userpref.py | 9 ++++++--- source/blender/makesrna/intern/rna_userdef.cc | 7 ++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/startup/bl_ui/properties_scene.py b/scripts/startup/bl_ui/properties_scene.py index 2a980812d7a..adf569487f6 100644 --- a/scripts/startup/bl_ui/properties_scene.py +++ b/scripts/startup/bl_ui/properties_scene.py @@ -88,7 +88,7 @@ class SceneKeyingSetsPanel: SceneKeyingSetsPanel._draw_keyframing_setting( context, layout, ks, ksp, iface_("Needed"), "use_insertkey_override_needed", "use_insertkey_needed", - userpref_fallback="use_keyframe_insert_needed", + userpref_fallback="use_auto_keyframe_insert_needed", ) SceneKeyingSetsPanel._draw_keyframing_setting( context, layout, ks, ksp, iface_("Visual"), diff --git a/scripts/startup/bl_ui/space_userpref.py b/scripts/startup/bl_ui/space_userpref.py index a0d6a86f4b8..dbb93e10f14 100644 --- a/scripts/startup/bl_ui/space_userpref.py +++ b/scripts/startup/bl_ui/space_userpref.py @@ -578,14 +578,17 @@ class USERPREF_PT_animation_keyframes(AnimationPanel, CenterAlignMixIn, Panel): layout.prop(edit, "key_insert_channels", expand=True) - col = layout.column() + col = layout.column(heading="Keyframing") col.prop(edit, "use_visual_keying") + + col = layout.column(heading="Manual-Keyframing") col.prop(edit, "use_keyframe_insert_needed", text="Only Insert Needed") col = layout.column(heading="Auto-Keyframing") - col.prop(edit, "use_auto_keying_warning", text="Show Warning") - col.prop(edit, "use_keyframe_insert_available", text="Only Insert Available") col.prop(edit, "use_auto_keying", text="Enable in New Scenes") + col.prop(edit, "use_auto_keying_warning", text="Show Warning") + col.prop(edit, "use_auto_keyframe_insert_needed", text="Only Insert Needed") + col.prop(edit, "use_keyframe_insert_available", text="Only Insert Available") class USERPREF_PT_animation_fcurves(AnimationPanel, CenterAlignMixIn, Panel): diff --git a/source/blender/makesrna/intern/rna_userdef.cc b/source/blender/makesrna/intern/rna_userdef.cc index fa4bdb9f7df..6e53cdd996f 100644 --- a/source/blender/makesrna/intern/rna_userdef.cc +++ b/source/blender/makesrna/intern/rna_userdef.cc @@ -5443,8 +5443,13 @@ static void rna_def_userdef_edit(BlenderRNA *brna) "Default Key Channels", "Which channels to insert keys at when no keying set is active"); - prop = RNA_def_property(srna, "use_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE); + prop = RNA_def_property(srna, "use_auto_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, nullptr, "autokey_flag", AUTOKEY_FLAG_INSERTNEEDED); + RNA_def_property_ui_text( + prop, "Autokey Insert Needed", "Auto-Keyframe insertion only when keyframe needed"); + + prop = RNA_def_property(srna, "use_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, nullptr, "autokey_flag", MANUALKEY_FLAG_INSERTNEEDED); RNA_def_property_ui_text( prop, "Keyframe Insert Needed", "Keyframe insertion only when keyframe needed"); -- 2.30.2 From 2c04a42136e63950d0cd7a5b88a584a8e5dd24f2 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Fri, 24 Nov 2023 12:15:19 +0100 Subject: [PATCH 08/18] wip --- source/blender/animrig/intern/keyframing_auto.cc | 5 ++--- source/blender/editors/animation/keyframing.cc | 2 -- source/blender/editors/animation/keyingsets.cc | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/source/blender/animrig/intern/keyframing_auto.cc b/source/blender/animrig/intern/keyframing_auto.cc index d0aa03fbe6f..39d7f54f4db 100644 --- a/source/blender/animrig/intern/keyframing_auto.cc +++ b/source/blender/animrig/intern/keyframing_auto.cc @@ -204,7 +204,7 @@ void autokeyframe_object( do_scale = true; } } - + AnimData *adt = ob->adt; if (do_loc) { KeyingSet *ks = ANIM_builtin_keyingset_get_named(ANIM_KS_LOCATION_ID); ANIM_apply_keyingset(C, &sources, ks, MODIFYKEY_MODE_INSERT, anim_eval_context.eval_time); @@ -280,14 +280,13 @@ void autokeyframe_pose(bContext *C, Scene *scene, Object *ob, int tmode, short t Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct( depsgraph, BKE_scene_frame_get(scene)); - eInsertKeyFlags flag = eInsertKeyFlags(0); /* flag is initialized from UserPref keyframing settings * - special exception for targetless IK - INSERTKEY_MATRIX keyframes should get * visual keyframes even if flag not set, as it's not that useful otherwise * (for quick animation recording) */ - flag = get_autokey_flags(scene); + eInsertKeyFlags flag = get_autokey_flags(scene); if (targetless_ik) { flag |= INSERTKEY_MATRIX; diff --git a/source/blender/editors/animation/keyframing.cc b/source/blender/editors/animation/keyframing.cc index 85ae166e4e7..7244a89a7d0 100644 --- a/source/blender/editors/animation/keyframing.cc +++ b/source/blender/editors/animation/keyframing.cc @@ -493,7 +493,6 @@ static int insert_key(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); const float scene_frame = BKE_scene_frame_get(scene); - /* Passing autokey mode as true because that is needed to get the cycle aware keying flag. */ const eInsertKeyFlags insert_key_flags = ANIM_get_keyframing_flags(scene); const eBezTriple_KeyframeType key_type = eBezTriple_KeyframeType( scene->toolsettings->keyframe_type); @@ -1026,7 +1025,6 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) const bool all = RNA_boolean_get(op->ptr, "all"); eInsertKeyFlags flag = INSERTKEY_NOFLAGS; - /* flags for inserting keyframes */ flag = ANIM_get_keyframing_flags(scene); if (!(but = UI_context_active_but_prop_get(C, &ptr, &prop, &index))) { diff --git a/source/blender/editors/animation/keyingsets.cc b/source/blender/editors/animation/keyingsets.cc index 5ba631ba3df..5a70adb58f8 100644 --- a/source/blender/editors/animation/keyingsets.cc +++ b/source/blender/editors/animation/keyingsets.cc @@ -103,7 +103,6 @@ static int add_default_keyingset_exec(bContext *C, wmOperator * /*op*/) */ flag |= KEYINGSET_ABSOLUTE; - /* 2nd arg is 0 to indicate that we don't want to include autokeying mode related settings */ keyingflag = ANIM_get_keyframing_flags(scene); /* call the API func, and set the active keyingset index */ -- 2.30.2 From ce2a3e13be24d1215cfa33ccf6241c5cc43ef320 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Tue, 28 Nov 2023 16:00:48 +0100 Subject: [PATCH 09/18] resolve merge issues --- source/blender/animrig/intern/keyframing_auto.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/source/blender/animrig/intern/keyframing_auto.cc b/source/blender/animrig/intern/keyframing_auto.cc index 39d7f54f4db..e8df7fae77e 100644 --- a/source/blender/animrig/intern/keyframing_auto.cc +++ b/source/blender/animrig/intern/keyframing_auto.cc @@ -46,11 +46,6 @@ static eInsertKeyFlags get_autokey_flags(Scene *scene) flag |= INSERTKEY_NEEDED; } - /* Default F-Curve color mode - RGB from XYZ indices. */ - if (is_autokey_flag(scene, KEYING_FLAG_XYZ2RGB)) { - flag |= INSERTKEY_XYZ2RGB; - } - /* Keyframing mode - only replace existing keyframes. */ if (is_autokey_mode(scene, AUTOKEY_MODE_EDITKEYS)) { flag |= INSERTKEY_REPLACE; -- 2.30.2 From 051e2d535b4258f718ce9191ed385936d25cb049 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Tue, 28 Nov 2023 16:29:37 +0100 Subject: [PATCH 10/18] rename autokey_flag --- release/datafiles/userdef/userdef_default.c | 2 +- source/blender/animrig/intern/action.cc | 2 +- source/blender/animrig/intern/keyframing_auto.cc | 6 +++--- .../blender/blenloader/intern/versioning_userdef.cc | 2 +- source/blender/editors/transform/transform.cc | 2 +- .../blender/editors/transform/transform_convert.cc | 2 +- source/blender/makesdna/DNA_scene_types.h | 2 +- source/blender/makesdna/DNA_userdef_types.h | 8 ++++---- source/blender/makesrna/intern/rna_scene.cc | 6 +++--- source/blender/makesrna/intern/rna_userdef.cc | 12 ++++++------ 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/release/datafiles/userdef/userdef_default.c b/release/datafiles/userdef/userdef_default.c index 5503bb9a955..3a9641e40f4 100644 --- a/release/datafiles/userdef/userdef_default.c +++ b/release/datafiles/userdef/userdef_default.c @@ -164,7 +164,7 @@ const UserDef U_default = { .image_draw_method = IMAGE_DRAW_METHOD_AUTO, .glalphaclip = 0.004, .autokey_mode = (AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON), - .autokey_flag = KEYING_FLAG_XYZ2RGB, + .keying_flag = KEYING_FLAG_XYZ2RGB, .key_insert_channels = USER_ANIM_KEY_CHANNEL_LOCATION, .animation_flag = USER_ANIM_HIGH_QUALITY_DRAWING, .text_render = 0, diff --git a/source/blender/animrig/intern/action.cc b/source/blender/animrig/intern/action.cc index 0a62e0c611f..8f78d1e6cb5 100644 --- a/source/blender/animrig/intern/action.cc +++ b/source/blender/animrig/intern/action.cc @@ -60,7 +60,7 @@ FCurve *action_fcurve_ensure(Main *bmain, fcu->rna_path = BLI_strdup(rna_path); fcu->array_index = array_index; - if (U.autokey_flag & AUTOKEY_FLAG_XYZ2RGB && ptr != nullptr) { + if (U.keying_flag & KEYING_FLAG_XYZ2RGB && ptr != nullptr) { /* For Loc/Rot/Scale and also Color F-Curves, the color of the F-Curve in the Graph Editor, * is determined by the array index for the F-Curve. */ diff --git a/source/blender/animrig/intern/keyframing_auto.cc b/source/blender/animrig/intern/keyframing_auto.cc index e8df7fae77e..9167081a7f0 100644 --- a/source/blender/animrig/intern/keyframing_auto.cc +++ b/source/blender/animrig/intern/keyframing_auto.cc @@ -78,9 +78,9 @@ bool is_autokey_mode(const Scene *scene, const eAutokey_Mode mode) bool is_autokey_flag(const Scene *scene, const eKeying_Flag flag) { if (scene) { - return (scene->toolsettings->autokey_flag & flag) || (U.autokey_flag & flag); + return (scene->toolsettings->keying_flag & flag) || (U.keying_flag & flag); } - return U.autokey_flag & flag; + return U.keying_flag & flag; } bool autokeyframe_cfra_can_key(const Scene *scene, ID *id) @@ -199,7 +199,7 @@ void autokeyframe_object( do_scale = true; } } - AnimData *adt = ob->adt; + if (do_loc) { KeyingSet *ks = ANIM_builtin_keyingset_get_named(ANIM_KS_LOCATION_ID); ANIM_apply_keyingset(C, &sources, ks, MODIFYKEY_MODE_INSERT, anim_eval_context.eval_time); diff --git a/source/blender/blenloader/intern/versioning_userdef.cc b/source/blender/blenloader/intern/versioning_userdef.cc index 287e0cebd7d..b25c2dfc50b 100644 --- a/source/blender/blenloader/intern/versioning_userdef.cc +++ b/source/blender/blenloader/intern/versioning_userdef.cc @@ -409,7 +409,7 @@ void blo_do_versions_userdef(UserDef *userdef) if (!USER_VERSION_ATLEAST(257, 0)) { /* Clear #AUTOKEY_FLAG_ONLYKEYINGSET flag from user-preferences, * so that it doesn't linger around from old configurations like a ghost. */ - userdef->autokey_flag &= ~AUTOKEY_FLAG_ONLYKEYINGSET; + userdef->keying_flag &= ~AUTOKEY_FLAG_ONLYKEYINGSET; } if (!USER_VERSION_ATLEAST(260, 3)) { diff --git a/source/blender/editors/transform/transform.cc b/source/blender/editors/transform/transform.cc index f2f40e6cec6..0d0ffcaed82 100644 --- a/source/blender/editors/transform/transform.cc +++ b/source/blender/editors/transform/transform.cc @@ -1591,7 +1591,7 @@ static void drawTransformPixel(const bContext * /*C*/, ARegion *region, void *ar * for objects that will be auto-keyframed (no point otherwise), * AND only for the active region (as showing all is too overwhelming) */ - if ((U.autokey_flag & AUTOKEY_FLAG_NOWARNING) == 0) { + if ((U.keying_flag & AUTOKEY_FLAG_NOWARNING) == 0) { if (region == t->region) { if (t->options & (CTX_OBJECT | CTX_POSE_BONE)) { if (ob && blender::animrig::autokeyframe_cfra_can_key(scene, &ob->id)) { diff --git a/source/blender/editors/transform/transform_convert.cc b/source/blender/editors/transform/transform_convert.cc index c4e1d47c606..3c555131b84 100644 --- a/source/blender/editors/transform/transform_convert.cc +++ b/source/blender/editors/transform/transform_convert.cc @@ -1202,7 +1202,7 @@ void animrecord_check_state(TransInfo *t, ID *id) * - the option to add new actions for each round is not enabled */ if (blender::animrig::is_autokey_flag(scene, AUTOKEY_FLAG_INSERTAVAILABLE) == 0 && - (scene->toolsettings->autokey_flag & AUTOKEY_FLAG_LAYERED_RECORD)) + (scene->toolsettings->keying_flag & AUTOKEY_FLAG_LAYERED_RECORD)) { /* if playback has just looped around, * we need to add a new NLA track+strip to allow a clean pass to occur */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index dcee0198981..cd77fd3260c 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1610,7 +1610,7 @@ typedef struct ToolSettings { /* Auto-Keying Mode. */ /** Defines in DNA_userdef_types.h. */ - short autokey_flag; + short keying_flag; char autokey_mode; /** Keyframe type (see DNA_curve_types.h). */ char keyframe_type; diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index c21023d72a4..d1685569e15 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -953,8 +953,8 @@ typedef struct UserDef { /** #eAutokey_Mode, auto-keying mode. */ short autokey_mode; - /** Flags for autokeying. */ - short autokey_flag; + /** Flags for inserting keyframes. */ + short keying_flag; /** Flags for which channels to insert keys at. */ short key_insert_channels; // eKeyInsertChannels char _pad15[6]; @@ -1283,8 +1283,8 @@ typedef enum eZoomFrame_Mode { /** * Defines how keyframes are inserted. * Used for regular keying and auto-keying. - * Not all of those flags are stored in the user preferences (U.autokey_flag). - * Some are stored on the scene (toolsettings.autokey_flag). + * Not all of those flags are stored in the user preferences (U.keying_flag). + * Some are stored on the scene (toolsettings.keying_flag). */ typedef enum eKeying_Flag { /* Settings used across manual and auto-keying. */ diff --git a/source/blender/makesrna/intern/rna_scene.cc b/source/blender/makesrna/intern/rna_scene.cc index 7c46e94862a..9b1a098d82f 100644 --- a/source/blender/makesrna/intern/rna_scene.cc +++ b/source/blender/makesrna/intern/rna_scene.cc @@ -3799,7 +3799,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) "Mode of automatic keyframe insertion for Objects, Bones and Masks"); prop = RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, nullptr, "autokey_flag", AUTOKEY_FLAG_LAYERED_RECORD); + RNA_def_property_boolean_sdna(prop, nullptr, "keying_flag", AUTOKEY_FLAG_LAYERED_RECORD); RNA_def_property_ui_text( prop, "Layered", @@ -3807,14 +3807,14 @@ static void rna_def_tool_settings(BlenderRNA *brna) "to allow non-destructive tweaking"); prop = RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, nullptr, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET); + RNA_def_property_boolean_sdna(prop, nullptr, "keying_flag", AUTOKEY_FLAG_ONLYKEYINGSET); RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set", "Automatic keyframe insertion using active Keying Set only"); RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0); prop = RNA_def_property(srna, "use_keyframe_cycle_aware", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, nullptr, "autokey_flag", KEYING_FLAG_CYCLEAWARE); + RNA_def_property_boolean_sdna(prop, nullptr, "keying_flag", KEYING_FLAG_CYCLEAWARE); RNA_def_property_ui_text( prop, "Cycle-Aware Keying", diff --git a/source/blender/makesrna/intern/rna_userdef.cc b/source/blender/makesrna/intern/rna_userdef.cc index 6e53cdd996f..1587490fd27 100644 --- a/source/blender/makesrna/intern/rna_userdef.cc +++ b/source/blender/makesrna/intern/rna_userdef.cc @@ -5422,13 +5422,13 @@ static void rna_def_userdef_edit(BlenderRNA *brna) "(default setting used for new Scenes)"); prop = RNA_def_property(srna, "use_keyframe_insert_available", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, nullptr, "autokey_flag", AUTOKEY_FLAG_INSERTAVAILABLE); + RNA_def_property_boolean_sdna(prop, nullptr, "keying_flag", AUTOKEY_FLAG_INSERTAVAILABLE); RNA_def_property_ui_text(prop, "Auto Keyframe Insert Available", "Automatic keyframe insertion in available F-Curves"); prop = RNA_def_property(srna, "use_auto_keying_warning", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, nullptr, "autokey_flag", AUTOKEY_FLAG_NOWARNING); + RNA_def_property_boolean_negative_sdna(prop, nullptr, "keying_flag", AUTOKEY_FLAG_NOWARNING); RNA_def_property_ui_text( prop, "Show Auto Keying Warning", @@ -5444,22 +5444,22 @@ static void rna_def_userdef_edit(BlenderRNA *brna) "Which channels to insert keys at when no keying set is active"); prop = RNA_def_property(srna, "use_auto_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, nullptr, "autokey_flag", AUTOKEY_FLAG_INSERTNEEDED); + RNA_def_property_boolean_sdna(prop, nullptr, "keying_flag", AUTOKEY_FLAG_INSERTNEEDED); RNA_def_property_ui_text( prop, "Autokey Insert Needed", "Auto-Keyframe insertion only when keyframe needed"); prop = RNA_def_property(srna, "use_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, nullptr, "autokey_flag", MANUALKEY_FLAG_INSERTNEEDED); + RNA_def_property_boolean_sdna(prop, nullptr, "keying_flag", MANUALKEY_FLAG_INSERTNEEDED); RNA_def_property_ui_text( prop, "Keyframe Insert Needed", "Keyframe insertion only when keyframe needed"); prop = RNA_def_property(srna, "use_visual_keying", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, nullptr, "autokey_flag", KEYING_FLAG_VISUALKEY); + RNA_def_property_boolean_sdna(prop, nullptr, "keying_flag", KEYING_FLAG_VISUALKEY); RNA_def_property_ui_text( prop, "Visual Keying", "Use Visual keying automatically for constrained objects"); prop = RNA_def_property(srna, "use_insertkey_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, nullptr, "autokey_flag", KEYING_FLAG_XYZ2RGB); + RNA_def_property_boolean_sdna(prop, nullptr, "keying_flag", KEYING_FLAG_XYZ2RGB); RNA_def_property_ui_text( prop, "New F-Curve Colors - XYZ to RGB", -- 2.30.2 From 19d091b6c1c0ffd391237e5e37fed0a35f7da86f Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 14 Dec 2023 10:43:37 +0100 Subject: [PATCH 11/18] versioning code and userdef defaults --- release/datafiles/userdef/userdef_default.c | 2 +- source/blender/blenloader/intern/versioning_400.cc | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/release/datafiles/userdef/userdef_default.c b/release/datafiles/userdef/userdef_default.c index 3a9641e40f4..0fd47559ab6 100644 --- a/release/datafiles/userdef/userdef_default.c +++ b/release/datafiles/userdef/userdef_default.c @@ -164,7 +164,7 @@ const UserDef U_default = { .image_draw_method = IMAGE_DRAW_METHOD_AUTO, .glalphaclip = 0.004, .autokey_mode = (AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON), - .keying_flag = KEYING_FLAG_XYZ2RGB, + .keying_flag = KEYING_FLAG_XYZ2RGB | AUTOKEY_FLAG_INSERTNEEDED, .key_insert_channels = USER_ANIM_KEY_CHANNEL_LOCATION, .animation_flag = USER_ANIM_HIGH_QUALITY_DRAWING, .text_render = 0, diff --git a/source/blender/blenloader/intern/versioning_400.cc b/source/blender/blenloader/intern/versioning_400.cc index 5833cbb381a..70da11e68ef 100644 --- a/source/blender/blenloader/intern/versioning_400.cc +++ b/source/blender/blenloader/intern/versioning_400.cc @@ -2590,6 +2590,11 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain) versioning_switch_node_dynamic_socket(*ntree); } } + + if (U.keying_flag & AUTOKEY_FLAG_INSERTNEEDED) { + U.keying_flag |= MANUALKEY_FLAG_INSERTNEEDED; + } + U.keying_flag |= AUTOKEY_FLAG_INSERTNEEDED; } /* Always run this versioning; meshes are written with the legacy format which always needs to -- 2.30.2 From 7fec5fa8bebcca29cfa4a2da48f173a8cbb69da7 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 14 Dec 2023 10:57:43 +0100 Subject: [PATCH 12/18] move versioning code to correct file --- source/blender/blenloader/intern/versioning_400.cc | 5 ----- source/blender/blenloader/intern/versioning_userdef.cc | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/source/blender/blenloader/intern/versioning_400.cc b/source/blender/blenloader/intern/versioning_400.cc index 70da11e68ef..5833cbb381a 100644 --- a/source/blender/blenloader/intern/versioning_400.cc +++ b/source/blender/blenloader/intern/versioning_400.cc @@ -2590,11 +2590,6 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain) versioning_switch_node_dynamic_socket(*ntree); } } - - if (U.keying_flag & AUTOKEY_FLAG_INSERTNEEDED) { - U.keying_flag |= MANUALKEY_FLAG_INSERTNEEDED; - } - U.keying_flag |= AUTOKEY_FLAG_INSERTNEEDED; } /* Always run this versioning; meshes are written with the legacy format which always needs to diff --git a/source/blender/blenloader/intern/versioning_userdef.cc b/source/blender/blenloader/intern/versioning_userdef.cc index 12439a1be66..22b198197b5 100644 --- a/source/blender/blenloader/intern/versioning_userdef.cc +++ b/source/blender/blenloader/intern/versioning_userdef.cc @@ -922,6 +922,10 @@ void blo_do_versions_userdef(UserDef *userdef) */ { /* Keep this block, even when empty. */ + if (userdef->keying_flag & AUTOKEY_FLAG_INSERTNEEDED) { + userdef->keying_flag |= MANUALKEY_FLAG_INSERTNEEDED; + } + userdef->keying_flag |= AUTOKEY_FLAG_INSERTNEEDED; } LISTBASE_FOREACH (bTheme *, btheme, &userdef->themes) { -- 2.30.2 From 29cce7b71062dc5594b6de0fc2a65f804463ea0d Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Fri, 5 Jan 2024 13:49:49 +0100 Subject: [PATCH 13/18] fix failing unit tests --- tests/python/bl_animation_keyframing.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/python/bl_animation_keyframing.py b/tests/python/bl_animation_keyframing.py index 47cb8459e52..2e1e138d88d 100644 --- a/tests/python/bl_animation_keyframing.py +++ b/tests/python/bl_animation_keyframing.py @@ -256,6 +256,7 @@ class AutoKeyframingTest(AbstractKeyframingTest, unittest.TestCase): bpy.context.scene.tool_settings.use_keyframe_insert_auto = True bpy.context.preferences.edit.use_keyframe_insert_available = False bpy.context.preferences.edit.use_keyframe_insert_needed = False + bpy.context.preferences.edit.use_auto_keyframe_insert_needed = False def tearDown(self): super().tearDown() @@ -291,6 +292,7 @@ class InsertAvailableTest(AbstractKeyframingTest, unittest.TestCase): bpy.context.scene.tool_settings.use_keyframe_insert_auto = True bpy.context.preferences.edit.use_keyframe_insert_available = True bpy.context.preferences.edit.use_keyframe_insert_needed = False + bpy.context.preferences.edit.use_auto_keyframe_insert_needed = False def tearDown(self): super().tearDown() @@ -385,12 +387,14 @@ class InsertNeededTest(AbstractKeyframingTest, unittest.TestCase): super().setUp() bpy.context.scene.tool_settings.use_keyframe_insert_auto = True bpy.context.preferences.edit.use_keyframe_insert_needed = True + bpy.context.preferences.edit.use_auto_keyframe_insert_needed = True bpy.context.preferences.edit.use_keyframe_insert_available = False def tearDown(self): super().tearDown() bpy.context.scene.tool_settings.use_keyframe_insert_auto = False bpy.context.preferences.edit.use_keyframe_insert_needed = False + bpy.context.preferences.edit.use_auto_keyframe_insert_needed = False def test_insert_needed_object(self): keyed_object = _create_animation_object() -- 2.30.2 From 609c4364a9d5b6eb5799074df1d39572748ec260 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Tue, 16 Jan 2024 16:17:01 +0100 Subject: [PATCH 14/18] change how the preferences are laid out --- scripts/startup/bl_ui/space_userpref.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/startup/bl_ui/space_userpref.py b/scripts/startup/bl_ui/space_userpref.py index 15f0093603e..4326e5910ea 100644 --- a/scripts/startup/bl_ui/space_userpref.py +++ b/scripts/startup/bl_ui/space_userpref.py @@ -579,16 +579,16 @@ class USERPREF_PT_animation_keyframes(AnimationPanel, CenterAlignMixIn, Panel): layout.prop(edit, "key_insert_channels", expand=True) + row = layout.row(align=True, heading="Only Insert Needed") + row.prop(edit, "use_keyframe_insert_needed", text="Manual", toggle=1) + row.prop(edit, "use_auto_keyframe_insert_needed", text="Auto", toggle=1) + col = layout.column(heading="Keyframing") col.prop(edit, "use_visual_keying") - col = layout.column(heading="Manual-Keyframing") - col.prop(edit, "use_keyframe_insert_needed", text="Only Insert Needed") - col = layout.column(heading="Auto-Keyframing") col.prop(edit, "use_auto_keying", text="Enable in New Scenes") col.prop(edit, "use_auto_keying_warning", text="Show Warning") - col.prop(edit, "use_auto_keyframe_insert_needed", text="Only Insert Needed") col.prop(edit, "use_keyframe_insert_available", text="Only Insert Available") -- 2.30.2 From dc6950fac11a120e529a8c6d8eebb68f70e19edd Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 18 Jan 2024 16:43:03 +0100 Subject: [PATCH 15/18] rename function --- source/blender/animrig/ANIM_keyframing.hh | 4 ++-- source/blender/animrig/intern/keyframing.cc | 10 +++++++++ .../blender/animrig/intern/keyframing_auto.cc | 22 ++++++------------- .../blender/editors/animation/keyframing.cc | 6 ++--- .../blender/editors/animation/keyingsets.cc | 4 ++-- .../editors/transform/transform_convert.cc | 2 +- .../transform/transform_convert_armature.cc | 2 +- .../transform/transform_convert_object.cc | 2 +- 8 files changed, 27 insertions(+), 25 deletions(-) diff --git a/source/blender/animrig/ANIM_keyframing.hh b/source/blender/animrig/ANIM_keyframing.hh index b960ac8a999..972cdc35560 100644 --- a/source/blender/animrig/ANIM_keyframing.hh +++ b/source/blender/animrig/ANIM_keyframing.hh @@ -134,8 +134,8 @@ bool is_autokey_on(const Scene *scene); /** Check the mode for auto-keyframing (per scene takes precedence). */ bool is_autokey_mode(const Scene *scene, eAutokey_Mode mode); -/** Check if a flag is set for auto-key-framing (per scene takes precedence). */ -bool is_autokey_flag(const Scene *scene, eKeying_Flag flag); +/** Check if a flag is set for keyframing (per scene takes precedence). */ +bool is_keying_flag(const Scene *scene, eKeying_Flag flag); /** * Auto-keyframing feature - checks for whether anything should be done for the current frame. diff --git a/source/blender/animrig/intern/keyframing.cc b/source/blender/animrig/intern/keyframing.cc index 830c02da946..f621a48f12e 100644 --- a/source/blender/animrig/intern/keyframing.cc +++ b/source/blender/animrig/intern/keyframing.cc @@ -26,6 +26,8 @@ #include "BKE_nla.h" #include "BKE_report.h" +#include "DNA_scene_types.h" + #include "BLI_dynstr.h" #include "BLI_math_base.h" #include "BLI_utildefines.h" @@ -66,6 +68,14 @@ void update_autoflags_fcurve_direct(FCurve *fcu, PropertyRNA *prop) } } +bool is_keying_flag(const Scene *scene, const eKeying_Flag flag) +{ + if (scene) { + return (scene->toolsettings->keying_flag & flag) || (U.keying_flag & flag); + } + return U.keying_flag & flag; +} + /** Used to make curves newly added to a cyclic Action cycle with the correct period. */ static void make_new_fcurve_cyclic(FCurve *fcu, const blender::float2 &action_range) { diff --git a/source/blender/animrig/intern/keyframing_auto.cc b/source/blender/animrig/intern/keyframing_auto.cc index 01d8c5133e0..3d5b8716698 100644 --- a/source/blender/animrig/intern/keyframing_auto.cc +++ b/source/blender/animrig/intern/keyframing_auto.cc @@ -38,12 +38,12 @@ static eInsertKeyFlags get_autokey_flags(Scene *scene) eInsertKeyFlags flag = INSERTKEY_NOFLAGS; /* Visual keying. */ - if (is_autokey_flag(scene, KEYING_FLAG_VISUALKEY)) { + if (is_keying_flag(scene, KEYING_FLAG_VISUALKEY)) { flag |= INSERTKEY_MATRIX; } /* Only needed. */ - if (is_autokey_flag(scene, AUTOKEY_FLAG_INSERTNEEDED)) { + if (is_keying_flag(scene, AUTOKEY_FLAG_INSERTNEEDED)) { flag |= INSERTKEY_NEEDED; } @@ -53,7 +53,7 @@ static eInsertKeyFlags get_autokey_flags(Scene *scene) } /* Cycle-aware keyframe insertion - preserve cycle period and flow. */ - if (is_autokey_flag(scene, KEYING_FLAG_CYCLEAWARE)) { + if (is_keying_flag(scene, KEYING_FLAG_CYCLEAWARE)) { flag |= INSERTKEY_CYCLE_AWARE; } @@ -76,14 +76,6 @@ bool is_autokey_mode(const Scene *scene, const eAutokey_Mode mode) return U.autokey_mode == mode; } -bool is_autokey_flag(const Scene *scene, const eKeying_Flag flag) -{ - if (scene) { - return (scene->toolsettings->keying_flag & flag) || (U.keying_flag & flag); - } - return U.keying_flag & flag; -} - bool autokeyframe_cfra_can_key(const Scene *scene, ID *id) { /* Only filter if auto-key mode requires this. */ @@ -130,7 +122,7 @@ void autokeyframe_object(bContext *C, Scene *scene, Object *ob, Span sources; ANIM_relative_keyingset_add_source(sources, id); - if (is_autokey_flag(scene, AUTOKEY_FLAG_ONLYKEYINGSET) && (active_ks)) { + if (is_keying_flag(scene, AUTOKEY_FLAG_ONLYKEYINGSET) && (active_ks)) { /* Only insert into active keyingset * NOTE: we assume here that the active Keying Set * does not need to have its iterator overridden. @@ -140,7 +132,7 @@ void autokeyframe_object(bContext *C, Scene *scene, Object *ob, Spanadt; ToolSettings *ts = scene->toolsettings; @@ -253,7 +245,7 @@ void autokeyframe_pose_channel(bContext *C, ANIM_relative_keyingset_add_source(sources, id, &RNA_PoseBone, pose_channel); /* only insert into active keyingset? */ - if (blender::animrig::is_autokey_flag(scene, AUTOKEY_FLAG_ONLYKEYINGSET) && (active_ks)) { + if (blender::animrig::is_keying_flag(scene, AUTOKEY_FLAG_ONLYKEYINGSET) && (active_ks)) { /* Run the active Keying Set on the current data-source. */ ANIM_apply_keyingset( C, &sources, active_ks, MODIFYKEY_MODE_INSERT, anim_eval_context.eval_time); @@ -261,7 +253,7 @@ void autokeyframe_pose_channel(bContext *C, } /* only insert into available channels? */ - if (blender::animrig::is_autokey_flag(scene, AUTOKEY_FLAG_INSERTAVAILABLE)) { + if (blender::animrig::is_keying_flag(scene, AUTOKEY_FLAG_INSERTAVAILABLE)) { if (!act) { return; } diff --git a/source/blender/editors/animation/keyframing.cc b/source/blender/editors/animation/keyframing.cc index 58c4bd1c8fd..3cdd91d1861 100644 --- a/source/blender/editors/animation/keyframing.cc +++ b/source/blender/editors/animation/keyframing.cc @@ -82,16 +82,16 @@ eInsertKeyFlags ANIM_get_keyframing_flags(Scene *scene) eInsertKeyFlags flag = INSERTKEY_NOFLAGS; /* Visual keying. */ - if (is_autokey_flag(scene, KEYING_FLAG_VISUALKEY)) { + if (is_keying_flag(scene, KEYING_FLAG_VISUALKEY)) { flag |= INSERTKEY_MATRIX; } /* Cycle-aware keyframe insertion - preserve cycle period and flow. */ - if (is_autokey_flag(scene, KEYING_FLAG_CYCLEAWARE)) { + if (is_keying_flag(scene, KEYING_FLAG_CYCLEAWARE)) { flag |= INSERTKEY_CYCLE_AWARE; } - if (is_autokey_flag(scene, MANUALKEY_FLAG_INSERTNEEDED)) { + if (is_keying_flag(scene, MANUALKEY_FLAG_INSERTNEEDED)) { flag |= INSERTKEY_NEEDED; } diff --git a/source/blender/editors/animation/keyingsets.cc b/source/blender/editors/animation/keyingsets.cc index c5eb968ea81..ccb0dcc09ff 100644 --- a/source/blender/editors/animation/keyingsets.cc +++ b/source/blender/editors/animation/keyingsets.cc @@ -741,13 +741,13 @@ KeyingSet *ANIM_get_keyingset_for_autokeying(const Scene *scene, const char *tra * - use the active KeyingSet if defined (and user wants to use it for all autokeying), * or otherwise key transforms only */ - if (blender::animrig::is_autokey_flag(scene, AUTOKEY_FLAG_ONLYKEYINGSET) && + if (blender::animrig::is_keying_flag(scene, AUTOKEY_FLAG_ONLYKEYINGSET) && (scene->active_keyingset)) { return ANIM_scene_get_active_keyingset(scene); } - if (blender::animrig::is_autokey_flag(scene, AUTOKEY_FLAG_INSERTAVAILABLE)) { + if (blender::animrig::is_keying_flag(scene, AUTOKEY_FLAG_INSERTAVAILABLE)) { return ANIM_builtin_keyingset_get_named(ANIM_KS_AVAILABLE_ID); } diff --git a/source/blender/editors/transform/transform_convert.cc b/source/blender/editors/transform/transform_convert.cc index fe07999de44..ae8a75fa8bd 100644 --- a/source/blender/editors/transform/transform_convert.cc +++ b/source/blender/editors/transform/transform_convert.cc @@ -1203,7 +1203,7 @@ void animrecord_check_state(TransInfo *t, ID *id) * - we're not only keying for available channels * - the option to add new actions for each round is not enabled */ - if (blender::animrig::is_autokey_flag(scene, AUTOKEY_FLAG_INSERTAVAILABLE) == 0 && + if (blender::animrig::is_keying_flag(scene, AUTOKEY_FLAG_INSERTAVAILABLE) == 0 && (scene->toolsettings->keying_flag & AUTOKEY_FLAG_LAYERED_RECORD)) { /* if playback has just looped around, diff --git a/source/blender/editors/transform/transform_convert_armature.cc b/source/blender/editors/transform/transform_convert_armature.cc index 64264d82018..a67ae001fc8 100644 --- a/source/blender/editors/transform/transform_convert_armature.cc +++ b/source/blender/editors/transform/transform_convert_armature.cc @@ -1330,7 +1330,7 @@ static void autokeyframe_pose( const blender::StringRef rotation_path = blender::animrig::get_rotation_mode_path( eRotationModes(pchan->rotmode)); - if (blender::animrig::is_autokey_flag(scene, AUTOKEY_FLAG_INSERTNEEDED)) { + if (blender::animrig::is_keying_flag(scene, AUTOKEY_FLAG_INSERTNEEDED)) { rna_paths = get_affected_rna_paths_from_transform_mode( tmode, scene->toolsettings, rotation_path, targetless_ik); } diff --git a/source/blender/editors/transform/transform_convert_object.cc b/source/blender/editors/transform/transform_convert_object.cc index 9f005427aeb..053b8b45caf 100644 --- a/source/blender/editors/transform/transform_convert_object.cc +++ b/source/blender/editors/transform/transform_convert_object.cc @@ -818,7 +818,7 @@ static void autokeyframe_object(bContext *C, Scene *scene, Object *ob, const eTf const blender::StringRef rotation_path = blender::animrig::get_rotation_mode_path( eRotationModes(ob->rotmode)); - if (blender::animrig::is_autokey_flag(scene, AUTOKEY_FLAG_INSERTNEEDED)) { + if (blender::animrig::is_keying_flag(scene, AUTOKEY_FLAG_INSERTNEEDED)) { rna_paths = get_affected_rna_paths_from_transform_mode( tmode, scene, view_layer, ob, rotation_path); } -- 2.30.2 From 1b638ffa9dc2d060df7042215e1662bd367c22ce Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 18 Jan 2024 16:47:27 +0100 Subject: [PATCH 16/18] change comment --- source/blender/makesdna/DNA_scene_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index d196266394a..c156de3df39 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1614,7 +1614,7 @@ typedef struct ToolSettings { /** Select Group Threshold. */ float select_thresh; - /* Auto-Keying Mode. */ + /* Keying Settings. */ /** Defines in DNA_userdef_types.h. */ short keying_flag; char autokey_mode; -- 2.30.2 From 69613931aad210c94e6b2f635849c1767b56c267 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Fri, 19 Jan 2024 12:13:52 +0100 Subject: [PATCH 17/18] add rename def --- source/blender/makesdna/intern/dna_rename_defs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/makesdna/intern/dna_rename_defs.h b/source/blender/makesdna/intern/dna_rename_defs.h index f5df8777238..416ac7978e1 100644 --- a/source/blender/makesdna/intern/dna_rename_defs.h +++ b/source/blender/makesdna/intern/dna_rename_defs.h @@ -219,6 +219,7 @@ DNA_STRUCT_RENAME_ELEM(bTheme, ttopbar, space_topbar) DNA_STRUCT_RENAME_ELEM(bTheme, tuserpref, space_preferences) DNA_STRUCT_RENAME_ELEM(bTheme, tv3d, space_view3d) DNA_STRUCT_RENAME_ELEM(bUserAssetLibrary, path, dirpath) +DNA_STRUCT_RENAME_ELEM(UserDef, autokey_flag, keying_flag) /* NOTE: Keep sorted! */ /* Write with a different name, old Blender versions crash loading files with non-NULL -- 2.30.2 From 31f7a6b1f1f47f874ed7aab0dc8de4121a96ebdb Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Fri, 19 Jan 2024 16:12:22 +0100 Subject: [PATCH 18/18] bump subversion --- source/blender/blenkernel/BKE_blender_version.h | 2 +- .../blender/blenloader/intern/versioning_userdef.cc | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index f499f28a5a3..d30e8c891a1 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -29,7 +29,7 @@ extern "C" { /* Blender file format version. */ #define BLENDER_FILE_VERSION BLENDER_VERSION -#define BLENDER_FILE_SUBVERSION 12 +#define BLENDER_FILE_SUBVERSION 13 /* Minimum Blender version that supports reading file written with the current * version. Older Blender versions will test this and cancel loading the file, showing a warning to diff --git a/source/blender/blenloader/intern/versioning_userdef.cc b/source/blender/blenloader/intern/versioning_userdef.cc index 9eb59766bfe..e523ff566ad 100644 --- a/source/blender/blenloader/intern/versioning_userdef.cc +++ b/source/blender/blenloader/intern/versioning_userdef.cc @@ -908,16 +908,19 @@ void blo_do_versions_userdef(UserDef *userdef) USER_ANIM_KEY_CHANNEL_CUSTOM_PROPERTIES); } + if (!USER_VERSION_ATLEAST(401, 13)) { + if (userdef->keying_flag & AUTOKEY_FLAG_INSERTNEEDED) { + userdef->keying_flag |= MANUALKEY_FLAG_INSERTNEEDED; + } + userdef->keying_flag |= AUTOKEY_FLAG_INSERTNEEDED; + } + /** * Always bump subversion in BKE_blender_version.h when adding versioning * code here, and wrap it inside a USER_VERSION_ATLEAST check. * * \note Keep this message at the bottom of the function. */ - if (userdef->keying_flag & AUTOKEY_FLAG_INSERTNEEDED) { - userdef->keying_flag |= MANUALKEY_FLAG_INSERTNEEDED; - } - userdef->keying_flag |= AUTOKEY_FLAG_INSERTNEEDED; LISTBASE_FOREACH (bTheme *, btheme, &userdef->themes) { do_versions_theme(userdef, btheme); -- 2.30.2