diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-19 08:51:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-19 08:51:14 +0300 |
commit | 082d7e8d5f8d85449257a68418fbd672bc49b60a (patch) | |
tree | 6d1731c40ab092d5e8f30797239b776f2ebf9e7a /release/scripts | |
parent | ba44602b2389385b4c7f719f980df2f7b9b6fff0 (diff) |
Cleanup: use staticmethod where appropriate
Diffstat (limited to 'release/scripts')
10 files changed, 23 insertions, 7 deletions
diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py index 83a7524fe03..fec8723ef5e 100644 --- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py +++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py @@ -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 diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py b/release/scripts/startup/bl_ui/properties_physics_field.py index 1b8c3667f2f..c38dad25cf4 100644 --- a/release/scripts/startup/bl_ui/properties_physics_field.py +++ b/release/scripts/startup/bl_ui/properties_physics_field.py @@ -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) diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index b01d806630c..8817d35b88a 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -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 diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py index 7770db7105e..898e1f3804e 100644 --- a/release/scripts/startup/bl_ui/properties_physics_smoke.py +++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py @@ -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 diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index 5905e0b37e4..61db70866e2 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -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 diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py index e22b0bfe345..196b12c0859 100644 --- a/release/scripts/startup/bl_ui/space_info.py +++ b/release/scripts/startup/bl_ui/space_info.py @@ -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. diff --git a/release/scripts/startup/bl_ui/space_time.py b/release/scripts/startup/bl_ui/space_time.py index 5c7f2c1b47f..d2c41f13ee3 100644 --- a/release/scripts/startup/bl_ui/space_time.py +++ b/release/scripts/startup/bl_ui/space_time.py @@ -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 diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index fad1fafa523..79769f1597c 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -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 diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index a85221323f1..1ee154b4879 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -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() diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index ecb629fb99e..a4b96b78b68 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -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: |