diff options
Diffstat (limited to 'release/scripts/ui/space_image.py')
-rw-r--r-- | release/scripts/ui/space_image.py | 114 |
1 files changed, 37 insertions, 77 deletions
diff --git a/release/scripts/ui/space_image.py b/release/scripts/ui/space_image.py index a28ddb90a40..99d41244431 100644 --- a/release/scripts/ui/space_image.py +++ b/release/scripts/ui/space_image.py @@ -19,7 +19,16 @@ # <pep8 compliant> import bpy -narrowui = bpy.context.user_preferences.view.properties_width_check + +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): @@ -335,7 +344,8 @@ class IMAGE_PT_image_properties(bpy.types.Panel): bl_region_type = 'UI' bl_label = "Image" - def poll(self, context): + @classmethod + def poll(cls, context): sima = context.space_data return (sima.image) @@ -354,7 +364,8 @@ class IMAGE_PT_game_properties(bpy.types.Panel): bl_region_type = 'UI' bl_label = "Game Properties" - def poll(self, context): + @classmethod + def poll(cls, context): rd = context.scene.render sima = context.space_data return (sima and sima.image) and (rd.engine == 'BLENDER_GAME') @@ -364,7 +375,6 @@ class IMAGE_PT_game_properties(bpy.types.Panel): sima = context.space_data ima = sima.image - wide_ui = context.region.width > narrowui split = layout.split() @@ -385,8 +395,7 @@ class IMAGE_PT_game_properties(bpy.types.Panel): sub.prop(ima, "tiles_x", text="X") sub.prop(ima, "tiles_y", text="Y") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Clamp:") col.prop(ima, "clamp_x", text="X") col.prop(ima, "clamp_y", text="Y") @@ -399,7 +408,8 @@ class IMAGE_PT_view_histogram(bpy.types.Panel): bl_region_type = 'PREVIEW' bl_label = "Histogram" - def poll(self, context): + @classmethod + def poll(cls, context): sima = context.space_data return (sima and sima.image) @@ -417,7 +427,8 @@ class IMAGE_PT_view_waveform(bpy.types.Panel): bl_region_type = 'PREVIEW' bl_label = "Waveform" - def poll(self, context): + @classmethod + def poll(cls, context): sima = context.space_data return (sima and sima.image) @@ -436,7 +447,8 @@ class IMAGE_PT_view_vectorscope(bpy.types.Panel): bl_region_type = 'PREVIEW' bl_label = "Vectorscope" - def poll(self, context): + @classmethod + def poll(cls, context): sima = context.space_data return (sima and sima.image) @@ -453,7 +465,8 @@ class IMAGE_PT_sample_line(bpy.types.Panel): bl_region_type = 'PREVIEW' bl_label = "Sample Line" - def poll(self, context): + @classmethod + def poll(cls, context): sima = context.space_data return (sima and sima.image) @@ -470,7 +483,8 @@ class IMAGE_PT_scope_sample(bpy.types.Panel): bl_region_type = 'PREVIEW' bl_label = "Scope Samples" - def poll(self, context): + @classmethod + def poll(cls, context): sima = context.space_data return sima @@ -490,7 +504,8 @@ class IMAGE_PT_view_properties(bpy.types.Panel): bl_region_type = 'UI' bl_label = "Display" - def poll(self, context): + @classmethod + def poll(cls, context): sima = context.space_data return (sima and (sima.image or sima.show_uvedit)) @@ -501,7 +516,6 @@ class IMAGE_PT_view_properties(bpy.types.Panel): ima = sima.image show_uvedit = sima.show_uvedit uvedit = sima.uv_editor - wide_ui = context.region.width > narrowui split = layout.split() @@ -509,8 +523,7 @@ class IMAGE_PT_view_properties(bpy.types.Panel): if ima: col.prop(ima, "display_aspect", text="Aspect Ratio") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Coordinates:") col.prop(sima, "draw_repeated", text="Repeat") if show_uvedit: @@ -528,10 +541,7 @@ class IMAGE_PT_view_properties(bpy.types.Panel): col = layout.column() col.label(text="UVs:") row = col.row() - if wide_ui: - row.prop(uvedit, "edge_draw_type", expand=True) - else: - row.prop(uvedit, "edge_draw_type", text="") + row.prop(uvedit, "edge_draw_type", expand=True) split = layout.split() col = split.column() @@ -540,8 +550,7 @@ class IMAGE_PT_view_properties(bpy.types.Panel): #col.prop(uvedit, "draw_edges") #col.prop(uvedit, "draw_faces") - if wide_ui: - col = split.column() + col = split.column() col.prop(uvedit, "draw_stretch", text="Stretch") sub = col.column() sub.active = uvedit.draw_stretch @@ -553,7 +562,8 @@ class IMAGE_PT_paint(bpy.types.Panel): bl_region_type = 'UI' bl_label = "Paint" - def poll(self, context): + @classmethod + def poll(cls, context): sima = context.space_data return sima.show_paint @@ -592,17 +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 - def poll(self, 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,17 +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 - def poll(self, 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 @@ -647,17 +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 - def poll(self, 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 @@ -674,41 +663,12 @@ class IMAGE_PT_paint_curve(bpy.types.Panel): row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE' row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX' -classes = [ - IMAGE_MT_view, - IMAGE_MT_select, - IMAGE_MT_image, - IMAGE_MT_uvs_showhide, - IMAGE_MT_uvs_transform, - IMAGE_MT_uvs_snap, - IMAGE_MT_uvs_mirror, - IMAGE_MT_uvs_weldalign, - IMAGE_MT_uvs, - IMAGE_HT_header, - IMAGE_PT_image_properties, - IMAGE_PT_paint, - IMAGE_PT_tools_brush_texture, - IMAGE_PT_paint_stroke, - IMAGE_PT_paint_curve, - IMAGE_PT_game_properties, - IMAGE_PT_view_properties, - IMAGE_PT_view_histogram, - IMAGE_PT_view_waveform, - IMAGE_PT_view_vectorscope, - IMAGE_PT_sample_line, - IMAGE_PT_scope_sample] - - def register(): - register = bpy.types.register - for cls in classes: - register(cls) + pass def unregister(): - unregister = bpy.types.unregister - for cls in classes: - unregister(cls) + pass if __name__ == "__main__": register() |