Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_view3d.py
| Context not available. | |||||
| ) | ) | ||||
| from bl_ui.properties_paint_common import ( | from bl_ui.properties_paint_common import ( | ||||
| UnifiedPaintPanel, | UnifiedPaintPanel, | ||||
| brush_basic_texpaint_settings, | |||||
| ) | ) | ||||
| from bl_ui.properties_grease_pencil_common import ( | from bl_ui.properties_grease_pencil_common import ( | ||||
| AnnotationDataPanel, | AnnotationDataPanel, | ||||
| Context not available. | |||||
| context, layout, | context, layout, | ||||
| tool_key=('VIEW_3D', tool_mode), | tool_key=('VIEW_3D', tool_mode), | ||||
| ) | ) | ||||
| # Object Mode Options | # Object Mode Options | ||||
| # ------------------- | # ------------------- | ||||
| Context not available. | |||||
| if draw_fn is not None: | if draw_fn is not None: | ||||
| draw_fn(context, layout, tool) | draw_fn(context, layout, tool) | ||||
| def draw_3d_brush_settings(layout, tool_mode): | |||||
| layout.popover("VIEW3D_PT_tools_brush_settings_advanced", text="Brush") | |||||
| if tool_mode != 'PAINT_WEIGHT': | |||||
| layout.popover("VIEW3D_PT_tools_brush_texture") | |||||
| if tool_mode == 'PAINT_TEXTURE': | |||||
| layout.popover("VIEW3D_PT_tools_mask_texture") | |||||
| layout.popover("VIEW3D_PT_tools_brush_stroke") | |||||
| layout.popover("VIEW3D_PT_tools_brush_falloff") | |||||
| layout.popover("VIEW3D_PT_tools_brush_display") | |||||
| # Mets TODO: This dict is no longer used. | |||||
| popover_kw = {"space_type": 'VIEW_3D', "region_type": 'UI', "category": "Tool"} | popover_kw = {"space_type": 'VIEW_3D', "region_type": 'UI', "category": "Tool"} | ||||
| # Note: general mode options should be added to 'draw_mode_settings'. | # Note: general mode options should be added to 'draw_mode_settings'. | ||||
| if tool_mode == 'SCULPT': | if tool_mode == 'SCULPT': | ||||
| if (tool is not None) and tool.has_datablock: | if (tool is not None) and tool.has_datablock: | ||||
| layout.popover_group(context=".paint_common", **popover_kw) | draw_3d_brush_settings(layout, tool_mode) | ||||
| elif tool_mode == 'PAINT_VERTEX': | elif tool_mode == 'PAINT_VERTEX': | ||||
| if (tool is not None) and tool.has_datablock: | if (tool is not None) and tool.has_datablock: | ||||
| layout.popover_group(context=".paint_common", **popover_kw) | draw_3d_brush_settings(layout, tool_mode) | ||||
| elif tool_mode == 'PAINT_WEIGHT': | elif tool_mode == 'PAINT_WEIGHT': | ||||
| if (tool is not None) and tool.has_datablock: | if (tool is not None) and tool.has_datablock: | ||||
| layout.popover_group(context=".paint_common", **popover_kw) | draw_3d_brush_settings(layout, tool_mode) | ||||
| elif tool_mode == 'PAINT_TEXTURE': | elif tool_mode == 'PAINT_TEXTURE': | ||||
| if (tool is not None) and tool.has_datablock: | if (tool is not None) and tool.has_datablock: | ||||
| layout.popover_group(context=".paint_common", **popover_kw) | draw_3d_brush_settings(layout, tool_mode) | ||||
| elif tool_mode == 'EDIT_ARMATURE': | elif tool_mode == 'EDIT_ARMATURE': | ||||
| pass | pass | ||||
| elif tool_mode == 'EDIT_CURVE': | elif tool_mode == 'EDIT_CURVE': | ||||
| Context not available. | |||||
| # if tool.has_datablock: | # if tool.has_datablock: | ||||
| # layout.popover_group(context=".paint_common", **popover_kw) | # layout.popover_group(context=".paint_common", **popover_kw) | ||||
| pass | pass | ||||
| # Mets TODO: Don't draw grayed out settings.... somehow... If I could just do a hard check for tools I'd be happy, but idk how. | |||||
| elif tool_mode == 'PAINT_GPENCIL': | elif tool_mode == 'PAINT_GPENCIL': | ||||
| if (tool is not None) and tool.has_datablock: | if (tool is not None) and tool.has_datablock: | ||||
| layout.popover_group(context=".greasepencil_paint", **popover_kw) | brush = context.tool_settings.gpencil_paint.brush | ||||
| if brush.gpencil_tool != 'ERASE': | |||||
| layout.popover("VIEW3D_PT_tools_grease_pencil_brush_advanced") | |||||
| if brush.gpencil_tool not in ('ERASE', 'FILL'): | |||||
| layout.popover("VIEW3D_PT_tools_grease_pencil_brush_settings") | |||||
| layout.popover("VIEW3D_PT_tools_grease_pencil_brush_stabilizer") | |||||
| layout.popover("VIEW3D_PT_tools_grease_pencil_brush_random") | |||||
| layout.popover("VIEW3D_PT_tools_grease_pencil_brushcurves") | |||||
| layout.popover("VIEW3D_PT_tools_grease_pencil_paint_appearance") | |||||
| elif tool_mode == 'SCULPT_GPENCIL': | elif tool_mode == 'SCULPT_GPENCIL': | ||||
| layout.popover_group(context=".greasepencil_sculpt", **popover_kw) | settings = context.tool_settings.gpencil_sculpt | ||||
| tool = settings.sculpt_tool | |||||
| if tool in ('SMOOTH', 'RANDOMIZE', 'SMOOTH'): | |||||
| layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_options") | |||||
| layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_appearance") | |||||
| elif tool_mode == 'WEIGHT_GPENCIL': | elif tool_mode == 'WEIGHT_GPENCIL': | ||||
| layout.popover_group(context=".greasepencil_weight", **popover_kw) | layout.popover("VIEW3D_PT_tools_grease_pencil_weight_appearance") | ||||
| def draw_mode_settings(self, context): | def draw_mode_settings(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| Context not available. | |||||
| 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" | |||||
| # NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281 | |||||
| UnifiedPaintPanel.prop_unified(layout, context, size_owner, 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", 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): | ||||
| Context not available. | |||||
| 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 | ||||
| Context not available. | |||||
| 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): | ||||
| Context not available. | |||||
| if brush is None: | if brush is None: | ||||
| return | return | ||||
| from bl_ui.properties_paint_common import brush_basic_wpaint_settings | # NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281 | ||||
| brush_basic_wpaint_settings(layout, context, brush, compact=True) | capabilities = brush.weight_paint_capabilities | ||||
| if capabilities.has_weight: | |||||
| UnifiedPaintPanel.prop_unified(layout, context, brush, "weight", slider=True) | |||||
| UnifiedPaintPanel.prop_unified(layout, context, brush, "size", pressure_name="use_pressure_size", slider=True, text="Radius") | |||||
| UnifiedPaintPanel.prop_unified(layout, context, brush, "strength", pressure_name="use_pressure_strength") | |||||
| @staticmethod | @staticmethod | ||||
| def PAINT_GPENCIL(context, layout, tool): | def PAINT_GPENCIL(context, layout, tool): | ||||
| Context not available. | |||||
| text="Thickness Profile", | text="Thickness Profile", | ||||
| ) | ) | ||||
| if brush.gpencil_tool == 'FILL': | |||||
| settings = context.tool_settings.gpencil_sculpt | |||||
| row = layout.row(align=True) | |||||
| sub = row.row(align=True) | |||||
| sub.popover( | |||||
| panel="TOPBAR_PT_gpencil_fill", | |||||
| text="Fill Options", | |||||
| ) | |||||
| @staticmethod | @staticmethod | ||||
| def SCULPT_GPENCIL(context, layout, tool): | def SCULPT_GPENCIL(context, layout, tool): | ||||
| if (tool is None) or (not tool.has_datablock): | if (tool is None) or (not tool.has_datablock): | ||||
| Context not available. | |||||
| 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 hasattr(brush, "stroke_method") and brush.stroke_method == 'CURVE': | ||||
| show_snap = True | show_snap = True | ||||
| if show_snap: | if show_snap: | ||||
| Context not available. | |||||
| if not use_local_collections: | if not use_local_collections: | ||||
| subrow.active = collection.is_visible # Parent collection runtime visibility | subrow.active = collection.is_visible # Parent collection runtime visibility | ||||
| subrow.prop(child, "hide_viewport", text="", emboss=False) | subrow.prop(child, "hide_viewport", text="", emboss=False) | ||||
| elif not child.is_visible: | |||||
| subrow.active = False | |||||
| subrow.label(text="", icon='REMOVE') | |||||
| else: | else: | ||||
| subrow.active = collection.visible_get() # Parent collection runtime visibility | subrow.active = collection.visible_get() # Parent collection runtime visibility | ||||
| icon = 'HIDE_OFF' if child.visible_get() else 'HIDE_ON' | icon = 'HIDE_OFF' if child.visible_get() else 'HIDE_ON' | ||||
| Context not available. | |||||
| 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 | ||||
| Context not available. | |||||
| 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 | ||||
| Context not available. | |||||
| 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): | ||||
| Context not available. | |||||
| 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(layout, context, brush, "weight", unified_name="use_unified_weight", slider=True) | ||||
| 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_sculpt_context_menu(Panel): | class VIEW3D_PT_sculpt_context_menu(Panel): | ||||
| Context not available. | |||||
| 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) | ||||
| Context not available. | |||||