예제 #1
0
 def __add_component_actions(cls, root_menu, selected_control):
     if not selected_control.connected_component:
         return
     pm.menuItem(p=root_menu,
                 l=str(selected_control.connected_component),
                 en=0)
     # Space switching
     if selected_control.spaces:
         spaces_menu = pm.subMenuItem(p=root_menu, l="Spaces")
         for space_name in selected_control.spaces_dict.keys():
             pm.menuItem(p=spaces_menu,
                         l=space_name,
                         c=lambda triggered=True, name=space_name, *args:
                         selected_control.switch_space(
                             selected_control.spaces_dict.get(name)))
     # Actions callbacks
     if hasattr(selected_control.connected_component, "actions_dict"):
         for label, data_dict in selected_control.connected_component.actions_dict.items(
         ):
             pm.menuItem(
                 p=root_menu,
                 l=label,
                 c=lambda *args: data_dict.get("callback", cls.__null_cmd)
                 (),
                 i=fileFn.get_icon_path(data_dict.get("icon")))
예제 #2
0
 def __add_shape_actions(cls, root_menu, selection):
     selected_control = luna_rig.Control(selection[-1])
     pm.menuItem(
         p=root_menu,
         l="Load shape",
         rp="E",
         c=lambda *args: importexport.CtlShapeManager.load_shape_from_lib(),
         i=fileFn.get_icon_path("library.png"))
     pm.menuItem(p=root_menu,
                 l="Copy shape",
                 rp="N",
                 c=shape_manager.ShapeManager.copy_shape,
                 i=fileFn.get_icon_path("copyCurve.png"))
     pm.menuItem(
         p=root_menu,
         l="Paste shape",
         rp="NE",
         c=lambda *args: shape_manager.ShapeManager.paste_shape(selection),
         i=fileFn.get_icon_path("pasteCurve.png"))
     pm.menuItem(p=root_menu,
                 l="Copy color",
                 rp="S",
                 c=lambda *args: shape_manager.ShapeManager.copy_color(),
                 i=fileFn.get_icon_path("copyColor.png"))
     pm.menuItem(p=root_menu,
                 l="Paste color",
                 rp="SE",
                 c=lambda *args: shape_manager.ShapeManager.paste_color(),
                 i=fileFn.get_icon_path("pasteColor.png"))
     pm.menuItem(p=root_menu,
                 l="Mirror shape YZ",
                 rp="W",
                 c=lambda *args: selected_control.mirror_shape())
     pm.menuItem(
         p=root_menu,
         l="Flip shape YZ",
         rp="SW",
         c=lambda *args: curveFn.flip_shape(selected_control.transform))
     pm.menuItem(
         p=root_menu,
         l="Mirror shape to opposite control",
         rp="NW",
         c=lambda *args: selected_control.mirror_shape_to_opposite())
예제 #3
0
파일: help_cmds.py 프로젝트: S0nic014/luna
def show_about_dialog(*args):
    help_text = "luna\nVersion: {0}".format(__version__)
    icon_pixmap = QtGui.QPixmap(fileFn.get_icon_path("luna.png"))
    icon_pixmap = icon_pixmap.scaled(128, 128)
    about_dialog = QtWidgets.QMessageBox()
    about_dialog.setWindowIcon(QtGui.QIcon(icon_pixmap))
    about_dialog.setWindowTitle("Luna")
    about_dialog.setText(help_text)
    about_dialog.setIconPixmap(icon_pixmap)
    about_dialog.exec_()
예제 #4
0
 def __add_pose_actions(cls, root_menu, selection):
     selected_control = luna_rig.Control(selection[-1])
     pm.menuItem(p=root_menu,
                 l="Mirror pose (Behaviour)",
                 rp="SW",
                 c=lambda *args: [
                     luna_rig.Control(trs).mirror_pose(behavior=True,
                                                       direction="source")
                     for trs in selection
                     if luna_rig.Control.is_control(trs)
                 ])
     pm.menuItem(p=root_menu,
                 l="Mirror pose (No behaviour)",
                 rp="S",
                 c=lambda *args: [
                     luna_rig.Control(trs).mirror_pose(behavior=False,
                                                       direction="source")
                     for trs in selection
                     if luna_rig.Control.is_control(trs)
                 ])
     pm.menuItem(p=root_menu,
                 l="Asset bind pose",
                 rp="N",
                 c=lambda *args: selected_control.character.to_bind_pose(),
                 i=fileFn.get_icon_path("bindpose.png"))
     pm.menuItem(p=root_menu,
                 l="Component bind pose",
                 rp="NE",
                 c=lambda *args: selected_control.connected_component.
                 to_bind_pose(),
                 i=fileFn.get_icon_path("bodyPart.png"))
     pm.menuItem(p=root_menu,
                 l="Control bind pose",
                 rp="E",
                 c=lambda *args: [
                     luna_rig.Control(trs).to_bind_pose()
                     for trs in selection
                     if luna_rig.Control.is_control(trs)
                 ],
                 i=fileFn.get_icon_path("control.png"))
예제 #5
0
파일: menu.py 프로젝트: S0nic014/luna
    def addSubMenu(parent,
                   label,
                   tear_off=False,
                   icon=None,
                   use_maya_icons=False):
        '''Adds a sub menu item with the specified label and icon to the specified parent popup menu.'''
        if icon and not use_maya_icons:
            icon = fileFn.get_icon_path(icon)

        return pm.menuItem(p=parent,
                           l=label,
                           i=icon,
                           subMenu=True,
                           to=tear_off)
예제 #6
0
    def __add_rigger_control_actions(cls, root_menu, selection):
        selected_control = luna_rig.Control(selection[-1])

        pm.menuItem(p=root_menu,
                    l="Select CVs",
                    rp="W",
                    c=lambda *args: curveFn.select_cvs(),
                    i=fileFn.get_icon_path("cvs.png"))
        # Adjust shape sub menu
        adjust_shape_menu = pm.subMenuItem(p=root_menu, l="Shape", rp="N")
        cls.__add_shape_actions(adjust_shape_menu, selection)
        pose_menu = pm.subMenuItem(p=root_menu, l="Pose", rp="E")
        cls.__add_pose_actions(pose_menu, selection)
        # Component menu
        cls.__add_component_actions(root_menu, selected_control)
예제 #7
0
 def __add_joint_actions(cls, root_menu, selection):
     pm.menuItem(p=root_menu,
                 l="Joint chain from selection",
                 rp="E",
                 c=lambda *args: jointFn.create_chain(
                     joint_list=pm.selected(type="joint")),
                 i="kinJoint.png")
     pm.menuItem(p=root_menu,
                 l="Mirror joints",
                 rp="W",
                 c=lambda *args: jointFn.mirror_chain(chains=selection),
                 i=fileFn.get_icon_path("mirrorJoint.png"))
     # Transform menu
     transform_menu = pm.subMenuItem(p=root_menu, l="Transform", rp="N")
     cls.__add_transform_actions(transform_menu, selection)
예제 #8
0
파일: menu.py 프로젝트: S0nic014/luna
    def addMenuItem(parent=None,
                    label="",
                    command=_null_command,
                    icon="",
                    divider=False,
                    option_box=False,
                    check_box=False,
                    use_maya_icons=False,
                    var_name=None,
                    default_value=False):

        if icon and not use_maya_icons:
            icon = fileFn.get_icon_path(icon)

        if divider:
            return pm.menuItem(p=parent, dl=label, i=icon, d=divider)

        elif option_box:
            return pm.menuItem(p=parent,
                               l=label,
                               i=icon,
                               ob=option_box,
                               c=command)

        elif check_box:
            if not var_name:
                Logger.error(
                    "Menuitem: {0}::{1} is not connected to config!".format(
                        parent, label))
                return

            checkBox_value = Config.get(var_name, default_value)
            checkBox = pm.menuItem(p=parent,
                                   l=label,
                                   i=icon,
                                   cb=checkBox_value,
                                   c=partial(Config.set, var_name))
            return checkBox

        else:
            return pm.menuItem(p=parent, l=label, i=icon, c=command)