def __init__(self, *args, **kwargs): kwargs['model'] = kwargs.pop('model', QuadSpineModel()) super(RigQuadSpine, self).__init__(*args, **kwargs) self._model.ik_spine = rigIKQuadSpine.RigIKQuadSpine( rig_system=self.rig_system) self._model.chest = rigSingleJoint.RigSingleJoint( rig_system=self.rig_system) self._model.back = rigSingleJoint.RigSingleJoint( rig_system=self.rig_system) self._model.center = rigSingleJoint.RigSingleJoint( rig_system=self.rig_system) self.tip = None self.root = None
def create_point_base(self, *arm_points, **kwargs): super(Leg, self).create_point_base(*arm_points, **kwargs) self.ik_rig = rigIK.IKRig(rig_system=self.rig_system) self.ik_rig.create_point_base(*arm_points[:-1], control_orientation='world', last_joint_follows_control=False) self.fk_rig = rigFK.RigFK(rig_system=self.rig_system) self.fk_rig.create_point_base(*arm_points, orient_type='point_orient') self.palm = rigSingleJoint.RigSingleJoint(rig_system=self.rig_system) self.palm.create_point_base(arm_points[-1], name='palm', type='box') self.ik_fk_switch = constraintSwitch.ConstraintSwitch( rig_system=self.rig_system) self.ik_fk_switch.build(self.ik_rig.joints, self.fk_rig.joints, control=self.palm.controls[0], attribute_name='IkFkSwitch') for each_control in self.ik_rig.controls: self.ik_fk_switch.attribute_output_a >> each_control.visibility for each_control in self.fk_rig.controls: self.ik_fk_switch.attribute_output_b >> each_control.visibility # pm.parentConstraint(self.fk_limb.controls[0], self.ik_limb.reset_controls['poleVector'], mo=True) # pm.parentConstraint(self.fk_limb.controls[0], self.ik_limb.reset_controls['ikHandleSecondary'], mo=True) pm.parentConstraint(self.fk_rig.controls[0], self.ik_rig.root_joints, mo=True)
def create_point_base(self, *points, **kwargs): """ :param points: :param kwargs: depth: the number of controls that will be nested inside each reference point default 2 size: size of the controls default 1 step size: a multiplier for each one of the nested controls, default will be size /10 align: the alignment of the controls 'point' each control will be aligned to each one of the points 'world' each control will align to the world :return: """ depth = kwargs.pop('depth', 2) size = kwargs.pop('size', 1.0) size_step = kwargs.pop('size_step', -size / 10.0) align = kwargs.pop('align', 'point') offset_visibility = kwargs.pop('offset_visibility', False) single_joint = rigSingleJoint.RigSingleJoint( rig_system=self.rig_system) self.single_joints.append(single_joint) for each_point in points: for index in range(depth): single_joint.create_point_base(each_point, size=size + size_step * index, **kwargs) if index >= 1: single_joint.reset_controls[-1].setParent( single_joint.controls[-2]) if offset_visibility: single_joint.controls[ 0].offset_visibility >> single_joint.reset_controls[ -1].visibility else: if offset_visibility: single_joint.controls[0].addAttr('offset_visibility', at='bool', k=True) if align == 'world': self.custom_world_align(single_joint.reset_controls[-1]) self.joints.extend(single_joint.joints) self.controls.extend(single_joint.controls) self.reset_controls.extend(single_joint.reset_controls) self.reset_joints.extend(single_joint.reset_joints)
def create_point_base(self, *args, **kwargs): super(IKQuadLeg, self).create_point_base(*args, **kwargs) self._model.rig_ik_leg = rigStretchyIK.StretchyIK(rig_system=self.rig_system) self.rig_ik_leg.create_point_base(*args[:-1], create_pole_vector=False, create_controls=False, make_stretchy=False) self.rig_ik_leg.create_pole_vector() self.rig_ik_leg.create_control_pole_vector() self.rig_ik_leg.make_stretchy() reset_controls, ik_control = self.create.controls.point_base(args[-1], name='ikControl', centered=True) self.controls_dict['ikHandle'] = ik_control self.reset_controls_dict['ikHandle'] = reset_controls self.controls_dict['poleVector'] = self.rig_ik_leg.controls_dict['poleVector'] self.reset_controls_dict['poleVector'] = self.rig_ik_leg.reset_controls_dict['poleVector'] pm.parent(reset_controls, self.rig_system.controls) self.custom_world_align(reset_controls) self.controls.append(ik_control) self.rig_ik_leg.expose_attributes_on_control(ik_control) self._model.rig_leg_palm = rigSingleJoint.RigSingleJoint(rig_system=self.rig_system) self.rig_leg_palm.create_point_base(ik_control) self.create.constraint.point(ik_control, self.rig_leg_palm.root) ankle_reset_joint, ankle_joint = self.rig_leg_palm.create.joint.point_base(args[-2], name='ankle', orient_type='point_orient') palm_reset_joint, palm_joint = self.rig_leg_palm.create.joint.point_base(args[-1], name='palm') self.rm.aim_point_based(ankle_joint[0], ankle_joint[0], palm_joint[0], self.rig_ik_leg.pole_vector) self.create.constraint.orient(ankle_joint[0], self.rig_ik_leg.joints[-1]) palm_joint[0].setParent(self.rig_ik_leg.joints[-1]) self.rig_ik_leg.joints.append(palm_joint[0]) ankle_joint[0].setParent(self.rig_leg_palm.joints[-1]) self.rig_leg_palm.joints.append(ankle_joint[0]) pm.delete(ankle_reset_joint, palm_reset_joint) self.create.constraint.node_base(self.rig_leg_palm.tip, self.rig_ik_leg.ik_handle, mo=True) offset_group = self.create.group.point_base(self.rig_leg_palm.controls[0]) pm.addAttr(ik_control, ln='rotationFront', at='float', k=True) pm.addAttr(ik_control, ln='rotationSide', at='float', k=True) ik_control.rotationFront >> offset_group.rotateZ ik_control.rotationSide >> offset_group.rotateX self.joints.extend(self.rig_ik_leg.joints) self.reset_joints.extend(self.rig_ik_leg.reset_joints) self._model.root_controls = pm.group(empty=True, name='ikControls') self.rm.align(self.joints[0], self.root_controls) self.create.constraint.node_base(self.root_controls, self.reset_joints[0]) for each_control in self.reset_controls_dict: self.reset_controls_dict[each_control].setParent(self.root_controls) self.root_controls.setParent(self.rig_system.controls) self.attach_points['root'] = self.root_controls
def __init__(self, *args, **kwargs): kwargs['model'] = kwargs.pop('model', QuadFrontLegModel()) super(RigQuadFrontLeg, self).__init__(*args, **kwargs) self._model.shoulder = rigSingleJoint.RigSingleJoint() self._model.leg = rigIKQuadLegFeet.RigIKQuadLegFeet() self.root = None
def switch_control_rig(self): if self._model.switch_control_rig is None: self._model.switch_control_rig = rigSingleJoint.RigSingleJoint(rig_system=self.rig_system) return self._model.switch_control_rig
def __init__(self): super(HandModel, self).__init__() self.fingers = [] self.palm = rigSingleJoint.RigSingleJoint()