Cleanup: replace multiple checks with static sets

This commit is contained in:
Campbell Barton
2025-03-21 11:08:24 +00:00
parent d6fa68eb58
commit d9edc0c057
3 changed files with 9 additions and 9 deletions

View File

@@ -94,9 +94,9 @@ class GreasePencilDisplayPanel:
settings = tool_settings.gpencil_paint
elif context.mode == 'SCULPT_GPENCIL':
settings = tool_settings.gpencil_sculpt_paint
elif context.mode == 'WEIGHT_GPENCIL' or context.mode == 'WEIGHT_GREASE_PENCIL':
elif context.mode in {'WEIGHT_GPENCIL', 'WEIGHT_GREASE_PENCIL'}:
settings = tool_settings.gpencil_weight_paint
elif context.mode == 'VERTEX_GPENCIL' or context.mode == 'VERTEX_GREASE_PENCIL':
elif context.mode in {'VERTEX_GPENCIL', 'VERTEX_GREASE_PENCIL'}:
settings = tool_settings.gpencil_vertex_paint
brush = settings.brush
if brush:
@@ -108,13 +108,13 @@ class GreasePencilDisplayPanel:
layout.use_property_decorate = False
tool_settings = context.tool_settings
if context.mode == 'PAINT_GPENCIL' or context.mode == 'PAINT_GREASE_PENCIL':
if context.mode in {'PAINT_GPENCIL', 'PAINT_GREASE_PENCIL'}:
settings = tool_settings.gpencil_paint
elif context.mode == 'SCULPT_GPENCIL' or context.mode == 'SCULPT_GREASE_PENCIL':
elif context.mode in {'SCULPT_GPENCIL', 'SCULPT_GREASE_PENCIL'}:
settings = tool_settings.gpencil_sculpt_paint
elif context.mode == 'WEIGHT_GPENCIL' or context.mode == 'WEIGHT_GREASE_PENCIL':
elif context.mode in {'WEIGHT_GPENCIL', 'WEIGHT_GREASE_PENCIL'}:
settings = tool_settings.gpencil_weight_paint
elif context.mode == 'VERTEX_GPENCIL' or context.mode == 'VERTEX_GREASE_PENCIL':
elif context.mode in {'VERTEX_GPENCIL', 'VERTEX_GREASE_PENCIL'}:
settings = tool_settings.gpencil_vertex_paint
brush = settings.brush
gp_settings = brush.gpencil_settings

View File

@@ -121,10 +121,10 @@ class VIEW3D_HT_tool_header(Header):
if tool in {'SMOOTH', 'RANDOMIZE'}:
layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_brush_popover")
layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_appearance")
elif tool_mode == 'WEIGHT_GPENCIL' or tool_mode == 'WEIGHT_GREASE_PENCIL':
elif tool_mode in {'WEIGHT_GPENCIL', 'WEIGHT_GREASE_PENCIL'}:
if is_valid_context:
layout.popover("VIEW3D_PT_tools_grease_pencil_weight_appearance")
elif tool_mode == 'VERTEX_GPENCIL' or tool_mode == 'VERTEX_GREASE_PENCIL':
elif tool_mode in {'VERTEX_GPENCIL', 'VERTEX_GREASE_PENCIL'}:
if is_valid_context:
layout.popover("VIEW3D_PT_tools_grease_pencil_vertex_appearance")

View File

@@ -74,7 +74,7 @@ class VIEW3D_MT_brush_gpencil_context_menu(Menu):
settings = tool_settings.gpencil_paint
if context.mode == 'SCULPT_GPENCIL':
settings = tool_settings.gpencil_sculpt_paint
elif context.mode == 'WEIGHT_GPENCIL' or context.mode == 'WEIGHT_GREASE_PENCIL':
elif context.mode in {'WEIGHT_GPENCIL', 'WEIGHT_GREASE_PENCIL'}:
settings = tool_settings.gpencil_weight_paint
elif context.mode == 'VERTEX_GPENCIL':
settings = tool_settings.gpencil_vertex_paint