Skip to content
Snippets Groups Projects
Commit 43fea1f1 authored by Campbell Barton's avatar Campbell Barton
Browse files

Cleanup: pep8

parent 9dc19735
No related branches found
No related tags found
No related merge requests found
...@@ -33,13 +33,13 @@ bl_info = { ...@@ -33,13 +33,13 @@ bl_info = {
import bpy import bpy
from mathutils import Matrix from mathutils import Matrix
from bpy.types import ( from bpy.types import (
Operator, Operator,
Menu, Menu,
) )
from bpy.props import ( from bpy.props import (
BoolVectorProperty, BoolVectorProperty,
StringProperty, StringProperty,
) )
# First part of the operator Info message # First part of the operator Info message
INFO_MESSAGE = "Copy Attributes: " INFO_MESSAGE = "Copy Attributes: "
...@@ -82,7 +82,7 @@ def genops(copylist, oplist, prefix, poll_func, loopfunc): ...@@ -82,7 +82,7 @@ def genops(copylist, oplist, prefix, poll_func, loopfunc):
exec_func = build_exec(loopfunc, op[3]) exec_func = build_exec(loopfunc, op[3])
invoke_func = build_invoke(loopfunc, op[3]) invoke_func = build_invoke(loopfunc, op[3])
opclass = build_op(prefix + op[0], "Copy " + op[1], op[2], opclass = build_op(prefix + op[0], "Copy " + op[1], op[2],
poll_func, exec_func, invoke_func) poll_func, exec_func, invoke_func)
oplist.append(opclass) oplist.append(opclass)
...@@ -161,13 +161,13 @@ def pVisLocExec(bone, active, context): ...@@ -161,13 +161,13 @@ def pVisLocExec(bone, active, context):
def pVisRotExec(bone, active, context): def pVisRotExec(bone, active, context):
rotcopy(bone, getmat(bone, active, rotcopy(bone, getmat(bone, active,
context, not context.active_object.data.bones[bone.name].use_inherit_rotation)) context, not context.active_object.data.bones[bone.name].use_inherit_rotation))
def pVisScaExec(bone, active, context): def pVisScaExec(bone, active, context):
bone.scale = getmat(bone, active, context, bone.scale = getmat(bone, active, context,
not context.active_object.data.bones[bone.name].use_inherit_scale)\ not context.active_object.data.bones[bone.name].use_inherit_scale)\
.to_scale() .to_scale()
def pDrwExec(bone, active, context): def pDrwExec(bone, active, context):
...@@ -207,29 +207,29 @@ def pBBonesExec(bone, active, context): ...@@ -207,29 +207,29 @@ def pBBonesExec(bone, active, context):
pose_copies = ( pose_copies = (
('pose_loc_loc', "Local Location", ('pose_loc_loc', "Local Location",
"Copy Location from Active to Selected", pLocLocExec), "Copy Location from Active to Selected", pLocLocExec),
('pose_loc_rot', "Local Rotation", ('pose_loc_rot', "Local Rotation",
"Copy Rotation from Active to Selected", pLocRotExec), "Copy Rotation from Active to Selected", pLocRotExec),
('pose_loc_sca', "Local Scale", ('pose_loc_sca', "Local Scale",
"Copy Scale from Active to Selected", pLocScaExec), "Copy Scale from Active to Selected", pLocScaExec),
('pose_vis_loc', "Visual Location", ('pose_vis_loc', "Visual Location",
"Copy Location from Active to Selected", pVisLocExec), "Copy Location from Active to Selected", pVisLocExec),
('pose_vis_rot', "Visual Rotation", ('pose_vis_rot', "Visual Rotation",
"Copy Rotation from Active to Selected", pVisRotExec), "Copy Rotation from Active to Selected", pVisRotExec),
('pose_vis_sca', "Visual Scale", ('pose_vis_sca', "Visual Scale",
"Copy Scale from Active to Selected", pVisScaExec), "Copy Scale from Active to Selected", pVisScaExec),
('pose_drw', "Bone Shape", ('pose_drw', "Bone Shape",
"Copy Bone Shape from Active to Selected", pDrwExec), "Copy Bone Shape from Active to Selected", pDrwExec),
('pose_lok', "Protected Transform", ('pose_lok', "Protected Transform",
"Copy Protected Tranforms from Active to Selected", pLokExec), "Copy Protected Tranforms from Active to Selected", pLokExec),
('pose_con', "Bone Constraints", ('pose_con', "Bone Constraints",
"Copy Object Constraints from Active to Selected", pConExec), "Copy Object Constraints from Active to Selected", pConExec),
('pose_iks', "IK Limits", ('pose_iks', "IK Limits",
"Copy IK Limits from Active to Selected", pIKsExec), "Copy IK Limits from Active to Selected", pIKsExec),
('bbone_settings', "BBone Settings", ('bbone_settings', "BBone Settings",
"Copy BBone Settings from Active to Selected", pBBonesExec), "Copy BBone Settings from Active to Selected", pBBonesExec),
) )
@classmethod @classmethod
...@@ -249,9 +249,9 @@ class CopySelectedPoseConstraints(Operator): ...@@ -249,9 +249,9 @@ class CopySelectedPoseConstraints(Operator):
bl_label = "Copy Selected Constraints" bl_label = "Copy Selected Constraints"
selection = BoolVectorProperty( selection = BoolVectorProperty(
size=32, size=32,
options={'SKIP_SAVE'} options={'SKIP_SAVE'}
) )
poll = pose_poll_func poll = pose_poll_func
invoke = pose_invoke_func invoke = pose_invoke_func
...@@ -260,7 +260,7 @@ class CopySelectedPoseConstraints(Operator): ...@@ -260,7 +260,7 @@ class CopySelectedPoseConstraints(Operator):
layout = self.layout layout = self.layout
for idx, const in enumerate(context.active_pose_bone.constraints): for idx, const in enumerate(context.active_pose_bone.constraints):
layout.prop(self, "selection", index=idx, text=const.name, layout.prop(self, "selection", index=idx, text=const.name,
toggle=True) toggle=True)
def execute(self, context): def execute(self, context):
active = context.active_pose_bone active = context.active_pose_bone
...@@ -271,8 +271,8 @@ class CopySelectedPoseConstraints(Operator): ...@@ -271,8 +271,8 @@ class CopySelectedPoseConstraints(Operator):
if flag: if flag:
old_constraint = active.constraints[index] old_constraint = active.constraints[index]
new_constraint = bone.constraints.new( new_constraint = bone.constraints.new(
active.constraints[index].type active.constraints[index].type
) )
generic_copy(old_constraint, new_constraint) generic_copy(old_constraint, new_constraint)
return {'FINISHED'} return {'FINISHED'}
...@@ -425,7 +425,7 @@ def obMod(ob, active, context): ...@@ -425,7 +425,7 @@ def obMod(ob, active, context):
ob.modifiers.remove(modifier) ob.modifiers.remove(modifier)
for old_modifier in active.modifiers.values(): for old_modifier in active.modifiers.values():
new_modifier = ob.modifiers.new(name=old_modifier.name, new_modifier = ob.modifiers.new(name=old_modifier.name,
type=old_modifier.type) type=old_modifier.type)
generic_copy(old_modifier, new_modifier) generic_copy(old_modifier, new_modifier)
return('INFO', "Modifiers copied") return('INFO', "Modifiers copied")
...@@ -479,60 +479,60 @@ def obWei(ob, active, context): ...@@ -479,60 +479,60 @@ def obWei(ob, active, context):
for vgs in range(0, len(groups)): for vgs in range(0, len(groups)):
if groups[vgs].name == groupName: if groups[vgs].name == groupName:
groups[vgs].add((v.index,), groups[vgs].add((v.index,),
vgroupIndex_weight[i][1], "REPLACE") vgroupIndex_weight[i][1], "REPLACE")
return('INFO', "Weights copied") return('INFO', "Weights copied")
object_copies = ( object_copies = (
# ('obj_loc', "Location", # ('obj_loc', "Location",
# "Copy Location from Active to Selected", obLoc), # "Copy Location from Active to Selected", obLoc),
# ('obj_rot', "Rotation", # ('obj_rot', "Rotation",
# "Copy Rotation from Active to Selected", obRot), # "Copy Rotation from Active to Selected", obRot),
# ('obj_sca', "Scale", # ('obj_sca', "Scale",
# "Copy Scale from Active to Selected", obSca), # "Copy Scale from Active to Selected", obSca),
('obj_vis_loc', "Location", ('obj_vis_loc', "Location",
"Copy Location from Active to Selected", obVisLoc), "Copy Location from Active to Selected", obVisLoc),
('obj_vis_rot', "Rotation", ('obj_vis_rot', "Rotation",
"Copy Rotation from Active to Selected", obVisRot), "Copy Rotation from Active to Selected", obVisRot),
('obj_vis_sca', "Scale", ('obj_vis_sca', "Scale",
"Copy Scale from Active to Selected", obVisSca), "Copy Scale from Active to Selected", obVisSca),
('obj_drw', "Draw Options", ('obj_drw', "Draw Options",
"Copy Draw Options from Active to Selected", obDrw), "Copy Draw Options from Active to Selected", obDrw),
('obj_ofs', "Time Offset", ('obj_ofs', "Time Offset",
"Copy Time Offset from Active to Selected", obOfs), "Copy Time Offset from Active to Selected", obOfs),
('obj_dup', "Dupli", ('obj_dup', "Dupli",
"Copy Dupli from Active to Selected", obDup), "Copy Dupli from Active to Selected", obDup),
('obj_col', "Object Color", ('obj_col', "Object Color",
"Copy Object Color from Active to Selected", obCol), "Copy Object Color from Active to Selected", obCol),
# ('obj_dmp', "Damping", # ('obj_dmp', "Damping",
# "Copy Damping from Active to Selected"), # "Copy Damping from Active to Selected"),
# ('obj_all', "All Physical Attributes", # ('obj_all', "All Physical Attributes",
# "Copy Physical Attributes from Active to Selected"), # "Copy Physical Attributes from Active to Selected"),
# ('obj_prp', "Properties", # ('obj_prp', "Properties",
# "Copy Properties from Active to Selected"), # "Copy Properties from Active to Selected"),
# ('obj_log', "Logic Bricks", # ('obj_log', "Logic Bricks",
# "Copy Logic Bricks from Active to Selected"), # "Copy Logic Bricks from Active to Selected"),
('obj_lok', "Protected Transform", ('obj_lok', "Protected Transform",
"Copy Protected Tranforms from Active to Selected", obLok), "Copy Protected Tranforms from Active to Selected", obLok),
('obj_con', "Object Constraints", ('obj_con', "Object Constraints",
"Copy Object Constraints from Active to Selected", obCon), "Copy Object Constraints from Active to Selected", obCon),
# ('obj_nla', "NLA Strips", # ('obj_nla', "NLA Strips",
# "Copy NLA Strips from Active to Selected"), # "Copy NLA Strips from Active to Selected"),
# ('obj_tex', "Texture Space", # ('obj_tex', "Texture Space",
# "Copy Texture Space from Active to Selected", obTex), # "Copy Texture Space from Active to Selected", obTex),
# ('obj_sub', "Subsurf Settings", # ('obj_sub', "Subsurf Settings",
# "Copy Subsurf Setings from Active to Selected"), # "Copy Subsurf Setings from Active to Selected"),
# ('obj_smo', "AutoSmooth", # ('obj_smo', "AutoSmooth",
# "Copy AutoSmooth from Active to Selected"), # "Copy AutoSmooth from Active to Selected"),
('obj_idx', "Pass Index", ('obj_idx', "Pass Index",
"Copy Pass Index from Active to Selected", obIdx), "Copy Pass Index from Active to Selected", obIdx),
('obj_mod', "Modifiers", ('obj_mod', "Modifiers",
"Copy Modifiers from Active to Selected", obMod), "Copy Modifiers from Active to Selected", obMod),
('obj_wei', "Vertex Weights", ('obj_wei', "Vertex Weights",
"Copy vertex weights based on indices", obWei), "Copy vertex weights based on indices", obWei),
('obj_grp', "Group Links", ('obj_grp', "Group Links",
"Copy selected into active object's groups", obGrp) "Copy selected into active object's groups", obGrp)
) )
@classmethod @classmethod
...@@ -552,9 +552,9 @@ class CopySelectedObjectConstraints(Operator): ...@@ -552,9 +552,9 @@ class CopySelectedObjectConstraints(Operator):
bl_label = "Copy Selected Constraints" bl_label = "Copy Selected Constraints"
selection = BoolVectorProperty( selection = BoolVectorProperty(
size=32, size=32,
options={'SKIP_SAVE'} options={'SKIP_SAVE'}
) )
poll = object_poll_func poll = object_poll_func
invoke = object_invoke_func invoke = object_invoke_func
...@@ -563,7 +563,7 @@ class CopySelectedObjectConstraints(Operator): ...@@ -563,7 +563,7 @@ class CopySelectedObjectConstraints(Operator):
layout = self.layout layout = self.layout
for idx, const in enumerate(context.active_object.constraints): for idx, const in enumerate(context.active_object.constraints):
layout.prop(self, "selection", index=idx, text=const.name, layout.prop(self, "selection", index=idx, text=const.name,
toggle=True) toggle=True)
def execute(self, context): def execute(self, context):
active = context.active_object active = context.active_object
...@@ -574,8 +574,8 @@ class CopySelectedObjectConstraints(Operator): ...@@ -574,8 +574,8 @@ class CopySelectedObjectConstraints(Operator):
if flag: if flag:
old_constraint = active.constraints[index] old_constraint = active.constraints[index]
new_constraint = obj.constraints.new( new_constraint = obj.constraints.new(
active.constraints[index].type active.constraints[index].type
) )
generic_copy(old_constraint, new_constraint) generic_copy(old_constraint, new_constraint)
return{'FINISHED'} return{'FINISHED'}
...@@ -586,9 +586,9 @@ class CopySelectedObjectModifiers(Operator): ...@@ -586,9 +586,9 @@ class CopySelectedObjectModifiers(Operator):
bl_label = "Copy Selected Modifiers" bl_label = "Copy Selected Modifiers"
selection = BoolVectorProperty( selection = BoolVectorProperty(
size=32, size=32,
options={'SKIP_SAVE'} options={'SKIP_SAVE'}
) )
poll = object_poll_func poll = object_poll_func
invoke = object_invoke_func invoke = object_invoke_func
...@@ -597,7 +597,7 @@ class CopySelectedObjectModifiers(Operator): ...@@ -597,7 +597,7 @@ class CopySelectedObjectModifiers(Operator):
layout = self.layout layout = self.layout
for idx, const in enumerate(context.active_object.modifiers): for idx, const in enumerate(context.active_object.modifiers):
layout.prop(self, 'selection', index=idx, text=const.name, layout.prop(self, 'selection', index=idx, text=const.name,
toggle=True) toggle=True)
def execute(self, context): def execute(self, context):
active = context.active_object active = context.active_object
...@@ -608,9 +608,9 @@ class CopySelectedObjectModifiers(Operator): ...@@ -608,9 +608,9 @@ class CopySelectedObjectModifiers(Operator):
if flag: if flag:
old_modifier = active.modifiers[index] old_modifier = active.modifiers[index]
new_modifier = obj.modifiers.new( new_modifier = obj.modifiers.new(
type=active.modifiers[index].type, type=active.modifiers[index].type,
name=active.modifiers[index].name name=active.modifiers[index].name
) )
generic_copy(old_modifier, new_modifier) generic_copy(old_modifier, new_modifier)
return{'FINISHED'} return{'FINISHED'}
...@@ -662,23 +662,23 @@ class MESH_MT_CopyFaceSettings(Menu): ...@@ -662,23 +662,23 @@ class MESH_MT_CopyFaceSettings(Menu):
layout.separator() layout.separator()
op = layout.operator(MESH_OT_CopyFaceSettings.bl_idname, op = layout.operator(MESH_OT_CopyFaceSettings.bl_idname,
text="Copy Material") text="Copy Material")
op['layer'] = '' op['layer'] = ''
op['mode'] = 'MAT' op['mode'] = 'MAT'
if mesh.uv_textures.active: if mesh.uv_textures.active:
op = layout.operator(MESH_OT_CopyFaceSettings.bl_idname, op = layout.operator(MESH_OT_CopyFaceSettings.bl_idname,
text="Copy Active UV Image") text="Copy Active UV Image")
op['layer'] = '' op['layer'] = ''
op['mode'] = 'IMAGE' op['mode'] = 'IMAGE'
op = layout.operator(MESH_OT_CopyFaceSettings.bl_idname, op = layout.operator(MESH_OT_CopyFaceSettings.bl_idname,
text="Copy Active UV Coords") text="Copy Active UV Coords")
op['layer'] = '' op['layer'] = ''
op['mode'] = 'UV' op['mode'] = 'UV'
if mesh.vertex_colors.active: if mesh.vertex_colors.active:
op = layout.operator(MESH_OT_CopyFaceSettings.bl_idname, op = layout.operator(MESH_OT_CopyFaceSettings.bl_idname,
text="Copy Active Vertex Colors") text="Copy Active Vertex Colors")
op['layer'] = '' op['layer'] = ''
op['mode'] = 'VCOL' op['mode'] = 'VCOL'
...@@ -702,7 +702,7 @@ class MESH_MT_CopyImagesFromLayer(Menu): ...@@ -702,7 +702,7 @@ class MESH_MT_CopyImagesFromLayer(Menu):
def poll(cls, context): def poll(cls, context):
obj = context.active_object obj = context.active_object
return obj and obj.mode == "EDIT_MESH" and len( return obj and obj.mode == "EDIT_MESH" and len(
obj.data.uv_layers) > 1 obj.data.uv_layers) > 1
def draw(self, context): def draw(self, context):
mesh = context.active_object.data mesh = context.active_object.data
...@@ -716,7 +716,7 @@ class MESH_MT_CopyUVCoordsFromLayer(Menu): ...@@ -716,7 +716,7 @@ class MESH_MT_CopyUVCoordsFromLayer(Menu):
def poll(cls, context): def poll(cls, context):
obj = context.active_object obj = context.active_object
return obj and obj.mode == "EDIT_MESH" and len( return obj and obj.mode == "EDIT_MESH" and len(
obj.data.uv_layers) > 1 obj.data.uv_layers) > 1
def draw(self, context): def draw(self, context):
mesh = context.active_object.data mesh = context.active_object.data
...@@ -730,7 +730,7 @@ class MESH_MT_CopyVertexColorsFromLayer(Menu): ...@@ -730,7 +730,7 @@ class MESH_MT_CopyVertexColorsFromLayer(Menu):
def poll(cls, context): def poll(cls, context):
obj = context.active_object obj = context.active_object
return obj and obj.mode == "EDIT_MESH" and len( return obj and obj.mode == "EDIT_MESH" and len(
obj.data.vertex_colors) > 1 obj.data.vertex_colors) > 1
def draw(self, context): def draw(self, context):
mesh = context.active_object.data mesh = context.active_object.data
...@@ -758,13 +758,13 @@ class MESH_OT_CopyFaceSettings(Operator): ...@@ -758,13 +758,13 @@ class MESH_OT_CopyFaceSettings(Operator):
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
mode = StringProperty( mode = StringProperty(
name="Mode", name="Mode",
options={"HIDDEN"}, options={"HIDDEN"},
) )
layer = StringProperty( layer = StringProperty(
name="Layer", name="Layer",
options={"HIDDEN"}, options={"HIDDEN"},
) )
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment