Bugfix T43343: Buttons for Keyframing Settings are Mutually Exclusive

Since 1c3f2354f8 the keyframing settings on
Keying Sets have been incorrectly displayed as a clump of toggle buttons,
which are usually only used when only one of the options apply.

Reverting this back to how it was, while leaving bl_options in place still for
the one case where it makes sense to do it that way (i.e. for KeyingSetInfo)
This commit is contained in:
Joshua Leung 2015-01-26 19:15:46 +13:00
parent 146a0e9447
commit 8db4a24e4e
Notes: blender-bot 2023-09-08 04:55:43 +02:00
Referenced by issue #43343, Butttons for Keyframing Settings Are Mutually Exclusive
3 changed files with 39 additions and 12 deletions

View File

@ -84,7 +84,9 @@ class ANIM_OT_keying_set_export(Operator):
f.write("ks.is_path_absolute = False\n")
f.write("\n")
f.write("ks.bl_options = %r\n" % ks.bl_options)
f.write("ks.use_insertkey_needed = %s\n" % ks.use_insertkey_needed)
f.write("ks.use_insertkey_visual = %s\n" % ks.use_insertkey_visual)
f.write("ks.use_insertkey_xyz_to_rgb = %s\n" % ks.use_insertkey_xyz_to_rgb)
f.write("\n")
# --------------------------------------------------------

View File

@ -115,7 +115,9 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, Panel):
col = row.column()
col.label(text="Keyframing Settings:")
col.prop(ks, "bl_options")
col.prop(ks, "use_insertkey_needed", text="Needed")
col.prop(ks, "use_insertkey_visual", text="Visual")
col.prop(ks, "use_insertkey_xyz_to_rgb", text="XYZ to RGB")
class SCENE_PT_keying_set_paths(SceneButtonsPanel, Panel):
@ -171,7 +173,9 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel, Panel):
col = row.column()
col.label(text="Keyframing Settings:")
col.prop(ksp, "bl_options")
col.prop(ksp, "use_insertkey_needed", text="Needed")
col.prop(ksp, "use_insertkey_visual", text="Visual")
col.prop(ksp, "use_insertkey_xyz_to_rgb", text="XYZ to RGB")
class SCENE_PT_color_management(SceneButtonsPanel, Panel):

View File

@ -554,16 +554,24 @@ static FCurve *rna_Driver_from_existing(AnimData *adt, bContext *C, FCurve *src_
#else
/* helper function for Keying Set -> keying settings */
/* TODO: use reg option! */
static void rna_def_common_keying_flags(StructRNA *srna, short UNUSED(reg))
static void rna_def_common_keying_flags(StructRNA *srna, short reg)
{
PropertyRNA *prop;
prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "keyingflag");
RNA_def_property_enum_items(prop, keying_flag_items);
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
RNA_def_property_ui_text(prop, "Options", "Keying set options");
prop = RNA_def_property(srna, "use_insertkey_needed", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_NEEDED);
RNA_def_property_ui_text(prop, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves");
if (reg) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
prop = RNA_def_property(srna, "use_insertkey_visual", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_MATRIX);
RNA_def_property_ui_text(prop, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'");
if (reg) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
prop = RNA_def_property(srna, "use_insertkey_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_XYZ2RGB);
RNA_def_property_ui_text(prop, "F-Curve Colors - XYZ to RGB", "Color for newly added transformation F-Curves (Location, Rotation, Scale) and also Color is based on the transform axis");
if (reg) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
}
/* --- */
@ -610,7 +618,20 @@ static void rna_def_keyingset_info(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
RNA_def_property_ui_text(prop, "Description", "A short description of the keying set");
rna_def_common_keying_flags(srna, 1); /* '1' arg here is to indicate that we need these to be set on registering */
/* Regarding why we don't use rna_def_common_keying_flags() here:
* - Using it would keep this case in sync with the other places
* where these options are exposed (which are optimised for being
* used in the UI).
* - Unlike all the other places, this case is used for defining
* new "built in" Keying Sets via the Python API. In that case,
* it makes more sense to expose these in a way more similar to
* other places featuring bl_idname/label/description (i.e. operators)
*/
prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "keyingflag");
RNA_def_property_enum_items(prop, keying_flag_items);
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
RNA_def_property_ui_text(prop, "Options", "Keying Set options to use when inserting keyframes");
RNA_define_verify_sdna(1);