def __init__(self, obj, bone, params, ikfk_switch=False): """ Gather and validate data about the rig. Store any data or references to data that will be needed later on. In particular, store references to bones that will be needed, and store names of bones that will be needed. Do NOT change any data in the scene. This is a gathering phase only. ikfk_switch: if True, create an ik/fk switch slider """ self.obj = obj self.params = params self.switch = ikfk_switch # Get the chain of 3 connected bones self.org_bones = [bone] + connected_children_names(self.obj, bone)[:2] if len(self.org_bones) != 3: raise MetarigError("RIGIFY ERROR: Bone '%s': input to rig type must be a chain of 3 bones" % (strip_org(bone))) # Get the rig parameters if params.separate_ik_layers: self.layers = list(params.ik_layers) else: self.layers = None self.bend_hint = params.bend_hint self.primary_rotation_axis = params.primary_rotation_axis
def __init__(self, obj, bone, params): """ Gather and validate data about the rig. Store any data or references to data that will be needed later on. In particular, store references to bones that will be needed, and store names of bones that will be needed. Do NOT change any data in the scene. This is a gathering phase only. """ self.obj = obj self.params = params # Get the chain of 3 connected bones self.org_bones = [bone] + connected_children_names(self.obj, bone)[:2] if len(self.org_bones) != 3: raise MetarigError( "RIGIFY ERROR: Bone '%s': input to rig type must be a chain of 3 bones" % (strip_org(bone))) # Get (optional) parent if self.obj.data.bones[bone].parent is None: self.org_parent = None else: self.org_parent = self.obj.data.bones[bone].parent.name # Get the rig parameters if "layers" in params: self.layers = get_layers(params["layers"]) else: self.layers = None self.primary_rotation_axis = params.primary_rotation_axis
def __init__(self, obj, bone_name, params): self.obj = obj self.org_bones = ([bone_name] + connected_children_names(obj, bone_name)[:2]) self.params = params if params.duplicate_lr: sides = ['.L', '.R'] else: sides = [params.side] self.sides = {} for s in sides: side_org_bones = limb_common.create_side_org_bones( self.obj, self.org_bones, params.duplicate_lr, s) self.sides[s] = [side_org_bones] self.sides[s].append( limb_common.IKLimb(obj, self.org_bones, side_org_bones, params.do_flip, True, params.pelvis_name, s, ik_limits=[-160.0, 0.0])) self.sides[s].append( limb_common.FKLimb(obj, self.org_bones, side_org_bones, params.do_flip, True, params.pelvis_name, s))
def __init__(self, obj, bone, params, ikfk_switch=False): """ Gather and validate data about the rig. Store any data or references to data that will be needed later on. In particular, store references to bones that will be needed, and store names of bones that will be needed. Do NOT change any data in the scene. This is a gathering phase only. ikfk_switch: if True, create an ik/fk switch slider """ self.obj = obj self.params = params # Get the chain of 3 connected bones self.org_bones = [bone] + connected_children_names(self.obj, bone)[:2] if len(self.org_bones) != 3: raise MetarigError( "RIGIFY ERROR: Bone '%s': input to rig type must be a chain of 3 bones" % (strip_org(bone))) # Get the rig parameters if params.separate_ik_layers: layers = list(params.ik_layers) else: layers = None bend_hint = params.bend_hint primary_rotation_axis = params.primary_rotation_axis_cessen pole_target_base_name = self.params.elbow_base_name + "_target" # Arm is based on common limb self.ik_limb = limb_common.IKLimb(obj, self.org_bones[0], self.org_bones[1], self.org_bones[2], None, pole_target_base_name, primary_rotation_axis, bend_hint, layers, ikfk_switch)
def __init__(self, obj, bone, params): self.obj = obj self.params = params # Get the chain of 3 connected bones self.org_bones = [bone] + connected_children_names(self.obj, bone)[:2] if len(self.org_bones) != 3: raise MetarigError( "RIGIFY ERROR: Bone '%s': input to rig type must be a chain of 3 bones" % (strip_org(bone))) # Get rig parameters if params.separate_hose_layers: layers = list(params.hose_layers) else: layers = None use_complex_rig = params.use_complex_arm elbow_base_name = params.elbow_base_name primary_rotation_axis = params.primary_rotation_axis_cessen # Based on common limb self.rubber_hose_limb = limb_common.RubberHoseLimb( obj, self.org_bones[0], self.org_bones[1], self.org_bones[2], use_complex_rig, elbow_base_name, primary_rotation_axis, layers)
def __init__(self, obj, bone, params): """ Gather and validate data about the rig. Store any data or references to data that will be needed later on. In particular, store references to bones that will be needed, and store names of bones that will be needed. Do NOT change any data in the scene. This is a gathering phase only. """ self.obj = obj # Get the chain of 3 connected bones self.org_bones = [bone] + connected_children_names(self.obj, bone)[:2] if len(self.org_bones) != 3: raise MetarigError( "RIGIFY ERROR: Bone '%s': input to rig type must be a chain of at least 3 bones" % (strip_org(bone))) # Get params if "layers" in params: layers = get_layers(params["layers"]) else: layers = None primary_rotation_axis = params.primary_rotation_axis_cessen # Arm is based on common limb self.fk_limb = limb_common.FKLimb(obj, self.org_bones[0], self.org_bones[1], self.org_bones[2], primary_rotation_axis, layers)
def __init__(self, obj, bone_name, params): """ Gather and validate data about the rig. """ self.obj = obj self.org_bones = [bone_name] + connected_children_names(obj, bone_name) self.params = params # Collect control bone indices self.control_indices = [0, len(self.org_bones) - 1] temp = self.params.chain_bone_controls.split(",") for i in temp: try: j = int(i) - 1 except ValueError: pass else: if (j > 0) and (j < len(self.org_bones)) and (j not in self.control_indices): self.control_indices += [j] self.control_indices.sort() self.pivot_rest = self.params.rest_pivot_slide self.pivot_rest = max(self.pivot_rest, 1.0/len(self.org_bones)) self.pivot_rest = min(self.pivot_rest, 1.0-(1.0/len(self.org_bones))) if len(self.org_bones) <= 1: raise MetarigError("RIGIFY ERROR: Bone '%s': input to rig type must be a chain of 2 or more bones" % (strip_org(bone_name)))
def __init__(self, obj, bone, params, ikfk_switch=False): """ Gather and validate data about the rig. Store any data or references to data that will be needed later on. In particular, store references to bones that will be needed, and store names of bones that will be needed. Do NOT change any data in the scene. This is a gathering phase only. ikfk_switch: if True, create an ik/fk switch slider """ self.obj = obj self.params = params self.switch = ikfk_switch # Get the chain of 3 connected bones self.org_bones = [bone] + connected_children_names(self.obj, bone)[:2] if len(self.org_bones) != 3: raise MetarigError("RIGIFY ERROR: Bone '%s': input to rig type must be a chain of 3 bones." % (strip_org(bone))) # Get the rig parameters if params.separate_ik_layers: self.layers = list(params.ik_layers) else: self.layers = None self.bend_hint = params.bend_hint self.primary_rotation_axis = params.primary_rotation_axis
def __init__(self, obj, bone, params): """ Gather and validate data about the rig. Store any data or references to data that will be needed later on. In particular, store references to bones that will be needed, and store names of bones that will be needed. Do NOT change any data in the scene. This is a gathering phase only. """ self.obj = obj self.params = params # Get the chain of 3 connected bones self.org_bones = [bone] + connected_children_names(self.obj, bone)[:2] if len(self.org_bones) != 3: raise MetarigError("RIGIFY ERROR: Bone '%s': input to rig type must be a chain of 3 bones" % (strip_org(bone))) # Get (optional) parent if self.obj.data.bones[bone].parent is None: self.org_parent = None else: self.org_parent = self.obj.data.bones[bone].parent.name # Get the rig parameters if "layers" in params: self.layers = get_layers(params["layers"]) else: self.layers = None self.primary_rotation_axis = params.primary_rotation_axis
def __init__(self, obj, bone_name, params): """ Gather and validate data about the rig. """ self.obj = obj self.org_bones = [bone_name] + connected_children_names(obj, bone_name) self.params = params # Collect control bone indices self.control_indices = [0, len(self.org_bones) - 1] temp = self.params.chain_bone_controls.split(",") for i in temp: try: j = int(i) - 1 except ValueError: pass else: if (j > 0) and (j < len( self.org_bones)) and (j not in self.control_indices): self.control_indices += [j] self.control_indices.sort() self.pivot_rest = self.params.rest_pivot_slide self.pivot_rest = max(self.pivot_rest, 1.0 / len(self.org_bones)) self.pivot_rest = min(self.pivot_rest, 1.0 - (1.0 / len(self.org_bones))) if len(self.org_bones) <= 1: raise MetarigError( "RIGIFY ERROR: Bone '%s': input to rig type must be a chain of 2 or more bones" % (strip_org(bone_name)))
def __init__(self, obj, bone_name, params): self.obj = obj self.params = params self.neck = bone_name self.head = connected_children_names(self.obj, bone_name)[0] self.org_bones = [self.neck, self.head]
def __init__(self, obj, bone, params): """ Gather and validate data about the rig. Store any data or references to data that will be needed later on. In particular, store references to bones that will be needed, and store names of bones that will be needed. Do NOT change any data in the scene. This is a gathering phase only. """ self.obj = obj self.params = params # Get the chain of 2 connected bones leg_bones = [bone] + connected_children_names(self.obj, bone)[:2] if len(leg_bones) != 2: raise MetarigError( "RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type -- leg bones != 2" % (strip_org(bone)) ) # Get the foot and heel foot = None heel = None for b in self.obj.data.bones[leg_bones[1]].children: if b.use_connect == True: if len(b.children) >= 1 and has_connected_children(b): foot = b.name else: heel = b.name if foot is None: raise MetarigError( "RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type -- could not find foot bone (that is, a bone with >1 children connected) attached to bone '%s'" % (strip_org(bone), strip_org(shin)) ) if heel is None: raise MetarigError( "RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type -- could not find heel bone (that is, a bone with no childrenconnected) attached to bone '%s'" % (strip_org(bone), strip_org(shin)) ) # Get the toe toe = None for b in self.obj.data.bones[foot].children: if b.use_connect == True: toe = b.name if toe is None: raise MetarigError( "RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type -- toe is None" % (strip_org(bone)) ) self.org_bones = leg_bones + [foot, toe, heel] # Get rig parameters self.use_thigh_twist = params.use_thigh_twist self.use_shin_twist = params.use_shin_twist
def __init__(self, obj, bone, params): self.obj = obj self.params = params # Get the chain of 2 connected bones leg_bones = [bone] + connected_children_names(self.obj, bone)[:2] if len(leg_bones) != 2: raise MetarigError( "RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type -- leg bones != 2" % (strip_org(bone))) # Get the foot and heel foot = None heel = None for b in self.obj.data.bones[leg_bones[1]].children: if b.use_connect is True: if len(b.children) >= 1 and has_connected_children(b): foot = b.name else: heel = b.name if foot is None: raise MetarigError( "RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type -- could not find foot bone (that is, a bone with >1 children connected) attached to bone '%s'" % (strip_org(bone), strip_org(leg_bones[1]))) if heel is None: raise MetarigError( "RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type -- could not find heel bone (that is, a bone with no children connected) attached to bone '%s'" % (strip_org(bone), strip_org(leg_bones[1]))) # Get the toe toe = None for b in self.obj.data.bones[foot].children: if b.use_connect is True: toe = b.name if toe is None: raise MetarigError( "RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type -- toe is None" % (strip_org(bone))) self.org_bones = leg_bones + [foot, toe, heel] # Get rig parameters if params.separate_hose_layers: layers = list(params.hose_layers) else: layers = None use_complex_rig = params.use_complex_leg knee_base_name = params.knee_base_name primary_rotation_axis = params.primary_rotation_axis_legacy # Based on common limb self.rubber_hose_limb = limb_common.RubberHoseLimb( obj, self.org_bones[0], self.org_bones[1], self.org_bones[2], use_complex_rig, knee_base_name, primary_rotation_axis, layers)
def __init__(self, obj, bone, params): """ Gather and validate data about the rig. Store any data or references to data that will be needed later on. In particular, store references to bones that will be needed, and store names of bones that will be needed. Do NOT change any data in the scene. This is a gathering phase only. """ self.obj = obj self.params = params # Get the chain of 2 connected bones leg_bones = [bone] + connected_children_names(self.obj, bone)[:2] if len(leg_bones) != 2: raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type." % (strip_org(bone))) # Get the foot and heel foot = None heel = None for b in self.obj.data.bones[leg_bones[1]].children: if b.use_connect == True: if len(b.children) == 0: heel = b.name else: foot = b.name if foot == None or heel == None: raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type." % (strip_org(bone))) # Get the toe toe = None for b in self.obj.data.bones[foot].children: if b.use_connect == True: toe = b.name # Get the toe if toe == None: raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type." % (strip_org(bone))) self.org_bones = leg_bones + [foot, toe, heel] # Get (optional) parent if self.obj.data.bones[bone].parent == None: self.org_parent = None else: self.org_parent = self.obj.data.bones[bone].parent.name # Get rig parameters if "layers" in params: self.layers = get_layers(params["layers"]) else: self.layers = None self.primary_rotation_axis = params.primary_rotation_axis
def __init__(self, obj, bone, params, ikfk_switch=False): """ Gather and validate data about the rig. Store any data or references to data that will be needed later on. In particular, store references to bones that will be needed, and store names of bones that will be needed. Do NOT change any data in the scene. This is a gathering phase only. """ self.obj = obj self.params = params self.switch = ikfk_switch # Get the chain of 2 connected bones leg_bones = [bone] + connected_children_names(self.obj, bone)[:2] if len(leg_bones) != 2: raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type" % (strip_org(bone))) # Get the foot and heel foot = None heel = None rocker = None for b in self.obj.data.bones[leg_bones[1]].children: if b.use_connect == True: if len(b.children) >= 1 and has_connected_children(b): foot = b.name else: heel = b.name if len(b.children) > 0: rocker = b.children[0].name if foot is None or heel is None: print("blah") raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type" % (strip_org(bone))) # Get the toe toe = None for b in self.obj.data.bones[foot].children: if b.use_connect == True: toe = b.name # Get toe if toe is None: raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type" % (strip_org(bone))) self.org_bones = leg_bones + [foot, toe, heel, rocker] # Get rig parameters if params.separate_ik_layers: self.layers = list(params.ik_layers) else: self.layers = None self.bend_hint = params.bend_hint self.primary_rotation_axis = params.primary_rotation_axis
def __init__(self, obj, bone, params): """ Gather and validate data about the rig. Store any data or references to data that will be needed later on. In particular, store references to bones that will be needed, and store names of bones that will be needed. Do NOT change any data in the scene. This is a gathering phase only. """ self.obj = obj self.params = params # Get the chain of 2 connected bones leg_bones = [bone] + connected_children_names(self.obj, bone)[:2] if len(leg_bones) != 2: raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type" % (strip_org(bone))) # Get the foot and heel foot = None heel = None for b in self.obj.data.bones[leg_bones[1]].children: if b.use_connect is True: if len(b.children) >= 1 and has_connected_children(b): foot = b.name else: heel = b.name if foot is None or heel is None: raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type" % (strip_org(bone))) # Get the toe toe = None for b in self.obj.data.bones[foot].children: if b.use_connect is True: toe = b.name # Get the toe if toe is None: raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type" % (strip_org(bone))) self.org_bones = leg_bones + [foot, toe, heel] # Get (optional) parent if self.obj.data.bones[bone].parent is None: self.org_parent = None else: self.org_parent = self.obj.data.bones[bone].parent.name # Get rig parameters if "layers" in params: self.layers = get_layers(params["layers"]) else: self.layers = None self.primary_rotation_axis = params.primary_rotation_axis
def __init__(self, obj, bone_name, params): """ Gather and validate data about the rig. """ self.obj = obj self.org_bones = [bone_name] + connected_children_names(obj, bone_name) self.params = params self.make_controls = params.make_controls self.make_deforms = params.make_deforms if len(self.org_bones) <= 1: raise MetarigError("RIGIFY ERROR: Bone '%s': input to rig type must be a chain of 2 or more bones" % (strip_org(bone_name)))
def __init__(self, obj, bone, params): """ Gather and validate data about the rig. Store any data or references to data that will be needed later on. In particular, store references to bones that will be needed, and store names of bones that will be needed. Do NOT change any data in the scene. This is a gathering phase only. """ self.obj = obj self.params = params # Get the chain of 2 connected bones leg_bones = [bone] + connected_children_names(self.obj, bone)[:2] if len(leg_bones) != 2: raise MetarigError( "RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type" % (strip_org(bone))) # Get the foot and heel foot = None heel = None for b in self.obj.data.bones[leg_bones[1]].children: if b.use_connect == True: if len(b.children) >= 1 and has_connected_children(b): foot = b.name else: heel = b.name if foot is None or heel is None: raise MetarigError( "RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type" % (strip_org(bone))) # Get the toe toe = None for b in self.obj.data.bones[foot].children: if b.use_connect == True: toe = b.name if toe is None: raise MetarigError( "RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type" % (strip_org(bone))) self.org_bones = leg_bones + [foot, toe, heel] # Get rig parameters self.use_thigh_twist = params.use_thigh_twist self.use_shin_twist = params.use_shin_twist
def __init__(self, obj, bone_name, params): """ Gather and validate data about the rig. """ self.obj = obj self.org_bones = [bone_name] + connected_children_names(obj, bone_name) self.params = params if len(self.org_bones) <= 1: raise MetarigError("RIGIFY ERROR: Bone '%s': input to rig type must be a chain of 2 or more bones." % (strip_org(bone_name))) self.isolate = False if self.obj.data.bones[bone_name].parent: self.isolate = True
def __init__(self, obj, bone_name, params): """ Gather and validate data about the rig. """ self.obj = obj self.org_bones = [bone_name] + connected_children_names(obj, bone_name) self.params = params if len(self.org_bones) <= 1: raise MetarigError("RIGIFY ERROR: Bone '%s': input to rig type must be a chain of 2 or more bones" % (strip_org(bone_name))) self.isolate = False if self.obj.data.bones[bone_name].parent: self.isolate = True
def __init__(self, obj, bone_name, params): """ Chain with pivot Rig """ eb = obj.data.edit_bones self.obj = obj self.org_bones = [bone_name] + connected_children_names(obj, bone_name) self.params = params self.spine_length = sum([eb[b].length for b in self.org_bones]) self.bbones = params.bbones self.SINGLE_BONE = (len(self.org_bones) == 1) # Assign values to tweak layers props if opted by user if params.tweak_extra_layers: self.tweak_layers = list(params.tweak_layers) else: self.tweak_layers = None
def __init__(self, obj, bone_name, params): self.obj = obj self.params = params eb = self.obj.data.edit_bones self.org_bones = [bone_name] + connected_children_names( self.obj, bone_name) if eb[bone_name].parent is not None: self.org_parent = eb[bone_name].parent.name else: self.org_parent = None if eb[bone_name].use_connect: raise MetarigError( "RIGIFY ERROR: Bone %s should not be connected. " "Check bone chain for multiple pantin.simple rigs" % (strip_org(self.org_parent))) if self.params.chain_type == 'Dynamic' and len(self.org_bones) > 1: self.params.chain_type = "Curve"
def __init__(self, obj, bone, params): """ Gather and validate data about the rig. """ self.obj = obj self.org_bones = [bone] + connected_children_names(obj, bone) self.params = params if len(self.org_bones) <= 1: raise MetarigError("RIGIFY ERROR: Bone '%s': input to rig type must be a chain of 2 or more bones" % (strip_org(bone))) # Get user-specified layers, if they exist if params.separate_extra_layers: self.ex_layers = list(params.extra_layers) else: self.ex_layers = None # Get other rig parameters self.primary_rotation_axis = params.primary_rotation_axis self.use_digit_twist = params.use_digit_twist
def __init__(self, obj, bone, params): """ Gather and validate data about the rig. Store any data or references to data that will be needed later on. In particular, store references to bones that will be needed, and store names of bones that will be needed. Do NOT change any data in the scene. This is a gathering phase only. """ self.obj = obj self.params = params # Get the chain of 3 connected bones self.org_bones = [bone] + connected_children_names(self.obj, bone)[:2] if len(self.org_bones) != 3: raise MetarigError("RIGIFY ERROR: Bone '%s': input to rig type must be a chain of 3 bones." % (strip_org(bone))) # Get rig parameters self.use_upper_arm_twist = params.use_upper_arm_twist self.use_forearm_twist = params.use_forearm_twist
def __init__(self, obj, bone, params): """ Gather and validate data about the rig. Store any data or references to data that will be needed later on. In particular, store references to bones that will be needed, and store names of bones that will be needed. Do NOT change any data in the scene. This is a gathering phase only. """ self.obj = obj self.params = params # Get the chain of 3 connected bones self.org_bones = [bone] + connected_children_names(self.obj, bone)[:2] if len(self.org_bones) != 3: raise MetarigError( "RIGIFY ERROR: Bone '%s': input to rig type must be a chain of 3 bones" % (strip_org(bone))) # Get rig parameters self.use_upper_arm_twist = params.use_upper_arm_twist self.use_forearm_twist = params.use_forearm_twist
def __init__(self, obj, bone_name, params): self.obj = obj self.org_bones = [bone_name] + connected_children_names(obj, bone_name) self.params = params