Cleanup: format

This commit is contained in:
Campbell Barton 2022-12-05 12:54:00 +11:00
parent 997e143a50
commit cc6bdac921
9 changed files with 46 additions and 17 deletions

View File

@ -69,6 +69,7 @@ Thanks to Tyler Alden Gubala for maintaining the original version of this packag
# ------------------------------------------------------------------------------
# Generic Functions
def find_dominating_file(
path: str,
search: Sequence[str],

View File

@ -87,11 +87,26 @@ enum_sampling_pattern = (
)
enum_emission_sampling = (
('NONE', 'None', "Do not use this surface as a light for sampling", 0),
('AUTO', 'Auto', "Automatically determine if the surface should be treated as a light for sampling, based on estimated emission intensity", 1),
('FRONT', 'Front', "Treat only front side of the surface as a light, usually for closed meshes whose interior is not visible", 2),
('BACK', 'Back', "Treat only back side of the surface as a light for sampling", 3),
('FRONT_BACK', 'Front and Back', "Treat surface as a light for sampling, emitting from both the front and back side", 4),
('NONE',
'None',
"Do not use this surface as a light for sampling",
0),
('AUTO',
'Auto',
"Automatically determine if the surface should be treated as a light for sampling, based on estimated emission intensity",
1),
('FRONT',
'Front',
"Treat only front side of the surface as a light, usually for closed meshes whose interior is not visible",
2),
('BACK',
'Back',
"Treat only back side of the surface as a light for sampling",
3),
('FRONT_BACK',
'Front and Back',
"Treat surface as a light for sampling, emitting from both the front and back side",
4),
)
enum_volume_sampling = (

View File

@ -9,7 +9,7 @@ __all__ = (
)
import bpy
from typing import Mapping, List, Tuple, Sequence
from typing import Mapping, List, Tuple, Sequence
# (fcurve.data_path, fcurve.array_index)
FCurveKey = Tuple[str, int]
@ -17,6 +17,7 @@ FCurveKey = Tuple[str, int]
ListKeyframes = List[float]
Action = bpy.types.Action
def bake_action(
obj,
*,
@ -430,6 +431,7 @@ def bake_action_iter(
yield action
class KeyframesCo:
"""A buffer for keyframe Co unpacked values per FCurveKey. FCurveKeys are added using
add_paths(), Co values stored using extend_co_values(), then finally use

View File

@ -112,7 +112,10 @@ class ANIM_OT_keying_set_export(Operator):
break
if not found:
self.report({'WARN'}, tip_("Could not find material or light using Shader Node Tree - %s") % (ksp.id))
self.report(
{'WARN'},
tip_("Could not find material or light using Shader Node Tree - %s") %
(ksp.id))
elif ksp.id.bl_rna.identifier.startswith("CompositorNodeTree"):
# Find compositor nodetree using this node tree...
for scene in bpy.data.scenes:
@ -335,7 +338,7 @@ class ClearUselessActions(Operator):
removed += 1
self.report({'INFO'}, tip_("Removed %d empty and/or fake-user only Actions")
% removed)
% removed)
return {'FINISHED'}

View File

@ -3083,7 +3083,13 @@ class WM_MT_splash_quick_setup(Menu):
old_version = bpy.types.PREFERENCES_OT_copy_prev.previous_version()
if bpy.types.PREFERENCES_OT_copy_prev.poll(context) and old_version:
sub.operator("preferences.copy_prev", text=iface_("Load %d.%d Settings", "Operator") % old_version, translate=False)
sub.operator(
"preferences.copy_prev",
text=iface_(
"Load %d.%d Settings",
"Operator") %
old_version,
translate=False)
sub.operator("wm.save_userpref", text="Save New Settings")
else:
sub.label()

View File

@ -8,6 +8,7 @@ from bpy.app.translations import (
pgettext_tip as tip_,
)
class MESH_MT_vertex_group_context_menu(Menu):
bl_label = "Vertex Group Specials"

View File

@ -68,7 +68,7 @@ class WORKSPACE_PT_addons(WorkSpaceButtonsPanel, Panel):
row.operator(
"wm.owner_disable" if is_enabled else "wm.owner_enable",
icon='CHECKBOX_HLT' if is_enabled else 'CHECKBOX_DEHLT',
text=iface_("%s: %s" ) % (iface_(info["category"]), iface_(info["name"])),
text=iface_("%s: %s") % (iface_(info["category"]), iface_(info["name"])),
translate=False,
emboss=False,
).owner_id = module_name

View File

@ -354,7 +354,6 @@ class NODE_MT_node(Menu):
layout.operator("node.options_toggle")
layout.operator("node.collapse_hide_unused_toggle")
if is_compositor:
layout.separator()

View File

@ -214,12 +214,13 @@ class TestBlendLibLinkIndirect(TestBlendLibLinkHelper):
assert material.library is not None
assert material.use_fake_user is True
assert material.users == 2 # Fake user is not cleared when linking.
assert material.is_library_indirect == True
assert material.is_library_indirect
assert mesh.library is not None
assert mesh.use_fake_user is False
assert mesh.users == 0
assert mesh.is_library_indirect == False # IDs explicitely linked by the user are forcefully considered directly linked.
# IDs explicitely linked by the user are forcefully considered directly linked.
assert mesh.is_library_indirect == False
ob = bpy.data.objects.new("LocalMesh", mesh)
coll = bpy.data.collections.new("LocalMesh")
@ -227,7 +228,7 @@ class TestBlendLibLinkIndirect(TestBlendLibLinkHelper):
bpy.context.scene.collection.children.link(coll)
assert material.users == 2
assert material.is_library_indirect == True
assert material.is_library_indirect
assert mesh.users == 1
assert mesh.is_library_indirect == False
@ -240,14 +241,15 @@ class TestBlendLibLinkIndirect(TestBlendLibLinkHelper):
ob.material_slots[0].material = None
assert material.users == 2
assert material.is_library_indirect == False # This is not properly updated whene removing a local user of linked data.
# This is not properly updated whene removing a local user of linked data.
assert material.is_library_indirect == False
output_work_path = os.path.join(output_dir, self.unique_blendfile_name("blendfile"))
bpy.ops.wm.save_as_mainfile(filepath=output_work_path, check_existing=False, compress=False)
assert material.users == 2
# Currently linked data which has no more local user never gets reset to indirectly linked status.
assert material.is_library_indirect == True
assert material.is_library_indirect
bpy.ops.wm.open_mainfile(filepath=output_work_path, load_ui=False)
@ -264,7 +266,7 @@ class TestBlendLibLinkIndirect(TestBlendLibLinkHelper):
assert material.users == 2 # Fake user is not cleared when linking.
# Currently even re-reading the .blend file will not properly reset tag for indirectly linked data,
# if their reference was written in the .blend file.
assert material.is_library_indirect == True
assert material.is_library_indirect
assert mesh.library is not None
assert mesh.use_fake_user is False