From 48950ff934de4b6abda50310e75598b9d49d5005 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 6 Sep 2023 19:15:47 +1000 Subject: [PATCH] Cleanup: format --- .../startup/bl_ui/properties_data_modifier.py | 151 +++++++++++------- tests/python/bl_node_group_compat.py | 1 + 2 files changed, 95 insertions(+), 57 deletions(-) diff --git a/scripts/startup/bl_ui/properties_data_modifier.py b/scripts/startup/bl_ui/properties_data_modifier.py index b8939514acd..875dad441c5 100644 --- a/scripts/startup/bl_ui/properties_data_modifier.py +++ b/scripts/startup/bl_ui/properties_data_modifier.py @@ -23,7 +23,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): def draw(self, _context): layout = self.layout - layout.operator("wm.call_menu", text="Add Modifier", icon='ADD').name="OBJECT_MT_modifier_add" + layout.operator("wm.call_menu", text="Add Modifier", icon='ADD').name = "OBJECT_MT_modifier_add" layout.template_modifiers() @@ -35,7 +35,7 @@ class OBJECT_MT_modifier_add(Menu): ob_type = context.object.type geometry_nodes_supported = ob_type in {'MESH', 'CURVE', 'CURVES', 'FONT', 'SURFACE', 'VOLUME', 'POINTCLOUD'} if geometry_nodes_supported: - layout.operator("object.modifier_add", text="Empty Modifier").type='NODES' + layout.operator("object.modifier_add", text="Empty Modifier").type = 'NODES' if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}: layout.menu("OBJECT_MT_modifier_add_edit") if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'VOLUME'}: @@ -56,19 +56,43 @@ class OBJECT_MT_modifier_add_edit(Menu): layout = self.layout ob_type = context.object.type if ob_type == 'MESH': - layout.operator("object.modifier_add", text="Data Transfer", icon='MOD_DATA_TRANSFER').type='DATA_TRANSFER' + layout.operator( + "object.modifier_add", + text="Data Transfer", + icon='MOD_DATA_TRANSFER', + ).type = 'DATA_TRANSFER' if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}: - layout.operator("object.modifier_add", text="Mesh Cache", icon='MOD_MESHDEFORM').type='MESH_CACHE' + layout.operator("object.modifier_add", text="Mesh Cache", icon='MOD_MESHDEFORM').type = 'MESH_CACHE' if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}: - layout.operator("object.modifier_add", text="Mesh Sequence Cache", icon='MOD_MESHDEFORM').type='MESH_SEQUENCE_CACHE' + layout.operator( + "object.modifier_add", + text="Mesh Sequence Cache", + icon='MOD_MESHDEFORM', + ).type = 'MESH_SEQUENCE_CACHE' if ob_type == 'MESH': - layout.operator("object.modifier_add", text="Normal Edit", icon='MOD_NORMALEDIT').type='NORMAL_EDIT' - layout.operator("object.modifier_add", text="Weighted Normal", icon='MOD_NORMALEDIT').type='WEIGHTED_NORMAL' - layout.operator("object.modifier_add", text="UV Project", icon='MOD_UVPROJECT').type='UV_PROJECT' - layout.operator("object.modifier_add", text="UV Warp", icon='MOD_UVPROJECT').type='UV_WARP' - layout.operator("object.modifier_add", text="Vertex Weight Edit", icon='MOD_VERTEX_WEIGHT').type='VERTEX_WEIGHT_EDIT' - layout.operator("object.modifier_add", text="Vertex Weight Mix", icon='MOD_VERTEX_WEIGHT').type='VERTEX_WEIGHT_MIX' - layout.operator("object.modifier_add", text="Vertex Weight Proximity", icon='MOD_VERTEX_WEIGHT').type='VERTEX_WEIGHT_PROXIMITY' + layout.operator("object.modifier_add", text="Normal Edit", icon='MOD_NORMALEDIT').type = 'NORMAL_EDIT' + layout.operator( + "object.modifier_add", + text="Weighted Normal", + icon='MOD_NORMALEDIT', + ).type = 'WEIGHTED_NORMAL' + layout.operator("object.modifier_add", text="UV Project", icon='MOD_UVPROJECT').type = 'UV_PROJECT' + layout.operator("object.modifier_add", text="UV Warp", icon='MOD_UVPROJECT').type = 'UV_WARP' + layout.operator( + "object.modifier_add", + text="Vertex Weight Edit", + icon='MOD_VERTEX_WEIGHT', + ).type = 'VERTEX_WEIGHT_EDIT' + layout.operator( + "object.modifier_add", + text="Vertex Weight Mix", + icon='MOD_VERTEX_WEIGHT', + ).type = 'VERTEX_WEIGHT_MIX' + layout.operator( + "object.modifier_add", + text="Vertex Weight Proximity", + icon='MOD_VERTEX_WEIGHT', + ).type = 'VERTEX_WEIGHT_PROXIMITY' layout.template_modifier_asset_menu_items(catalog_path=self.bl_label) @@ -79,37 +103,37 @@ class OBJECT_MT_modifier_add_generate(Menu): layout = self.layout ob_type = context.object.type if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}: - layout.operator("object.modifier_add", text="Array", icon='MOD_ARRAY').type='ARRAY' - layout.operator("object.modifier_add", text="Bevel", icon='MOD_BEVEL').type='BEVEL' + layout.operator("object.modifier_add", text="Array", icon='MOD_ARRAY').type = 'ARRAY' + layout.operator("object.modifier_add", text="Bevel", icon='MOD_BEVEL').type = 'BEVEL' if ob_type == 'MESH': - layout.operator("object.modifier_add", text="Boolean", icon='MOD_BOOLEAN').type='BOOLEAN' + layout.operator("object.modifier_add", text="Boolean", icon='MOD_BOOLEAN').type = 'BOOLEAN' if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}: - layout.operator("object.modifier_add", text="Build", icon='MOD_BUILD').type='BUILD' - layout.operator("object.modifier_add", text="Decimate", icon='MOD_DECIM').type='DECIMATE' - layout.operator("object.modifier_add", text="Edge Split", icon='MOD_EDGESPLIT').type='EDGE_SPLIT' + layout.operator("object.modifier_add", text="Build", icon='MOD_BUILD').type = 'BUILD' + layout.operator("object.modifier_add", text="Decimate", icon='MOD_DECIM').type = 'DECIMATE' + layout.operator("object.modifier_add", text="Edge Split", icon='MOD_EDGESPLIT').type = 'EDGE_SPLIT' if ob_type == 'MESH': - layout.operator("object.modifier_add", text="Mask", icon='MOD_MASK').type='MASK' + layout.operator("object.modifier_add", text="Mask", icon='MOD_MASK').type = 'MASK' if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}: - layout.operator("object.modifier_add", text="Mirror", icon='MOD_MIRROR').type='MIRROR' + layout.operator("object.modifier_add", text="Mirror", icon='MOD_MIRROR').type = 'MIRROR' if ob_type == 'VOLUME': - layout.operator("object.modifier_add", text="Mesh to Volume", icon='VOLUME_DATA').type='MESH_TO_VOLUME' + layout.operator("object.modifier_add", text="Mesh to Volume", icon='VOLUME_DATA').type = 'MESH_TO_VOLUME' if ob_type == 'MESH': - layout.operator("object.modifier_add", text="Multiresolution", icon='MOD_MULTIRES').type='MULTIRES' + layout.operator("object.modifier_add", text="Multiresolution", icon='MOD_MULTIRES').type = 'MULTIRES' if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}: - layout.operator("object.modifier_add", text="Remesh", icon='MOD_REMESH').type='REMESH' - layout.operator("object.modifier_add", text="Screw", icon='MOD_SCREW').type='SCREW' + layout.operator("object.modifier_add", text="Remesh", icon='MOD_REMESH').type = 'REMESH' + layout.operator("object.modifier_add", text="Screw", icon='MOD_SCREW').type = 'SCREW' if ob_type == 'MESH': - layout.operator("object.modifier_add", text="Skin", icon='MOD_SKIN').type='SKIN' + layout.operator("object.modifier_add", text="Skin", icon='MOD_SKIN').type = 'SKIN' if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}: - layout.operator("object.modifier_add", text="Solidify", icon='MOD_SOLIDIFY').type='SOLIDIFY' - layout.operator("object.modifier_add", text="Subdivision Surface", icon='MOD_SUBSURF').type='SUBSURF' - layout.operator("object.modifier_add", text="Triangulate", icon='MOD_TRIANGULATE').type='TRIANGULATE' + layout.operator("object.modifier_add", text="Solidify", icon='MOD_SOLIDIFY').type = 'SOLIDIFY' + layout.operator("object.modifier_add", text="Subdivision Surface", icon='MOD_SUBSURF').type = 'SUBSURF' + layout.operator("object.modifier_add", text="Triangulate", icon='MOD_TRIANGULATE').type = 'TRIANGULATE' if ob_type == 'MESH': - layout.operator("object.modifier_add", text="Volume to Mesh", icon='VOLUME_DATA').type='VOLUME_TO_MESH' + layout.operator("object.modifier_add", text="Volume to Mesh", icon='VOLUME_DATA').type = 'VOLUME_TO_MESH' if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}: - layout.operator("object.modifier_add", text="Weld", icon='AUTOMERGE_OFF').type='WELD' + layout.operator("object.modifier_add", text="Weld", icon='AUTOMERGE_OFF').type = 'WELD' if ob_type == 'MESH': - layout.operator("object.modifier_add", text="Wireframe", icon='MOD_WIREFRAME').type='WIREFRAME' + layout.operator("object.modifier_add", text="Wireframe", icon='MOD_WIREFRAME').type = 'WIREFRAME' layout.template_modifier_asset_menu_items(catalog_path=self.bl_label) @@ -120,31 +144,36 @@ class OBJECT_MT_modifier_add_deform(Menu): layout = self.layout ob_type = context.object.type if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}: - layout.operator("object.modifier_add", text="Armature", icon='MOD_ARMATURE').type='ARMATURE' - layout.operator("object.modifier_add", text="Cast", icon='MOD_CAST').type='CAST' - layout.operator("object.modifier_add", text="Curve", icon='MOD_CURVE').type='CURVE' + layout.operator("object.modifier_add", text="Armature", icon='MOD_ARMATURE').type = 'ARMATURE' + layout.operator("object.modifier_add", text="Cast", icon='MOD_CAST').type = 'CAST' + layout.operator("object.modifier_add", text="Curve", icon='MOD_CURVE').type = 'CURVE' if ob_type == 'MESH': - layout.operator("object.modifier_add", text="Displace", icon='MOD_DISPLACE').type='DISPLACE' + layout.operator("object.modifier_add", text="Displace", icon='MOD_DISPLACE').type = 'DISPLACE' if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}: - layout.operator("object.modifier_add", text="Hook", icon='HOOK').type='HOOK' + layout.operator("object.modifier_add", text="Hook", icon='HOOK').type = 'HOOK' if ob_type == 'MESH': - layout.operator("object.modifier_add", text="Laplacian Deform", icon='MOD_MESHDEFORM').type='LAPLACIANDEFORM' + layout.operator("object.modifier_add", text="Laplacian Deform", + icon='MOD_MESHDEFORM').type = 'LAPLACIANDEFORM' if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}: - layout.operator("object.modifier_add", text="Lattice", icon='MOD_LATTICE').type='LATTICE' - layout.operator("object.modifier_add", text="Mesh Deform", icon='MOD_MESHDEFORM').type='MESH_DEFORM' - layout.operator("object.modifier_add", text="Shrinkwrap", icon='MOD_SHRINKWRAP').type='SHRINKWRAP' - layout.operator("object.modifier_add", text="Simple Deform", icon='MOD_SIMPLEDEFORM').type='SIMPLE_DEFORM' + layout.operator("object.modifier_add", text="Lattice", icon='MOD_LATTICE').type = 'LATTICE' + layout.operator("object.modifier_add", text="Mesh Deform", icon='MOD_MESHDEFORM').type = 'MESH_DEFORM' + layout.operator("object.modifier_add", text="Shrinkwrap", icon='MOD_SHRINKWRAP').type = 'SHRINKWRAP' + layout.operator("object.modifier_add", text="Simple Deform", icon='MOD_SIMPLEDEFORM').type = 'SIMPLE_DEFORM' if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}: - layout.operator("object.modifier_add", text="Smooth", icon='MOD_SMOOTH').type='SMOOTH' + layout.operator("object.modifier_add", text="Smooth", icon='MOD_SMOOTH').type = 'SMOOTH' if ob_type == 'MESH': - layout.operator("object.modifier_add", text="Smooth Corrective", icon='MOD_SMOOTH').type='CORRECTIVE_SMOOTH' - layout.operator("object.modifier_add", text="Smooth Laplacian", icon='MOD_SMOOTH').type='LAPLACIANSMOOTH' - layout.operator("object.modifier_add", text="Surface Deform", icon='MOD_MESHDEFORM').type='SURFACE_DEFORM' + layout.operator( + "object.modifier_add", + text="Smooth Corrective", + icon='MOD_SMOOTH', + ).type = 'CORRECTIVE_SMOOTH' + layout.operator("object.modifier_add", text="Smooth Laplacian", icon='MOD_SMOOTH').type = 'LAPLACIANSMOOTH' + layout.operator("object.modifier_add", text="Surface Deform", icon='MOD_MESHDEFORM').type = 'SURFACE_DEFORM' if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}: - layout.operator("object.modifier_add", text="Warp", icon='MOD_WARP').type='WARP' - layout.operator("object.modifier_add", text="Wave", icon='MOD_WAVE').type='WAVE' + layout.operator("object.modifier_add", text="Warp", icon='MOD_WARP').type = 'WARP' + layout.operator("object.modifier_add", text="Wave", icon='MOD_WAVE').type = 'WAVE' if ob_type == 'VOLUME': - layout.operator("object.modifier_add", text="Volume Displace", icon='VOLUME_DATA').type='VOLUME_DISPLACE' + layout.operator("object.modifier_add", text="Volume Displace", icon='VOLUME_DATA').type = 'VOLUME_DISPLACE' layout.template_modifier_asset_menu_items(catalog_path=self.bl_label) @@ -155,16 +184,24 @@ class OBJECT_MT_modifier_add_physics(Menu): layout = self.layout ob_type = context.object.type if ob_type == 'MESH': - layout.operator("object.modifier_add", text="Cloth", icon='MOD_CLOTH').type='CLOTH' - layout.operator("object.modifier_add", text="Collision", icon='MOD_PHYSICS').type='COLLISION' - layout.operator("object.modifier_add", text="Dynamic Paint", icon='MOD_DYNAMICPAINT').type='DYNAMIC_PAINT' - layout.operator("object.modifier_add", text="Explode", icon='MOD_EXPLODE').type='EXPLODE' - layout.operator("object.modifier_add", text="Fluid", icon='MOD_FLUIDSIM').type='FLUID' - layout.operator("object.modifier_add", text="Ocean", icon='MOD_OCEAN').type='OCEAN' - layout.operator("object.modifier_add", text="Particle Instance", icon='MOD_PARTICLE_INSTANCE').type='PARTICLE_INSTANCE' - layout.operator("object.modifier_add", text="Particle System", icon='MOD_PARTICLES').type='PARTICLE_SYSTEM' + layout.operator("object.modifier_add", text="Cloth", icon='MOD_CLOTH').type = 'CLOTH' + layout.operator("object.modifier_add", text="Collision", icon='MOD_PHYSICS').type = 'COLLISION' + layout.operator("object.modifier_add", text="Dynamic Paint", icon='MOD_DYNAMICPAINT').type = 'DYNAMIC_PAINT' + layout.operator("object.modifier_add", text="Explode", icon='MOD_EXPLODE').type = 'EXPLODE' + layout.operator("object.modifier_add", text="Fluid", icon='MOD_FLUIDSIM').type = 'FLUID' + layout.operator("object.modifier_add", text="Ocean", icon='MOD_OCEAN').type = 'OCEAN' + layout.operator( + "object.modifier_add", + text="Particle Instance", + icon='MOD_PARTICLE_INSTANCE', + ).type = 'PARTICLE_INSTANCE' + layout.operator( + "object.modifier_add", + text="Particle System", + icon='MOD_PARTICLES', + ).type = 'PARTICLE_SYSTEM' if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}: - layout.operator("object.modifier_add", text="Soft Body", icon='MOD_SOFT').type='SOFT_BODY' + layout.operator("object.modifier_add", text="Soft Body", icon='MOD_SOFT').type = 'SOFT_BODY' layout.template_modifier_asset_menu_items(catalog_path=self.bl_label) diff --git a/tests/python/bl_node_group_compat.py b/tests/python/bl_node_group_compat.py index 7919c69dee2..a8c02cb7c58 100644 --- a/tests/python/bl_node_group_compat.py +++ b/tests/python/bl_node_group_compat.py @@ -183,6 +183,7 @@ class AbstractNodeGroupInterfaceTest(unittest.TestCase): for index, spec in enumerate(specs): self.compare_group_socket_to_spec(group.interface.ui_items[index], node, spec, test_links=test_links) + class NodeGroupVersioning36Test(AbstractNodeGroupInterfaceTest): def open_file(self): bpy.ops.wm.open_mainfile(filepath=str(self.testdir / "nodegroup36.blend"))