Cleanup: line length in Python scripts
This commit is contained in:
@@ -743,7 +743,9 @@ def dump_src_messages(msgs, reports, settings):
|
|||||||
def clean_str(s):
|
def clean_str(s):
|
||||||
# The encode/decode to/from 'raw_unicode_escape' allows to transform the C-type unicode hexadecimal escapes
|
# The encode/decode to/from 'raw_unicode_escape' allows to transform the C-type unicode hexadecimal escapes
|
||||||
# (like '\u2715' for the '×' symbol) back into a proper unicode character.
|
# (like '\u2715' for the '×' symbol) back into a proper unicode character.
|
||||||
return "".join(m.group("clean") for m in _clean_str(s)).encode('raw_unicode_escape').decode('raw_unicode_escape')
|
return "".join(
|
||||||
|
m.group("clean") for m in _clean_str(s)
|
||||||
|
).encode('raw_unicode_escape').decode('raw_unicode_escape')
|
||||||
|
|
||||||
def dump_src_file(path, rel_path, msgs, reports, settings):
|
def dump_src_file(path, rel_path, msgs, reports, settings):
|
||||||
def process_entry(_msgctxt, _msgid):
|
def process_entry(_msgctxt, _msgid):
|
||||||
@@ -870,7 +872,10 @@ def dump_messages(do_messages, do_checks, settings):
|
|||||||
dump_src_messages(msgs, reports, settings)
|
dump_src_messages(msgs, reports, settings)
|
||||||
|
|
||||||
# Get strings from addons' categories.
|
# Get strings from addons' categories.
|
||||||
for uid, label, tip in bpy.types.WindowManager.addon_filter.keywords['items'](bpy.context.window_manager, bpy.context):
|
for uid, label, tip in bpy.types.WindowManager.addon_filter.keywords['items'](
|
||||||
|
bpy.context.window_manager,
|
||||||
|
bpy.context,
|
||||||
|
):
|
||||||
process_msg(msgs, settings.DEFAULT_CONTEXT, label, "Add-ons' categories", reports, None, settings)
|
process_msg(msgs, settings.DEFAULT_CONTEXT, label, "Add-ons' categories", reports, None, settings)
|
||||||
if tip:
|
if tip:
|
||||||
process_msg(msgs, settings.DEFAULT_CONTEXT, tip, "Add-ons' categories", reports, None, settings)
|
process_msg(msgs, settings.DEFAULT_CONTEXT, tip, "Add-ons' categories", reports, None, settings)
|
||||||
|
|||||||
@@ -483,19 +483,44 @@ def main():
|
|||||||
argv = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
|
argv = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="Use Blender to generate previews for currently open Blender file's items.")
|
description="Use Blender to generate previews for currently open Blender file's items.",
|
||||||
parser.add_argument('--clear', default=False, action="store_true",
|
)
|
||||||
help="Clear previews instead of generating them.")
|
parser.add_argument(
|
||||||
parser.add_argument('--no_backups', default=False, action="store_true",
|
'--clear',
|
||||||
help="Do not generate a backup .blend1 file when saving processed ones.")
|
default=False,
|
||||||
parser.add_argument('--no_scenes', default=True, action="store_false",
|
action="store_true",
|
||||||
help="Do not generate/clear previews for scene IDs.")
|
help="Clear previews instead of generating them.",
|
||||||
parser.add_argument('--no_collections', default=True, action="store_false",
|
)
|
||||||
help="Do not generate/clear previews for collection IDs.")
|
parser.add_argument(
|
||||||
parser.add_argument('--no_objects', default=True, action="store_false",
|
'--no_backups',
|
||||||
help="Do not generate/clear previews for object IDs.")
|
default=False,
|
||||||
parser.add_argument('--no_data_intern', default=True, action="store_false",
|
action="store_true",
|
||||||
help="Do not generate/clear previews for mat/tex/image/etc. IDs (those handled by core Blender code).")
|
help="Do not generate a backup .blend1 file when saving processed ones.",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--no_scenes',
|
||||||
|
default=True,
|
||||||
|
action="store_false",
|
||||||
|
help="Do not generate/clear previews for scene IDs.",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--no_collections',
|
||||||
|
default=True,
|
||||||
|
action="store_false",
|
||||||
|
help="Do not generate/clear previews for collection IDs.",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--no_objects',
|
||||||
|
default=True,
|
||||||
|
action="store_false",
|
||||||
|
help="Do not generate/clear previews for object IDs.",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--no_data_intern',
|
||||||
|
default=True,
|
||||||
|
action="store_false",
|
||||||
|
help="Do not generate/clear previews for mat/tex/image/etc. IDs (those handled by core Blender code).",
|
||||||
|
)
|
||||||
args = parser.parse_args(argv)
|
args = parser.parse_args(argv)
|
||||||
|
|
||||||
orig_save_version = bpy.context.preferences.filepaths.save_version
|
orig_save_version = bpy.context.preferences.filepaths.save_version
|
||||||
|
|||||||
@@ -1327,7 +1327,10 @@ class WM_OT_properties_edit(Operator):
|
|||||||
|
|
||||||
use_soft_limits: BoolProperty(
|
use_soft_limits: BoolProperty(
|
||||||
name="Use Soft Limits",
|
name="Use Soft Limits",
|
||||||
description="Limits the Property Value slider to a range, values outside the range must be inputted numerically",
|
description=(
|
||||||
|
"Limits the Property Value slider to a range, "
|
||||||
|
"values outside the range must be inputted numerically"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
array_length: IntProperty(
|
array_length: IntProperty(
|
||||||
name="Array Length",
|
name="Array Length",
|
||||||
|
|||||||
@@ -227,7 +227,12 @@ class PHYSICS_PT_settings(PhysicButtonsPanel, Panel):
|
|||||||
split.enabled = note_flag and ob.mode == 'OBJECT'
|
split.enabled = note_flag and ob.mode == 'OBJECT'
|
||||||
|
|
||||||
bake_incomplete = (domain.cache_frame_pause_data < domain.cache_frame_end)
|
bake_incomplete = (domain.cache_frame_pause_data < domain.cache_frame_end)
|
||||||
if domain.cache_resumable and domain.has_cache_baked_data and not domain.is_cache_baking_data and bake_incomplete:
|
if (
|
||||||
|
domain.cache_resumable and
|
||||||
|
domain.has_cache_baked_data and
|
||||||
|
not domain.is_cache_baking_data and
|
||||||
|
bake_incomplete
|
||||||
|
):
|
||||||
col = split.column()
|
col = split.column()
|
||||||
col.operator("fluid.bake_data", text="Resume")
|
col.operator("fluid.bake_data", text="Resume")
|
||||||
col = split.column()
|
col = split.column()
|
||||||
@@ -1249,7 +1254,12 @@ class PHYSICS_PT_cache(PhysicButtonsPanel, Panel):
|
|||||||
split.enabled = ob.mode == 'OBJECT'
|
split.enabled = ob.mode == 'OBJECT'
|
||||||
|
|
||||||
bake_incomplete = (domain.cache_frame_pause_data < domain.cache_frame_end)
|
bake_incomplete = (domain.cache_frame_pause_data < domain.cache_frame_end)
|
||||||
if domain.cache_resumable and domain.has_cache_baked_data and not domain.is_cache_baking_data and bake_incomplete:
|
if (
|
||||||
|
domain.cache_resumable and
|
||||||
|
domain.has_cache_baked_data and
|
||||||
|
not domain.is_cache_baking_data and
|
||||||
|
bake_incomplete
|
||||||
|
):
|
||||||
col = split.column()
|
col = split.column()
|
||||||
col.operator("fluid.bake_all", text="Resume")
|
col.operator("fluid.bake_all", text="Resume")
|
||||||
col = split.column()
|
col = split.column()
|
||||||
|
|||||||
@@ -109,7 +109,11 @@ class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
obj = context.object
|
obj = context.object
|
||||||
if obj.parent is not None and obj.parent.rigid_body is not None and not obj.parent.rigid_body.collision_shape == 'COMPOUND':
|
if (
|
||||||
|
(obj.parent is not None) and
|
||||||
|
(obj.parent.rigid_body is not None) and
|
||||||
|
(not obj.parent.rigid_body.collision_shape == 'COMPOUND')
|
||||||
|
):
|
||||||
return False
|
return False
|
||||||
return (obj and obj.rigid_body and (context.engine in cls.COMPAT_ENGINES))
|
return (obj and obj.rigid_body and (context.engine in cls.COMPAT_ENGINES))
|
||||||
|
|
||||||
@@ -124,7 +128,11 @@ class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel):
|
|||||||
layout.prop(rbo, "collision_shape", text="Shape")
|
layout.prop(rbo, "collision_shape", text="Shape")
|
||||||
|
|
||||||
if rbo.collision_shape == 'COMPOUND':
|
if rbo.collision_shape == 'COMPOUND':
|
||||||
if parent is not None and parent.rigid_body is not None and parent.rigid_body.collision_shape == 'COMPOUND':
|
if (
|
||||||
|
(parent is not None) and
|
||||||
|
(parent.rigid_body is not None) and
|
||||||
|
(parent.rigid_body.collision_shape == 'COMPOUND')
|
||||||
|
):
|
||||||
rigid_body_warning(layout, "Sub compound shapes are not allowed")
|
rigid_body_warning(layout, "Sub compound shapes are not allowed")
|
||||||
else:
|
else:
|
||||||
found = False
|
found = False
|
||||||
@@ -179,7 +187,11 @@ class PHYSICS_PT_rigid_body_collisions_sensitivity(PHYSICS_PT_rigidbody_panel, P
|
|||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
obj = context.object
|
obj = context.object
|
||||||
if obj.parent is not None and obj.parent.rigid_body is not None and not obj.parent.rigid_body.collision_shape == 'COMPOUND':
|
if (
|
||||||
|
(obj.parent is not None) and
|
||||||
|
(obj.parent.rigid_body is not None) and
|
||||||
|
(not obj.parent.rigid_body.collision_shape == 'COMPOUND')
|
||||||
|
):
|
||||||
return False
|
return False
|
||||||
return (obj and obj.rigid_body and (context.engine in cls.COMPAT_ENGINES))
|
return (obj and obj.rigid_body and (context.engine in cls.COMPAT_ENGINES))
|
||||||
|
|
||||||
|
|||||||
@@ -614,7 +614,10 @@ class ASSETBROWSER_PT_filter(asset_utils.AssetBrowserPanel, Panel):
|
|||||||
|
|
||||||
filter_id = params.filter_asset_id
|
filter_id = params.filter_asset_id
|
||||||
for identifier in dir(filter_id):
|
for identifier in dir(filter_id):
|
||||||
if identifier.startswith("filter_") or (identifier.startswith("experimental_filter_") and use_extended_browser):
|
if (
|
||||||
|
identifier.startswith("filter_") or
|
||||||
|
(identifier.startswith("experimental_filter_") and use_extended_browser)
|
||||||
|
):
|
||||||
row = col.row()
|
row = col.row()
|
||||||
row.label(icon=filter_id.bl_rna.properties[identifier].icon)
|
row.label(icon=filter_id.bl_rna.properties[identifier].icon)
|
||||||
row.prop(filter_id, identifier, toggle=False)
|
row.prop(filter_id, identifier, toggle=False)
|
||||||
|
|||||||
@@ -786,8 +786,16 @@ class NodeTreeInterfacePanel:
|
|||||||
if tree.type == 'GEOMETRY':
|
if tree.type == 'GEOMETRY':
|
||||||
layout.prop(active_socket, "description")
|
layout.prop(active_socket, "description")
|
||||||
field_socket_prefixes = {
|
field_socket_prefixes = {
|
||||||
"NodeSocketInt", "NodeSocketColor", "NodeSocketVector", "NodeSocketBool", "NodeSocketFloat"}
|
"NodeSocketInt",
|
||||||
is_field_type = any(active_socket.bl_socket_idname.startswith(prefix) for prefix in field_socket_prefixes)
|
"NodeSocketColor",
|
||||||
|
"NodeSocketVector",
|
||||||
|
"NodeSocketBool",
|
||||||
|
"NodeSocketFloat",
|
||||||
|
}
|
||||||
|
is_field_type = any(
|
||||||
|
active_socket.bl_socket_idname.startswith(prefix)
|
||||||
|
for prefix in field_socket_prefixes
|
||||||
|
)
|
||||||
if in_out == 'OUT' and is_field_type:
|
if in_out == 'OUT' and is_field_type:
|
||||||
layout.prop(active_socket, "attribute_domain")
|
layout.prop(active_socket, "attribute_domain")
|
||||||
active_socket.draw(context, layout)
|
active_socket.draw(context, layout)
|
||||||
|
|||||||
Reference in New Issue
Block a user