Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/properties_grease_pencil_common.py
| Show First 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| elif is_clip_editor: | elif is_clip_editor: | ||||
| row.prop(context.space_data, "grease_pencil_source", expand=True) | row.prop(context.space_data, "grease_pencil_source", expand=True) | ||||
| # col.separator() | # col.separator() | ||||
| # col.separator() | # col.separator() | ||||
| gpencil_stroke_placement_settings(context, col) | gpencil_stroke_placement_settings(context, col) | ||||
| # NOTE: UNUSED. | |||||
| class GreasePencilStrokeEditPanel: | class GreasePencilStrokeEditPanel: | ||||
| # subclass must set | # subclass must set | ||||
| # bl_space_type = 'IMAGE_EDITOR' | # bl_space_type = 'IMAGE_EDITOR' | ||||
| bl_label = "Edit Strokes" | bl_label = "Edit Strokes" | ||||
| bl_category = "Tools" | bl_category = "Tool" | ||||
| bl_region_type = 'TOOLS' | bl_region_type = 'TOOLS' | ||||
mont29: This seems to be a weird hack to 'hide' a panel, unless am mistaken? Do not do that (fine in… | |||||
antoniovUnsubmitted Not Done Inline ActionsNo problem to remove these panels. These were from 2.7x when Gpencil hadn't modes and now with the mdoes and the split of annotation tool, we don't need them. antoniov: No problem to remove these panels. These were from 2.7x when Gpencil hadn't modes and now with… | |||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| if context.gpencil_data is None: | if context.gpencil_data is None: | ||||
| return False | return False | ||||
| gpd = context.gpencil_data | gpd = context.gpencil_data | ||||
| return bool(context.editable_gpencil_strokes) and bool(gpd.use_stroke_edit_mode) | return bool(context.editable_gpencil_strokes) and bool(gpd.use_stroke_edit_mode) | ||||
| ▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| col.operator("gpencil.stroke_split", text="Split") | col.operator("gpencil.stroke_split", text="Split") | ||||
| col = layout.column(align=True) | col = layout.column(align=True) | ||||
| col.label(text="Cleanup:") | col.label(text="Cleanup:") | ||||
| col.operator_menu_enum("gpencil.reproject", text="Reproject Strokes...", property="type") | col.operator_menu_enum("gpencil.reproject", text="Reproject Strokes...", property="type") | ||||
| col.operator_menu_enum("gpencil.frame_clean_fill", text="Clean Boundary Strokes...", property="mode") | col.operator_menu_enum("gpencil.frame_clean_fill", text="Clean Boundary Strokes...", property="mode") | ||||
| class GreasePencilStrokeSculptPanel: | |||||
| # subclass must set | |||||
| # bl_space_type = 'IMAGE_EDITOR' | |||||
| bl_label = "Sculpt Strokes" | |||||
| bl_category = "Tools" | |||||
| def draw(self, context): | |||||
| layout = self.layout | |||||
| layout.use_property_split = True | |||||
| layout.use_property_decorate = False | |||||
| settings = context.tool_settings.gpencil_sculpt | |||||
| brush = settings.brush | |||||
| layout.template_icon_view(settings, "sculpt_tool", show_labels=True) | |||||
| if not self.is_popover: | |||||
| from bl_ui.properties_paint_common import ( | |||||
| brush_basic_gpencil_sculpt_settings, | |||||
| ) | |||||
| brush_basic_gpencil_sculpt_settings(layout, context, brush) | |||||
| class GreasePencilSculptOptionsPanel: | class GreasePencilSculptOptionsPanel: | ||||
| bl_label = "Sculpt Strokes" | bl_label = "Sculpt Strokes" | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| settings = context.tool_settings.gpencil_sculpt | settings = context.tool_settings.gpencil_sculpt | ||||
| tool = settings.sculpt_tool | tool = settings.sculpt_tool | ||||
| Show All 13 Lines | def draw(self, context): | ||||
| layout.prop(settings, "use_edit_strength", text="Affect Strength") | layout.prop(settings, "use_edit_strength", text="Affect Strength") | ||||
| layout.prop(settings, "use_edit_thickness", text="Affect Thickness") | layout.prop(settings, "use_edit_thickness", text="Affect Thickness") | ||||
| if tool == 'SMOOTH': | if tool == 'SMOOTH': | ||||
| layout.prop(brush, "use_edit_pressure") | layout.prop(brush, "use_edit_pressure") | ||||
| layout.prop(settings, "use_edit_uv", text="Affect UV") | layout.prop(settings, "use_edit_uv", text="Affect UV") | ||||
| # GP Object Tool Settings | # GP Object Tool Settings | ||||
| class GreasePencilAppearancePanel: | class GreasePencilDisplayPanel: | ||||
| bl_label = "Brush Appearance" | bl_label = "Display" | ||||
| bl_options = {'DEFAULT_CLOSED'} | bl_options = {'DEFAULT_CLOSED'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| ob = context.active_object | ob = context.active_object | ||||
| return ob and ob.type == 'GPENCIL' | brush = context.tool_settings.gpencil_paint.brush | ||||
| return (ob and ob.type == 'GPENCIL') and (brush is not None and brush.gpencil_tool != 'ERASE') | |||||
| def draw_header(self, context): | |||||
| if self.is_popover: return | |||||
| if context.mode == 'PAINT_GPENCIL': | |||||
| brush = context.tool_settings.gpencil_paint.brush | |||||
| gp_settings = brush.gpencil_settings | |||||
| self.layout.prop(gp_settings, "use_cursor", text="") | |||||
| elif context.mode in ('SCULPT_GPENCIL', 'WEIGHT_GPENCIL'): | |||||
| settings = context.tool_settings.gpencil_sculpt | |||||
| brush = settings.brush | |||||
| self.layout.prop(brush, "use_cursor", text="") | |||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| layout.use_property_split = True | layout.use_property_split = True | ||||
| layout.use_property_decorate = False | layout.use_property_decorate = False | ||||
| tool_settings = context.tool_settings | tool_settings = context.tool_settings | ||||
| ob = context.active_object | ob = context.active_object | ||||
| if ob.mode == 'PAINT_GPENCIL': | if ob.mode == 'PAINT_GPENCIL': | ||||
| brush = tool_settings.gpencil_paint.brush | brush = tool_settings.gpencil_paint.brush | ||||
| gp_settings = brush.gpencil_settings | gp_settings = brush.gpencil_settings | ||||
| sub = layout.column(align=True) | if self.is_popover: | ||||
| sub.enabled = not brush.use_custom_icon | row = layout.row(align=True) | ||||
| sub.prop(gp_settings, "gp_icon", text="Icon") | row.prop(gp_settings, "use_cursor", text="") | ||||
| row.label(text="Display Cursor") | |||||
| layout.prop(brush, "use_custom_icon") | |||||
| sub = layout.column() | |||||
| sub.active = brush.use_custom_icon | |||||
| sub.prop(brush, "icon_filepath", text="") | |||||
| layout.prop(gp_settings, "use_cursor", text="Show Brush") | col = layout.column(align=True) | ||||
| col.active = gp_settings.use_cursor | |||||
| if brush.gpencil_tool == 'DRAW': | if brush.gpencil_tool == 'DRAW': | ||||
| layout.prop(gp_settings, "show_lasso", text="Show Fill Color While Drawing") | col.prop(gp_settings, "show_lasso", text="Show Fill Color While Drawing") | ||||
| if brush.gpencil_tool == 'FILL': | if brush.gpencil_tool == 'FILL': | ||||
| layout.prop(brush, "cursor_color_add", text="Color") | col.prop(brush, "cursor_color_add", text="Cursor Color") | ||||
| elif ob.mode in {'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}: | elif ob.mode in {'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}: | ||||
| settings = tool_settings.gpencil_sculpt | settings = tool_settings.gpencil_sculpt | ||||
| brush = settings.brush | brush = settings.brush | ||||
| tool = settings.sculpt_tool | tool = settings.sculpt_tool | ||||
| if self.is_popover: | |||||
| row = layout.row(align=True) | |||||
| row.prop(brush, "use_cursor", text="") | |||||
| row.label(text="Display Cursor") | |||||
| col = layout.column(align=True) | col = layout.column(align=True) | ||||
| col.prop(brush, "use_cursor", text="Show Brush") | col.active = brush.use_cursor | ||||
| if tool in {'THICKNESS', 'STRENGTH'}: | if tool in {'THICKNESS', 'STRENGTH'}: | ||||
| col.prop(brush, "cursor_color_add", text="Add") | col.prop(brush, "cursor_color_add", text="Add Cursor Color") | ||||
| col.prop(brush, "cursor_color_sub", text="Subtract") | col.prop(brush, "cursor_color_sub", text="Subtract Cursor Color") | ||||
| elif tool == 'PINCH': | elif tool == 'PINCH': | ||||
| col.prop(brush, "cursor_color_add", text="Pinch") | col.prop(brush, "cursor_color_add", text="Pinch Cursor Color") | ||||
| col.prop(brush, "cursor_color_sub", text="Inflate") | col.prop(brush, "cursor_color_sub", text="Inflate Cursor Color") | ||||
| elif tool == 'TWIST': | elif tool == 'TWIST': | ||||
| col.prop(brush, "cursor_color_add", text="CCW") | col.prop(brush, "cursor_color_add", text="CCW Cursor Color") | ||||
| col.prop(brush, "cursor_color_sub", text="CW") | col.prop(brush, "cursor_color_sub", text="CW Cursor Color") | ||||
| else: | else: | ||||
| col.prop(brush, "cursor_color_add", text="") | col.prop(brush, "cursor_color_add", text="Cursor Color") | ||||
| class GPENCIL_MT_pie_tool_palette(Menu): | class GPENCIL_MT_pie_tool_palette(Menu): | ||||
| """A pie menu for quick access to Grease Pencil tools""" | """A pie menu for quick access to Grease Pencil tools""" | ||||
| bl_label = "Grease Pencil Tools" | bl_label = "Grease Pencil Tools" | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| ▲ Show 20 Lines • Show All 656 Lines • Show Last 20 Lines | |||||
This seems to be a weird hack to 'hide' a panel, unless am mistaken? Do not do that (fine in dev process, but not for final patch), just remove whatever becomes unused. We have git history in case we need to find that code again.