Cleanup: use staticmethods

This commit is contained in:
Campbell Barton 2015-06-07 17:40:39 +10:00
parent bf010c4a15
commit 404f9ddc37
7 changed files with 33 additions and 18 deletions

@ -225,7 +225,8 @@ class CLIP_OT_track_to_empty(Operator):
bl_label = "Link Empty to Track"
bl_options = {'UNDO', 'REGISTER'}
def _link_track(self, context, clip, tracking_object, track):
@staticmethod
def _link_track(context, clip, tracking_object, track):
sc = context.space_data
constraint = None
ob = None
@ -331,7 +332,8 @@ class CLIP_OT_delete_proxy(Operator):
return wm.invoke_confirm(self, event)
def _rmproxy(self, abspath):
@staticmethod
def _rmproxy(abspath):
import shutil
if not os.path.exists(abspath):

@ -33,7 +33,8 @@ class EditExternally(Operator):
subtype='FILE_PATH',
)
def _editor_guess(self, context):
@staticmethod
def _editor_guess(context):
import sys
image_editor = context.user_preferences.filepaths.image_editor

@ -579,7 +579,8 @@ class MakeDupliFace(Operator):
bl_label = "Make Dupli-Face"
bl_options = {'REGISTER', 'UNDO'}
def _main(self, context):
@staticmethod
def _main(context):
from mathutils import Vector
SCALE_FAC = 0.01

@ -38,7 +38,8 @@ class ConstraintButtonsPanel:
if con.type not in {'RIGID_BODY_JOINT', 'NULL'}:
box.prop(con, "influence")
def space_template(self, layout, con, target=True, owner=True):
@staticmethod
def space_template(layout, con, target=True, owner=True):
if target or owner:
split = layout.split(percentage=0.2)
@ -55,7 +56,8 @@ class ConstraintButtonsPanel:
if owner:
row.prop(con, "owner_space", text="")
def target_template(self, layout, con, subtargets=True):
@staticmethod
def target_template(layout, con, subtargets=True):
layout.prop(con, "target") # XXX limiting settings for only 'curves' or some type of object
if con.target and subtargets:
@ -69,6 +71,7 @@ class ConstraintButtonsPanel:
elif con.target.type in {'MESH', 'LATTICE'}:
layout.prop_search(con, "subtarget", con.target, "vertex_groups", text="Vertex Group")
@staticmethod
def ik_template(self, layout, con):
# only used for iTaSC
layout.prop(con, "pole_target")

@ -126,7 +126,8 @@ class RENDERLAYER_PT_layer_passes(RenderLayerButtonsPanel, Panel):
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw_pass_type_buttons(self, box, rl, pass_type):
@staticmethod
def draw_pass_type_buttons(box, rl, pass_type):
# property names
use_pass_type = "use_pass_" + pass_type
exclude_pass_type = "exclude_" + pass_type

@ -86,19 +86,25 @@ class SCENE_PT_unit(SceneButtonsPanel, Panel):
class SceneKeyingSetsPanel:
def draw_keyframing_settings(self, context, layout, ks, ksp):
self.draw_keyframing_setting(context, layout, ks, ksp, "Needed",
@staticmethod
def draw_keyframing_settings(context, layout, ks, ksp):
SceneKeyingSetsPanel._draw_keyframing_setting(
context, layout, ks, ksp, "Needed",
"use_insertkey_override_needed", "use_insertkey_needed",
userpref_fallback="use_keyframe_insert_needed")
self.draw_keyframing_setting(context, layout, ks, ksp, "Visual",
SceneKeyingSetsPanel._draw_keyframing_setting(
context, layout, ks, ksp, "Visual",
"use_insertkey_override_visual", "use_insertkey_visual",
userpref_fallback="use_visual_keying")
self.draw_keyframing_setting(context, layout, ks, ksp, "XYZ to RGB",
SceneKeyingSetsPanel._draw_keyframing_setting(
context, layout, ks, ksp, "XYZ to RGB",
"use_insertkey_override_xyz_to_rgb", "use_insertkey_xyz_to_rgb")
def draw_keyframing_setting(self, context, layout, ks, ksp, label, toggle_prop, prop, userpref_fallback=None):
@staticmethod
def _draw_keyframing_setting(context, layout, ks, ksp, label, toggle_prop, prop, userpref_fallback=None):
if ksp:
item = ksp

@ -1046,7 +1046,8 @@ class USERPREF_PT_input(Panel):
userpref = context.user_preferences
return (userpref.active_section == 'INPUT')
def draw_input_prefs(self, inputs, layout):
@staticmethod
def draw_input_prefs(inputs, layout):
import sys
# General settings