Exemplo n.º 1
0
def make_control(name=None,
                 obj=None,
                 buffers=None,
                 color=None,
                 scale=None,
                 typ=None,
                 reg_node=None):
    '''Given a pm.nt.Transform, create control at its
    location/orientation.

    Attributes:
        name -- Prefix name to be used for control
        obj -- Object control will be made for. [pm.nt.Transform, pm.nt.Joint]
        buffer -- Number of groups above the control. Int
        color -- Color for control. Str
        scale -- Scale for the control. Float
        typ -- Type of control curve. 'circle','pointed_circle','square','cube'
        reg_node -- reg_node to use
    '''
    general.check_type(name, 'name', [str])
    general.check_type(obj, 'obj', [pm.nt.Transform, pm.nt.Joint])
    general.check_type(buffers, 'buffers', [int])
    general.check_type(color, 'color', [str])
    general.check_type(scale, 'scale', [float])
    general.check_type(typ, 'typ', [str])
    if reg_node:
        general.check_type(reg_node, 'reg_node', [pm.nt.Transform])

    # Create curve
    reg_node, crv = control.create_curve(name=name,
                                         typ=typ,
                                         scale=scale,
                                         color=color,
                                         reg_node=reg_node)

    # Match curve to object
    control.match_object(crv, obj)

    # Setup heirarchy
    if obj.getParent():
        pm.parent(crv, obj.getParent())
    pm.parent(obj, crv)

    # Create heirarchy
    control.create_heirarchy(name=name, obj=crv, num=buffers)

    return reg_node, crv
Exemplo n.º 2
0
def make_control(name=None, obj=None, buffers=None, color=None,
                 scale=None, typ=None, reg_node=None):
    '''Given a pm.nt.Transform, create control at its
    location/orientation.

    Attributes:
        name -- Prefix name to be used for control
        obj -- Object control will be made for. [pm.nt.Transform, pm.nt.Joint]
        buffer -- Number of groups above the control. Int
        color -- Color for control. Str
        scale -- Scale for the control. Float
        typ -- Type of control curve. 'circle','pointed_circle','square','cube'
        reg_node -- reg_node to use
    '''
    general.check_type(name, 'name', [str])
    general.check_type(obj, 'obj', [pm.nt.Transform, pm.nt.Joint])
    general.check_type(buffers, 'buffers', [int])
    general.check_type(color, 'color', [str])
    general.check_type(scale, 'scale', [float])
    general.check_type(typ, 'typ', [str])
    if reg_node:
        general.check_type(reg_node, 'reg_node', [pm.nt.Transform])

    # Create curve
    reg_node, crv = control.create_curve(name=name,
                                         typ=typ,
                                         scale=scale,
                                         color=color,
                                         reg_node=reg_node)

    # Match curve to object
    control.match_object(crv, obj)

    # Setup heirarchy
    if obj.getParent():
        pm.parent(crv, obj.getParent())
    pm.parent(obj, crv)

    # Create heirarchy
    control.create_heirarchy(name=name, obj=crv, num=buffers)

    return reg_node, crv