diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py index 39bb7e90948..36445d742e2 100644 --- a/release/scripts/startup/bl_operators/anim.py +++ b/release/scripts/startup/bl_operators/anim.py @@ -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") # -------------------------------------------------------- diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index d172596d51f..5d822cef9af 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -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): diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 12fa754e636..8e1d4c0e333 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -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);