From e1b8af9ba7d833496ae222b93f889aa8e6df03fd Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Sat, 2 Jan 2021 16:09:31 -0500 Subject: Fix Unreported: Run time error in UI code Steps to reproduce: 1. Add clip to clip editor 2. Open the tracking settings & tracking settings extra panels To fix this the sub panel is only drawn if a track is active. The main panel will exit early and display a "No active track" message. This is consistent with other panels in the clip editor. Reviewed By: HooglyBoogly Differential Revision: https://developer.blender.org/D9727 --- release/scripts/startup/bl_ui/space_clip.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'release/scripts/startup/bl_ui') diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index a0cf22877d5..35fd7333cf4 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -807,16 +807,19 @@ class CLIP_PT_track_settings(CLIP_PT_tracking_panel, Panel): layout.use_property_decorate = False clip = context.space_data.clip + active = clip.tracking.tracks.active - col = layout.column() + if not active: + layout.active = False + layout.label(text="No active track") + return - active = clip.tracking.tracks.active - if active: - col.prop(active, "motion_model") - col.prop(active, "pattern_match", text="Match") + col = layout.column() + col.prop(active, "motion_model") + col.prop(active, "pattern_match", text="Match") - col.prop(active, "use_brute") - col.prop(active, "use_normalization") + col.prop(active, "use_brute") + col.prop(active, "use_normalization") class CLIP_PT_track_settings_extras(CLIP_PT_tracking_panel, Panel): @@ -827,6 +830,12 @@ class CLIP_PT_track_settings_extras(CLIP_PT_tracking_panel, Panel): bl_parent_id = 'CLIP_PT_track_settings' bl_options = {'DEFAULT_CLOSED'} + @classmethod + def poll(cls, context): + clip = context.space_data.clip + + return clip.tracking.tracks.active + def draw(self, context): layout = self.layout layout.use_property_split = True -- cgit v1.2.3