I am writing an addon that displays in the Mask mode of the Clip Editor. I only want my panel to display when there is an active mask selected. Currently, it shows only when in mask mode and the video clip collection is not empty. The goal is to have it appear when the normal mask panel shows up. (When a mask has been created and is selected). So how do I go about getting the actively selected mask? Or at least its ID so I can get it using
py.data.masks[ID] and check to make sure it's not none?
Here is my current code:
class TEST_PT_Panel(bpy.types.Panel): bl_idname = "TEST_PT_Panel" bl_label = "Export Mask" bl_category = "Masking Addon" bl_space_type = "CLIP_EDITOR" bl_region_type = "UI" def draw(self, context): layout = self.layout row = layout.row() row.operator('clipeditor.export_mask', text="Export") if len(bpy.data.masks) == 0: row.enabled = False #other ui... @classmethod def poll(cls, context): #should only show when in MASK mode and there is an active mask return (context.space_data.mode == 'MASK') & (len(bpy.data.movieclips) > 0)