[Bf-blender-cvs] [6d7a6c46eb1] tracking_tools: MCE: Only options in toolbar in correct context

Sebastian Koenig noreply at git.blender.org
Wed Jul 14 15:19:33 CEST 2021


Commit: 6d7a6c46eb1abcadfd1d84a48b6a945ef9317b20
Author: Sebastian Koenig
Date:   Wed Jul 14 15:15:44 2021 +0200
Branches: tracking_tools
https://developer.blender.org/rB6d7a6c46eb1abcadfd1d84a48b6a945ef9317b20

MCE: Only options in toolbar in correct context

Some popovers produced errors if no clip was loaded yet or the wrong
mode was active.

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

M	release/scripts/startup/bl_ui/space_clip.py

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

diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index 68e6f3c5144..7c3528af0e2 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -160,8 +160,11 @@ class CLIP_HT_tool_header(Header):
         from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
         tool = ToolSelectPanelHelper.draw_active_tool_header(context, layout)
         tool_mode = context.mode if tool is None else tool.mode
-        layout.separator()
-        CLIP_PT_tracking_settings_presets.draw_menu(self.layout)
+        if tool_mode == 'TRACKING':
+            clip = context.space_data.clip
+            if clip:
+                layout.separator()
+                CLIP_PT_tracking_settings_presets.draw_menu(self.layout)
 
     def draw_mode_settings(self, context):
         layout = self.layout
@@ -171,14 +174,14 @@ class CLIP_HT_tool_header(Header):
         from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
         tool = ToolSelectPanelHelper.tool_active_from_context(context)
         tool_mode = context.mode if tool is None else tool.mode
-        if tool_mode == 'TRACKING':
-            clip = context.space_data.clip
-            active = clip.tracking.tracks.active
-            settings = clip.tracking.settings
-            # Expand panels from the side-bar as popovers.
-            layout.popover(panel="CLIP_PT_track_settings")
-            layout.popover(panel="CLIP_PT_objects")
-            layout.prop(settings, "speed", text="")
+        clip = context.space_data.clip
+        if clip:
+            if tool_mode == 'TRACKING':
+                layout.popover(panel='CLIP_PT_track_settings')
+                settings = clip.tracking.settings
+                layout.prop(settings, "speed", text="")
+
+            layout.popover(panel='CLIP_PT_objects')
 
 
 class CLIP_HT_header(Header):



More information about the Bf-blender-cvs mailing list