Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_image.py
| Context not available. | |||||
| from bl_ui.properties_paint_common import ( | from bl_ui.properties_paint_common import ( | ||||
| UnifiedPaintPanel, | UnifiedPaintPanel, | ||||
| brush_texture_settings, | brush_texture_settings, | ||||
| brush_texpaint_common, | brush_basic_texpaint_settings, | ||||
| brush_texpaint_common_color, | |||||
| brush_texpaint_common_gradient, | |||||
| brush_texpaint_common_clone, | brush_texpaint_common_clone, | ||||
| brush_texpaint_common_options, | |||||
| brush_mask_texture_settings, | brush_mask_texture_settings, | ||||
| brush_selector, | |||||
| brush_settings, | |||||
| brush_settings_advanced, | |||||
| draw_color_settings, | |||||
| ) | ) | ||||
| from bl_ui.properties_grease_pencil_common import ( | from bl_ui.properties_grease_pencil_common import ( | ||||
| AnnotationDataPanel, | AnnotationDataPanel, | ||||
| Context not available. | |||||
| layout.operator("uv.select_overlap") | layout.operator("uv.select_overlap") | ||||
| class IMAGE_MT_brush(Menu): | |||||
| bl_label = "Brush" | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| tool_settings = context.tool_settings | |||||
| settings = tool_settings.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.prop(ups, "use_unified_color", text="Unified Color") | |||||
| layout.separator() | |||||
| # Brush tool. | |||||
| layout.prop_menu_enum(brush, "image_tool") | |||||
| class IMAGE_MT_image(Menu): | class IMAGE_MT_image(Menu): | ||||
| bl_label = "Image" | bl_label = "Image" | ||||
| Context not available. | |||||
| uv_sculpt = tool_settings.uv_sculpt | uv_sculpt = tool_settings.uv_sculpt | ||||
| brush = uv_sculpt.brush | brush = uv_sculpt.brush | ||||
| if brush: | if brush: | ||||
| from bl_ui.properties_paint_common import UnifiedPaintPanel | # NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281 | ||||
| UnifiedPaintPanel.prop_unified(layout, context, brush, "size", pressure_name="use_pressure_size", slider=True) | |||||
| row = layout.row(align=True) | UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", pressure_name="use_pressure_strength", slider=True) | ||||
| UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True) | |||||
| UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="") | |||||
| row = layout.row(align=True) | |||||
| UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True) | |||||
| UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="") | |||||
| @staticmethod | @staticmethod | ||||
| def PAINT(context, layout, tool): | def PAINT(context, layout, tool): | ||||
| Context not available. | |||||
| brush = paint.brush | brush = paint.brush | ||||
| if brush is None: | if brush is None: | ||||
| return | return | ||||
| from bl_ui.properties_paint_common import ( | |||||
| UnifiedPaintPanel, | |||||
| brush_basic_texpaint_settings, | |||||
| ) | |||||
| capabilities = brush.image_paint_capabilities | |||||
| if capabilities.has_color: | |||||
| UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="") | |||||
| brush_basic_texpaint_settings(layout, context, brush, compact=True) | brush_basic_texpaint_settings(layout, context, brush, compact=True) | ||||
| Context not available. | |||||
| layout.menu("IMAGE_MT_select") | layout.menu("IMAGE_MT_select") | ||||
| if show_maskedit: | if show_maskedit: | ||||
| layout.menu("MASK_MT_select") | layout.menu("MASK_MT_select") | ||||
| if show_paint: | |||||
| layout.menu("IMAGE_MT_brush") | |||||
| if ima and ima.is_dirty: | if ima and ima.is_dirty: | ||||
| layout.menu("IMAGE_MT_image", text="Image*") | layout.menu("IMAGE_MT_image", text="Image*") | ||||
| Context not available. | |||||
| col.operator("image.clear_render_slot", icon='X', text="") | col.operator("image.clear_render_slot", icon='X', text="") | ||||
| class IMAGE_PT_paint_select(Panel, ImagePaintPanel): | |||||
| bl_context = ".paint_common_2d" | |||||
| bl_category = "Tool" | |||||
| bl_label = "Brushes" | |||||
| class IMAGE_PT_paint(Panel, ImagePaintPanel): | def draw(self, context): | ||||
| bl_label = "Brush" | layout = self.layout | ||||
| brush_selector(layout, context) | |||||
| class IMAGE_PT_paint_settings(Panel, ImagePaintPanel): | |||||
| bl_context = ".paint_common_2d" | bl_context = ".paint_common_2d" | ||||
| bl_category = "Tool" | bl_category = "Tool" | ||||
| bl_label = "Brush Settings" | |||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| Context not available. | |||||
| settings = context.tool_settings.image_paint | settings = context.tool_settings.image_paint | ||||
| brush = settings.brush | brush = settings.brush | ||||
| col = layout.column() | |||||
| col.template_ID_preview(settings, "brush", new="brush.add", rows=2, cols=6) | |||||
| if brush: | if brush: | ||||
| brush_texpaint_common(self, context, layout, brush, settings) | brush_settings(layout.column(), context, brush, '2D_PAINT', popover=self.is_popover) | ||||
| class IMAGE_PT_paint_settings_advanced(Panel, ImagePaintPanel): | |||||
| bl_context = ".paint_common_2d" | |||||
| bl_parent_id = "IMAGE_PT_paint_settings" | |||||
| bl_label = "Advanced" | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| layout.use_property_split = True | |||||
| layout.use_property_decorate = False # No animation. | |||||
| settings = UnifiedPaintPanel.paint_settings(context) | |||||
| brush = settings.brush | |||||
| brush_settings_advanced(layout.column(), context, brush, '2D_PAINT') | |||||
| class IMAGE_PT_paint_color(Panel, ImagePaintPanel): | class IMAGE_PT_paint_color(Panel, ImagePaintPanel): | ||||
| bl_category = "Tool" | |||||
| bl_context = ".paint_common_2d" | bl_context = ".paint_common_2d" | ||||
| bl_parent_id = "IMAGE_PT_paint" | bl_category = "Tool" | ||||
| bl_parent_id = "IMAGE_PT_paint_settings" | |||||
| bl_label = "Color Picker" | bl_label = "Color Picker" | ||||
| @classmethod | @classmethod | ||||
| Context not available. | |||||
| settings = context.tool_settings.image_paint | settings = context.tool_settings.image_paint | ||||
| brush = settings.brush | brush = settings.brush | ||||
| layout.prop(brush, "color_type", expand=True) | draw_color_settings(context, layout, brush, color_type=True) | ||||
| if brush.color_type == 'COLOR': | |||||
| brush_texpaint_common_color(self, context, layout, brush, settings, True) | |||||
| elif brush.color_type == 'GRADIENT': | |||||
| brush_texpaint_common_gradient(self, context, layout, brush, settings, True) | |||||
| class IMAGE_PT_paint_swatches(Panel, ImagePaintPanel): | class IMAGE_PT_paint_swatches(Panel, ImagePaintPanel): | ||||
| bl_category = "Tool" | bl_category = "Tool" | ||||
| bl_context = ".paint_common_2d" | bl_context = ".paint_common_2d" | ||||
| bl_parent_id = "IMAGE_PT_paint" | bl_parent_id = "IMAGE_PT_paint_settings" | ||||
| bl_label = "Color Palette" | bl_label = "Color Palette" | ||||
| bl_options = {'DEFAULT_CLOSED'} | bl_options = {'DEFAULT_CLOSED'} | ||||
| Context not available. | |||||
| class IMAGE_PT_paint_clone(Panel, ImagePaintPanel): | class IMAGE_PT_paint_clone(Panel, ImagePaintPanel): | ||||
| bl_category = "Tool" | bl_category = "Tool" | ||||
| bl_context = ".paint_common_2d" | bl_context = ".paint_common_2d" | ||||
| bl_parent_id = "IMAGE_PT_paint" | bl_parent_id = "IMAGE_PT_paint_settings" | ||||
| bl_label = "Clone from Image/UV Map" | bl_label = "Clone from Image/UV Map" | ||||
| bl_options = {'DEFAULT_CLOSED'} | bl_options = {'DEFAULT_CLOSED'} | ||||
| Context not available. | |||||
| brush_texpaint_common_clone(self, context, layout, brush, settings, True) | brush_texpaint_common_clone(self, context, layout, brush, settings, True) | ||||
| class IMAGE_PT_paint_options(Panel, ImagePaintPanel): | |||||
| bl_category = "Tool" | |||||
| bl_context = ".paint_common_2d" | |||||
| bl_parent_id = "IMAGE_PT_paint" | |||||
| bl_label = "Options" | |||||
| bl_options = {'DEFAULT_CLOSED'} | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| settings = context.tool_settings.image_paint | |||||
| brush = settings.brush | |||||
| capabilities = brush.image_paint_capabilities | |||||
| return capabilities.has_color | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| settings = context.tool_settings.image_paint | |||||
| brush = settings.brush | |||||
| layout.use_property_split = True | |||||
| layout.use_property_decorate = False # No animation. | |||||
| brush_texpaint_common_options(self, context, layout, brush, settings, True) | |||||
| class IMAGE_PT_tools_brush_display(BrushButtonsPanel, Panel): | class IMAGE_PT_tools_brush_display(BrushButtonsPanel, Panel): | ||||
| bl_label = "Display" | bl_label = "Display" | ||||
| bl_context = ".paint_common_2d" | bl_context = ".paint_common_2d" | ||||
| Context not available. | |||||
| row.prop(ipaint, "tile_x", text="X", toggle=True) | row.prop(ipaint, "tile_x", text="X", toggle=True) | ||||
| row.prop(ipaint, "tile_y", text="Y", toggle=True) | row.prop(ipaint, "tile_y", text="Y", toggle=True) | ||||
| def is_uv_sculpt_mode(context): | |||||
| sima = context.space_data | |||||
| # TODO(campbell): nicer way to check if we're in uv sculpt mode. | |||||
| if sima and sima.show_uvedit: | |||||
| from bl_ui.space_toolsystem_common import ToolSelectPanelHelper | |||||
| tool = ToolSelectPanelHelper.tool_active_from_context(context) | |||||
| if tool.has_datablock: | |||||
| return True | |||||
| return False | |||||
| class IMAGE_PT_uv_sculpt_brush(Panel): | class IMAGE_PT_uv_sculpt_brush(Panel): | ||||
| bl_space_type = 'IMAGE_EDITOR' | bl_space_type = 'IMAGE_EDITOR' | ||||
| Context not available. | |||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| sima = context.space_data | return is_uv_sculpt_mode(context) | ||||
| # TODO(campbell): nicer way to check if we're in uv sculpt mode. | |||||
| if sima and sima.show_uvedit: | |||||
| from bl_ui.space_toolsystem_common import ToolSelectPanelHelper | |||||
| tool = ToolSelectPanelHelper.tool_active_from_context(context) | |||||
| if tool.has_datablock: | |||||
| return True | |||||
| return False | |||||
| def draw(self, context): | def draw(self, context): | ||||
| from bl_ui.properties_paint_common import UnifiedPaintPanel | |||||
| layout = self.layout | layout = self.layout | ||||
| tool_settings = context.tool_settings | tool_settings = context.tool_settings | ||||
| uvsculpt = tool_settings.uv_sculpt | uvsculpt = tool_settings.uv_sculpt | ||||
| layout.template_ID(uvsculpt, "brush") | layout.template_ID(uvsculpt, "brush") | ||||
| brush = uvsculpt.brush | brush = uvsculpt.brush | ||||
| if not self.is_popover: | brush_settings(layout.column(), context, brush, mode='UV_SCULPT') | ||||
| if brush: | |||||
| col = layout.column() | if brush: | ||||
| if brush.uv_sculpt_tool == 'RELAX': | |||||
| layout.prop(tool_settings, "uv_relax_method") # Although this is a scene-wide setting, since it is only used by a single tool, it doesn't make sense from a user perspective to move it to the Options panel. | |||||
| row = col.row(align=True) | |||||
| UnifiedPaintPanel.prop_unified_size(row, context, brush, "size", slider=True) | |||||
| UnifiedPaintPanel.prop_unified_size(row, context, brush, "use_pressure_size", text="") | |||||
| row = col.row(align=True) | class IMAGE_PT_uv_sculpt_options(Panel): | ||||
| UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True) | bl_space_type = 'IMAGE_EDITOR' | ||||
| UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength", text="") | bl_region_type = 'UI' | ||||
| bl_context = ".uv_sculpt" # dot on purpose (access from topbar) | |||||
| bl_category = "Tool" | |||||
| bl_label = "Options" | |||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| return is_uv_sculpt_mode(context) | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| tool_settings = context.tool_settings | |||||
| uvsculpt = tool_settings.uv_sculpt | |||||
| col = layout.column() | col = layout.column() | ||||
| col.prop(tool_settings, "uv_sculpt_lock_borders") | col.prop(tool_settings, "uv_sculpt_lock_borders") | ||||
| col.prop(tool_settings, "uv_sculpt_all_islands") | col.prop(tool_settings, "uv_sculpt_all_islands") | ||||
| if brush: | |||||
| if brush.uv_sculpt_tool == 'RELAX': | |||||
| col.prop(tool_settings, "uv_relax_method") | |||||
| col.prop(uvsculpt, "show_brush") | col.prop(uvsculpt, "show_brush") | ||||
| Context not available. | |||||
| IMAGE_MT_view, | IMAGE_MT_view, | ||||
| IMAGE_MT_view_zoom, | IMAGE_MT_view_zoom, | ||||
| IMAGE_MT_select, | IMAGE_MT_select, | ||||
| IMAGE_MT_brush, | |||||
| IMAGE_MT_image, | IMAGE_MT_image, | ||||
| IMAGE_MT_image_invert, | IMAGE_MT_image_invert, | ||||
| IMAGE_MT_uvs, | IMAGE_MT_uvs, | ||||
| Context not available. | |||||
| IMAGE_PT_view_display, | IMAGE_PT_view_display, | ||||
| IMAGE_PT_view_display_uv_edit_overlays, | IMAGE_PT_view_display_uv_edit_overlays, | ||||
| IMAGE_PT_view_display_uv_edit_overlays_stretch, | IMAGE_PT_view_display_uv_edit_overlays_stretch, | ||||
| IMAGE_PT_paint, | IMAGE_PT_paint_select, | ||||
| IMAGE_PT_paint_settings, | |||||
| IMAGE_PT_paint_settings_advanced, | |||||
| IMAGE_PT_paint_color, | IMAGE_PT_paint_color, | ||||
| IMAGE_PT_paint_swatches, | IMAGE_PT_paint_swatches, | ||||
| IMAGE_PT_paint_clone, | IMAGE_PT_paint_clone, | ||||
| IMAGE_PT_paint_options, | |||||
| IMAGE_PT_tools_brush_texture, | IMAGE_PT_tools_brush_texture, | ||||
| IMAGE_PT_tools_mask_texture, | IMAGE_PT_tools_mask_texture, | ||||
| IMAGE_PT_paint_stroke, | IMAGE_PT_paint_stroke, | ||||
| Context not available. | |||||
| IMAGE_PT_tools_brush_display_custom_icon, | IMAGE_PT_tools_brush_display_custom_icon, | ||||
| IMAGE_PT_tools_imagepaint_symmetry, | IMAGE_PT_tools_imagepaint_symmetry, | ||||
| IMAGE_PT_uv_sculpt_brush, | IMAGE_PT_uv_sculpt_brush, | ||||
| IMAGE_PT_uv_sculpt_options, | |||||
| IMAGE_PT_uv_sculpt_curve, | IMAGE_PT_uv_sculpt_curve, | ||||
| IMAGE_PT_view_histogram, | IMAGE_PT_view_histogram, | ||||
| IMAGE_PT_view_waveform, | IMAGE_PT_view_waveform, | ||||
| Context not available. | |||||