[Bf-blender-cvs] [8db4a24] master: Bugfix T43343: Buttons for Keyframing Settings are Mutually Exclusive

Joshua Leung noreply at git.blender.org
Mon Jan 26 08:11:12 CET 2015


Commit: 8db4a24e4efc6d94e69e790a1ce3179f2e9948e7
Author: Joshua Leung
Date:   Mon Jan 26 19:15:46 2015 +1300
Branches: master
https://developer.blender.org/rB8db4a24e4efc6d94e69e790a1ce3179f2e9948e7

Bugfix T43343: Buttons for Keyframing Settings are Mutually Exclusive

Since 1c3f2354f83b3e79dee31d837ca4d7c08d2c3f26 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)

===================================================================

M	release/scripts/startup/bl_operators/anim.py
M	release/scripts/startup/bl_ui/properties_scene.py
M	source/blender/makesrna/intern/rna_animation.c

===================================================================

diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py
index 39bb7e9..36445d7 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 d172596..5d822ce 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 12fa754..8e1d4c0 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);




More information about the Bf-blender-cvs mailing list