Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_view3d.py
| Show All 19 Lines | |||||
| import bpy | import bpy | ||||
| from bpy.types import ( | from bpy.types import ( | ||||
| Header, | Header, | ||||
| Menu, | Menu, | ||||
| Panel, | Panel, | ||||
| ) | ) | ||||
| from bl_ui.properties_paint_common import ( | from bl_ui.properties_paint_common import ( | ||||
| UnifiedPaintPanel, | UnifiedPaintPanel, | ||||
| brush_basic_texpaint_settings, | |||||
| draw_all_brush_settings, | |||||
| ) | ) | ||||
| from bl_ui.properties_grease_pencil_common import ( | from bl_ui.properties_grease_pencil_common import ( | ||||
| AnnotationDataPanel, | AnnotationDataPanel, | ||||
| AnnotationOnionSkin, | AnnotationOnionSkin, | ||||
| GreasePencilMaterialsPanel, | GreasePencilMaterialsPanel, | ||||
| ) | ) | ||||
| from bl_ui.space_toolsystem_common import ( | from bl_ui.space_toolsystem_common import ( | ||||
| ToolActivePanelHelper, | ToolActivePanelHelper, | ||||
| ) | ) | ||||
| from bl_ui.space_view3d_toolbar import weight_paint_options | |||||
| from bpy.app.translations import contexts as i18n_contexts | from bpy.app.translations import contexts as i18n_contexts | ||||
| class VIEW3D_HT_tool_header(Header): | class VIEW3D_HT_tool_header(Header): | ||||
| bl_space_type = 'VIEW_3D' | bl_space_type = 'VIEW_3D' | ||||
| bl_region_type = 'TOOL_HEADER' | bl_region_type = 'TOOL_HEADER' | ||||
| def draw(self, context): | def draw(self, context): | ||||
| ▲ Show 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | def SCULPT(context, layout, tool): | ||||
| paint = context.tool_settings.sculpt | paint = context.tool_settings.sculpt | ||||
| layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) | layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) | ||||
| brush = paint.brush | brush = paint.brush | ||||
| if brush is None: | if brush is None: | ||||
| return | return | ||||
| from bl_ui.properties_paint_common import ( | tool_settings = context.tool_settings | ||||
| brush_basic_sculpt_settings, | capabilities = brush.sculpt_capabilities | ||||
| ) | |||||
| brush_basic_sculpt_settings(layout, context, brush, compact=True) | ups = tool_settings.unified_paint_settings | ||||
| size = "size" | |||||
| size_owner = ups if ups.use_unified_size else brush | |||||
| if size_owner.use_locked_size == 'SCENE': | |||||
| size = "unprojected_radius" | |||||
| UnifiedPaintPanel.prop_unified(layout, context, size_owner, size, unified_name="use_unified_size", pressure_name="use_pressure_size", text="Radius", slider=True) | |||||
| # strength, use_strength_pressure | |||||
| pressure_name = "use_pressure_strength" if capabilities.has_strength_pressure else None | |||||
| UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name=pressure_name, text="Strength") | |||||
| # direction | |||||
| if not capabilities.has_direction: | |||||
| layout.row().prop(brush, "direction", expand=True, text="") | |||||
| @staticmethod | @staticmethod | ||||
| def PAINT_TEXTURE(context, layout, tool): | def PAINT_TEXTURE(context, layout, tool): | ||||
| if (tool is None) or (not tool.has_datablock): | if (tool is None) or (not tool.has_datablock): | ||||
| return | return | ||||
| paint = context.tool_settings.image_paint | paint = context.tool_settings.image_paint | ||||
| layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) | layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) | ||||
| 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) | ||||
| @staticmethod | @staticmethod | ||||
| def PAINT_VERTEX(context, layout, tool): | def PAINT_VERTEX(context, layout, tool): | ||||
| if (tool is None) or (not tool.has_datablock): | if (tool is None) or (not tool.has_datablock): | ||||
| return | return | ||||
| paint = context.tool_settings.vertex_paint | paint = context.tool_settings.vertex_paint | ||||
| layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) | layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) | ||||
| brush = paint.brush | brush = paint.brush | ||||
| if brush is None: | if brush is None: | ||||
| return | return | ||||
| from bl_ui.properties_paint_common import ( | brush_basic_texpaint_settings(layout, context, brush, compact=True) | ||||
| UnifiedPaintPanel, | |||||
| brush_basic_vpaint_settings, | |||||
| ) | |||||
| capabilities = brush.vertex_paint_capabilities | |||||
| if capabilities.has_color: | |||||
| UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="") | |||||
| brush_basic_vpaint_settings(layout, context, brush, compact=True) | |||||
| @staticmethod | @staticmethod | ||||
| def PAINT_WEIGHT(context, layout, tool): | def PAINT_WEIGHT(context, layout, tool): | ||||
| if (tool is None) or (not tool.has_datablock): | if (tool is None) or (not tool.has_datablock): | ||||
| return | return | ||||
| paint = context.tool_settings.weight_paint | paint = context.tool_settings.weight_paint | ||||
| layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) | layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True) | ||||
| brush = paint.brush | brush = paint.brush | ||||
| if brush is None: | if brush is None: | ||||
| return | return | ||||
| from bl_ui.properties_paint_common import brush_basic_wpaint_settings | capabilities = brush.weight_paint_capabilities | ||||
| brush_basic_wpaint_settings(layout, context, brush, compact=True) | if capabilities.has_weight: | ||||
| UnifiedPaintPanel.prop_unified(layout, context, brush, "weight", unified_name="use_unified_weight", slider=True) | |||||
| UnifiedPaintPanel.prop_unified(layout, context, brush, "size", unified_name="use_unified_size", pressure_name="use_pressure_size", slider=True, text="Radius") | |||||
| UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name="use_pressure_strength") | |||||
| @staticmethod | @staticmethod | ||||
| def PAINT_GPENCIL(context, layout, tool): | def PAINT_GPENCIL(context, layout, tool): | ||||
| if tool is None: | if tool is None: | ||||
| return | return | ||||
| # is_paint = True | # is_paint = True | ||||
| # FIXME: tools must use their own UI drawing! | # FIXME: tools must use their own UI drawing! | ||||
| ▲ Show 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | def draw_xform_template(layout, context): | ||||
| else: | else: | ||||
| if (object_mode not in { | if (object_mode not in { | ||||
| 'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT', | 'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT', | ||||
| 'PAINT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL' | 'PAINT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL' | ||||
| }) or has_pose_mode: | }) or has_pose_mode: | ||||
| show_snap = True | show_snap = True | ||||
| else: | else: | ||||
| from bl_ui.properties_paint_common import UnifiedPaintPanel | |||||
| paint_settings = UnifiedPaintPanel.paint_settings(context) | paint_settings = UnifiedPaintPanel.paint_settings(context) | ||||
| if paint_settings: | if paint_settings: | ||||
| brush = paint_settings.brush | brush = paint_settings.brush | ||||
| if brush and brush.stroke_method == 'CURVE': | if brush and brush.stroke_method == 'CURVE': | ||||
| show_snap = True | show_snap = True | ||||
| if show_snap: | if show_snap: | ||||
| ▲ Show 20 Lines • Show All 6,129 Lines • ▼ Show 20 Lines | |||||
| class VIEW3D_PT_paint_vertex_context_menu(Panel): | class VIEW3D_PT_paint_vertex_context_menu(Panel): | ||||
| # Only for popover, these are dummy values. | # Only for popover, these are dummy values. | ||||
| bl_space_type = 'VIEW_3D' | bl_space_type = 'VIEW_3D' | ||||
| bl_region_type = 'WINDOW' | bl_region_type = 'WINDOW' | ||||
| bl_label = "Vertex Paint Context Menu" | bl_label = "Vertex Paint Context Menu" | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| brush = context.tool_settings.vertex_paint.brush | brush = context.tool_settings.vertex_paint.brush | ||||
| capabilities = brush.vertex_paint_capabilities | capabilities = brush.vertex_paint_capabilities | ||||
| if capabilities.has_color: | if capabilities.has_color: | ||||
| split = layout.split(factor=0.1) | split = layout.split(factor=0.1) | ||||
| UnifiedPaintPanel.prop_unified_color(split, context, brush, "color", text="") | UnifiedPaintPanel.prop_unified_color(split, context, brush, "color", text="") | ||||
| UnifiedPaintPanel.prop_unified_color_picker(split, context, brush, "color", value_slider=True) | UnifiedPaintPanel.prop_unified_color_picker(split, context, brush, "color", value_slider=True) | ||||
| layout.prop(brush, "blend", text="") | layout.prop(brush, "blend", text="") | ||||
| UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True) | UnifiedPaintPanel.prop_unified(layout, context, brush, "size", unified_name="use_unified_size", pressure_name="use_pressure_size", slider=True) | ||||
| UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength") | UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name="use_pressure_strength", slider=True) | ||||
| class VIEW3D_PT_paint_texture_context_menu(Panel): | class VIEW3D_PT_paint_texture_context_menu(Panel): | ||||
| # Only for popover, these are dummy values. | # Only for popover, these are dummy values. | ||||
| bl_space_type = 'VIEW_3D' | bl_space_type = 'VIEW_3D' | ||||
| bl_region_type = 'WINDOW' | bl_region_type = 'WINDOW' | ||||
| bl_label = "Texture Paint Context Menu" | bl_label = "Texture Paint Context Menu" | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| brush = context.tool_settings.image_paint.brush | brush = context.tool_settings.image_paint.brush | ||||
| capabilities = brush.image_paint_capabilities | capabilities = brush.image_paint_capabilities | ||||
| if capabilities.has_color: | if capabilities.has_color: | ||||
| split = layout.split(factor=0.1) | split = layout.split(factor=0.1) | ||||
| UnifiedPaintPanel.prop_unified_color(split, context, brush, "color", text="") | UnifiedPaintPanel.prop_unified_color(split, context, brush, "color", text="") | ||||
| UnifiedPaintPanel.prop_unified_color_picker(split, context, brush, "color", value_slider=True) | UnifiedPaintPanel.prop_unified_color_picker(split, context, brush, "color", value_slider=True) | ||||
| layout.prop(brush, "blend", text="") | layout.prop(brush, "blend", text="") | ||||
| if capabilities.has_radius: | if capabilities.has_radius: | ||||
| UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True) | UnifiedPaintPanel.prop_unified(layout, context, brush, "size", unified_name="use_unified_size", pressure_name="use_pressure_size", slider=True) | ||||
| UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength") | UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name="use_pressure_strength", slider=True) | ||||
| class VIEW3D_PT_paint_weight_context_menu(Panel): | class VIEW3D_PT_paint_weight_context_menu(Panel): | ||||
| # Only for popover, these are dummy values. | # Only for popover, these are dummy values. | ||||
| bl_space_type = 'VIEW_3D' | bl_space_type = 'VIEW_3D' | ||||
| bl_region_type = 'WINDOW' | bl_region_type = 'WINDOW' | ||||
| bl_label = "Weights Context Menu" | bl_label = "Weights Context Menu" | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| brush = context.tool_settings.weight_paint.brush | brush = context.tool_settings.weight_paint.brush | ||||
| UnifiedPaintPanel.prop_unified_weight(layout, context, brush, "weight", slider=True) | |||||
| UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True) | |||||
| UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength") | |||||
| col = layout.column() | |||||
| draw_all_brush_settings(col, context, brush, context.object.mode, context_menu=True) | |||||
| col.separator() | |||||
| col.label(text="Weight Paint Options") | |||||
| weight_paint_options(col, context) | |||||
| class VIEW3D_PT_sculpt_context_menu(Panel): | class VIEW3D_PT_sculpt_context_menu(Panel): | ||||
| # Only for popover, these are dummy values. | # Only for popover, these are dummy values. | ||||
| bl_space_type = 'VIEW_3D' | bl_space_type = 'VIEW_3D' | ||||
| bl_region_type = 'WINDOW' | bl_region_type = 'WINDOW' | ||||
| bl_label = "Sculpt Context Menu" | bl_label = "Sculpt Context Menu" | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| brush = context.tool_settings.sculpt.brush | brush = context.tool_settings.sculpt.brush | ||||
| capabilities = brush.sculpt_capabilities | capabilities = brush.sculpt_capabilities | ||||
| UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True) | UnifiedPaintPanel.prop_unified(layout, context, brush, "size", unified_name="use_unified_size", pressure_name="use_pressure_size", slider=True) | ||||
| UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength") | UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", unified_name="use_unified_strength", pressure_name="use_pressure_strength", slider=True) | ||||
| if capabilities.has_auto_smooth: | if capabilities.has_auto_smooth: | ||||
| layout.prop(brush, "auto_smooth_factor", slider=True) | layout.prop(brush, "auto_smooth_factor", slider=True) | ||||
| if capabilities.has_normal_weight: | if capabilities.has_normal_weight: | ||||
| layout.prop(brush, "normal_weight", slider=True) | layout.prop(brush, "normal_weight", slider=True) | ||||
| if capabilities.has_pinch_factor: | if capabilities.has_pinch_factor: | ||||
| ▲ Show 20 Lines • Show All 244 Lines • Show Last 20 Lines | |||||