[Bf-extensions-cvs] [36974bed] master: Amaranth: Fix Jump Keyframes layout

Pablo Vazquez noreply at git.blender.org
Tue Sep 20 00:48:11 CEST 2022


Commit: 36974bed34488753231261e771a60a5afbea7576
Author: Pablo Vazquez
Date:   Tue Sep 20 00:48:06 2022 +0200
Branches: master
https://developer.blender.org/rBA36974bed34488753231261e771a60a5afbea7576

Amaranth: Fix Jump Keyframes layout

* Move into its own sub-panel inside the Keyframes panel

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

M	amaranth/__init__.py
M	amaranth/animation/jump_frames.py

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

diff --git a/amaranth/__init__.py b/amaranth/__init__.py
index 4442e344..61d979b2 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 db65709b..16dae391 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()



More information about the Bf-extensions-cvs mailing list