Cleanup: run autopep8 on release/scripts/startup/

This commit is contained in:
Campbell Barton 2022-04-19 15:05:55 +10:00
parent 8c25889bb6
commit 58d86527ae
20 changed files with 68 additions and 44 deletions

View File

@ -5,6 +5,7 @@
import bpy
from bpy.app.handlers import persistent
def update_factory_startup_screens():
# 2D Animation.
screen = bpy.data.screens["2D Animation"]

View File

@ -70,8 +70,8 @@ class CONSTRAINT_OT_normalize_target_weights(Operator):
class CONSTRAINT_OT_disable_keep_transform(Operator):
"""Set the influence of this constraint to zero while """ \
"""trying to maintain the object's transformation. Other active """ \
"""constraints can still influence the final transformation"""
"""trying to maintain the object's transformation. Other active """ \
"""constraints can still influence the final transformation"""
bl_idname = "constraint.disable_keep_transform"
bl_label = "Disable and Keep Transform"

View File

@ -247,7 +247,7 @@ class WM_OT_previews_batch_clear(Operator):
class WM_OT_blend_strings_utf8_validate(Operator):
"""Check and fix all strings in current .blend file to be valid UTF-8 Unicode """ \
"""(needed for some old, 2.4x area files)"""
"""(needed for some old, 2.4x area files)"""
bl_idname = "wm.blend_strings_utf8_validate"
bl_label = "Validate .blend strings"
bl_options = {'REGISTER'}

View File

@ -26,7 +26,6 @@ def geometry_node_group_empty_new():
def geometry_modifier_poll(context):
ob = context.object
# Test object support for geometry node modifier
if not ob or ob.type not in {'MESH', 'POINTCLOUD', 'VOLUME', 'CURVE', 'FONT', 'CURVES'}:
return False

View File

@ -937,7 +937,7 @@ class LoadReferenceImage(LoadImageAsEmpty, Operator):
class OBJECT_OT_assign_property_defaults(Operator):
"""Assign the current values of custom properties as their defaults, """ \
"""for use as part of the rest pose state in NLA track mixing"""
"""for use as part of the rest pose state in NLA track mixing"""
bl_idname = "object.assign_property_defaults"
bl_label = "Assign Custom Property Values as Default"
bl_options = {'UNDO', 'REGISTER'}

View File

@ -1317,7 +1317,7 @@ class WM_OT_properties_edit(Operator):
name="Array Length",
default=3,
min=1,
max=32, # 32 is the maximum size for RNA array properties.
max=32, # 32 is the maximum size for RNA array properties.
)
# Integer properties.
@ -1511,7 +1511,7 @@ class WM_OT_properties_edit(Operator):
elif self.property_type == 'STRING':
self.default_string = rna_data["default"]
if self.property_type in { 'FLOAT_ARRAY', 'INT_ARRAY'}:
if self.property_type in {'FLOAT_ARRAY', 'INT_ARRAY'}:
self.array_length = len(item[name])
# The dictionary does not contain the description if it was empty.
@ -2940,9 +2940,9 @@ class WM_MT_splash_quick_setup(Menu):
layout.label(text="Quick Setup")
split = layout.split(factor=0.14) # Left margin.
split = layout.split(factor=0.14) # Left margin.
split.label()
split = split.split(factor=0.73) # Content width.
split = split.split(factor=0.73) # Content width.
col = split.column()

View File

@ -239,4 +239,5 @@ class UI_MT_list_item_context_menu(bpy.types.Menu):
# context menu items.
pass
bpy.utils.register_class(UI_MT_list_item_context_menu)

View File

@ -1162,6 +1162,7 @@ class ConstraintButtonsSubPanel:
# Child Of Constraint
class OBJECT_PT_bChildOfConstraint(ObjectConstraintPanel, ConstraintButtonsPanel, Panel):
def draw(self, context):
self.draw_childof(context)

View File

@ -65,6 +65,7 @@ class MESH_MT_shape_key_context_menu(Menu):
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'
class MESH_MT_attribute_context_menu(Menu):
bl_label = "Attribute Specials"
@ -134,6 +135,7 @@ class MESH_UL_uvmaps(UIList):
layout.alignment = 'CENTER'
layout.label(text="", icon_value=icon)
class MeshButtonsPanel:
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@ -419,6 +421,7 @@ class DATA_PT_uv_texture(MeshButtonsPanel, Panel):
col.operator("mesh.uv_texture_add", icon='ADD', text="")
col.operator("mesh.uv_texture_remove", icon='REMOVE', text="")
class DATA_PT_remesh(MeshButtonsPanel, Panel):
bl_label = "Remesh"
bl_options = {'DEFAULT_CLOSED'}
@ -605,7 +608,7 @@ class MESH_UL_color_attributes(UIList, ColorAttributesListBase):
sub.label(text="%s%s" % (domain_name, data_type.name))
active_render = _index == data.color_attributes.render_color_index
row = layout.row()
row.emboss = 'NONE'
prop = row.operator(
@ -650,6 +653,7 @@ class DATA_PT_vertex_colors(DATA_PT_mesh_attributes, Panel):
self.draw_attribute_warnings(context, layout)
classes = (
MESH_MT_vertex_group_context_menu,
MESH_MT_shape_key_context_menu,

View File

@ -838,6 +838,7 @@ classes = (
ASSETBROWSER_MT_context_menu,
)
def asset_path_str_get(_self):
asset_file_handle = bpy.context.asset_file_handle
if asset_file_handle is None:

View File

@ -324,6 +324,7 @@ class GRAPH_MT_key_snap(Menu):
layout.operator("graph.frame_jump", text="Cursor to Selection")
layout.operator("graph.snap_cursor_value", text="Cursor Value to Selection")
class GRAPH_MT_slider(Menu):
bl_label = "Slider Operators"

View File

@ -166,7 +166,6 @@ class NLA_MT_marker_select(Menu):
layout.operator("marker.select_leftright", text="After Current Frame").mode = 'RIGHT'
class NLA_MT_edit(Menu):
bl_label = "Edit"
@ -214,8 +213,10 @@ class NLA_MT_edit(Menu):
layout.operator("nla.tweakmode_exit", text="Stop Tweaking Strip Actions")
else:
layout.operator("nla.tweakmode_enter", text="Start Editing Stashed Action").isolate_action = True
layout.operator("nla.tweakmode_enter", text="Start Tweaking Strip Actions (Full Stack)").use_upper_stack_evaluation = True
layout.operator("nla.tweakmode_enter", text="Start Tweaking Strip Actions (Lower Stack)").use_upper_stack_evaluation = False
layout.operator("nla.tweakmode_enter",
text="Start Tweaking Strip Actions (Full Stack)").use_upper_stack_evaluation = True
layout.operator("nla.tweakmode_enter",
text="Start Tweaking Strip Actions (Lower Stack)").use_upper_stack_evaluation = False
class NLA_MT_add(Menu):
@ -289,8 +290,10 @@ class NLA_MT_context_menu(Menu):
layout.operator("nla.tweakmode_exit", text="Stop Tweaking Strip Actions")
else:
layout.operator("nla.tweakmode_enter", text="Start Editing Stashed Action").isolate_action = True
layout.operator("nla.tweakmode_enter", text="Start Tweaking Strip Actions (Full Stack)").use_upper_stack_evaluation = True
layout.operator("nla.tweakmode_enter", text="Start Tweaking Strip Actions (Lower Stack)").use_upper_stack_evaluation = False
layout.operator("nla.tweakmode_enter",
text="Start Tweaking Strip Actions (Full Stack)").use_upper_stack_evaluation = True
layout.operator("nla.tweakmode_enter",
text="Start Tweaking Strip Actions (Lower Stack)").use_upper_stack_evaluation = False
layout.separator()

View File

@ -776,7 +776,7 @@ class NodeTreeInterfacePanel:
"node.tree_socket_change_type",
"socket_type",
text=active_socket.bl_label if active_socket.bl_label else active_socket.bl_idname
)
)
props.in_out = in_out
layout.use_property_split = True
@ -816,6 +816,7 @@ class NODE_PT_node_tree_interface_inputs(NodeTreeInterfacePanel, Panel):
def draw(self, context):
self.draw_socket_list(context, "IN", "inputs", "active_input")
class NODE_PT_node_tree_interface_outputs(NodeTreeInterfacePanel, Panel):
bl_space_type = 'NODE_EDITOR'
bl_region_type = 'UI'

View File

@ -1959,7 +1959,6 @@ class SEQUENCER_PT_adjust_sound(SequencerButtonsPanel, Panel):
split.prop(strip, "show_waveform")
class SEQUENCER_PT_adjust_comp(SequencerButtonsPanel, Panel):
bl_label = "Compositing"
bl_category = "Strip"

View File

@ -2322,7 +2322,7 @@ class _defs_curves_sculpt:
context,
idname_prefix="builtin_brush.",
icon_prefix="ops.curves.sculpt_",
type= bpy.types.Brush,
type=bpy.types.Brush,
attr="curves_sculpt_tool",
)
@ -2527,7 +2527,8 @@ class _defs_sequencer_generic:
icon="ops.transform.transform",
widget="SEQUENCER_GGT_gizmo2d",
# No keymap default action, only for gizmo!
)
)
class _defs_sequencer_select:
@ToolDef.from_fn

View File

@ -2281,6 +2281,7 @@ class USERPREF_PT_experimental_prototypes(ExperimentalPanel, Panel):
),
)
# Keep this as tweaks can be useful to restore.
"""
class USERPREF_PT_experimental_tweaks(ExperimentalPanel, Panel):
@ -2295,6 +2296,7 @@ class USERPREF_PT_experimental_tweaks(ExperimentalPanel, Panel):
"""
class USERPREF_PT_experimental_debugging(ExperimentalPanel, Panel):
bl_label = "Debugging"

View File

@ -2835,6 +2835,7 @@ class VIEW3D_MT_object_cleanup(Menu):
layout.operator("object.material_slot_remove_unused", text="Remove Unused Material Slots")
class VIEW3D_MT_object_asset(Menu):
bl_label = "Asset"
@ -6500,7 +6501,6 @@ class VIEW3D_PT_overlay_edit_mesh_normals(Panel):
row.prop(overlay, "use_normals_constant_screen_size", text="", icon='FIXED_SIZE')
class VIEW3D_PT_overlay_edit_mesh_freestyle(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER'

View File

@ -483,15 +483,19 @@ class SelectPaintSlotHelper:
match getattr(mode_settings, self.canvas_source_attr_name):
case 'MATERIAL':
if len(ob.material_slots) > 1:
layout.template_list("MATERIAL_UL_matslots", "layers",
ob, "material_slots",
ob, "active_material_index", rows=2)
layout.template_list(
"MATERIAL_UL_matslots", "layers",
ob, "material_slots",
ob, "active_material_index", rows=2,
)
mat = ob.active_material
if mat and mat.texture_paint_images:
row = layout.row()
row.template_list("TEXTURE_UL_texpaintslots", "",
mat, "texture_paint_slots",
mat, "paint_active_slot", rows=2)
row.template_list(
"TEXTURE_UL_texpaintslots", "",
mat, "texture_paint_slots",
mat, "paint_active_slot", rows=2,
)
if mat.texture_paint_slots:
slot = mat.texture_paint_slots[mat.paint_active_slot]
@ -517,7 +521,7 @@ class SelectPaintSlotHelper:
else:
layout.menu("VIEW3D_MT_tools_projectpaint_uvlayer", text=uv_text, translate=False)
have_image = getattr(settings, self.canvas_image_attr_name) is not None
self.draw_image_interpolation(layout=layout, mode_settings=mode_settings)
case 'COLOR_ATTRIBUTE':
@ -562,7 +566,6 @@ class VIEW3D_PT_slots_projectpaint(SelectPaintSlotHelper, View3DPanel, Panel):
layout.prop(mode_settings, "interpolation", text="")
class VIEW3D_PT_slots_paint_canvas(SelectPaintSlotHelper, View3DPanel, Panel):
bl_category = "Tool"
bl_context = ".sculpt_mode" # dot on purpose (access from topbar)

View File

@ -201,7 +201,7 @@ class BUILTIN_KSI_BendyBones(KeyingSetInfo):
# VisualLocation
class BUILTIN_KSI_VisualLoc(KeyingSetInfo):
"""Insert a keyframe on each of the location channels, """ \
"""taking into account effects of constraints and relationships"""
"""taking into account effects of constraints and relationships"""
bl_label = "Visual Location"
bl_options = {'INSERTKEY_VISUAL'}
@ -219,7 +219,7 @@ class BUILTIN_KSI_VisualLoc(KeyingSetInfo):
# VisualRotation
class BUILTIN_KSI_VisualRot(KeyingSetInfo):
"""Insert a keyframe on each of the rotation channels, """ \
"""taking into account effects of constraints and relationships"""
"""taking into account effects of constraints and relationships"""
bl_label = "Visual Rotation"
bl_options = {'INSERTKEY_VISUAL'}
@ -237,7 +237,7 @@ class BUILTIN_KSI_VisualRot(KeyingSetInfo):
# VisualScaling
class BUILTIN_KSI_VisualScaling(KeyingSetInfo):
"""Insert a keyframe on each of the scale channels, """ \
"""taking into account effects of constraints and relationships"""
"""taking into account effects of constraints and relationships"""
bl_label = "Visual Scale"
bl_options = {'INSERTKEY_VISUAL'}
@ -255,7 +255,7 @@ class BUILTIN_KSI_VisualScaling(KeyingSetInfo):
# VisualLocRot
class BUILTIN_KSI_VisualLocRot(KeyingSetInfo):
"""Insert a keyframe on each of the location and rotation channels, """ \
"""taking into account effects of constraints and relationships"""
"""taking into account effects of constraints and relationships"""
bl_label = "Visual Location & Rotation"
bl_options = {'INSERTKEY_VISUAL'}
@ -277,7 +277,7 @@ class BUILTIN_KSI_VisualLocRot(KeyingSetInfo):
# VisualLocScale
class BUILTIN_KSI_VisualLocScale(KeyingSetInfo):
"""Insert a keyframe on each of the location and scale channels, """ \
"""taking into account effects of constraints and relationships"""
"""taking into account effects of constraints and relationships"""
bl_label = "Visual Location & Scale"
bl_options = {'INSERTKEY_VISUAL'}
@ -299,7 +299,7 @@ class BUILTIN_KSI_VisualLocScale(KeyingSetInfo):
# VisualLocRotScale
class BUILTIN_KSI_VisualLocRotScale(KeyingSetInfo):
"""Insert a keyframe on each of the location, """ \
"""rotation and scale channels, taking into account effects of constraints and relationships"""
"""rotation and scale channels, taking into account effects of constraints and relationships"""
bl_label = "Visual Location, Rotation & Scale"
bl_options = {'INSERTKEY_VISUAL'}
@ -323,7 +323,7 @@ class BUILTIN_KSI_VisualLocRotScale(KeyingSetInfo):
# VisualRotScale
class BUILTIN_KSI_VisualRotScale(KeyingSetInfo):
"""Insert a keyframe on each of the rotation and scale channels, """ \
"""taking into account effects of constraints and relationships"""
"""taking into account effects of constraints and relationships"""
bl_label = "Visual Rotation & Scale"
bl_options = {'INSERTKEY_VISUAL'}
@ -525,14 +525,14 @@ class WholeCharacterMixin:
class BUILTIN_KSI_WholeCharacter(WholeCharacterMixin, KeyingSetInfo):
"""Insert a keyframe for all properties that are likely to get animated in a character rig """ \
"""(useful when blocking out a shot)"""
"""(useful when blocking out a shot)"""
bl_idname = ANIM_KS_WHOLE_CHARACTER_ID
bl_label = "Whole Character"
class BUILTIN_KSI_WholeCharacterSelected(WholeCharacterMixin, KeyingSetInfo):
"""Insert a keyframe for all properties that are likely to get animated in a character rig """ \
"""(only selected bones)"""
"""(only selected bones)"""
bl_idname = ANIM_KS_WHOLE_CHARACTER_SELECTED_ID
bl_label = "Whole Character (Selected Bones Only)"

View File

@ -64,7 +64,8 @@ node_tree_group_type = {
'GeometryNodeTree': 'GeometryNodeGroup',
}
# Custom Menu for Geometry Node Curves
# Custom Menu for Geometry Node Curves.
def curve_node_items(context):
if context is None:
return
@ -100,7 +101,8 @@ def curve_node_items(context):
yield NodeItem("GeometryNodeSetSplineResolution")
yield NodeItem("GeometryNodeCurveSplineType")
# Custom Menu for Geometry Node Mesh
# Custom Menu for Geometry Node Mesh.
def mesh_node_items(context):
if context is None:
return
@ -131,7 +133,8 @@ def mesh_node_items(context):
yield NodeItemCustom(draw=lambda self, layout, context: layout.separator())
yield NodeItem("GeometryNodeSetShadeSmooth")
# Custom Menu for Geometry Nodes "Geometry" category
# Custom Menu for Geometry Nodes "Geometry" category.
def geometry_node_items(context):
if context is None:
return
@ -154,7 +157,8 @@ def geometry_node_items(context):
yield NodeItem("GeometryNodeSetID")
yield NodeItem("GeometryNodeSetPosition")
# Custom Menu for Geometry Node Input Nodes
# Custom Menu for Geometry Node Input Nodes.
def geometry_input_node_items(context):
if context is None:
return
@ -181,7 +185,8 @@ def geometry_input_node_items(context):
yield NodeItem("GeometryNodeInputRadius")
yield NodeItem("GeometryNodeInputSceneTime")
# Custom Menu for Material Nodes
# Custom Menu for Material Nodes.
def geometry_material_node_items(context):
if context is None:
return
@ -196,7 +201,8 @@ def geometry_material_node_items(context):
yield NodeItem("GeometryNodeSetMaterial")
yield NodeItem("GeometryNodeSetMaterialIndex")
# Custom Menu for Geometry Node Points
# Custom Menu for Geometry Node Points.
def point_node_items(context):
if context is None:
return
@ -210,7 +216,8 @@ def point_node_items(context):
yield NodeItemCustom(draw=lambda self, layout, context: layout.separator())
yield NodeItem("GeometryNodeSetPointRadius")
# generic node group items generator for shader, compositor, geometry and texture node groups
# Generic node group items generator for shader, compositor, geometry and texture node groups.
def node_group_items(context):
if context is None:
return