Exemplo n.º 1
0
    def create_hook(cls, asset="asset", side="c",  part="part",
                    snap_to=None, in_out='in'):
        """
        Settings for generating hooks in the autorig.

        :parameters:
            asset: For naming convention.
            side: For naming convention. (l, r, c)
            part: For naming convention.
            snap_to: Object to snap to.
            in_out: default value.
        """
        hook_name = NameUtils.get_unique_name(asset, side, part, "loc")
        hook = pm.createNode(settings.HOOK_NODE_TYPE, n=hook_name)

        if settings.HOOK_NODE_TYPE == "locator":
            hook = hook.getParent()
            hook.rename(hook_name)

        digit_type = 0
        if in_out == 'out':
            digit_type = 1

        hook.addAttr('hookType', at='float', dv=digit_type)
        hook.attr('hookType').lock(1)
        if snap_to:
            pm.xform(hook, ws=1, matrix=snap_to.wm.get())
        return hook
Exemplo n.º 2
0
def zero(obj, security=50):
    """
    This will group and zero out the transforms of an object.
    """
    parent = obj.getParent()
    name = obj.name()
    temp = name.split("_")

    # group name
    grp_name = NameUtils.get_unique_name(temp[0].split('0')[0],
                                          temp[1],
                                          temp[2].split('0')[0],
                                          "grp",
                                          security)
    if not grp_name:
        OpenMaya.MGlobal.displayError('ERROR generating name')
        return

    grp = pm.createNode("transform", n=grp_name)
    matrix = obj.wm.get()
    grp.setMatrix(matrix)

    # rebuild
    obj.setParent(grp)
    if parent:
        grp.setParent(par)
    return grp
Exemplo n.º 3
0
    def create_hook(self,
                    asset="asset",
                    side="c",
                    part="part",
                    snap_to=None,
                    in_out='in',
                    *args):
        """
        Settings for generating hooks in the autorig.

        :parameters:
            asset: For naming convention.
            side: For naming convention. (l, r, c)
            part: For naming convention.
            snap_to: Object to snap to.
            in_out: default value.

        :args:
            Please satisfy all arguements, args = security.
        """
        hook_name = NameUtils.get_unique_name(asset, side, part, "loc", args)
        hook = pm.createNode(settings.HOOK_NODE_TYPE, n=hook_name)

        if settings.HOOK_NODE_TYPE == "locator":
            hook = hook.getParent()
            hook.rename(hook_name)

        digit_type = 0
        if in_out == 'out':
            digit_type = 1

        hook.addAttr('hookType', at='float', dv=digit_type)
        hook.attr('hookType').lock(1)
        if snap_to:
            pm.xform(hook, ws=1, matrix=snap_to.wm.get())
        return hook