Exemplo n.º 1
0
    def __createNode__(self,
                       size=None,
                       normal=(1, 0, 0),
                       multiplier=1.0,
                       refs=None,
                       offset=None,
                       geometries=None,
                       *args,
                       **kwargs):
        """
        Create a simple circle nurbsCurve.
        size: The maximum dimension of the controller.
        """
        # Hack: Ensure geometries are hashable
        if isinstance(geometries, list):
            geometries = tuple(geometries)

        # Resolve size automatically if refs are provided.
        ref = next(iter(refs), None) if isinstance(
            refs, collections.Iterable) else refs
        if size is None:
            if ref is not None:
                size = libRigging.get_recommended_ctrl_size(
                    ref, geometries=geometries) * multiplier
            else:
                size = 1.0

        transform, make = pymel.circle()
        make.radius.set(size)
        make.normal.set(normal)

        # Expose the rotateOrder
        # transform.rotateOrder.setKeyable(True)

        return transform
Exemplo n.º 2
0
    def __createNode__(self, size=None, normal=(1,0,0), multiplier=1.0, refs=None, offset=None, geometries=None, *args, **kwargs):
        """
        Create a simple circle nurbsCurve.
        size: The maximum dimension of the controller.
        """
        # Hack: Ensure geometries are hashable
        if isinstance(geometries, list):
            geometries = tuple(geometries)

        # Resolve size automatically if refs are provided.
        ref = next(iter(refs), None) if isinstance(refs, collections.Iterable) else refs
        if size is None:
            if ref is not None:
                size = libRigging.get_recommended_ctrl_size(ref, geometries=geometries) * multiplier
            else:
                size = 1.0

        transform, make = pymel.circle()
        make.radius.set(size)
        make.normal.set(normal)

        # Expose the rotateOrder
        # transform.rotateOrder.setKeyable(True)

        return transform
Exemplo n.º 3
0
    def __createNode__(self, refs=None, size=None, line_target=True, offset=None, *args, **kwargs):
        """
        Create the swivel ctrl itself when build node function is called
        :param refs: Reference used to correctly size the ctrl
        :param size: Size of the ctrl
        :param line_target: Bool to tell if we want a line target or not
        :param offset: Offset applied on the ctrl
        :param args: More args passed to the superclass
        :param kwargs: More kwargs passed to the super class
        :return: The created swivel node ctrl
        """
        # Resolve size automatically if refs are provided
        ref = next(iter(refs), None) if isinstance(refs, collections.Iterable) else refs
        if size is None and ref is not None:
            size = libRigging.get_recommended_ctrl_size(ref)
        else:
            size = 1.0

        node = super(CtrlIkSwivel, self).__createNode__(*args, **kwargs)
        make = node.getShape().create.inputs()[0]
        make.radius.set(size * 2)
        make.degree.set(1)
        make.sections.set(4)

        make.radius.set(make.radius.get() * 0.5)
        make.degree.set(1)
        make.sections.set(4)

        return node
Exemplo n.º 4
0
    def __createNode__(self, size=None, refs=None, *args, **kwargs):
        # Resolve size automatically if refs are provided
        ref = next(iter(refs), None) if isinstance(refs, collections.Iterable) else refs
        if size is None and ref is not None:
            size = libRigging.get_recommended_ctrl_size(ref) * 1.25
        else:
            size = 1.0

        return libCtrlShapes.create_shape_cross(size=size, **kwargs)
Exemplo n.º 5
0
    def __createNode__(self, size=None, refs=None, *args, **kwargs):
        # Resolve size automatically if refs are provided
        ref = next(iter(refs), None) if isinstance(refs, collections.Iterable) else refs
        if size is None and ref is not None:
            size = libRigging.get_recommended_ctrl_size(ref) * 1.25
        else:
            size = 1.0

        return libCtrlShapes.create_shape_cross(size=size, **kwargs)
Exemplo n.º 6
0
    def __createNode__(self, size=None, multiplier=1.25, refs=None, **kwargs):
        ref = next(iter(refs), None) if isinstance(refs, collections.Iterable) else refs
        if size is None and ref is not None:
            size = libRigging.get_recommended_ctrl_size(ref) * multiplier
        else:
            size = 1.0

        node = libCtrlShapes.create_shape_box(size=size, **kwargs)
        return node
Exemplo n.º 7
0
    def __createNode__(self, size=None, refs=None, **kwargs):
        # Resolve size automatically if refs are provided.
        ref = next(iter(refs), None) if isinstance(refs, collections.Iterable) else refs
        if size is None and ref is not None:
            size = libRigging.get_recommended_ctrl_size(ref)
        else:
            size = 1.0

        node = libCtrlShapes.create_shape_attrholder(size=size, **kwargs)

        # Hide default keyable attributes
        node.t.set(channelBox=False)
        node.r.set(channelBox=False)
        node.s.set(channelBox=False)

        return node
Exemplo n.º 8
0
    def __createNode__(self, size=None, refs=None, **kwargs):
        # Resolve size automatically if refs are provided.
        ref = next(iter(refs), None) if isinstance(refs, collections.Iterable) else refs
        if size is None and ref is not None:
            size = libRigging.get_recommended_ctrl_size(ref)
        else:
            size = 1.0

        node = libCtrlShapes.create_shape_attrholder(size=size, **kwargs)

        # Hide default keyable attributes
        node.t.set(channelBox=False)
        node.r.set(channelBox=False)
        node.s.set(channelBox=False)

        return node
Exemplo n.º 9
0
    def __createNode__(self,
                       refs=None,
                       size=None,
                       line_target=True,
                       offset=None,
                       *args,
                       **kwargs):
        """
        Create the swivel ctrl itself when build node function is called
        :param refs: Reference used to correctly size the ctrl
        :param size: Size of the ctrl
        :param line_target: Bool to tell if we want a line target or not
        :param offset: Offset applied on the ctrl
        :param args: More args passed to the superclass
        :param kwargs: More kwargs passed to the super class
        :return: The created swivel node ctrl
        """
        # Resolve size automatically if refs are provided
        ref = next(iter(refs), None) if isinstance(
            refs, collections.Iterable) else refs
        if size is None and ref is not None:
            size = libRigging.get_recommended_ctrl_size(ref)
        else:
            size = 1.0

        node = super(CtrlIkSwivel, self).__createNode__(*args, **kwargs)
        make = node.getShape().create.inputs()[0]
        make.radius.set(size * 2)
        make.degree.set(1)
        make.sections.set(4)

        make.radius.set(make.radius.get() * 0.5)
        make.degree.set(1)
        make.sections.set(4)

        return node
Exemplo n.º 10
0
 def _get_recommended_size(self, refs, geometries, default_size=1.0, multiplier=1.0, **kwargs):
     ref = next(iter(refs), None) if isinstance(refs, collections.Iterable) else refs
     if ref is not None:
         return libRigging.get_recommended_ctrl_size(ref, geometries=geometries, **kwargs) * multiplier
     else:
         return default_size * multiplier