Cleanup: consistent naming for tool_settings & operator properties

Use names:
- `tool_settings` instead of `ts`.

- `props` instead of `op` / `prop` / `op_props`
  As Python may reference operators, don't confuse the operator
  properties with an instance of the operator.

In both cases these names were already used for most scripts.
This commit is contained in:
2023-04-13 13:14:01 +10:00
parent b0edd63752
commit ab64bd264a
11 changed files with 300 additions and 290 deletions

View File

@@ -120,15 +120,15 @@ def _draw_add_remove_buttons(
list_length, list_length,
): ):
"""Draw the +/- buttons to add and remove list entries.""" """Draw the +/- buttons to add and remove list entries."""
add_op = layout.operator(UILIST_OT_entry_add.bl_idname, text="", icon='ADD') props = layout.operator(UILIST_OT_entry_add.bl_idname, text="", icon='ADD')
add_op.list_path = list_path props.list_path = list_path
add_op.active_index_path = active_index_path props.active_index_path = active_index_path
row = layout.row() row = layout.row()
row.enabled = list_length > 0 row.enabled = list_length > 0
remove_op = row.operator(UILIST_OT_entry_remove.bl_idname, text="", icon='REMOVE') props = row.operator(UILIST_OT_entry_remove.bl_idname, text="", icon='REMOVE')
remove_op.list_path = list_path props.list_path = list_path
remove_op.active_index_path = active_index_path props.active_index_path = active_index_path
def _draw_move_buttons( def _draw_move_buttons(
@@ -141,15 +141,15 @@ def _draw_move_buttons(
"""Draw the up/down arrows to move elements in the list.""" """Draw the up/down arrows to move elements in the list."""
col = layout.column() col = layout.column()
col.enabled = list_length > 1 col.enabled = list_length > 1
move_up_op = layout.operator(UILIST_OT_entry_move.bl_idname, text="", icon='TRIA_UP') props = layout.operator(UILIST_OT_entry_move.bl_idname, text="", icon='TRIA_UP')
move_up_op.direction = 'UP' props.direction = 'UP'
move_up_op.list_path = list_path props.list_path = list_path
move_up_op.active_index_path = active_index_path props.active_index_path = active_index_path
move_down_op = layout.operator(UILIST_OT_entry_move.bl_idname, text="", icon='TRIA_DOWN') props = layout.operator(UILIST_OT_entry_move.bl_idname, text="", icon='TRIA_DOWN')
move_down_op.direction = 'DOWN' props.direction = 'DOWN'
move_down_op.list_path = list_path props.list_path = list_path
move_down_op.active_index_path = active_index_path props.active_index_path = active_index_path
def _get_context_attr(context, data_path): def _get_context_attr(context, data_path):

View File

@@ -63,12 +63,12 @@ class MESH_MT_shape_key_context_menu(Menu):
layout.operator("object.join_shapes") layout.operator("object.join_shapes")
layout.operator("object.shape_key_transfer") layout.operator("object.shape_key_transfer")
layout.separator() layout.separator()
op = layout.operator("object.shape_key_remove", icon='X', text="Delete All Shape Keys") props = layout.operator("object.shape_key_remove", icon='X', text="Delete All Shape Keys")
op.all = True props.all = True
op.apply_mix = False props.apply_mix = False
op = layout.operator("object.shape_key_remove", text="Apply All Shape Keys") props = layout.operator("object.shape_key_remove", text="Apply All Shape Keys")
op.all = True props.all = True
op.apply_mix = True props.apply_mix = True
layout.separator() layout.separator()
layout.operator("object.shape_key_move", icon='TRIA_UP_BAR', text="Move to Top").type = 'TOP' layout.operator("object.shape_key_move", icon='TRIA_UP_BAR', text="Move to Top").type = 'TOP'
layout.operator("object.shape_key_move", icon='TRIA_DOWN_BAR', text="Move to Bottom").type = 'BOTTOM' layout.operator("object.shape_key_move", icon='TRIA_DOWN_BAR', text="Move to Bottom").type = 'BOTTOM'
@@ -674,12 +674,12 @@ class MESH_UL_color_attributes(UIList, ColorAttributesListBase):
row = layout.row() row = layout.row()
row.emboss = 'NONE' row.emboss = 'NONE'
prop = row.operator( props = row.operator(
"geometry.color_attribute_render_set", "geometry.color_attribute_render_set",
text="", text="",
icon='RESTRICT_RENDER_OFF' if active_render else 'RESTRICT_RENDER_ON', icon='RESTRICT_RENDER_OFF' if active_render else 'RESTRICT_RENDER_ON',
) )
prop.name = attribute.name props.name = attribute.name
class MESH_UL_color_attributes_selector(UIList, ColorAttributesListBase): class MESH_UL_color_attributes_selector(UIList, ColorAttributesListBase):

View File

@@ -739,15 +739,15 @@ class VIEWLAYER_PT_freestyle_linestyle_color(ViewLayerFreestyleLineStyle, Panel)
elif modifier.type == 'DISTANCE_FROM_OBJECT': elif modifier.type == 'DISTANCE_FROM_OBJECT':
box.prop(modifier, "target") box.prop(modifier, "target")
draw_modifier_color_ramp_common(box, modifier, True) draw_modifier_color_ramp_common(box, modifier, True)
prop = box.operator("scene.freestyle_fill_range_by_selection") props = box.operator("scene.freestyle_fill_range_by_selection")
prop.type = 'COLOR' props.type = 'COLOR'
prop.name = modifier.name props.name = modifier.name
elif modifier.type == 'DISTANCE_FROM_CAMERA': elif modifier.type == 'DISTANCE_FROM_CAMERA':
draw_modifier_color_ramp_common(box, modifier, True) draw_modifier_color_ramp_common(box, modifier, True)
prop = box.operator("scene.freestyle_fill_range_by_selection") props = box.operator("scene.freestyle_fill_range_by_selection")
prop.type = 'COLOR' props.type = 'COLOR'
prop.name = modifier.name props.name = modifier.name
elif modifier.type == 'MATERIAL': elif modifier.type == 'MATERIAL':
row = box.row() row = box.row()
@@ -842,15 +842,15 @@ class VIEWLAYER_PT_freestyle_linestyle_alpha(ViewLayerFreestyleLineStyle, Panel)
elif modifier.type == 'DISTANCE_FROM_OBJECT': elif modifier.type == 'DISTANCE_FROM_OBJECT':
box.prop(modifier, "target") box.prop(modifier, "target")
draw_modifier_curve_common(box, modifier, True, False) draw_modifier_curve_common(box, modifier, True, False)
prop = box.operator("scene.freestyle_fill_range_by_selection") props = box.operator("scene.freestyle_fill_range_by_selection")
prop.type = 'ALPHA' props.type = 'ALPHA'
prop.name = modifier.name props.name = modifier.name
elif modifier.type == 'DISTANCE_FROM_CAMERA': elif modifier.type == 'DISTANCE_FROM_CAMERA':
draw_modifier_curve_common(box, modifier, True, False) draw_modifier_curve_common(box, modifier, True, False)
prop = box.operator("scene.freestyle_fill_range_by_selection") props = box.operator("scene.freestyle_fill_range_by_selection")
prop.type = 'ALPHA' props.type = 'ALPHA'
prop.name = modifier.name props.name = modifier.name
elif modifier.type == 'MATERIAL': elif modifier.type == 'MATERIAL':
box.prop(modifier, "material_attribute", text="Material Attribute") box.prop(modifier, "material_attribute", text="Material Attribute")
@@ -934,15 +934,15 @@ class VIEWLAYER_PT_freestyle_linestyle_thickness(ViewLayerFreestyleLineStyle, Pa
elif modifier.type == 'DISTANCE_FROM_OBJECT': elif modifier.type == 'DISTANCE_FROM_OBJECT':
box.prop(modifier, "target") box.prop(modifier, "target")
draw_modifier_curve_common(box, modifier, True, True) draw_modifier_curve_common(box, modifier, True, True)
prop = box.operator("scene.freestyle_fill_range_by_selection") props = box.operator("scene.freestyle_fill_range_by_selection")
prop.type = 'THICKNESS' props.type = 'THICKNESS'
prop.name = modifier.name props.name = modifier.name
elif modifier.type == 'DISTANCE_FROM_CAMERA': elif modifier.type == 'DISTANCE_FROM_CAMERA':
draw_modifier_curve_common(box, modifier, True, True) draw_modifier_curve_common(box, modifier, True, True)
prop = box.operator("scene.freestyle_fill_range_by_selection") props = box.operator("scene.freestyle_fill_range_by_selection")
prop.type = 'THICKNESS' props.type = 'THICKNESS'
prop.name = modifier.name props.name = modifier.name
elif modifier.type == 'MATERIAL': elif modifier.type == 'MATERIAL':
box.prop(modifier, "material_attribute", text="Material Attribute") box.prop(modifier, "material_attribute", text="Material Attribute")

View File

@@ -148,16 +148,16 @@ class GreasePencilBrushFalloff:
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
ts = context.tool_settings tool_settings = context.tool_settings
settings = None settings = None
if context.mode == 'PAINT_GPENCIL': if context.mode == 'PAINT_GPENCIL':
settings = ts.gpencil_paint settings = tool_settings.gpencil_paint
if context.mode == 'SCULPT_GPENCIL': if context.mode == 'SCULPT_GPENCIL':
settings = ts.gpencil_sculpt_paint settings = tool_settings.gpencil_sculpt_paint
elif context.mode == 'WEIGHT_GPENCIL': elif context.mode == 'WEIGHT_GPENCIL':
settings = ts.gpencil_weight_paint settings = tool_settings.gpencil_weight_paint
elif context.mode == 'VERTEX_GPENCIL': elif context.mode == 'VERTEX_GPENCIL':
settings = ts.gpencil_vertex_paint settings = tool_settings.gpencil_vertex_paint
if settings: if settings:
brush = settings.brush brush = settings.brush
@@ -588,9 +588,9 @@ class GreasePencilVertexcolorPanel:
layout.use_property_split = True layout.use_property_split = True
layout.use_property_decorate = False layout.use_property_decorate = False
ts = context.scene.tool_settings tool_settings = context.scene.tool_settings
is_vertex = context.mode == 'VERTEX_GPENCIL' is_vertex = context.mode == 'VERTEX_GPENCIL'
gpencil_paint = ts.gpencil_vertex_paint if is_vertex else ts.gpencil_paint gpencil_paint = tool_settings.gpencil_vertex_paint if is_vertex else tool_settings.gpencil_paint
brush = gpencil_paint.brush brush = gpencil_paint.brush
gp_settings = brush.gpencil_settings gp_settings = brush.gpencil_settings
tool = brush.gpencil_vertex_tool if is_vertex else brush.gpencil_tool tool = brush.gpencil_vertex_tool if is_vertex else brush.gpencil_tool
@@ -858,30 +858,30 @@ class GreasePencilFlipTintColors(Operator):
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
ts = context.tool_settings tool_settings = context.tool_settings
settings = None settings = None
if context.mode == 'PAINT_GPENCIL': if context.mode == 'PAINT_GPENCIL':
settings = ts.gpencil_paint settings = tool_settings.gpencil_paint
if context.mode == 'SCULPT_GPENCIL': if context.mode == 'SCULPT_GPENCIL':
settings = ts.gpencil_sculpt_paint settings = tool_settings.gpencil_sculpt_paint
elif context.mode == 'WEIGHT_GPENCIL': elif context.mode == 'WEIGHT_GPENCIL':
settings = ts.gpencil_weight_paint settings = tool_settings.gpencil_weight_paint
elif context.mode == 'VERTEX_GPENCIL': elif context.mode == 'VERTEX_GPENCIL':
settings = ts.gpencil_vertex_paint settings = tool_settings.gpencil_vertex_paint
return settings and settings.brush return settings and settings.brush
def execute(self, context): def execute(self, context):
ts = context.tool_settings tool_settings = context.tool_settings
settings = None settings = None
if context.mode == 'PAINT_GPENCIL': if context.mode == 'PAINT_GPENCIL':
settings = ts.gpencil_paint settings = tool_settings.gpencil_paint
if context.mode == 'SCULPT_GPENCIL': if context.mode == 'SCULPT_GPENCIL':
settings = ts.gpencil_sculpt_paint settings = tool_settings.gpencil_sculpt_paint
elif context.mode == 'WEIGHT_GPENCIL': elif context.mode == 'WEIGHT_GPENCIL':
settings = ts.gpencil_weight_paint settings = tool_settings.gpencil_weight_paint
elif context.mode == 'VERTEX_GPENCIL': elif context.mode == 'VERTEX_GPENCIL':
settings = ts.gpencil_vertex_paint settings = tool_settings.gpencil_vertex_paint
brush = settings.brush brush = settings.brush
color = brush.color color = brush.color

View File

@@ -1732,13 +1732,13 @@ class CLIP_MT_marker_pie(Menu):
layout = self.layout layout = self.layout
pie = layout.menu_pie() pie = layout.menu_pie()
# Use Location Tracking # Use Location Tracking
prop = pie.operator("wm.context_set_enum", text="Location") props = pie.operator("wm.context_set_enum", text="Location")
prop.data_path = "space_data.clip.tracking.tracks.active.motion_model" props.data_path = "space_data.clip.tracking.tracks.active.motion_model"
prop.value = "Loc" props.value = "Loc"
# Use Affine Tracking # Use Affine Tracking
prop = pie.operator("wm.context_set_enum", text="Affine") props = pie.operator("wm.context_set_enum", text="Affine")
prop.data_path = "space_data.clip.tracking.tracks.active.motion_model" props.data_path = "space_data.clip.tracking.tracks.active.motion_model"
prop.value = "Affine" props.value = "Affine"
# Copy Settings From Active To Selected # Copy Settings From Active To Selected
pie.operator("clip.track_settings_to_track", icon='COPYDOWN') pie.operator("clip.track_settings_to_track", icon='COPYDOWN')
# Make Settings Default # Make Settings Default
@@ -1749,13 +1749,13 @@ class CLIP_MT_marker_pie(Menu):
# Use Brute Force # Use Brute Force
pie.prop(track_active, "use_brute", text="Use Brute Force") pie.prop(track_active, "use_brute", text="Use Brute Force")
# Match Keyframe # Match Keyframe
prop = pie.operator("wm.context_set_enum", text="Match Previous", icon='KEYFRAME_HLT') props = pie.operator("wm.context_set_enum", text="Match Previous", icon='KEYFRAME_HLT')
prop.data_path = "space_data.clip.tracking.tracks.active.pattern_match" props.data_path = "space_data.clip.tracking.tracks.active.pattern_match"
prop.value = 'PREV_FRAME' props.value = 'PREV_FRAME'
# Match Previous Frame # Match Previous Frame
prop = pie.operator("wm.context_set_enum", text="Match Keyframe", icon='KEYFRAME') props = pie.operator("wm.context_set_enum", text="Match Keyframe", icon='KEYFRAME')
prop.data_path = "space_data.clip.tracking.tracks.active.pattern_match" props.data_path = "space_data.clip.tracking.tracks.active.pattern_match"
prop.value = 'KEYFRAME' props.value = 'KEYFRAME'
class CLIP_MT_tracking_pie(Menu): class CLIP_MT_tracking_pie(Menu):
@@ -1773,13 +1773,13 @@ class CLIP_MT_tracking_pie(Menu):
pie = layout.menu_pie() pie = layout.menu_pie()
# Track Backwards # Track Backwards
prop = pie.operator("clip.track_markers", icon='TRACKING_BACKWARDS') props = pie.operator("clip.track_markers", icon='TRACKING_BACKWARDS')
prop.backwards = True props.backwards = True
prop.sequence = True props.sequence = True
# Track Forwards # Track Forwards
prop = pie.operator("clip.track_markers", icon='TRACKING_FORWARDS') props = pie.operator("clip.track_markers", icon='TRACKING_FORWARDS')
prop.backwards = False props.backwards = False
prop.sequence = True props.sequence = True
# Disable Marker # Disable Marker
pie.operator("clip.disable_markers", icon='HIDE_OFF').action = 'TOGGLE' pie.operator("clip.disable_markers", icon='HIDE_OFF').action = 'TOGGLE'
# Detect Features # Detect Features
@@ -1831,11 +1831,11 @@ class CLIP_MT_solving_pie(Menu):
icon='KEYFRAME', icon='KEYFRAME',
).keyframe = 'KEYFRAME_B' ).keyframe = 'KEYFRAME_B'
# Clean Tracks # Clean Tracks
prop = pie.operator("clip.clean_tracks", icon='X') props = pie.operator("clip.clean_tracks", icon='X')
props.frames = 15
props.error = 2
# Filter Tracks # Filter Tracks
pie.operator("clip.filter_tracks", icon='FILTER') pie.operator("clip.filter_tracks", icon='FILTER')
prop.frames = 15
prop.error = 2
class CLIP_MT_reconstruction_pie(Menu): class CLIP_MT_reconstruction_pie(Menu):

View File

@@ -621,17 +621,17 @@ class SEQUENCER_MT_change(Menu):
layout.operator_context = 'INVOKE_DEFAULT' layout.operator_context = 'INVOKE_DEFAULT'
layout.operator_menu_enum("sequencer.change_effect_input", "swap") layout.operator_menu_enum("sequencer.change_effect_input", "swap")
layout.operator_menu_enum("sequencer.change_effect_type", "type") layout.operator_menu_enum("sequencer.change_effect_type", "type")
prop = layout.operator("sequencer.change_path", text="Path/Files") props = layout.operator("sequencer.change_path", text="Path/Files")
if strip: if strip:
strip_type = strip.type strip_type = strip.type
if strip_type == 'IMAGE': if strip_type == 'IMAGE':
prop.filter_image = True props.filter_image = True
elif strip_type == 'MOVIE': elif strip_type == 'MOVIE':
prop.filter_movie = True props.filter_movie = True
elif strip_type == 'SOUND': elif strip_type == 'SOUND':
prop.filter_sound = True props.filter_sound = True
class SEQUENCER_MT_navigation(Menu): class SEQUENCER_MT_navigation(Menu):
@@ -865,18 +865,18 @@ class SEQUENCER_MT_strip_input(Menu):
layout.operator("sequencer.reload", text="Reload Strips") layout.operator("sequencer.reload", text="Reload Strips")
layout.operator("sequencer.reload", text="Reload Strips and Adjust Length").adjust_length = True layout.operator("sequencer.reload", text="Reload Strips and Adjust Length").adjust_length = True
prop = layout.operator("sequencer.change_path", text="Change Path/Files") props = layout.operator("sequencer.change_path", text="Change Path/Files")
layout.operator("sequencer.swap_data", text="Swap Data") layout.operator("sequencer.swap_data", text="Swap Data")
if strip: if strip:
strip_type = strip.type strip_type = strip.type
if strip_type == 'IMAGE': if strip_type == 'IMAGE':
prop.filter_image = True props.filter_image = True
elif strip_type == 'MOVIE': elif strip_type == 'MOVIE':
prop.filter_movie = True props.filter_movie = True
elif strip_type == 'SOUND': elif strip_type == 'SOUND':
prop.filter_sound = True props.filter_sound = True
class SEQUENCER_MT_strip_lock_mute(Menu): class SEQUENCER_MT_strip_lock_mute(Menu):

View File

@@ -2094,13 +2094,13 @@ class _defs_gpencil_paint:
class _defs_gpencil_edit: class _defs_gpencil_edit:
def is_segment(context): def is_segment(context):
ts = context.scene.tool_settings tool_settings = context.scene.tool_settings
if context.mode == 'EDIT_GPENCIL': if context.mode == 'EDIT_GPENCIL':
return ts.gpencil_selectmode_edit == 'SEGMENT' return tool_settings.gpencil_selectmode_edit == 'SEGMENT'
elif context.mode == 'SCULPT_GPENCIL': elif context.mode == 'SCULPT_GPENCIL':
return ts.use_gpencil_select_mask_segment return tool_settings.use_gpencil_select_mask_segment
elif context.mode == 'VERTEX_GPENCIL': elif context.mode == 'VERTEX_GPENCIL':
return ts.use_gpencil_vertex_select_mask_segment return tool_settings.use_gpencil_vertex_select_mask_segment
else: else:
return False return False
@@ -2283,10 +2283,15 @@ class _defs_gpencil_sculpt:
if context is None: if context is None:
return True return True
ob = context.active_object ob = context.active_object
ts = context.scene.tool_settings tool_settings = context.scene.tool_settings
return ob and ob.type == 'GPENCIL' and (ts.use_gpencil_select_mask_point or return (
ts.use_gpencil_select_mask_stroke or ob is not None and
ts.use_gpencil_select_mask_segment) ob.type == 'GPENCIL' and (
tool_settings.use_gpencil_select_mask_point or
tool_settings.use_gpencil_select_mask_stroke or
tool_settings.use_gpencil_select_mask_segment
)
)
@staticmethod @staticmethod
def generate_from_brushes(context): def generate_from_brushes(context):
@@ -2427,10 +2432,15 @@ class _defs_gpencil_vertex:
if context is None: if context is None:
return True return True
ob = context.active_object ob = context.active_object
ts = context.scene.tool_settings tool_settings = context.scene.tool_settings
return ob and ob.type == 'GPENCIL' and (ts.use_gpencil_vertex_select_mask_point or return (
ts.use_gpencil_vertex_select_mask_stroke or ob is not None and
ts.use_gpencil_vertex_select_mask_segment) ob.type == 'GPENCIL' and (
tool_settings.use_gpencil_vertex_select_mask_point or
tool_settings.use_gpencil_vertex_select_mask_stroke or
tool_settings.use_gpencil_vertex_select_mask_segment
)
)
@staticmethod @staticmethod
def generate_from_brushes(context): def generate_from_brushes(context):

View File

@@ -235,34 +235,34 @@ class TOPBAR_MT_file_cleanup(Menu):
layout = self.layout layout = self.layout
layout.separator() layout.separator()
op_props = layout.operator("outliner.orphans_purge", text="Unused Data-Blocks") props = layout.operator("outliner.orphans_purge", text="Unused Data-Blocks")
op_props.do_local_ids = True props.do_local_ids = True
op_props.do_linked_ids = True props.do_linked_ids = True
op_props.do_recursive = False props.do_recursive = False
op_props = layout.operator("outliner.orphans_purge", text="Recursive Unused Data-Blocks") props = layout.operator("outliner.orphans_purge", text="Recursive Unused Data-Blocks")
op_props.do_local_ids = True props.do_local_ids = True
op_props.do_linked_ids = True props.do_linked_ids = True
op_props.do_recursive = True props.do_recursive = True
layout.separator() layout.separator()
op_props = layout.operator("outliner.orphans_purge", text="Unused Linked Data-Blocks") props = layout.operator("outliner.orphans_purge", text="Unused Linked Data-Blocks")
op_props.do_local_ids = False props.do_local_ids = False
op_props.do_linked_ids = True props.do_linked_ids = True
op_props.do_recursive = False props.do_recursive = False
op_props = layout.operator("outliner.orphans_purge", text="Recursive Unused Linked Data-Blocks") props = layout.operator("outliner.orphans_purge", text="Recursive Unused Linked Data-Blocks")
op_props.do_local_ids = False props.do_local_ids = False
op_props.do_linked_ids = True props.do_linked_ids = True
op_props.do_recursive = True props.do_recursive = True
layout.separator() layout.separator()
op_props = layout.operator("outliner.orphans_purge", text="Unused Local Data-Blocks") props = layout.operator("outliner.orphans_purge", text="Unused Local Data-Blocks")
op_props.do_local_ids = True props.do_local_ids = True
op_props.do_linked_ids = False props.do_linked_ids = False
op_props.do_recursive = False props.do_recursive = False
op_props = layout.operator("outliner.orphans_purge", text="Recursive Unused Local Data-Blocks") props = layout.operator("outliner.orphans_purge", text="Recursive Unused Local Data-Blocks")
op_props.do_local_ids = True props.do_local_ids = True
op_props.do_linked_ids = False props.do_linked_ids = False
op_props.do_recursive = True props.do_recursive = True
class TOPBAR_MT_file(Menu): class TOPBAR_MT_file(Menu):

View File

@@ -2205,12 +2205,12 @@ class StudioLightPanelMixin:
row.template_icon(layout.icon(studio_light), scale=3.0) row.template_icon(layout.icon(studio_light), scale=3.0)
col = row.column() col = row.column()
op = col.operator("preferences.studiolight_uninstall", text="", icon='REMOVE') props = col.operator("preferences.studiolight_uninstall", text="", icon='REMOVE')
op.index = studio_light.index props.index = studio_light.index
if studio_light.type == 'STUDIO': if studio_light.type == 'STUDIO':
op = col.operator("preferences.studiolight_copy_settings", text="", icon='IMPORT') props = col.operator("preferences.studiolight_copy_settings", text="", icon='IMPORT')
op.index = studio_light.index props.index = studio_light.index
box.label(text=studio_light.name) box.label(text=studio_light.name)
@@ -2247,9 +2247,9 @@ class USERPREF_PT_studiolight_lights(StudioLightPanel, StudioLightPanelMixin, Pa
def draw_header_preset(self, _context): def draw_header_preset(self, _context):
layout = self.layout layout = self.layout
op = layout.operator("preferences.studiolight_install", icon='IMPORT', text="Install...") props = layout.operator("preferences.studiolight_install", icon='IMPORT', text="Install...")
op.type = 'STUDIO' props.type = 'STUDIO'
op.filter_glob = ".sl" props.filter_glob = ".sl"
layout.separator() layout.separator()
def get_error_message(self): def get_error_message(self):

View File

@@ -927,7 +927,7 @@ class VIEW3D_MT_editor_menus(Menu):
edit_object = context.edit_object edit_object = context.edit_object
gp_edit = obj and obj.mode in {'EDIT_GPENCIL', 'PAINT_GPENCIL', 'SCULPT_GPENCIL', gp_edit = obj and obj.mode in {'EDIT_GPENCIL', 'PAINT_GPENCIL', 'SCULPT_GPENCIL',
'WEIGHT_GPENCIL', 'VERTEX_GPENCIL'} 'WEIGHT_GPENCIL', 'VERTEX_GPENCIL'}
ts = context.scene.tool_settings tool_settings = context.scene.tool_settings
layout.menu("VIEW3D_MT_view") layout.menu("VIEW3D_MT_view")
@@ -936,9 +936,9 @@ class VIEW3D_MT_editor_menus(Menu):
if mode_string not in {'PAINT_GPENCIL', 'WEIGHT_GPENCIL'}: if mode_string not in {'PAINT_GPENCIL', 'WEIGHT_GPENCIL'}:
if ( if (
mode_string == 'SCULPT_GPENCIL' and mode_string == 'SCULPT_GPENCIL' and
(ts.use_gpencil_select_mask_point or (tool_settings.use_gpencil_select_mask_point or
ts.use_gpencil_select_mask_stroke or tool_settings.use_gpencil_select_mask_stroke or
ts.use_gpencil_select_mask_segment) tool_settings.use_gpencil_select_mask_segment)
): ):
layout.menu("VIEW3D_MT_select_gpencil") layout.menu("VIEW3D_MT_select_gpencil")
elif mode_string == 'EDIT_GPENCIL': elif mode_string == 'EDIT_GPENCIL':
@@ -3143,36 +3143,36 @@ class VIEW3D_MT_paint_weight_lock(Menu):
def draw(self, _context): def draw(self, _context):
layout = self.layout layout = self.layout
op = layout.operator("object.vertex_group_lock", icon='LOCKED', text="Lock All") props = layout.operator("object.vertex_group_lock", icon='LOCKED', text="Lock All")
op.action, op.mask = 'LOCK', 'ALL' props.action, props.mask = 'LOCK', 'ALL'
op = layout.operator("object.vertex_group_lock", text="Lock Selected") props = layout.operator("object.vertex_group_lock", text="Lock Selected")
op.action, op.mask = 'LOCK', 'SELECTED' props.action, props.mask = 'LOCK', 'SELECTED'
op = layout.operator("object.vertex_group_lock", text="Lock Unselected") props = layout.operator("object.vertex_group_lock", text="Lock Unselected")
op.action, op.mask = 'LOCK', 'UNSELECTED' props.action, props.mask = 'LOCK', 'UNSELECTED'
op = layout.operator("object.vertex_group_lock", text="Lock Only Selected") props = layout.operator("object.vertex_group_lock", text="Lock Only Selected")
op.action, op.mask = 'LOCK', 'INVERT_UNSELECTED' props.action, props.mask = 'LOCK', 'INVERT_UNSELECTED'
op = layout.operator("object.vertex_group_lock", text="Lock Only Unselected") props = layout.operator("object.vertex_group_lock", text="Lock Only Unselected")
op.action, op.mask = 'UNLOCK', 'INVERT_UNSELECTED' props.action, props.mask = 'UNLOCK', 'INVERT_UNSELECTED'
layout.separator() layout.separator()
op = layout.operator("object.vertex_group_lock", icon='UNLOCKED', text="Unlock All") props = layout.operator("object.vertex_group_lock", icon='UNLOCKED', text="Unlock All")
op.action, op.mask = 'UNLOCK', 'ALL' props.action, props.mask = 'UNLOCK', 'ALL'
op = layout.operator("object.vertex_group_lock", text="Unlock Selected") props = layout.operator("object.vertex_group_lock", text="Unlock Selected")
op.action, op.mask = 'UNLOCK', 'SELECTED' props.action, props.mask = 'UNLOCK', 'SELECTED'
op = layout.operator("object.vertex_group_lock", text="Unlock Unselected") props = layout.operator("object.vertex_group_lock", text="Unlock Unselected")
op.action, op.mask = 'UNLOCK', 'UNSELECTED' props.action, props.mask = 'UNLOCK', 'UNSELECTED'
layout.separator() layout.separator()
op = layout.operator("object.vertex_group_lock", icon='ARROW_LEFTRIGHT', text="Invert Locks") props = layout.operator("object.vertex_group_lock", icon='ARROW_LEFTRIGHT', text="Invert Locks")
op.action, op.mask = 'INVERT', 'ALL' props.action, props.mask = 'INVERT', 'ALL'
class VIEW3D_MT_paint_weight(Menu): class VIEW3D_MT_paint_weight(Menu):
@@ -3417,14 +3417,14 @@ class VIEW3D_MT_face_sets(Menu):
def draw(self, _context): def draw(self, _context):
layout = self.layout layout = self.layout
op = layout.operator("sculpt.face_sets_create", text="Face Set from Masked") props = layout.operator("sculpt.face_sets_create", text="Face Set from Masked")
op.mode = 'MASKED' props.mode = 'MASKED'
op = layout.operator("sculpt.face_sets_create", text="Face Set from Visible") props = layout.operator("sculpt.face_sets_create", text="Face Set from Visible")
op.mode = 'VISIBLE' props.mode = 'VISIBLE'
op = layout.operator("sculpt.face_sets_create", text="Face Set from Edit Mode Selection") props = layout.operator("sculpt.face_sets_create", text="Face Set from Edit Mode Selection")
op.mode = 'SELECTION' props.mode = 'SELECTION'
layout.separator() layout.separator()
@@ -3432,11 +3432,11 @@ class VIEW3D_MT_face_sets(Menu):
layout.separator() layout.separator()
op = layout.operator("sculpt.face_set_edit", text="Grow Face Set") props = layout.operator("sculpt.face_set_edit", text="Grow Face Set")
op.mode = 'GROW' props.mode = 'GROW'
op = layout.operator("sculpt.face_set_edit", text="Shrink Face Set") props = layout.operator("sculpt.face_set_edit", text="Shrink Face Set")
op.mode = 'SHRINK' props.mode = 'SHRINK'
layout.separator() layout.separator()
@@ -3454,18 +3454,18 @@ class VIEW3D_MT_face_sets(Menu):
layout.separator() layout.separator()
op = layout.operator("mesh.face_set_extract", text="Extract Face Set") props = layout.operator("mesh.face_set_extract", text="Extract Face Set")
layout.separator() layout.separator()
op = layout.operator("sculpt.face_set_change_visibility", text="Invert Visible Face Sets") props = layout.operator("sculpt.face_set_change_visibility", text="Invert Visible Face Sets")
op.mode = 'INVERT' props.mode = 'INVERT'
op = layout.operator("sculpt.reveal_all", text="Show All Face Sets") props = layout.operator("sculpt.reveal_all", text="Show All Face Sets")
layout.separator() layout.separator()
op = layout.operator("sculpt.face_sets_randomize_colors", text="Randomize Colors") props = layout.operator("sculpt.face_sets_randomize_colors", text="Randomize Colors")
class VIEW3D_MT_sculpt_set_pivot(Menu): class VIEW3D_MT_sculpt_set_pivot(Menu):
@@ -3496,32 +3496,32 @@ class VIEW3D_MT_face_sets_init(Menu):
def draw(self, _context): def draw(self, _context):
layout = self.layout layout = self.layout
op = layout.operator("sculpt.face_sets_init", text="By Loose Parts") props = layout.operator("sculpt.face_sets_init", text="By Loose Parts")
op.mode = 'LOOSE_PARTS' props.mode = 'LOOSE_PARTS'
op = layout.operator("sculpt.face_sets_init", text="By Face Set Boundaries") props = layout.operator("sculpt.face_sets_init", text="By Face Set Boundaries")
op.mode = 'FACE_SET_BOUNDARIES' props.mode = 'FACE_SET_BOUNDARIES'
op = layout.operator("sculpt.face_sets_init", text="By Materials") props = layout.operator("sculpt.face_sets_init", text="By Materials")
op.mode = 'MATERIALS' props.mode = 'MATERIALS'
op = layout.operator("sculpt.face_sets_init", text="By Normals") props = layout.operator("sculpt.face_sets_init", text="By Normals")
op.mode = 'NORMALS' props.mode = 'NORMALS'
op = layout.operator("sculpt.face_sets_init", text="By UV Seams") props = layout.operator("sculpt.face_sets_init", text="By UV Seams")
op.mode = 'UV_SEAMS' props.mode = 'UV_SEAMS'
op = layout.operator("sculpt.face_sets_init", text="By Edge Creases") props = layout.operator("sculpt.face_sets_init", text="By Edge Creases")
op.mode = 'CREASES' props.mode = 'CREASES'
op = layout.operator("sculpt.face_sets_init", text="By Edge Bevel Weight") props = layout.operator("sculpt.face_sets_init", text="By Edge Bevel Weight")
op.mode = 'BEVEL_WEIGHT' props.mode = 'BEVEL_WEIGHT'
op = layout.operator("sculpt.face_sets_init", text="By Sharp Edges") props = layout.operator("sculpt.face_sets_init", text="By Sharp Edges")
op.mode = 'SHARP_EDGES' props.mode = 'SHARP_EDGES'
op = layout.operator("sculpt.face_sets_init", text="By Face Maps") props = layout.operator("sculpt.face_sets_init", text="By Face Maps")
op.mode = 'FACE_MAPS' props.mode = 'FACE_MAPS'
class VIEW3D_MT_random_mask(Menu): class VIEW3D_MT_random_mask(Menu):
@@ -3530,14 +3530,14 @@ class VIEW3D_MT_random_mask(Menu):
def draw(self, _context): def draw(self, _context):
layout = self.layout layout = self.layout
op = layout.operator("sculpt.mask_init", text="Per Vertex") props = layout.operator("sculpt.mask_init", text="Per Vertex")
op.mode = 'RANDOM_PER_VERTEX' props.mode = 'RANDOM_PER_VERTEX'
op = layout.operator("sculpt.mask_init", text="Per Face Set") props = layout.operator("sculpt.mask_init", text="Per Face Set")
op.mode = 'RANDOM_PER_FACE_SET' props.mode = 'RANDOM_PER_FACE_SET'
op = layout.operator("sculpt.mask_init", text="Per Loose Part") props = layout.operator("sculpt.mask_init", text="Per Loose Part")
op.mode = 'RANDOM_PER_LOOSE_PART' props.mode = 'RANDOM_PER_LOOSE_PART'
class VIEW3D_MT_particle(Menu): class VIEW3D_MT_particle(Menu):
@@ -4431,17 +4431,17 @@ class VIEW3D_MT_edit_mesh_normals_select_strength(Menu):
def draw(self, _context): def draw(self, _context):
layout = self.layout layout = self.layout
op = layout.operator("mesh.mod_weighted_strength", text="Weak") props = layout.operator("mesh.mod_weighted_strength", text="Weak")
op.set = False props.set = False
op.face_strength = 'WEAK' props.face_strength = 'WEAK'
op = layout.operator("mesh.mod_weighted_strength", text="Medium") props = layout.operator("mesh.mod_weighted_strength", text="Medium")
op.set = False props.set = False
op.face_strength = 'MEDIUM' props.face_strength = 'MEDIUM'
op = layout.operator("mesh.mod_weighted_strength", text="Strong") props = layout.operator("mesh.mod_weighted_strength", text="Strong")
op.set = False props.set = False
op.face_strength = 'STRONG' props.face_strength = 'STRONG'
class VIEW3D_MT_edit_mesh_normals_set_strength(Menu): class VIEW3D_MT_edit_mesh_normals_set_strength(Menu):
@@ -4450,17 +4450,17 @@ class VIEW3D_MT_edit_mesh_normals_set_strength(Menu):
def draw(self, _context): def draw(self, _context):
layout = self.layout layout = self.layout
op = layout.operator("mesh.mod_weighted_strength", text="Weak") props = layout.operator("mesh.mod_weighted_strength", text="Weak")
op.set = True props.set = True
op.face_strength = 'WEAK' props.face_strength = 'WEAK'
op = layout.operator("mesh.mod_weighted_strength", text="Medium") props = layout.operator("mesh.mod_weighted_strength", text="Medium")
op.set = True props.set = True
op.face_strength = 'MEDIUM' props.face_strength = 'MEDIUM'
op = layout.operator("mesh.mod_weighted_strength", text="Strong") props = layout.operator("mesh.mod_weighted_strength", text="Strong")
op.set = True props.set = True
op.face_strength = 'STRONG' props.face_strength = 'STRONG'
class VIEW3D_MT_edit_mesh_normals_average(Menu): class VIEW3D_MT_edit_mesh_normals_average(Menu):
@@ -5276,9 +5276,9 @@ class VIEW3D_MT_edit_gpencil_stroke(Menu):
layout.separator() layout.separator()
# Convert # Convert
op = layout.operator("gpencil.stroke_cyclical_set", text="Close") props = layout.operator("gpencil.stroke_cyclical_set", text="Close")
op.type = 'CLOSE' props.type = 'CLOSE'
op.geometry = True props.geometry = True
layout.operator("gpencil.stroke_cyclical_set", text="Toggle Cyclic").type = 'TOGGLE' layout.operator("gpencil.stroke_cyclical_set", text="Toggle Cyclic").type = 'TOGGLE'
layout.operator_menu_enum("gpencil.stroke_caps_set", text="Toggle Caps", property="type") layout.operator_menu_enum("gpencil.stroke_caps_set", text="Toggle Caps", property="type")
layout.operator("gpencil.stroke_flip", text="Switch Direction") layout.operator("gpencil.stroke_flip", text="Switch Direction")
@@ -5569,25 +5569,25 @@ class VIEW3D_MT_sculpt_mask_edit_pie(Menu):
layout = self.layout layout = self.layout
pie = layout.menu_pie() pie = layout.menu_pie()
op = pie.operator("paint.mask_flood_fill", text="Invert Mask") props = pie.operator("paint.mask_flood_fill", text="Invert Mask")
op.mode = 'INVERT' props.mode = 'INVERT'
op = pie.operator("paint.mask_flood_fill", text="Clear Mask") props = pie.operator("paint.mask_flood_fill", text="Clear Mask")
op.mode = 'VALUE' props.mode = 'VALUE'
op.value = 0.0 props.value = 0.0
op = pie.operator("sculpt.mask_filter", text="Smooth Mask") props = pie.operator("sculpt.mask_filter", text="Smooth Mask")
op.filter_type = 'SMOOTH' props.filter_type = 'SMOOTH'
op = pie.operator("sculpt.mask_filter", text="Sharpen Mask") props = pie.operator("sculpt.mask_filter", text="Sharpen Mask")
op.filter_type = 'SHARPEN' props.filter_type = 'SHARPEN'
op = pie.operator("sculpt.mask_filter", text="Grow Mask") props = pie.operator("sculpt.mask_filter", text="Grow Mask")
op.filter_type = 'GROW' props.filter_type = 'GROW'
op = pie.operator("sculpt.mask_filter", text="Shrink Mask") props = pie.operator("sculpt.mask_filter", text="Shrink Mask")
op.filter_type = 'SHRINK' props.filter_type = 'SHRINK'
op = pie.operator("sculpt.mask_filter", text="Increase Contrast") props = pie.operator("sculpt.mask_filter", text="Increase Contrast")
op.filter_type = 'CONTRAST_INCREASE' props.filter_type = 'CONTRAST_INCREASE'
op.auto_iteration_count = False props.auto_iteration_count = False
op = pie.operator("sculpt.mask_filter", text="Decrease Contrast") props = pie.operator("sculpt.mask_filter", text="Decrease Contrast")
op.filter_type = 'CONTRAST_DECREASE' props.filter_type = 'CONTRAST_DECREASE'
op.auto_iteration_count = False props.auto_iteration_count = False
class VIEW3D_MT_sculpt_automasking_pie(Menu): class VIEW3D_MT_sculpt_automasking_pie(Menu):
@@ -5634,16 +5634,16 @@ class VIEW3D_MT_sculpt_face_sets_edit_pie(Menu):
layout = self.layout layout = self.layout
pie = layout.menu_pie() pie = layout.menu_pie()
op = pie.operator("sculpt.face_sets_create", text="Face Set from Masked") props = pie.operator("sculpt.face_sets_create", text="Face Set from Masked")
op.mode = 'MASKED' props.mode = 'MASKED'
op = pie.operator("sculpt.face_sets_create", text="Face Set from Visible") props = pie.operator("sculpt.face_sets_create", text="Face Set from Visible")
op.mode = 'VISIBLE' props.mode = 'VISIBLE'
op = pie.operator("sculpt.face_set_change_visibility", text="Invert Visible") props = pie.operator("sculpt.face_set_change_visibility", text="Invert Visible")
op.mode = 'INVERT' props.mode = 'INVERT'
op = pie.operator("sculpt.reveal_all", text="Show All") props = pie.operator("sculpt.reveal_all", text="Show All")
class VIEW3D_MT_wpaint_vgroup_lock_pie(Menu): class VIEW3D_MT_wpaint_vgroup_lock_pie(Menu):
@@ -5654,29 +5654,29 @@ class VIEW3D_MT_wpaint_vgroup_lock_pie(Menu):
pie = layout.menu_pie() pie = layout.menu_pie()
# 1: Left # 1: Left
op = pie.operator("object.vertex_group_lock", icon='LOCKED', text="Lock All") props = pie.operator("object.vertex_group_lock", icon='LOCKED', text="Lock All")
op.action, op.mask = 'LOCK', 'ALL' props.action, props.mask = 'LOCK', 'ALL'
# 2: Right # 2: Right
op = pie.operator("object.vertex_group_lock", icon='UNLOCKED', text="Unlock All") props = pie.operator("object.vertex_group_lock", icon='UNLOCKED', text="Unlock All")
op.action, op.mask = 'UNLOCK', 'ALL' props.action, props.mask = 'UNLOCK', 'ALL'
# 3: Down # 3: Down
op = pie.operator("object.vertex_group_lock", icon='UNLOCKED', text="Unlock Selected") props = pie.operator("object.vertex_group_lock", icon='UNLOCKED', text="Unlock Selected")
op.action, op.mask = 'UNLOCK', 'SELECTED' props.action, props.mask = 'UNLOCK', 'SELECTED'
# 4: Up # 4: Up
op = pie.operator("object.vertex_group_lock", icon='LOCKED', text="Lock Selected") props = pie.operator("object.vertex_group_lock", icon='LOCKED', text="Lock Selected")
op.action, op.mask = 'LOCK', 'SELECTED' props.action, props.mask = 'LOCK', 'SELECTED'
# 5: Up/Left # 5: Up/Left
op = pie.operator("object.vertex_group_lock", icon='LOCKED', text="Lock Unselected") props = pie.operator("object.vertex_group_lock", icon='LOCKED', text="Lock Unselected")
op.action, op.mask = 'LOCK', 'UNSELECTED' props.action, props.mask = 'LOCK', 'UNSELECTED'
# 6: Up/Right # 6: Up/Right
op = pie.operator("object.vertex_group_lock", text="Lock Only Selected") props = pie.operator("object.vertex_group_lock", text="Lock Only Selected")
op.action, op.mask = 'LOCK', 'INVERT_UNSELECTED' props.action, props.mask = 'LOCK', 'INVERT_UNSELECTED'
# 7: Down/Left # 7: Down/Left
op = pie.operator("object.vertex_group_lock", text="Lock Only Unselected") props = pie.operator("object.vertex_group_lock", text="Lock Only Unselected")
op.action, op.mask = 'UNLOCK', 'INVERT_UNSELECTED' props.action, props.mask = 'UNLOCK', 'INVERT_UNSELECTED'
# 8: Down/Right # 8: Down/Right
op = pie.operator("object.vertex_group_lock", text="Invert Locks") props = pie.operator("object.vertex_group_lock", text="Invert Locks")
op.action, op.mask = 'INVERT', 'ALL' props.action, props.mask = 'INVERT', 'ALL'
# ********** Panel ********** # ********** Panel **********
@@ -7628,8 +7628,8 @@ class VIEW3D_PT_gpencil_sculpt_context_menu(Panel):
bl_ui_units_x = 12 bl_ui_units_x = 12
def draw(self, context): def draw(self, context):
ts = context.tool_settings tool_settings = context.tool_settings
settings = ts.gpencil_sculpt_paint settings = tool_settings.gpencil_sculpt_paint
brush = settings.brush brush = settings.brush
layout = self.layout layout = self.layout
@@ -7648,8 +7648,8 @@ class VIEW3D_PT_gpencil_weight_context_menu(Panel):
bl_ui_units_x = 12 bl_ui_units_x = 12
def draw(self, context): def draw(self, context):
ts = context.tool_settings tool_settings = context.tool_settings
settings = ts.gpencil_weight_paint settings = tool_settings.gpencil_weight_paint
brush = settings.brush brush = settings.brush
layout = self.layout layout = self.layout
@@ -7669,8 +7669,8 @@ class VIEW3D_PT_gpencil_draw_context_menu(Panel):
bl_ui_units_x = 12 bl_ui_units_x = 12
def draw(self, context): def draw(self, context):
ts = context.tool_settings tool_settings = context.tool_settings
settings = ts.gpencil_paint settings = tool_settings.gpencil_paint
brush = settings.brush brush = settings.brush
gp_settings = brush.gpencil_settings gp_settings = brush.gpencil_settings
@@ -7708,8 +7708,8 @@ class VIEW3D_PT_gpencil_vertex_context_menu(Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
ts = context.tool_settings tool_settings = context.tool_settings
settings = ts.gpencil_vertex_paint settings = tool_settings.gpencil_vertex_paint
brush = settings.brush brush = settings.brush
gp_settings = brush.gpencil_settings gp_settings = brush.gpencil_settings

View File

@@ -61,17 +61,17 @@ class VIEW3D_MT_brush_gpencil_context_menu(Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
ts = context.tool_settings tool_settings = context.tool_settings
settings = None settings = None
if context.mode == 'PAINT_GPENCIL': if context.mode == 'PAINT_GPENCIL':
settings = ts.gpencil_paint settings = tool_settings.gpencil_paint
if context.mode == 'SCULPT_GPENCIL': if context.mode == 'SCULPT_GPENCIL':
settings = ts.gpencil_sculpt_paint settings = tool_settings.gpencil_sculpt_paint
elif context.mode == 'WEIGHT_GPENCIL': elif context.mode == 'WEIGHT_GPENCIL':
settings = ts.gpencil_weight_paint settings = tool_settings.gpencil_weight_paint
elif context.mode == 'VERTEX_GPENCIL': elif context.mode == 'VERTEX_GPENCIL':
settings = ts.gpencil_vertex_paint settings = tool_settings.gpencil_vertex_paint
brush = getattr(settings, "brush", None) brush = getattr(settings, "brush", None)
# skip if no active brush # skip if no active brush
@@ -1816,8 +1816,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_paint_falloff(GreasePencilBrushFalloff
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
ts = context.tool_settings tool_settings = context.tool_settings
settings = ts.gpencil_paint settings = tool_settings.gpencil_paint
brush = settings.brush brush = settings.brush
if brush is None: if brush is None:
return False return False
@@ -1934,8 +1934,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_sculpt_falloff(GreasePencilBrushFallof
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
ts = context.tool_settings tool_settings = context.tool_settings
settings = ts.gpencil_sculpt_paint settings = tool_settings.gpencil_sculpt_paint
return (settings and settings.brush and settings.brush.curve) return (settings and settings.brush and settings.brush.curve)
@@ -2043,8 +2043,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_weight_falloff(GreasePencilBrushFallof
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
ts = context.tool_settings tool_settings = context.tool_settings
settings = ts.gpencil_weight_paint settings = tool_settings.gpencil_weight_paint
brush = settings.brush brush = settings.brush
return (brush and brush.curve) return (brush and brush.curve)
@@ -2119,8 +2119,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_vertex_color(View3DPanel, Panel):
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
ob = context.object ob = context.object
ts = context.tool_settings tool_settings = context.tool_settings
settings = ts.gpencil_vertex_paint settings = tool_settings.gpencil_vertex_paint
brush = settings.brush brush = settings.brush
if ob is None or brush is None: if ob is None or brush is None:
@@ -2135,8 +2135,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_vertex_color(View3DPanel, Panel):
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
ts = context.tool_settings tool_settings = context.tool_settings
settings = ts.gpencil_vertex_paint settings = tool_settings.gpencil_vertex_paint
brush = settings.brush brush = settings.brush
col = layout.column() col = layout.column()
@@ -2157,8 +2157,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_vertex_falloff(GreasePencilBrushFallof
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
ts = context.tool_settings tool_settings = context.tool_settings
settings = ts.gpencil_vertex_paint settings = tool_settings.gpencil_vertex_paint
return (settings and settings.brush and settings.brush.curve) return (settings and settings.brush and settings.brush.curve)
@@ -2171,8 +2171,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_vertex_palette(View3DPanel, Panel):
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
ob = context.object ob = context.object
ts = context.tool_settings tool_settings = context.tool_settings
settings = ts.gpencil_vertex_paint settings = tool_settings.gpencil_vertex_paint
brush = settings.brush brush = settings.brush
if ob is None or brush is None: if ob is None or brush is None:
@@ -2187,8 +2187,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_vertex_palette(View3DPanel, Panel):
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
ts = context.tool_settings tool_settings = context.tool_settings
settings = ts.gpencil_vertex_paint settings = tool_settings.gpencil_vertex_paint
col = layout.column() col = layout.column()
@@ -2206,8 +2206,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_mixcolor(View3DPanel, Panel):
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
ob = context.object ob = context.object
ts = context.tool_settings tool_settings = context.tool_settings
settings = ts.gpencil_paint settings = tool_settings.gpencil_paint
brush = settings.brush brush = settings.brush
if ob is None or brush is None: if ob is None or brush is None:
@@ -2231,8 +2231,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_mixcolor(View3DPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
ts = context.tool_settings tool_settings = context.tool_settings
settings = ts.gpencil_paint settings = tool_settings.gpencil_paint
brush = settings.brush brush = settings.brush
gp_settings = brush.gpencil_settings gp_settings = brush.gpencil_settings
@@ -2270,8 +2270,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_mix_palette(View3DPanel, Panel):
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
ob = context.object ob = context.object
ts = context.tool_settings tool_settings = context.tool_settings
settings = ts.gpencil_paint settings = tool_settings.gpencil_paint
brush = settings.brush brush = settings.brush
if ob is None or brush is None: if ob is None or brush is None:
@@ -2294,8 +2294,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_mix_palette(View3DPanel, Panel):
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
ts = context.tool_settings tool_settings = context.tool_settings
settings = ts.gpencil_paint settings = tool_settings.gpencil_paint
brush = settings.brush brush = settings.brush
col = layout.column() col = layout.column()