Python maya.cmds.loadPlugin() Examples

The following are 18 code examples of maya.cmds.loadPlugin(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module maya.cmds , or try the search function .
Example #1
Source File: plotBendHV.py    From maya_rotationDriver with MIT License 6 votes vote down vote up
def doit(radius=5., num=36):
    cmds.loadPlugin('rotationDriver', qt=True)
    node = cmds.createNode('composeRotate')
    node_or = node + '.outRotate'
    node_h = node + '.bendH'
    node_v = node + '.bendV'

    shiftX = radius * 1.25

    top0 = _plotBendHV(node_or, node_h, node_v, 'plotStereoProj', radius, num)
    cmds.setAttr(top0 + '.tx', -shiftX)

    cmds.setAttr(node + '.method', 1)
    top1 = _plotBendHV(node_or, node_h, node_v, 'plotExpmap', radius, num)
    cmds.setAttr(top1 + '.tx', shiftX)

    cmds.delete(node)

    cmds.select([top0, top1]) 
Example #2
Source File: createGreenCageDeformer.py    From maya_greenCageDeformer with MIT License 6 votes vote down vote up
def doit(cage_tgt=None):
    if not cage_tgt:
        cage_tgt = cmds.ls(sl=True, o=True)
    cage = cage_tgt[0]
    tgt = cage_tgt[1:]

    cmds.loadPlugin('greenCageDeformer.py', qt=True)
    deformer = cmds.deformer(tgt, type='greenCageDeformer')[0]

    freezer = cmds.createNode('transformGeometry')
    cmds.connectAttr(cage + '.o', freezer + '.ig')
    cmds.connectAttr(cage + '.wm', freezer + '.txf')
    cmds.connectAttr(freezer + '.og', deformer + '.bc')
    cmds.disconnectAttr(freezer + '.og', deformer + '.bc')
    cmds.delete(freezer)

    cmds.connectAttr(cage + '.w', deformer + '.ic')
    cmds.dgeval(cmds.listConnections(deformer + '.og', s=False, d=True, sh=True, p=True))


#doit([cmds.polyCube(w=2.5, d=2.5, h=2.5)[0], cmds.polySphere()[0]]) 
Example #3
Source File: manager.py    From spore with MIT License 6 votes vote down vote up
def close_event(self):
        self.remove_callbacks()



#  if __name__ == 'manager':
#
#      #  spore_root = os.path.dirname(__file__)
#      #  os.environ['SPORE_ROOT_DIR'] = spore_root
#
#      #  if not spore_root in sys.path:
#      #      sys.path.append(spore_root)
#      #
#      #
#      #  if not cmds.pluginInfo('spore_plugin', q=True, l=True):
#      #      cmds.loadPlugin(os.path.join(spore_root, 'plugins', 'spore_plugin.py'))
#      #
#      #  global manager
#      if not manager:
#          manager = SporeManager()
#
#      manager.show() 
Example #4
Source File: setup.py    From DeformationLearningSolver with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def loadSSDSolverPlugin():
    """"""    
    os = cmds.about(os=1)

    if os == 'win64':
        pluginName = '%s.mll' % (SSD_SOLVER_PLUGIN_BASE_NAME)
    elif os == 'mac':
        pluginName = '%s.bundle' % (SSD_SOLVER_PLUGIN_BASE_NAME)
    elif os == 'linux64':
        pluginName = '%s.so' % (SSD_SOLVER_PLUGIN_BASE_NAME)

    if not cmds.pluginInfo(pluginName, q=True, l=True ):
        try:
            cmds.loadPlugin(pluginName)
            pluginVers = cmds.pluginInfo(pluginName, q=1, v=1)
            log.info('Plug-in: %s v%s loaded success!' % (pluginName, pluginVers))
        except: 
            log.info('Plug-in: %s, was not found on MAYA_PLUG_IN_PATH.' % (pluginName))
    else:
        pluginVers = cmds.pluginInfo(pluginName, q=1, v=1)
        log.info('Plug-in: %s v%s has been loaded!' % (pluginName, pluginVers))

#---------------------------------------------------------------------- 
Example #5
Source File: setup.py    From DeformationLearningSolver with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def loadDeltaMushPlugin():
    """"""   
    os = cmds.about(os=1)

    if os == 'win64':
        pluginName = '%s.mll' % (DELTA_MUSH_PLUGIN_BASE_NAME)
    elif os == 'mac':
        pluginName = '%s.bundle' % (DELTA_MUSH_PLUGIN_BASE_NAME)
    elif os == 'linux64':
        pluginName = '%s.so' % (DELTA_MUSH_PLUGIN_BASE_NAME)

    if not cmds.pluginInfo(pluginName, q=True, l=True ):
        try:
            cmds.loadPlugin(pluginName)
            pluginVers = cmds.pluginInfo(pluginName, q=1, v=1)
            log.info('Plug-in: %s v%s loaded success!' % (pluginName, pluginVers))
        except:
            log.info('Plug-in: %s, was not found on MAYA_PLUG_IN_PATH.' % (pluginName))
    else:
        pluginVers = cmds.pluginInfo(pluginName, q=1, v=1)
        log.info('Plug-in: %s v%s has been loaded!' % (pluginName, pluginVers))

#---------------------------------------------------------------------- 
Example #6
Source File: setup.py    From DeformationLearningSolver with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def launch():
    '''
    Main entry point
    '''
    log.info('Deformation Learning v%s : Author: %s' % (getVersion(), getAuthor()))
    log.info('Deformation Learning Setup Calls :: Booting from >> %s' % getModulePath())  

    # Add module to environment
    os.environ[__ENVIRONMENT_NAME__] = getModulePath()    
    # addScriptsPath(os.environ[__ENVIRONMENT_NAME__])

    # Load Plug-in
    loadPlugin()    

    # launch UI
    show()

    log.info('Deformation Learning initialize Complete!') 
Example #7
Source File: decorator.py    From maya-skinning-tools with GNU General Public License v3.0 6 votes vote down vote up
def loadPlugin(plugin):
    """
    This decorator can be used on functions that require a certain plugin to
    be loaded.

    :param str plugin:
    """
    def wrapper(func):
        @wraps(func)
        def inner(*args, **kwargs):
            loaded = cmds.pluginInfo(plugin, q=True, loaded=True)
            registered = cmds.pluginInfo(plugin, q=True, registered=True)

            if not registered or not loaded:
                cmds.loadPlugin(plugin)

            return func(*args, **kwargs)
        return inner
    return wrapper 
Example #8
Source File: dpUtils.py    From dpAutoRigSystem with GNU General Public License v2.0 6 votes vote down vote up
def checkLoadedPlugin(pluginName, exceptName=None, message="Not loaded plugin", *args):
    """ Check if plugin is loaded and try to load it.
        Returns True if ok (loaded)
        Returns False if not found or not loaded.
    """
    loadedPlugin = True
    if not (cmds.pluginInfo(pluginName, query=True, loaded=True)):
        loadedPlugin = False
        try:
            # Maya 2012
            cmds.loadPlugin(pluginName+".mll")
            loadedPlugin = True
        except:
            if exceptName:
                try:
                    # Maya 2013 or earlier
                    cmds.loadPlugin(exceptName+".mll")
                    loadedPlugin = True
                except:
                    pass
    if not loadedPlugin:
        print message, pluginName
    return loadedPlugin 
Example #9
Source File: MyWindow.py    From MayaDev with MIT License 5 votes vote down vote up
def btnCallCppPlugin_clicked(self):
        print('btnCallCppPlugin_clicked')
        try:
            cmds.loadPlugin('HelloMaya')
            cmds.myCmd1()
            cmds.hello()
        except Exception as ex:
            cmds.error(ex.message) 
Example #10
Source File: mayaunittest.py    From cmt with MIT License 5 votes vote down vote up
def load_plugin(cls, plugin):
        """Load the given plug-in and saves it to be unloaded when the TestCase is finished.

        @param plugin: Plug-in name.
        """
        cmds.loadPlugin(plugin, qt=True)
        cls.plugins_loaded.add(plugin) 
Example #11
Source File: rbf.py    From cmt with MIT License 5 votes vote down vote up
def create(
        cls,
        name=None,
        inputs=None,
        outputs=None,
        input_transforms=None,
        output_transforms=None,
        add_neutral_sample=True,
    ):
        cmds.loadPlugin("cmt", qt=True)
        name = name or "rbf#"
        node = cmds.createNode("rbf", name=name)
        node = RBF(node)
        if add_neutral_sample:
            # Store the current output values because they may be different once
            # connected
            output_values = [cmds.getAttr(x) for x in outputs] if outputs else None
            output_rotations = (
                [cmds.getAttr("{}.r".format(x))[0] for x in output_transforms]
                if output_transforms
                else None
            )

        node.set_inputs(inputs)
        node.set_outputs(outputs)
        node.set_input_transforms(input_transforms)
        node.set_output_transforms(output_transforms)

        if add_neutral_sample:
            for i in range(3):
                node.add_sample(
                    output_values=output_values,
                    output_rotations=output_rotations,
                    rotation_type=i,
                )

        return node 
Example #12
Source File: dge.py    From cmt with MIT License 5 votes vote down vote up
def _euler_to_quat(self, x, attr):
        cmds.loadPlugin("quatNodes", qt=False)
        mdl = cmds.createNode("multDoubleLinear")
        cmds.setAttr("{}.input1".format(mdl), 2 * 57.2958)  # To degrees
        if isinstance(x, string_types):
            cmds.connectAttr(x, "{}.input2".format(mdl))
        else:
            cmds.setAttr("{}.input2".format(mdl), x)
        quat = cmds.createNode("eulerToQuat")
        cmds.connectAttr("{}.output".format(mdl), "{}.inputRotateX".format(quat))
        return "{}.outputQuat.outputQuat{}".format(quat, attr) 
Example #13
Source File: cmdx.py    From cmdx with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def install():
    """Load this shared as a plug-in

    Call this prior to using the shared

    """

    if ENABLE_UNDO:
        cmds.loadPlugin(__file__, quiet=True)

    self.installed = True 
Example #14
Source File: utils.py    From rush with MIT License 5 votes vote down vote up
def reloadRush():
    try:
        cmds.unloadPlugin("Rush.py")
        cmds.loadPlugin("Rush.py")
    except Exception:
        print("Failed to reload plugin") 
Example #15
Source File: MyWindow.py    From MayaDev with MIT License 5 votes vote down vote up
def btnCallCSPlugin_clicked(self):
        print('btnCallCSPlugin_clicked')
        try:
            cmds.loadPlugin('HiMaya2017')
            cmds.csHi()
        except Exception as ex:
            cmds.error(ex.message) 
Example #16
Source File: setup.py    From DeformationLearningSolver with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def loadPlugin():
    """"""
    loadSSDSolverPlugin()
    loadDeltaMushPlugin()

#---------------------------------------------------------------------- 
Example #17
Source File: test_util.py    From spore with MIT License 5 votes vote down vote up
def load_plugin(cls, plugin):
        if cmds.pluginInfo(plugin, q=True, l=True):
            cmds.unloadPlugin(plugin)
        cmds.loadPlugin(plugin, qt=True)
        cls.plugins.add(plugin) 
Example #18
Source File: create.py    From maya-spline-ik with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        Settings.__init__(self)
        
        # variables
        self._name = None
        self._curve = None
        
        # control variables
        self._controls = []
        self._rootControl = None
        self._tangentControls = None
        
        # slide control variables
        self._slideControl = None
        self._slideMinControl = None
        self._slideMaxControl = None
        
        # joints variables
        self._joints = []
        self._rootJoint = None
        
        # load matrix nodes plugin
        if not cmds.pluginInfo(MATRIX_PLUGIN, query=True, loaded=True):
            cmds.loadPlugin(MATRIX_PLUGIN)
        
    # ------------------------------------------------------------------------