diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index d5019d1b5d8..f489aa0e451 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -1328,56 +1328,9 @@ class _defs_gpencil_paint: row.prop(gp_settings, "use_material_pin", text="") - @staticmethod - def draw_settings_common(context, layout, tool): - ob = context.active_object - if ob and ob.mode == 'GPENCIL_PAINT': - brush = context.active_gpencil_brush - if brush is None: - return - gp_settings = brush.gpencil_settings - - row = layout.row(align=True) - ts = context.scene.tool_settings - settings = ts.gpencil_paint - row.template_ID_preview(settings, "brush", rows=3, cols=8, hide_buttons=True) - - if brush.gpencil_tool == 'ERASE': - row = layout.row(align=True) - row.prop(brush, "size", text="Radius") - row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE') - if gp_settings.eraser_mode == 'SOFT': - row = layout.row(align=True) - row.prop(gp_settings, "pen_strength", slider=True) - row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE') - elif brush.gpencil_tool == 'FILL': - row = layout.row() - row.prop(gp_settings, "fill_leak", text="Leak Size") - row.prop(brush, "size", text="Thickness") - row.prop(gp_settings, "fill_simplify_level", text="Simplify") - - _defs_gpencil_paint.draw_color_selector(context, layout) - - row = layout.row(align=True) - row.prop(gp_settings, "fill_draw_mode", text="") - row.prop(gp_settings, "show_fill_boundary", text="", icon='GRID') - - else: # bgpsettings.tool == 'DRAW': - row = layout.row(align=True) - row.prop(brush, "size", text="Radius") - row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE') - row = layout.row(align=True) - row.prop(gp_settings, "pen_strength", slider=True) - row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE') - - _defs_gpencil_paint.draw_color_selector(context, layout) - @staticmethod def generate_from_brushes(context): - def draw_settings(context, layout, tool): - _defs_gpencil_paint.draw_settings_common(context, layout, tool) - return generate_from_brushes_tool_slots_ex( context, context.tool_settings.gpencil_paint, icon_prefix="brush.gpencil_draw.", @@ -1389,7 +1342,6 @@ class _defs_gpencil_paint: ), tooldef_keywords=dict( operator="gpencil.draw", - draw_settings=draw_settings, ), ) @@ -2044,6 +1996,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): ], } + class TOPBAR_PT_annotation_layers(Panel, AnnotationDataPanel): bl_space_type = 'VIEW_3D' bl_region_type = 'HEADER' diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index e3b2b16c3c2..f406fb78562 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -241,6 +241,7 @@ class _draw_left_context_mode: UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", slider=True, text="Strength") layout.prop(brush, "direction", text="", expand=True) + @staticmethod def PAINT_TEXTURE(context, layout, tool): if (tool is None) or (not tool.has_datablock): return @@ -258,6 +259,7 @@ class _draw_left_context_mode: UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True, text="Radius") UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", slider=True, text="Strength") + @staticmethod def PAINT_VERTEX(context, layout, tool): if (tool is None) or (not tool.has_datablock): return @@ -275,6 +277,7 @@ class _draw_left_context_mode: UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True, text="Radius") UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", slider=True, text="Strength") + @staticmethod def PAINT_WEIGHT(context, layout, tool): if (tool is None) or (not tool.has_datablock): return @@ -291,6 +294,80 @@ class _draw_left_context_mode: UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True, text="Radius") UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", slider=True, text="Strength") + @staticmethod + def GPENCIL_PAINT(context, layout, tool): + + if (tool is None) or (not tool.has_datablock): + return + + paint = context.tool_settings.gpencil_paint + brush = paint.brush + if brush is None: + return + + gp_settings = brush.gpencil_settings + + def draw_color_selector(): + ma = gp_settings.material + row = layout.row(align=True) + + icon_id = 0 + if ma: + icon_id = ma.id_data.preview.icon_id + txt_ma = ma.name + maxw = 25 + if len(txt_ma) > maxw: + txt_ma = txt_ma[:maxw - 5] + '..' + txt_ma[-3:] + else: + txt_ma = "" + + row.label(text="Material:") + sub = row.row() + sub.ui_units_x = 8 + sub.popover( + panel="TOPBAR_PT_gpencil_materials", + text=txt_ma, + icon_value=icon_id, + ) + + row.prop(gp_settings, "use_material_pin", text="") + + row = layout.row(align=True) + ts = context.scene.tool_settings + settings = ts.gpencil_paint + row.template_ID_preview(settings, "brush", rows=3, cols=8, hide_buttons=True) + + if brush.gpencil_tool == 'ERASE': + row = layout.row(align=True) + row.prop(brush, "size", text="Radius") + row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE') + if gp_settings.eraser_mode == 'SOFT': + row = layout.row(align=True) + row.prop(gp_settings, "pen_strength", slider=True) + row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE') + elif brush.gpencil_tool == 'FILL': + row = layout.row() + row.prop(gp_settings, "fill_leak", text="Leak Size") + row.prop(brush, "size", text="Thickness") + row.prop(gp_settings, "fill_simplify_level", text="Simplify") + + draw_color_selector() + + row = layout.row(align=True) + row.prop(gp_settings, "fill_draw_mode", text="") + row.prop(gp_settings, "show_fill_boundary", text="", icon='GRID') + + else: # bgpsettings.tool == 'DRAW': + row = layout.row(align=True) + row.prop(brush, "size", text="Radius") + row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE') + row = layout.row(align=True) + row.prop(gp_settings, "pen_strength", slider=True) + row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE') + + draw_color_selector() + + @staticmethod def PARTICLE(context, layout, tool): # See: 'VIEW3D_PT_tools_brush', basically a duplicate settings = context.tool_settings.particle_edit @@ -323,6 +400,7 @@ class _draw_left_context_mode: sub.prop(settings, "emitter_distance", text="Distance") class IMAGE_EDITOR: + @staticmethod def VIEW(context, layout, tool): tool_settings = context.tool_settings if tool_settings.use_uv_sculpt: @@ -340,6 +418,7 @@ class _draw_left_context_mode: UnifiedPaintPanel.prop_unified_strength(row, context, brush, "strength", slider=True, text="Strength") UnifiedPaintPanel.prop_unified_strength(row, context, brush, "use_pressure_strength") + @staticmethod def PAINT(context, layout, tool): if (tool is None) or (not tool.has_datablock): return