Fix #119623: Anim: unintended API change in keyframe_insert() function

Bring back the `INSERTKEY_XYZ_TO_RGB` enum item for the
`keyframe_insert()` function (it was removed in 30b0c5b225). This way
any Python code that targets Blender 4.x can safely pass this flag,
without having to check specific Blender versions.

Note that the flag is implemented as a no-op, as the behaviour change
introduced in 30b0c5b225 (just looking at the user preference) is still
retained. The purpose of this commit is simply to avoid the `ValueError`
exception that would otherwise be raised.

This should also fix Rigify report blender/blender-addons#105241.

Pull Request: https://projects.blender.org/blender/blender/pulls/119625
This commit is contained in:
Sybren A. Stüvel 2024-03-19 10:05:22 +01:00
parent 51cdf665ab
commit 30711d1398
2 changed files with 15 additions and 2 deletions

View file

@ -51,6 +51,12 @@ const EnumPropertyItem rna_enum_keying_flag_items[] = {
0,
"Visual Keying",
"Insert keyframes based on 'visual transforms'"},
{0,
"INSERTKEY_XYZ_TO_RGB",
0,
"XYZ=RGB Colors (ignored)",
"This flag is no longer in use, and is here so that code that uses it doesn't break. The "
"XYZ=RGB coloring is determined by the animation preferences"},
{0, nullptr, 0, nullptr, nullptr},
};
@ -66,6 +72,12 @@ const EnumPropertyItem rna_enum_keying_flag_api_items[] = {
0,
"Visual Keying",
"Insert keyframes based on 'visual transforms'"},
{0,
"INSERTKEY_XYZ_TO_RGB",
0,
"XYZ=RGB Colors (ignored)",
"This flag is no longer in use, and is here so that code that uses it doesn't break. The "
"XYZ=RGB coloring is determined by the animation preferences"},
{INSERTKEY_REPLACE,
"INSERTKEY_REPLACE",
0,

View file

@ -297,8 +297,9 @@ char pyrna_struct_keyframe_insert_doc[] =
" - ``INSERTKEY_NEEDED`` Only insert keyframes where they're needed in the relevant "
"F-Curves.\n"
" - ``INSERTKEY_VISUAL`` Insert keyframes based on 'visual transforms'.\n"
" - ``INSERTKEY_XYZ_TO_RGB`` Color for newly added transformation F-Curves (Location, "
"Rotation, Scale) is based on the transform axis.\n"
" - ``INSERTKEY_XYZ_TO_RGB`` This flag is no longer in use, and is here so that code "
"that uses it doesn't break. The XYZ=RGB coloring is determined by the animation "
"preferences.\n"
" - ``INSERTKEY_REPLACE`` Only replace already existing keyframes.\n"
" - ``INSERTKEY_AVAILABLE`` Only insert into already existing F-Curves.\n"
" - ``INSERTKEY_CYCLE_AWARE`` Take cyclic extrapolation into account "