From 36974bed34488753231261e771a60a5afbea7576 Mon Sep 17 00:00:00 2001
From: Pablo Vazquez <pablo@blender.org>
Date: Tue, 20 Sep 2022 00:48:06 +0200
Subject: [PATCH] Amaranth: Fix Jump Keyframes layout

* Move into its own sub-panel inside the Keyframes panel
---
 amaranth/__init__.py              |  2 +-
 amaranth/animation/jump_frames.py | 46 ++++++++++++++-----------------
 2 files changed, 22 insertions(+), 26 deletions(-)

diff --git a/amaranth/__init__.py b/amaranth/__init__.py
index 4442e344f..61d979b2f 100644
--- a/amaranth/__init__.py
+++ b/amaranth/__init__.py
@@ -72,7 +72,7 @@ from amaranth.misc import (
 bl_info = {
     "name": "Amaranth Toolset",
     "author": "Pablo Vazquez, Bassam Kurdali, Sergey Sharybin, Lukas Tönne, Cesar Saez, CansecoGPC",
-    "version": (1, 0, 16),
+    "version": (1, 0, 17),
     "blender": (3, 2, 0),
     "location": "Everywhere!",
     "description": "A collection of tools and settings to improve productivity",
diff --git a/amaranth/animation/jump_frames.py b/amaranth/animation/jump_frames.py
index db65709bc..16dae3916 100644
--- a/amaranth/animation/jump_frames.py
+++ b/amaranth/animation/jump_frames.py
@@ -16,7 +16,7 @@ Find it on the User Preferences, Editing.
 """
 
 import bpy
-from bpy.types import Operator
+from bpy.types import Operator, Panel
 from bpy.props import BoolProperty
 
 KEYMAPS = list()
@@ -129,40 +129,35 @@ class AMTH_SCREEN_OT_frame_jump(Operator):
         return {"FINISHED"}
 
 
-def ui_userpreferences_edit(self, context):
-    get_addon = "amaranth" in context.preferences.addons.keys()
-    if not get_addon:
-        return
+class AMTH_USERPREF_PT_animation(Panel):
+    bl_space_type = 'PREFERENCES'
+    bl_region_type = 'WINDOW'
+    bl_label = "Jump Keyframes"
+    bl_parent_id = "USERPREF_PT_animation_keyframes"
 
-    preferences = context.preferences.addons["amaranth"].preferences
-
-    col = self.layout.column()
-    split = col.split(factor=0.21)
-    split.prop(preferences, "frames_jump",
-               text="Frames to Jump")
-
-
-def label(self, context):
-    get_addon = "amaranth" in context.preferences.addons.keys()
-    if not get_addon:
-        return
+    def draw(self, context):
+        preferences = context.preferences.addons["amaranth"].preferences
 
-    layout = self.layout
+        layout = self.layout
 
-    if context.preferences.addons["amaranth"].preferences.use_timeline_extra_info:
-        row = layout.row(align=True)
+        col = layout.column()
+        row = col.row()
+        row.label(text="Frames to Jump")
+        row.prop(preferences, "frames_jump", text="")
 
+        col = layout.column()
+        row = col.row()
+        row.label(text="Jump Operators")
         row.operator(AMTH_SCREEN_OT_keyframe_jump_inbetween.bl_idname,
-                     icon="PREV_KEYFRAME", text="").backwards = True
+                     icon="PREV_KEYFRAME", text="Jump to Previous").backwards = True
         row.operator(AMTH_SCREEN_OT_keyframe_jump_inbetween.bl_idname,
-                     icon="NEXT_KEYFRAME", text="").backwards = False
+                     icon="NEXT_KEYFRAME", text="Jump to Next").backwards = False
 
 
 def register():
+    bpy.utils.register_class(AMTH_USERPREF_PT_animation)
     bpy.utils.register_class(AMTH_SCREEN_OT_frame_jump)
     bpy.utils.register_class(AMTH_SCREEN_OT_keyframe_jump_inbetween)
-    bpy.types.USERPREF_PT_animation_timeline.append(ui_userpreferences_edit)
-    bpy.types.USERPREF_PT_animation_timeline.append(label)
 
     # register keyboard shortcuts
     wm = bpy.context.window_manager
@@ -189,9 +184,10 @@ def register():
 
 
 def unregister():
+    bpy.utils.unregister_class(AMTH_USERPREF_PT_animation)
     bpy.utils.unregister_class(AMTH_SCREEN_OT_frame_jump)
     bpy.utils.unregister_class(AMTH_SCREEN_OT_keyframe_jump_inbetween)
-    bpy.types.USERPREF_PT_animation_timeline.remove(ui_userpreferences_edit)
+
     for km, kmi in KEYMAPS:
         km.keymap_items.remove(kmi)
     KEYMAPS.clear()
-- 
GitLab