Cleanup: format

This commit is contained in:
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 # Generic Functions
def find_dominating_file( def find_dominating_file(
path: str, path: str,
search: Sequence[str], search: Sequence[str],

View File

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

View File

@@ -9,7 +9,7 @@ __all__ = (
) )
import bpy import bpy
from typing import Mapping, List, Tuple, Sequence from typing import Mapping, List, Tuple, Sequence
# (fcurve.data_path, fcurve.array_index) # (fcurve.data_path, fcurve.array_index)
FCurveKey = Tuple[str, int] FCurveKey = Tuple[str, int]
@@ -17,6 +17,7 @@ FCurveKey = Tuple[str, int]
ListKeyframes = List[float] ListKeyframes = List[float]
Action = bpy.types.Action Action = bpy.types.Action
def bake_action( def bake_action(
obj, obj,
*, *,
@@ -430,6 +431,7 @@ def bake_action_iter(
yield action yield action
class KeyframesCo: class KeyframesCo:
"""A buffer for keyframe Co unpacked values per FCurveKey. FCurveKeys are added using """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 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 break
if not found: 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"): elif ksp.id.bl_rna.identifier.startswith("CompositorNodeTree"):
# Find compositor nodetree using this node tree... # Find compositor nodetree using this node tree...
for scene in bpy.data.scenes: for scene in bpy.data.scenes:
@@ -335,7 +338,7 @@ class ClearUselessActions(Operator):
removed += 1 removed += 1
self.report({'INFO'}, tip_("Removed %d empty and/or fake-user only Actions") self.report({'INFO'}, tip_("Removed %d empty and/or fake-user only Actions")
% removed) % removed)
return {'FINISHED'} 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() old_version = bpy.types.PREFERENCES_OT_copy_prev.previous_version()
if bpy.types.PREFERENCES_OT_copy_prev.poll(context) and old_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") sub.operator("wm.save_userpref", text="Save New Settings")
else: else:
sub.label() sub.label()

View File

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

View File

@@ -68,7 +68,7 @@ class WORKSPACE_PT_addons(WorkSpaceButtonsPanel, Panel):
row.operator( row.operator(
"wm.owner_disable" if is_enabled else "wm.owner_enable", "wm.owner_disable" if is_enabled else "wm.owner_enable",
icon='CHECKBOX_HLT' if is_enabled else 'CHECKBOX_DEHLT', 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, translate=False,
emboss=False, emboss=False,
).owner_id = module_name ).owner_id = module_name

View File

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

View File

@@ -214,12 +214,13 @@ class TestBlendLibLinkIndirect(TestBlendLibLinkHelper):
assert material.library is not None assert material.library is not None
assert material.use_fake_user is True assert material.use_fake_user is True
assert material.users == 2 # Fake user is not cleared when linking. 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.library is not None
assert mesh.use_fake_user is False assert mesh.use_fake_user is False
assert mesh.users == 0 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) ob = bpy.data.objects.new("LocalMesh", mesh)
coll = bpy.data.collections.new("LocalMesh") coll = bpy.data.collections.new("LocalMesh")
@@ -227,7 +228,7 @@ class TestBlendLibLinkIndirect(TestBlendLibLinkHelper):
bpy.context.scene.collection.children.link(coll) bpy.context.scene.collection.children.link(coll)
assert material.users == 2 assert material.users == 2
assert material.is_library_indirect == True assert material.is_library_indirect
assert mesh.users == 1 assert mesh.users == 1
assert mesh.is_library_indirect == False assert mesh.is_library_indirect == False
@@ -240,14 +241,15 @@ class TestBlendLibLinkIndirect(TestBlendLibLinkHelper):
ob.material_slots[0].material = None ob.material_slots[0].material = None
assert material.users == 2 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")) 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) bpy.ops.wm.save_as_mainfile(filepath=output_work_path, check_existing=False, compress=False)
assert material.users == 2 assert material.users == 2
# Currently linked data which has no more local user never gets reset to indirectly linked status. # 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) 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. 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, # 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. # 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.library is not None
assert mesh.use_fake_user is False assert mesh.use_fake_user is False