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
This commit is contained in:
Aaron Carlisle 2021-01-02 16:09:31 -05:00 committed by Aaron Carlisle
parent 0330b0552b
commit e1b8af9ba7
1 changed files with 16 additions and 7 deletions

View File

@ -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
if not active:
layout.active = False
layout.label(text="No active track")
return
col = layout.column()
col.prop(active, "motion_model")
col.prop(active, "pattern_match", text="Match")
active = clip.tracking.tracks.active
if active:
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