pep8 changes to rigify (minor warnings still there)
also found quite a few cases where variables were used that hadnt been defined.
This commit is contained in:
		@@ -20,7 +20,7 @@
 | 
			
		||||
 | 
			
		||||
import bpy
 | 
			
		||||
from math import radians, pi
 | 
			
		||||
from rigify import RigifyError, get_layer_dict, ORG_PREFIX
 | 
			
		||||
from rigify import RigifyError, ORG_PREFIX
 | 
			
		||||
from rigify_utils import bone_class_instance, copy_bone_simple, add_pole_target_bone, add_stretch_to, blend_bone_list, get_side_name, get_base_name
 | 
			
		||||
from rna_prop_ui import rna_idprop_ui_prop_get
 | 
			
		||||
from Mathutils import Vector
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,6 @@
 | 
			
		||||
# <pep8 compliant>
 | 
			
		||||
 | 
			
		||||
import bpy
 | 
			
		||||
from rigify import get_layer_dict
 | 
			
		||||
from rigify_utils import bone_class_instance, copy_bone_simple
 | 
			
		||||
 | 
			
		||||
METARIG_NAMES = ("cpy",)
 | 
			
		||||
 
 | 
			
		||||
@@ -20,10 +20,9 @@
 | 
			
		||||
 | 
			
		||||
import bpy
 | 
			
		||||
from rna_prop_ui import rna_idprop_ui_prop_get
 | 
			
		||||
from math import acos
 | 
			
		||||
from Mathutils import Vector
 | 
			
		||||
from rigify import get_layer_dict
 | 
			
		||||
from rigify_utils import bone_class_instance, copy_bone_simple
 | 
			
		||||
from rigify import RigifyError
 | 
			
		||||
from rigify_utils import copy_bone_simple
 | 
			
		||||
 | 
			
		||||
#METARIG_NAMES = ("cpy",)
 | 
			
		||||
RIG_TYPE = "eye_balls"
 | 
			
		||||
@@ -70,7 +69,7 @@ def metarig_definition(obj, orig_bone_name):
 | 
			
		||||
    try:
 | 
			
		||||
        chain += [bone.parent.name, bone.name]
 | 
			
		||||
    except AttributeError:
 | 
			
		||||
        raise RigifyError("'%s' rig type requires a parent (bone: %s)" % (RIG_TYPE, base_names[0]))
 | 
			
		||||
        raise RigifyError("'%s' rig type requires a parent (bone: %s)" % (RIG_TYPE, orig_bone_name))
 | 
			
		||||
 | 
			
		||||
    return chain
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -22,8 +22,8 @@ import bpy
 | 
			
		||||
from rna_prop_ui import rna_idprop_ui_prop_get
 | 
			
		||||
from math import acos
 | 
			
		||||
from Mathutils import Vector
 | 
			
		||||
from rigify import get_layer_dict
 | 
			
		||||
from rigify_utils import bone_class_instance, copy_bone_simple
 | 
			
		||||
from rigify import RigifyError
 | 
			
		||||
from rigify_utils import copy_bone_simple
 | 
			
		||||
 | 
			
		||||
#METARIG_NAMES = ("cpy",)
 | 
			
		||||
RIG_TYPE = "eye_lid"
 | 
			
		||||
@@ -71,12 +71,12 @@ def metarig_definition(obj, orig_bone_name):
 | 
			
		||||
    try:
 | 
			
		||||
        chain += [bone.parent.parent.name, bone.parent.name, bone.name]
 | 
			
		||||
    except AttributeError:
 | 
			
		||||
        raise RigifyError("'%s' rig type requires a chain of two parents (bone: %s)" % (RIG_TYPE, base_names[0]))
 | 
			
		||||
        raise RigifyError("'%s' rig type requires a chain of two parents (bone: %s)" % (RIG_TYPE, orig_bone_name))
 | 
			
		||||
 | 
			
		||||
    chain += [child.name for child in bone.children_recursive_basename]
 | 
			
		||||
 | 
			
		||||
    if len(chain) < 10:
 | 
			
		||||
        raise RigifyError("'%s' rig type requires a chain of 10 bones (bone: %s)" % (RIG_TYPE, base_names[0]))
 | 
			
		||||
        raise RigifyError("'%s' rig type requires a chain of 10 bones (bone: %s)" % (RIG_TYPE, orig_bone_name))
 | 
			
		||||
 | 
			
		||||
    chain = chain[:10]
 | 
			
		||||
 | 
			
		||||
@@ -84,7 +84,7 @@ def metarig_definition(obj, orig_bone_name):
 | 
			
		||||
        chain += [bb[chain[9]].children[0].name]
 | 
			
		||||
        chain += [bb[chain[10]].children[0].name]
 | 
			
		||||
    except IndexError:
 | 
			
		||||
        raise RigifyError("'%s' rig type requires a chain of 10 bones (bone: %s)" % (RIG_TYPE, base_names[0]))
 | 
			
		||||
        raise RigifyError("'%s' rig type requires a chain of 10 bones (bone: %s)" % (RIG_TYPE, orig_bone_name))
 | 
			
		||||
 | 
			
		||||
    return chain
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -19,10 +19,9 @@
 | 
			
		||||
# <pep8 compliant>
 | 
			
		||||
 | 
			
		||||
import bpy
 | 
			
		||||
from rigify import RigifyError, get_layer_dict
 | 
			
		||||
from rigify import RigifyError
 | 
			
		||||
from rigify_utils import copy_bone_simple, get_side_name
 | 
			
		||||
from rna_prop_ui import rna_idprop_ui_prop_get
 | 
			
		||||
from functools import reduce
 | 
			
		||||
 | 
			
		||||
METARIG_NAMES = "finger_01", "finger_02", "finger_03"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
 | 
			
		||||
import bpy
 | 
			
		||||
from math import pi
 | 
			
		||||
from rigify import RigifyError, get_layer_dict
 | 
			
		||||
from rigify import RigifyError
 | 
			
		||||
from rigify_utils import bone_class_instance, copy_bone_simple, blend_bone_list, get_side_name, get_base_name
 | 
			
		||||
from rna_prop_ui import rna_idprop_ui_prop_get
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@ import bpy
 | 
			
		||||
from rna_prop_ui import rna_idprop_ui_prop_get
 | 
			
		||||
from math import pi
 | 
			
		||||
from rigify import RigifyError
 | 
			
		||||
from rigify_utils import bone_class_instance, copy_bone_simple, add_pole_target_bone, get_side_name, get_base_name
 | 
			
		||||
from rigify_utils import bone_class_instance, copy_bone_simple, get_side_name, get_base_name
 | 
			
		||||
from Mathutils import Vector
 | 
			
		||||
 | 
			
		||||
METARIG_NAMES = "hips", "thigh", "shin", "foot", "toe"
 | 
			
		||||
 
 | 
			
		||||
@@ -22,8 +22,8 @@ import bpy
 | 
			
		||||
from rna_prop_ui import rna_idprop_ui_prop_get
 | 
			
		||||
from math import acos, pi
 | 
			
		||||
from Mathutils import Vector
 | 
			
		||||
from rigify import get_layer_dict, RigifyError
 | 
			
		||||
from rigify_utils import bone_class_instance, copy_bone_simple
 | 
			
		||||
from rigify import RigifyError
 | 
			
		||||
from rigify_utils import copy_bone_simple
 | 
			
		||||
 | 
			
		||||
#METARIG_NAMES = ("cpy",)
 | 
			
		||||
RIG_TYPE = "mouth"
 | 
			
		||||
@@ -105,12 +105,12 @@ def metarig_definition(obj, orig_bone_name):
 | 
			
		||||
    try:
 | 
			
		||||
        chain += [bone.parent.parent.name, bone.parent.name, bone.name]
 | 
			
		||||
    except AttributeError:
 | 
			
		||||
        raise RigifyError("'%s' rig type requires a chain of two parents (bone: %s)" % (RIG_TYPE, base_names[0]))
 | 
			
		||||
        raise RigifyError("'%s' rig type requires a chain of two parents (bone: %s)" % (RIG_TYPE, orig_bone_name))
 | 
			
		||||
 | 
			
		||||
    chain += [child.name for child in bone.children_recursive_basename]
 | 
			
		||||
 | 
			
		||||
    if len(chain) < 10:
 | 
			
		||||
        raise RigifyError("'%s' rig type requires a chain of 8 bones (bone: %s)" % (RIG_TYPE, base_names[0]))
 | 
			
		||||
        raise RigifyError("'%s' rig type requires a chain of 8 bones (bone: %s)" % (RIG_TYPE, orig_bone_name))
 | 
			
		||||
 | 
			
		||||
    return chain[:10]
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@
 | 
			
		||||
# <pep8 compliant>
 | 
			
		||||
 | 
			
		||||
import bpy
 | 
			
		||||
from rigify import RigifyError, get_layer_dict
 | 
			
		||||
from rigify import RigifyError
 | 
			
		||||
from rigify_utils import bone_class_instance, copy_bone_simple
 | 
			
		||||
from rna_prop_ui import rna_idprop_ui_prop_get
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,6 @@
 | 
			
		||||
# <pep8 compliant>
 | 
			
		||||
 | 
			
		||||
import bpy
 | 
			
		||||
from rigify import get_layer_dict
 | 
			
		||||
from rigify_utils import copy_bone_simple, get_side_name
 | 
			
		||||
from rna_prop_ui import rna_idprop_ui_prop_get
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -19,11 +19,7 @@
 | 
			
		||||
# <pep8 compliant>
 | 
			
		||||
 | 
			
		||||
import bpy
 | 
			
		||||
from rna_prop_ui import rna_idprop_ui_prop_get
 | 
			
		||||
from math import acos
 | 
			
		||||
from Mathutils import Vector
 | 
			
		||||
from rigify import get_layer_dict
 | 
			
		||||
from rigify_utils import bone_class_instance, copy_bone_simple
 | 
			
		||||
from rigify import RigifyError
 | 
			
		||||
 | 
			
		||||
#METARIG_NAMES = ("cpy",)
 | 
			
		||||
RIG_TYPE = "shape_key_distance"
 | 
			
		||||
 
 | 
			
		||||
@@ -19,11 +19,7 @@
 | 
			
		||||
# <pep8 compliant>
 | 
			
		||||
 | 
			
		||||
import bpy
 | 
			
		||||
from rna_prop_ui import rna_idprop_ui_prop_get
 | 
			
		||||
from math import acos
 | 
			
		||||
from Mathutils import Vector
 | 
			
		||||
from rigify import get_layer_dict
 | 
			
		||||
from rigify_utils import bone_class_instance, copy_bone_simple
 | 
			
		||||
from rigify import RigifyError
 | 
			
		||||
 | 
			
		||||
#METARIG_NAMES = ("cpy",)
 | 
			
		||||
RIG_TYPE = "shape_key_rotdiff"
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@
 | 
			
		||||
# <pep8 compliant>
 | 
			
		||||
 | 
			
		||||
import bpy
 | 
			
		||||
from rigify import get_layer_dict
 | 
			
		||||
from rigify import RigifyError
 | 
			
		||||
from rigify_utils import bone_class_instance, copy_bone_simple
 | 
			
		||||
from rna_prop_ui import rna_idprop_ui_prop_get
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -19,8 +19,8 @@
 | 
			
		||||
# <pep8 compliant>
 | 
			
		||||
 | 
			
		||||
import bpy
 | 
			
		||||
from rigify import get_layer_dict, RigifyError
 | 
			
		||||
from rigify_utils import bone_class_instance, copy_bone_simple
 | 
			
		||||
from rigify import RigifyError
 | 
			
		||||
from rigify_utils import copy_bone_simple
 | 
			
		||||
 | 
			
		||||
METARIG_NAMES = tuple()
 | 
			
		||||
RIG_TYPE = "stretch"
 | 
			
		||||
 
 | 
			
		||||
@@ -19,8 +19,8 @@
 | 
			
		||||
# <pep8 compliant>
 | 
			
		||||
 | 
			
		||||
import bpy
 | 
			
		||||
from rigify import get_layer_dict
 | 
			
		||||
from rigify_utils import bone_class_instance, copy_bone_simple
 | 
			
		||||
from rigify import RigifyError
 | 
			
		||||
from rigify_utils import copy_bone_simple
 | 
			
		||||
 | 
			
		||||
METARIG_NAMES = tuple()
 | 
			
		||||
RIG_TYPE = "stretch_twist"
 | 
			
		||||
 
 | 
			
		||||
@@ -19,8 +19,8 @@
 | 
			
		||||
# <pep8 compliant>
 | 
			
		||||
 | 
			
		||||
import bpy
 | 
			
		||||
from rigify import get_layer_dict
 | 
			
		||||
from rigify_utils import bone_class_instance, copy_bone_simple
 | 
			
		||||
from rigify import RigifyError
 | 
			
		||||
from rigify_utils import copy_bone_simple
 | 
			
		||||
 | 
			
		||||
METARIG_NAMES = tuple()
 | 
			
		||||
RIG_TYPE = "track_dual"
 | 
			
		||||
@@ -48,12 +48,11 @@ bool_map = {0:False, 1:True,
 | 
			
		||||
            "no":False, "yes":True,
 | 
			
		||||
            "No":False, "Yes":True}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def metarig_definition(obj, orig_bone_name):
 | 
			
		||||
    return (orig_bone_name,)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def main(obj, bone_definition, base_names, options):
 | 
			
		||||
    """ A dual-bone track setup.
 | 
			
		||||
        Deformation only (no controls).
 | 
			
		||||
@@ -89,7 +88,6 @@ def main(obj, bone_definition, base_names, options):
 | 
			
		||||
    bone2 = bone_e.name
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    bpy.ops.object.mode_set(mode='OBJECT')
 | 
			
		||||
 | 
			
		||||
    # Constraints
 | 
			
		||||
@@ -110,4 +108,3 @@ def main(obj, bone_definition, base_names, options):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    return tuple()
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -19,8 +19,8 @@
 | 
			
		||||
# <pep8 compliant>
 | 
			
		||||
 | 
			
		||||
import bpy
 | 
			
		||||
from rigify import get_layer_dict
 | 
			
		||||
from rigify_utils import bone_class_instance, copy_bone_simple
 | 
			
		||||
from rigify import RigifyError
 | 
			
		||||
from rigify_utils import copy_bone_simple
 | 
			
		||||
 | 
			
		||||
METARIG_NAMES = tuple()
 | 
			
		||||
RIG_TYPE = "track_reverse"
 | 
			
		||||
 
 | 
			
		||||
@@ -174,7 +174,6 @@ def blend_bone_list(obj, apply_bones, from_bones, to_bones, target_bone=None, ta
 | 
			
		||||
        blend_transforms(new_pbone, from_bone_name, to_bone_name)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def add_pole_target_bone(obj, base_bone_name, name, mode='CROSS'):
 | 
			
		||||
    '''
 | 
			
		||||
    Does not actually create a poll target, just the bone to use as a poll target
 | 
			
		||||
@@ -320,10 +319,11 @@ def bone_class_instance(obj, slots, name="BoneContainer"):
 | 
			
		||||
    there are also utility functions for manipulating all members.
 | 
			
		||||
    '''
 | 
			
		||||
 | 
			
		||||
    attr_names = tuple(slots) # dont modify the original
 | 
			
		||||
 | 
			
		||||
    if len(slots) != len(set(slots)):
 | 
			
		||||
        raise Exception("duplicate entries found %s" % attr_names)
 | 
			
		||||
 | 
			
		||||
    attr_names = tuple(slots) # dont modify the original
 | 
			
		||||
    slots = list(slots) # dont modify the original
 | 
			
		||||
    for i in range(len(slots)):
 | 
			
		||||
        member = slots[i]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user