From e0ee74a171135e0e13a65eb60fc352eb34ada542 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 27 Jan 2015 02:09:50 +1300 Subject: Fix T38619: Confusing logic for Keying Set keyframing Settings The logic used for determining whether certain keyframing settings (i.e. visual, only needed, xyz -> rgb) got applied was wonky. The original intention here was that the Keying Set settings would override the global settings, and the path settings would override what was used for the Keying Set. However, that was not happening in all cases previously, as it was only possible to add flags and not to turn them off. This commit fixes that by introducing separate toggles to control whether the Keying Set/Path's settings override the settings inherited from its parent (i.e. the Keying Set for the Path, and the User Prefs for the Keying Set). The icons used for these toggles could get revised a bit (we need something which communicates "override this"; the current one is the closest I could find) WARNING: If you have old keying sets, this may cause some breakage! --- release/scripts/startup/bl_ui/properties_scene.py | 58 +++++++++++++++++++---- 1 file changed, 50 insertions(+), 8 deletions(-) (limited to 'release/scripts/startup/bl_ui/properties_scene.py') diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index 5d822cef9af..5e4c9314479 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -85,7 +85,53 @@ class SCENE_PT_unit(SceneButtonsPanel, Panel): row.prop(unit, "use_separate") -class SCENE_PT_keying_sets(SceneButtonsPanel, Panel): +class SceneKeyingSetsPanel(): + def draw_keyframing_settings(self, context, layout, ks, ksp): + self.draw_keyframing_setting(context, layout, ks, ksp, "Needed", + "use_insertkey_override_needed", "use_insertkey_needed", + userpref_fallback="use_keyframe_insert_needed") + + self.draw_keyframing_setting(context, layout, ks, ksp, "Visual", + "use_insertkey_override_visual", "use_insertkey_visual", + userpref_fallback="use_visual_keying") + + self.draw_keyframing_setting(context, layout, ks, ksp, "XYZ to RGB", + "use_insertkey_override_xyz_to_rgb", "use_insertkey_xyz_to_rgb") + + def draw_keyframing_setting(self, context, layout, ks, ksp, label, toggle_prop, prop, userpref_fallback=None): + if ksp: + item = ksp + + if getattr(ks, toggle_prop): + owner = ks + propname = prop + else: + owner = context.user_preferences.edit + if userpref_fallback: + propname = userpref_fallback + else: + propname = prop + else: + item = ks + + owner = context.user_preferences.edit + if userpref_fallback: + propname = userpref_fallback + else: + propname = prop + + row = layout.row(align=True) + row.prop(item, toggle_prop, text="", icon='STYLUS_PRESSURE', toggle=True) # XXX: needs dedicated icon + + subrow = row.row() + subrow.active = getattr(item, toggle_prop) + if subrow.active: + subrow.prop(item, prop, text=label) + else: + subrow.prop(owner, propname, text=label) + + +class SCENE_PT_keying_sets(SceneButtonsPanel, SceneKeyingSetsPanel, Panel): bl_label = "Keying Sets" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -115,12 +161,10 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, Panel): col = row.column() col.label(text="Keyframing Settings:") - 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") + self.draw_keyframing_settings(context, col, ks, None) -class SCENE_PT_keying_set_paths(SceneButtonsPanel, Panel): +class SCENE_PT_keying_set_paths(SceneButtonsPanel, SceneKeyingSetsPanel, Panel): bl_label = "Active Keying Set" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -173,9 +217,7 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel, Panel): col = row.column() col.label(text="Keyframing Settings:") - 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") + self.draw_keyframing_settings(context, col, ks, ksp) class SCENE_PT_color_management(SceneButtonsPanel, Panel): -- cgit v1.2.3