Exemplo n.º 1
0
    def attach_to_plane(self, constraint_rot=True):
        """
        Create follicle attached to the place for each input joint
        :param constraint_rot: Are the joints will be constraint in rotation on the follicle
        :return: Nothing
        """
        nomenclature_rig = self.get_nomenclature_rig()
        fol_v = 0.5  # Always in the center

        #split_value = 1.0 / (len(self.chain_jnt) - 1)

        for i, jnt in enumerate(self.chain_jnt):
            #fol_u = split_value * i
            # TODO: Validate that we don't need to inverse the rotation separately.
            jnt_pos = jnt.getMatrix(worldSpace=True).translate
            pos, fol_u, fol_v = libRigging.get_closest_point_on_surface(self._ribbon_shape, jnt_pos)
            fol_name = nomenclature_rig.resolve("ribbonFollicle{0:02d}".format(i))
            fol_shape = libRigging.create_follicle2(self._ribbon_shape, u=fol_u, v=fol_v)
            fol = fol_shape.getParent()
            fol.rename(fol_name)
            if constraint_rot:
                pymel.parentConstraint(fol, jnt, mo=True)
            else:
                pymel.pointConstraint(fol, jnt, mo=True)

            self._follicles.append(fol)
Exemplo n.º 2
0
    def get_base_uv(self):
        pos = self.get_jnt_tm().translate

        fol_pos, fol_u, fol_v = libRigging.get_closest_point_on_surface(
            self.surface, pos)
        return fol_u, fol_v