Cleanup: use staticmethod where appropriate
authorCampbell Barton <ideasman42@gmail.com>
Fri, 19 Apr 2019 05:51:14 +0000 (07:51 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 19 Apr 2019 05:51:14 +0000 (07:51 +0200)
release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
release/scripts/startup/bl_ui/properties_physics_field.py
release/scripts/startup/bl_ui/properties_physics_fluid.py
release/scripts/startup/bl_ui/properties_physics_smoke.py
release/scripts/startup/bl_ui/space_dopesheet.py
release/scripts/startup/bl_ui/space_info.py
release/scripts/startup/bl_ui/space_time.py
release/scripts/startup/bl_ui/space_topbar.py
release/scripts/startup/bl_ui/space_userpref.py
release/scripts/startup/bl_ui/space_view3d.py

index 83a7524fe0302f3efa61c05cd9b0c5c71a05ca69..fec8723ef5ec3e3f428493c79766acdf0ed650a5 100644 (file)
@@ -62,10 +62,12 @@ class PhysicButtonsPanel:
     bl_region_type = 'WINDOW'
     bl_context = "physics"
 
+    @staticmethod
     def poll_dyn_paint(context):
         ob = context.object
         return (ob and ob.type == 'MESH') and context.dynamic_paint
 
+    @staticmethod
     def poll_dyn_canvas(context):
         if not PhysicButtonsPanel.poll_dyn_paint(context):
             return False
@@ -73,6 +75,7 @@ class PhysicButtonsPanel:
         md = context.dynamic_paint
         return (md and md.ui_type == 'CANVAS' and md.canvas_settings and md.canvas_settings.canvas_surfaces.active)
 
+    @staticmethod
     def poll_dyn_canvas_paint(context):
         if not PhysicButtonsPanel.poll_dyn_canvas(context):
             return False
@@ -80,6 +83,7 @@ class PhysicButtonsPanel:
         surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
         return (surface.surface_type == 'PAINT')
 
+    @staticmethod
     def poll_dyn_canvas_brush(context):
         if not PhysicButtonsPanel.poll_dyn_paint(context):
             return False
@@ -87,6 +91,7 @@ class PhysicButtonsPanel:
         md = context.dynamic_paint
         return (md and md.ui_type == 'BRUSH' and md.brush_settings)
 
+    @staticmethod
     def poll_dyn_output(context):
         if not PhysicButtonsPanel.poll_dyn_canvas(context):
             return False
@@ -94,6 +99,7 @@ class PhysicButtonsPanel:
         surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
         return (not (surface.surface_format == 'VERTEX' and (surface.surface_type in {'DISPLACE', 'WAVE'})))
 
+    @staticmethod
     def poll_dyn_output_maps(context):
         if not PhysicButtonsPanel.poll_dyn_output(context):
             return False
index 1b8c3667f2f84ce6eeb4895a654ba382f2fc5c35..c38dad25cf485fbae8815926b26321ca5bc2194a 100644 (file)
@@ -32,10 +32,12 @@ class PhysicButtonsPanel:
     bl_region_type = 'WINDOW'
     bl_context = "physics"
 
+    @staticmethod
     def poll_force_field(context):
         ob = context.object
         return (ob and (ob.field) and (ob.field.type != 'NONE'))
 
+    @staticmethod
     def poll_collision(context):
         ob = context.object
         return (ob and ob.type == 'MESH') and (context.collision)
index b01d806630c9888a9c5b270947f5837b9ba611fa..8817d35b88af437f4ca81c9be3ab71c48b3cc2db 100644 (file)
@@ -38,6 +38,7 @@ class PhysicButtonsPanel:
     bl_region_type = 'WINDOW'
     bl_context = "physics"
 
+    @staticmethod
     def poll_fluid(context):
         ob = context.object
         if not ((ob and ob.type == 'MESH') and (context.fluid)):
@@ -45,6 +46,7 @@ class PhysicButtonsPanel:
 
         return (bpy.app.build_options.mod_fluid)
 
+    @staticmethod
     def poll_fluid_settings(context):
         if not (PhysicButtonsPanel.poll_fluid(context)):
             return False
@@ -52,6 +54,7 @@ class PhysicButtonsPanel:
         md = context.fluid
         return md and md.settings and (md.settings.type != 'NONE')
 
+    @staticmethod
     def poll_fluid_domain(context):
         if not PhysicButtonsPanel.poll_fluid(context):
             return False
index 7770db7105e339a482c692a6ccddaba08181270d..898e1f3804ea9eb4d7a4168e47e4667989c83449 100644 (file)
@@ -33,6 +33,7 @@ class PhysicButtonsPanel:
     bl_region_type = 'WINDOW'
     bl_context = "physics"
 
+    @staticmethod
     def poll_smoke(context):
         ob = context.object
         if not ((ob and ob.type == 'MESH') and (context.smoke)):
@@ -41,6 +42,7 @@ class PhysicButtonsPanel:
         md = context.smoke
         return md and (context.smoke.smoke_type != 'NONE') and (bpy.app.build_options.mod_smoke)
 
+    @staticmethod
     def poll_smoke_domain(context):
         if not PhysicButtonsPanel.poll_smoke(context):
             return False
index 5905e0b37e40df9bfc4da7000f05a951ff80499d..61db70866e2ec086ffa375175f1b9f2d8aef4b8b 100644 (file)
@@ -236,6 +236,7 @@ class DOPESHEET_HT_editor_buttons(Header):
     def draw(self, context):
         pass
 
+    @staticmethod
     def draw_header(context, layout):
         st = context.space_data
         tool_settings = context.tool_settings
index e22b0bfe345e1dbe0622acd9dd7fa071fffabe7b..196b12c08598cfd9dfbc198eca2a426d992f457e 100644 (file)
@@ -28,7 +28,6 @@ class INFO_HT_header(Header):
         layout.template_header()
 
         # Empty for now until info editor gets turned into log editor
-        pass
 
 
 # Not really info, just add to re-usable location.
index 5c7f2c1b47fc5272156898c4df353b518ea0bb17..d2c41f13ee3ae010d5a0ac2df2e51fd879cace65 100644 (file)
@@ -30,6 +30,7 @@ class TIME_HT_editor_buttons(Header):
     def draw(self, context):
         pass
 
+    @staticmethod
     def draw_header(context, layout):
         scene = context.scene
         tool_settings = context.tool_settings
index fad1fafa5230a0e7e59b1936d9456b9fb2a0a0d3..79769f1597c41b93b9a8c02a69b7e9b94ffd6737 100644 (file)
@@ -260,6 +260,7 @@ class TOPBAR_MT_file_new(Menu):
 
         return sorted(app_templates)
 
+    @staticmethod
     def draw_ex(layout, _context, *, use_splash=False, use_more=False):
         layout.operator_context = 'EXEC_DEFAULT'
 
@@ -639,7 +640,6 @@ class TOPBAR_PT_gpencil_fill(Panel):
     bl_region_type = 'HEADER'
     bl_label = "Advanced"
 
-    @staticmethod
     def draw(self, context):
         paint = context.tool_settings.gpencil_paint
         brush = paint.brush
index a85221323f1e38fd424fb13a667e396bfda7c6fd..1ee154b4879674f0a625a0a7dde0738e6dca5b61 100644 (file)
@@ -697,6 +697,7 @@ class USERPREF_MT_interface_theme_presets(Menu):
     )
     draw = Menu.draw_preset
 
+    @staticmethod
     def reset_cb(context):
         bpy.ops.preferences.reset_default_theme()
 
index ecb629fb99e989495f51a265674fc364fda1bf80..a4b96b78b685b40bef2ebdb3e79d2bc736077e87 100644 (file)
@@ -3482,15 +3482,15 @@ class VIEW3D_MT_edit_mesh_extrude(Menu):
 
     _extrude_funcs = {
         'VERT': lambda layout:
-            layout.operator("mesh.extrude_vertices_move", text="Extrude Vertices"),
+        layout.operator("mesh.extrude_vertices_move", text="Extrude Vertices"),
         'EDGE': lambda layout:
-            layout.operator("mesh.extrude_edges_move", text="Extrude Edges"),
+        layout.operator("mesh.extrude_edges_move", text="Extrude Edges"),
         'REGION': lambda layout:
-            layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces"),
+        layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces"),
         'REGION_VERT_NORMAL': lambda layout:
-            layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals"),
+        layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals"),
         'FACE': lambda layout:
-            layout.operator("mesh.extrude_faces_move", text="Extrude Individual Faces"),
+        layout.operator("mesh.extrude_faces_move", text="Extrude Individual Faces"),
     }
 
     @staticmethod
@@ -5991,6 +5991,7 @@ class VIEW3D_PT_context_properties(Panel):
     bl_label = "Properties"
     bl_options = {'DEFAULT_CLOSED'}
 
+    @staticmethod
     def _active_context_member(context):
         obj = context.object
         if obj: