Cleanup: wrap long lines in Python scripts

This commit is contained in:
Campbell Barton
2024-08-19 10:48:07 +10:00
parent fe6ab4f344
commit 8a7ff41a85
10 changed files with 81 additions and 35 deletions

View File

@@ -1343,8 +1343,8 @@ def extension_draw_item(
row_right.separator()
# NOTE: Keep space between any buttons and this menu to prevent stray clicks accidentally running install.
# The separator is around together with the align to give some space while keeping the button and the menu still close-by.
# Used `extension_path` so the menu can access "this" extension.
# The separator is around together with the align to give some space while keeping the button and the menu
# still close-by. Used `extension_path` so the menu can access "this" extension.
row_right.context_string_set("extension_path", "{:s}.{:s}".format(repo_item.module, pkg_id))
row_right.menu("USERPREF_MT_extensions_item", text="", icon='DOWNARROW_HLT')
del row_right

View File

@@ -155,9 +155,10 @@ def read_bvh(context, file_path, rotate_mode='XYZ', global_scale=1.0):
))
lineIdx += 1 # Increment to the next line (Channels)
# newChannel[Xposition, Yposition, Zposition, Xrotation, Yrotation, Zrotation]
# newChannel references indices to the motiondata,
# if not assigned then -1 refers to the last value that will be added on loading at a value of zero, this is appended
# `newChannel[Xposition, Yposition, Zposition, Xrotation, Yrotation, Zrotation]`
# newChannel references indices to the `motiondata`,
# if not assigned then -1 refers to the last value that will be added
# on loading at a value of zero, this is appended.
# We'll add a zero value onto the end of the MotionDATA so this always refers to a value.
my_channel = [-1, -1, -1, -1, -1, -1]
my_rot_order = [None, None, None]

View File

@@ -1048,9 +1048,10 @@ class I18nMessages:
msgstr_lines.append(line)
else:
self.parsing_errors.append((line_nr, "regular string outside msgctxt, msgid or msgstr scope"))
# self.parsing_errors.append((line_nr, "regular string outside msgctxt, msgid or msgstr scope:\n\t\t{}"
# "\n\tComments:{}\n\tContext:{}\n\tKey:{}\n\tMessage:{}".format(
# line, comment_lines, msgctxt_lines, msgid_lines, msgstr_lines)))
# self.parsing_errors.append((
# line_nr, "regular string outside msgctxt, msgid or msgstr scope:\n\t\t{}"
# "\n\tComments:{}\n\tContext:{}\n\tKey:{}\n\tMessage:{}".format(
# line, comment_lines, msgctxt_lines, msgid_lines, msgstr_lines)))
# If no final empty line, last message is not finalized!
if reading_msgstr:

View File

@@ -101,7 +101,8 @@ class Prefs(bpy.types.KeyConfigPreferences):
use_alt_click_leader: BoolProperty(
name="Alt Click Tool Prompt",
description=(
"Tapping Alt (without pressing any other keys) shows a prompt in the status-bar, prompting a second keystroke to activate the tool"
"Tapping Alt (without pressing any other keys) shows a prompt in the status-bar, "
"prompting a second keystroke to activate the tool"
),
default=False,
update=update_fn,
@@ -244,7 +245,9 @@ class Prefs(bpy.types.KeyConfigPreferences):
name="Transform Navigation with Alt",
description=(
"During transformations, use Alt to navigate in the 3D View. "
"Note that if disabled, hotkeys for Proportional Editing, Automatic Constraints, and Auto IK Chain Length will require holding Alt"),
"Note that if disabled, hotkeys for Proportional Editing, "
"Automatic Constraints, and Auto IK Chain Length will require holding Alt"
),
default=True,
update=update_fn,
)

View File

@@ -1057,7 +1057,8 @@ def km_mask_editing(params):
("mask.select_circle", {"type": 'C', "value": 'PRESS'}, None),
("mask.select_lasso", {"type": params.action_mouse, "value": 'CLICK_DRAG', "ctrl": True, "alt": True},
{"properties": [("mode", 'ADD')]}),
("mask.select_lasso", {"type": params.action_mouse, "value": 'CLICK_DRAG', "shift": True, "ctrl": True, "alt": True},
("mask.select_lasso",
{"type": params.action_mouse, "value": 'CLICK_DRAG', "shift": True, "ctrl": True, "alt": True},
{"properties": [("mode", 'SUB')]}),
("mask.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None),
("mask.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None),
@@ -3325,7 +3326,8 @@ def km_clip_editor(params):
op_menu("CLIP_MT_select_grouped", {"type": 'G', "value": 'PRESS', "shift": True}),
("clip.select_lasso", {"type": params.action_mouse, "value": 'CLICK_DRAG', "ctrl": True, "alt": True},
{"properties": [("mode", 'ADD')]}),
("clip.select_lasso", {"type": params.action_mouse, "value": 'CLICK_DRAG', "shift": True, "ctrl": True, "alt": True},
("clip.select_lasso",
{"type": params.action_mouse, "value": 'CLICK_DRAG', "shift": True, "ctrl": True, "alt": True},
{"properties": [("mode", 'SUB')]}),
("clip.add_marker_slide", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, None),
("clip.delete_marker", {"type": 'X', "value": 'PRESS', "shift": True}, None),
@@ -8859,8 +8861,9 @@ def km_sequencer_editor_tool_generic_select_timeline(params, *, fallback):
_fallback_id("Sequencer Timeline Tool: Tweak", fallback),
{"space_type": 'SEQUENCE_EDITOR', "region_type": 'WINDOW'},
{"items": [
*(km_sequencer_editor_tool_generic_select_timeline_rcs(params, fallback) if (params.select_mouse == 'RIGHTMOUSE')
else km_sequencer_editor_tool_generic_select_timeline_lcs(params, fallback)),
*(km_sequencer_editor_tool_generic_select_timeline_rcs(params, fallback)
if (params.select_mouse == 'RIGHTMOUSE') else
km_sequencer_editor_tool_generic_select_timeline_lcs(params, fallback)),
]},
)
@@ -9302,10 +9305,14 @@ def generate_keymaps(params=None):
km_3d_view_tool_sculpt_gpencil_select_box(params),
km_3d_view_tool_sculpt_gpencil_select_circle(params),
km_3d_view_tool_sculpt_gpencil_select_lasso(params),
*(km_sequencer_editor_tool_generic_select_timeline(params, fallback=fallback) for fallback in (False, True)),
*(km_sequencer_editor_tool_generic_select_box_timeline(params, fallback=fallback) for fallback in (False, True)),
*(km_sequencer_editor_tool_generic_select_preview(params, fallback=fallback) for fallback in (False, True)),
*(km_sequencer_editor_tool_generic_select_box_preview(params, fallback=fallback) for fallback in (False, True)),
*(km_sequencer_editor_tool_generic_select_timeline(params, fallback=fallback)
for fallback in (False, True)),
*(km_sequencer_editor_tool_generic_select_box_timeline(params, fallback=fallback)
for fallback in (False, True)),
*(km_sequencer_editor_tool_generic_select_preview(params, fallback=fallback)
for fallback in (False, True)),
*(km_sequencer_editor_tool_generic_select_box_preview(params, fallback=fallback)
for fallback in (False, True)),
km_3d_view_tool_paint_grease_pencil_cutter(params),
km_sequencer_editor_tool_generic_cursor(params),
km_sequencer_editor_tool_blade(params),

View File

@@ -809,7 +809,8 @@ def km_mask_editing(params):
("mask.select_circle", {"type": 'C', "value": 'PRESS'}, None),
("mask.select_lasso", {"type": params.action_mouse, "value": 'CLICK_DRAG', "ctrl": True, "alt": True},
{"properties": [("mode", 'ADD')]}),
("mask.select_lasso", {"type": params.action_mouse, "value": 'CLICK_DRAG', "shift": True, "ctrl": True, "alt": True},
("mask.select_lasso",
{"type": params.action_mouse, "value": 'CLICK_DRAG', "shift": True, "ctrl": True, "alt": True},
{"properties": [("mode", 'SUB')]}),
("mask.select_more", {"type": 'UP_ARROW', "value": 'PRESS', "repeat": True}, None),
("mask.select_less", {"type": 'DOWN_ARROW', "value": 'PRESS', "repeat": True}, None),
@@ -2160,8 +2161,10 @@ def km_clip_graph_editor(params):
{"properties": [("extend", True)]}),
("clip.graph_select_box", {"type": 'Q', "value": 'PRESS'}, None),
("clip.graph_select_all", {"type": 'A', "value": 'PRESS', "ctrl": True}, None),
# ("clip.graph_select_all", {"type": 'A', "value": 'PRESS', "ctrl": True}, {"properties": [("action", 'DESELECT')]}),
# ("clip.graph_select_all", {"type": 'I', "value": 'PRESS', "ctrl": True}, {"properties": [("action", 'INVERT')]}),
# ("clip.graph_select_all",
# {"type": 'A', "value": 'PRESS', "ctrl": True}, {"properties": [("action", 'DESELECT')]}),
# ("clip.graph_select_all",
# {"type": 'I', "value": 'PRESS', "ctrl": True}, {"properties": [("action", 'INVERT')]}),
("clip.graph_delete_curve", {"type": 'BACK_SPACE', "value": 'PRESS'}, None),
("clip.graph_delete_curve", {"type": 'DEL', "value": 'PRESS'}, None),
("clip.graph_delete_knot", {"type": 'BACK_SPACE', "value": 'PRESS', "shift": True}, None),
@@ -2578,10 +2581,21 @@ def km_gpencil_legacy_stroke_paint_fill(params):
{"properties": [("on_back", False)]}),
# If press alternate key, the brush now it's for drawing areas
("gpencil.draw", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True},
{"properties": [("mode", 'DRAW'), ("wait_for_input", False), ("disable_straight", True), ("disable_stabilizer", True)]}),
{"properties": [
("mode", 'DRAW'),
("wait_for_input", False),
("disable_straight", True),
("disable_stabilizer", True),
]}),
# If press alternative key, the brush now it's for drawing lines
("gpencil.draw", {"type": 'LEFTMOUSE', "value": 'PRESS', "alt": True},
{"properties": [("mode", 'DRAW'), ("wait_for_input", False), ("disable_straight", True), ("disable_stabilizer", True), ("disable_fill", True)]}),
{"properties": [
("mode", 'DRAW'),
("wait_for_input", False),
("disable_straight", True),
("disable_stabilizer", True),
("disable_fill", True),
]}),
])
return keymap
@@ -2982,7 +2996,9 @@ def km_gpencil_legacy_stroke_vertex_mode(params):
*_gpencil_legacy_selection(params),
# Brush strength
("wm.radial_control", {"type": 'U', "value": 'PRESS'},
{"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength')]}),
{"properties": [
("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength'),
]}),
# Brush size
("wm.radial_control", {"type": 'S', "value": 'PRESS'},
{"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.size')]}),
@@ -3032,7 +3048,9 @@ def km_gpencil_legacy_stroke_vertex_draw(params):
{"properties": [("wait_for_input", False)]}),
# Brush strength
("wm.radial_control", {"type": 'U', "value": 'PRESS'},
{"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength')]}),
{"properties": [
("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength'),
]}),
# Brush size
("wm.radial_control", {"type": 'S', "value": 'PRESS'},
{"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.size')]}),
@@ -3055,10 +3073,14 @@ def km_gpencil_legacy_stroke_vertex_blur(params):
{"properties": [("wait_for_input", False)]}),
# Brush strength
("wm.radial_control", {"type": 'U', "value": 'PRESS'},
{"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength')]}),
{"properties": [
("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength'),
]}),
# Brush size
("wm.radial_control", {"type": 'S', "value": 'PRESS'},
{"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.size')]}),
{"properties": [
("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.size'),
]}),
])
return keymap
@@ -3080,7 +3102,9 @@ def km_gpencil_legacy_stroke_vertex_average(params):
{"properties": [("wait_for_input", False)]}),
# Brush strength
("wm.radial_control", {"type": 'U', "value": 'PRESS'},
{"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength')]}),
{"properties": [
("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength'),
]}),
# Brush size
("wm.radial_control", {"type": 'S', "value": 'PRESS'},
{"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.size')]}),
@@ -3103,7 +3127,9 @@ def km_gpencil_legacy_stroke_vertex_smear(params):
{"properties": [("wait_for_input", False)]}),
# Brush strength
("wm.radial_control", {"type": 'U', "value": 'PRESS', "shift": True},
{"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength')]}),
{"properties": [
("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.gpencil_settings.pen_strength'),
]}),
# Brush size
("wm.radial_control", {"type": 'S', "value": 'PRESS'},
{"properties": [("data_path_primary", 'tool_settings.gpencil_vertex_paint.brush.size')]}),

View File

@@ -294,10 +294,12 @@ class MaterialProperties_MixIn:
items=(
('DITHERED',
"Dithered",
"Allows for grayscale hashed transparency, and compatible with render passes and raytracing. Also known as deferred rendering."),
"Allows for grayscale hashed transparency, and compatible with render passes and ray-tracing. "
"Also known as deferred rendering."),
('BLENDED',
"Blended",
"Allows for colored transparency, but incompatible with render passes and raytracing. Also known as forward rendering.")))
"Allows for colored transparency, but incompatible with render passes and ray-tracing. "
"Also known as forward rendering.")))
use_backface_culling: BoolProperty(
name="Backface Culling",

View File

@@ -2902,7 +2902,8 @@ class WM_OT_batch_rename(Operator):
(
# Outliner.
cls._selected_ids_from_outliner_by_type(context, bpy.types.Scene)
if ((space_type == 'OUTLINER') and only_selected) else [id for id in bpy.data.scenes if id.is_editable]
if ((space_type == 'OUTLINER') and only_selected) else
[id for id in bpy.data.scenes if id.is_editable]
),
"name",
iface_("Scene(s)"),
@@ -2912,7 +2913,8 @@ class WM_OT_batch_rename(Operator):
(
# Outliner.
cls._selected_ids_from_outliner_by_type(context, bpy.types.Brush)
if ((space_type == 'OUTLINER') and only_selected) else [id for id in bpy.data.brushes if id.is_editable]
if ((space_type == 'OUTLINER') and only_selected) else
[id for id in bpy.data.brushes if id.is_editable]
),
"name",
iface_("Brush(es)"),

View File

@@ -1282,7 +1282,9 @@ class VIEW3D_MT_editor_menus(Menu):
layout.menu("VIEW3D_MT_select_paint_mask")
elif mesh.use_paint_mask_vertex and mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX'}:
layout.menu("VIEW3D_MT_select_paint_mask_vertex")
elif mode_string not in {'SCULPT', 'SCULPT_CURVES', 'PAINT_GREASE_PENCIL', 'SCULPT_GREASE_PENCIL', 'WEIGHT_GREASE_PENCIL'}:
elif mode_string not in {
'SCULPT', 'SCULPT_CURVES', 'PAINT_GREASE_PENCIL', 'SCULPT_GREASE_PENCIL', 'WEIGHT_GREASE_PENCIL',
}:
layout.menu("VIEW3D_MT_select_" + mode_string.lower())
if gp_edit:

View File

@@ -30,7 +30,9 @@ from typing import (
CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
SOURCE_DIR = os.path.normpath(os.path.join(CURRENT_DIR, "..", ".."))
MARKDOWN_URL = "https://projects.blender.org/blender/blender-developer-docs/raw/branch/main/docs/features/code_layout.md"
MARKDOWN_URL = (
"https://projects.blender.org/blender/blender-developer-docs/raw/branch/main/docs/features/code_layout.md"
)
# -----------------------------------------------------------------------------