diff options
Diffstat (limited to 'release/scripts/ui/space_image.py')
-rw-r--r-- | release/scripts/ui/space_image.py | 77 |
1 files changed, 32 insertions, 45 deletions
diff --git a/release/scripts/ui/space_image.py b/release/scripts/ui/space_image.py index 2bd394809d5..99d41244431 100644 --- a/release/scripts/ui/space_image.py +++ b/release/scripts/ui/space_image.py @@ -20,6 +20,17 @@ import bpy +class BrushButtonsPanel(): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'UI' + + @classmethod + def poll(cls, context): + sima = context.space_data + toolsettings = context.tool_settings.image_paint + return sima.show_paint and toolsettings.brush + + class IMAGE_MT_view(bpy.types.Menu): bl_label = "View" @@ -333,8 +344,8 @@ class IMAGE_PT_image_properties(bpy.types.Panel): bl_region_type = 'UI' bl_label = "Image" - @staticmethod - def poll(context): + @classmethod + def poll(cls, context): sima = context.space_data return (sima.image) @@ -353,8 +364,8 @@ class IMAGE_PT_game_properties(bpy.types.Panel): bl_region_type = 'UI' bl_label = "Game Properties" - @staticmethod - def poll(context): + @classmethod + def poll(cls, context): rd = context.scene.render sima = context.space_data return (sima and sima.image) and (rd.engine == 'BLENDER_GAME') @@ -397,8 +408,8 @@ class IMAGE_PT_view_histogram(bpy.types.Panel): bl_region_type = 'PREVIEW' bl_label = "Histogram" - @staticmethod - def poll(context): + @classmethod + def poll(cls, context): sima = context.space_data return (sima and sima.image) @@ -416,8 +427,8 @@ class IMAGE_PT_view_waveform(bpy.types.Panel): bl_region_type = 'PREVIEW' bl_label = "Waveform" - @staticmethod - def poll(context): + @classmethod + def poll(cls, context): sima = context.space_data return (sima and sima.image) @@ -436,8 +447,8 @@ class IMAGE_PT_view_vectorscope(bpy.types.Panel): bl_region_type = 'PREVIEW' bl_label = "Vectorscope" - @staticmethod - def poll(context): + @classmethod + def poll(cls, context): sima = context.space_data return (sima and sima.image) @@ -454,8 +465,8 @@ class IMAGE_PT_sample_line(bpy.types.Panel): bl_region_type = 'PREVIEW' bl_label = "Sample Line" - @staticmethod - def poll(context): + @classmethod + def poll(cls, context): sima = context.space_data return (sima and sima.image) @@ -472,8 +483,8 @@ class IMAGE_PT_scope_sample(bpy.types.Panel): bl_region_type = 'PREVIEW' bl_label = "Scope Samples" - @staticmethod - def poll(context): + @classmethod + def poll(cls, context): sima = context.space_data return sima @@ -493,8 +504,8 @@ class IMAGE_PT_view_properties(bpy.types.Panel): bl_region_type = 'UI' bl_label = "Display" - @staticmethod - def poll(context): + @classmethod + def poll(cls, context): sima = context.space_data return (sima and (sima.image or sima.show_uvedit)) @@ -551,8 +562,8 @@ class IMAGE_PT_paint(bpy.types.Panel): bl_region_type = 'UI' bl_label = "Paint" - @staticmethod - def poll(context): + @classmethod + def poll(cls, context): sima = context.space_data return sima.show_paint @@ -591,18 +602,10 @@ class IMAGE_PT_paint(bpy.types.Panel): col.prop(brush, "clone_alpha", text="Alpha") -class IMAGE_PT_tools_brush_texture(bpy.types.Panel): - bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'UI' +class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, bpy.types.Panel): bl_label = "Texture" bl_default_closed = True - @staticmethod - def poll(context): - sima = context.space_data - toolsettings = context.tool_settings.image_paint - return sima.show_paint and toolsettings.brush - def draw(self, context): layout = self.layout @@ -616,18 +619,10 @@ class IMAGE_PT_tools_brush_texture(bpy.types.Panel): col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8) -class IMAGE_PT_paint_stroke(bpy.types.Panel): - bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'UI' +class IMAGE_PT_paint_stroke(BrushButtonsPanel, bpy.types.Panel): bl_label = "Paint Stroke" bl_default_closed = True - @staticmethod - def poll(context): - sima = context.space_data - toolsettings = context.tool_settings.image_paint - return sima.show_paint and toolsettings.brush - def draw(self, context): layout = self.layout @@ -648,18 +643,10 @@ class IMAGE_PT_paint_stroke(bpy.types.Panel): layout.prop(brush, "use_wrap") -class IMAGE_PT_paint_curve(bpy.types.Panel): - bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'UI' +class IMAGE_PT_paint_curve(BrushButtonsPanel, bpy.types.Panel): bl_label = "Paint Curve" bl_default_closed = True - @staticmethod - def poll(context): - sima = context.space_data - toolsettings = context.tool_settings.image_paint - return sima.show_paint and toolsettings.brush - def draw(self, context): layout = self.layout |