diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-07-21 14:02:05 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-07-21 14:02:05 +0400 |
commit | f745564e4ee791e4faf804b09ce975b882f4f8d9 (patch) | |
tree | 90ebbe363ccd925cedc652c9bb018ce552b5a2ab /release/scripts/startup/bl_ui/space_image.py | |
parent | 8489b94e07f9e73bd3c9c3e4f6a91f1f0a259827 (diff) |
GSOC 2013 paint
Yep, at last it's here!
There are a few minor issues remaining but development can go on in
master after discussion at blender institute.
For full list of features see:
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.72/Painting
Thanks to Sergey and Campbell for the extensive review and to the
countless artists that have given their input and reported issues during
development.
Diffstat (limited to 'release/scripts/startup/bl_ui/space_image.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_image.py | 130 |
1 files changed, 83 insertions, 47 deletions
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 97c89df0693..b3ba3b6305f 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -22,6 +22,7 @@ from bpy.types import Header, Menu, Panel from bl_ui.properties_paint_common import ( UnifiedPaintPanel, brush_texture_settings, + brush_texpaint_common, brush_mask_texture_settings, ) from bl_ui.properties_grease_pencil_common import GreasePencilPanel @@ -31,13 +32,11 @@ from bpy.app.translations import pgettext_iface as iface_ class ImagePaintPanel(UnifiedPaintPanel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'TOOLS' - bl_category = "Tools" -class BrushButtonsPanel: +class BrushButtonsPanel(UnifiedPaintPanel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'TOOLS' - bl_category = "Tools" @classmethod def poll(cls, context): @@ -66,6 +65,7 @@ class IMAGE_MT_view(Menu): sima = context.space_data uv = sima.uv_editor toolsettings = context.tool_settings + paint = toolsettings.image_paint show_uvedit = sima.show_uvedit show_render = sima.show_render @@ -80,6 +80,8 @@ class IMAGE_MT_view(Menu): layout.prop(toolsettings, "show_uv_local_view") layout.prop(uv, "show_other_objects") + if paint.brush and (context.image_paint_object or sima.mode == 'PAINT'): + layout.prop(uv, "show_texpaint") layout.separator() @@ -140,6 +142,24 @@ class IMAGE_MT_select(Menu): layout.operator("uv.select_split") +class IMAGE_MT_brush(Menu): + bl_label = "Brush" + + def draw(self, context): + layout = self.layout + toolsettings = context.tool_settings + settings = toolsettings.image_paint + brush = settings.brush + + ups = context.tool_settings.unified_paint_settings + layout.prop(ups, "use_unified_size", text="Unified Size") + layout.prop(ups, "use_unified_strength", text="Unified Strength") + layout.separator() + + # brush tool + layout.prop_menu_enum(brush, "image_tool") + + class IMAGE_MT_image(Menu): bl_label = "Image" @@ -382,7 +402,6 @@ class IMAGE_HT_header(Header): mode = sima.mode show_render = sima.show_render - # show_paint = sima.show_paint show_uvedit = sima.show_uvedit show_maskedit = sima.show_maskedit @@ -401,8 +420,7 @@ class IMAGE_HT_header(Header): row = layout.row() row.template_ID(sima, "mask", new="mask.new") - if show_uvedit or show_maskedit: - layout.prop(sima, "pivot_point", icon_only=True) + layout.prop(sima, "pivot_point", icon_only=True) # uv editing if show_uvedit: @@ -462,6 +480,7 @@ class MASK_MT_editor_menus(Menu): show_uvedit = sima.show_uvedit show_maskedit = sima.show_maskedit + show_paint = sima.show_paint layout.menu("IMAGE_MT_view") @@ -469,6 +488,8 @@ class MASK_MT_editor_menus(Menu): layout.menu("IMAGE_MT_select") if show_maskedit: layout.menu("MASK_MT_select") + if show_paint: + layout.menu("IMAGE_MT_brush") if ima and ima.is_dirty: layout.menu("IMAGE_MT_image", text="Image*") @@ -658,49 +679,27 @@ class IMAGE_PT_tools_transform_uvs(Panel, UVToolsPanel): col.operator("transform.shear") -class IMAGE_PT_paint(Panel, ImagePaintPanel): +class IMAGE_PT_paint(Panel, BrushButtonsPanel): bl_label = "Paint" - - @classmethod - def poll(cls, context): - sima = context.space_data - return sima.show_paint + bl_category = "Tools" def draw(self, context): layout = self.layout - toolsettings = context.tool_settings.image_paint - brush = toolsettings.brush + settings = context.tool_settings.image_paint + brush = settings.brush col = layout.column() - col.template_ID_preview(toolsettings, "brush", new="brush.add", rows=2, cols=6) + col.template_ID_preview(settings, "brush", new="brush.add", rows=2, cols=6) if brush: - col = layout.column() - - if brush.image_tool == 'DRAW' and brush.blend not in ('ERASE_ALPHA', 'ADD_ALPHA'): - col.template_color_picker(brush, "color", value_slider=True) - col.prop(brush, "color", text="") - - row = col.row(align=True) - self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius") - self.prop_unified_size(row, context, brush, "use_pressure_size") - - row = col.row(align=True) - self.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength") - self.prop_unified_strength(row, context, brush, "use_pressure_strength") - - col.prop(brush, "blend", text="Blend") - - if brush.image_tool == 'CLONE': - col.separator() - col.prop(brush, "clone_image", text="Image") - col.prop(brush, "clone_alpha", text="Alpha") + brush_texpaint_common(self, context, layout, brush, settings) class IMAGE_PT_tools_brush_overlay(BrushButtonsPanel, Panel): bl_label = "Overlay" bl_options = {'DEFAULT_CLOSED'} + bl_category = "Options" def draw(self, context): layout = self.layout @@ -754,6 +753,7 @@ class IMAGE_PT_tools_brush_overlay(BrushButtonsPanel, Panel): class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel): bl_label = "Texture" bl_options = {'DEFAULT_CLOSED'} + bl_category = "Tools" def draw(self, context): layout = self.layout @@ -770,6 +770,7 @@ class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel): class IMAGE_PT_tools_mask_texture(BrushButtonsPanel, Panel): bl_label = "Texture Mask" bl_options = {'DEFAULT_CLOSED'} + bl_category = "Tools" def draw(self, context): layout = self.layout @@ -786,6 +787,7 @@ class IMAGE_PT_tools_mask_texture(BrushButtonsPanel, Panel): class IMAGE_PT_tools_brush_tool(BrushButtonsPanel, Panel): bl_label = "Tool" bl_options = {'DEFAULT_CLOSED'} + bl_category = "Options" def draw(self, context): layout = self.layout @@ -804,6 +806,7 @@ class IMAGE_PT_tools_brush_tool(BrushButtonsPanel, Panel): class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel): bl_label = "Paint Stroke" bl_options = {'DEFAULT_CLOSED'} + bl_category = "Tools" def draw(self, context): layout = self.layout @@ -828,10 +831,19 @@ class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel): if brush.use_space: col.separator() row = col.row(align=True) - row.active = brush.use_space row.prop(brush, "spacing", text="Spacing") row.prop(brush, "use_pressure_spacing", toggle=True, text="") + if brush.use_line or brush.use_curve: + col.separator() + row = col.row(align=True) + row.prop(brush, "spacing", text="Spacing") + + if brush.use_curve: + col.separator() + col.template_ID(brush, "paint_curve", new="paintcurve.new") + col.operator("paintcurve.draw") + col = layout.column() col.separator() @@ -846,25 +858,23 @@ class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel): col = layout.column() col.separator() - col.prop(brush, "use_smooth_stroke") + if brush.brush_capabilities.has_smooth_stroke: + col.prop(brush, "use_smooth_stroke") - sub = col.column() - sub.active = brush.use_smooth_stroke - sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True) - sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True) + sub = col.column() + sub.active = brush.use_smooth_stroke + sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True) + sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True) - col.separator() + col.separator() col.prop(toolsettings, "input_samples") - col.separator() - - col.prop(brush, "use_wrap") - class IMAGE_PT_paint_curve(BrushButtonsPanel, Panel): bl_label = "Paint Curve" bl_options = {'DEFAULT_CLOSED'} + bl_category = "Tools" def draw(self, context): layout = self.layout @@ -874,7 +884,8 @@ class IMAGE_PT_paint_curve(BrushButtonsPanel, Panel): layout.template_curve_mapping(brush, "curve") - row = layout.row(align=True) + col = layout.column(align=True) + row = col.row(align=True) row.operator("brush.curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH' row.operator("brush.curve_preset", icon='SPHERECURVE', text="").shape = 'ROUND' row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT' @@ -886,6 +897,7 @@ class IMAGE_PT_paint_curve(BrushButtonsPanel, Panel): class IMAGE_PT_tools_brush_appearance(BrushButtonsPanel, Panel): bl_label = "Appearance" bl_options = {'DEFAULT_CLOSED'} + bl_category = "Options" def draw(self, context): layout = self.layout @@ -912,6 +924,30 @@ class IMAGE_PT_tools_brush_appearance(BrushButtonsPanel, Panel): sub.prop(brush, "icon_filepath", text="") +class IMAGE_PT_tools_paint_options(BrushButtonsPanel, Panel): + bl_label = "Image Paint" + bl_category = "Options" + + def draw(self, context): + layout = self.layout + + toolsettings = context.tool_settings + brush = toolsettings.image_paint.brush + + ups = toolsettings.unified_paint_settings + + col = layout.column(align=True) + + col.prop(brush, "use_wrap") + col.separator() + + col.label(text="Unified Settings:") + row = col.row() + row.prop(ups, "use_unified_size", text="Size") + row.prop(ups, "use_unified_strength", text="Strength") + col.prop(ups, "use_unified_color", text="Color") + + class IMAGE_UV_sculpt_curve(Panel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'TOOLS' |