當前位置: 首頁>>代碼示例>>Python>>正文


Python OpenMaya.MFnPlugin方法代碼示例

本文整理匯總了Python中maya.api.OpenMaya.MFnPlugin方法的典型用法代碼示例。如果您正苦於以下問題:Python OpenMaya.MFnPlugin方法的具體用法?Python OpenMaya.MFnPlugin怎麽用?Python OpenMaya.MFnPlugin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在maya.api.OpenMaya的用法示例。


在下文中一共展示了OpenMaya.MFnPlugin方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: uninitializePlugin

# 需要導入模塊: from maya.api import OpenMaya [as 別名]
# 或者: from maya.api.OpenMaya import MFnPlugin [as 別名]
def uninitializePlugin(plugin):
    om.MFnPlugin(plugin).deregisterCommand(command)


# --------------------------------------------------------
#
# Commonly Node Types
#
# Creating a new node using a pre-defined Type ID is 10% faster
# than doing it using a string, but keeping all (~800) around
# has a negative impact on maintainability and readability of
# the project, so a balance is struck where only the most
# performance sensitive types are included here.
#
# Developers: See cmdt.py for a list of all available types and their IDs
#
# -------------------------------------------------------- 
開發者ID:mottosso,項目名稱:cmdx,代碼行數:19,代碼來源:cmdx.py

示例2: initializePlugin

# 需要導入模塊: from maya.api import OpenMaya [as 別名]
# 或者: from maya.api.OpenMaya import MFnPlugin [as 別名]
def initializePlugin(plugin):
    # We convert our plugin to a type MfnPlugin so we can interact with it
    pluginFn = om.MFnPlugin(plugin)
    try:
        # Maya will then attempt to load and register the plugin to its internal memory
        pluginFn.registerCommand(
            # We give it the plugin name
            HelloWorldCmd.kPluginCmdName,
            # And give it the function to create it with
            cmdCreator,
            # Finally register the syntax creator
            syntaxCreator
        )
    except:
        # If it fails for whatever reason, we then error out and tell our user.
        om.MGlobal.displayError('Failed to register command: %s\n' % HelloWorldCmd.kPluginCmdName)
        # Then just let the exception be raised after we print the message above
        raise


# Finally we need to tell Maya how to unload the plug-in when requested.
# Some plugins can have a lot of actions required before unloading, but ours is again very simple 
開發者ID:dgovil,項目名稱:AdvancedPythonForMaya,代碼行數:24,代碼來源:helloWorldCmd.py

示例3: initializePlugin

# 需要導入模塊: from maya.api import OpenMaya [as 別名]
# 或者: from maya.api.OpenMaya import MFnPlugin [as 別名]
def initializePlugin(mobject):
    """Initialize the plug-in and add menu"""
    errMsg = u'Failed to register command: %s\n' % kPluginCmdName
    plugin = om.MFnPlugin(mobject, kPluginVendor, kPluginVersion)
    try:
        plugin.registerCommand(kPluginCmdName, MyDemo.creator)
        makeMenu(menuName=kPluginCmdName)
        # makeShelf(shelfName=kPluginCmdName)
    except:
        sys.stderr.write(errMsg)
        raise

# Uninitialize
# ---------------------------------------------------------------------- 
開發者ID:WendyAndAndy,項目名稱:MayaDev,代碼行數:16,代碼來源:pyMyPlugin.py

示例4: initializePlugin

# 需要導入模塊: from maya.api import OpenMaya [as 別名]
# 或者: from maya.api.OpenMaya import MFnPlugin [as 別名]
def initializePlugin(obj):
    plugin = om.MFnPlugin(obj, __VENDOR, __VERSION)
    try:
        plugin.registerCommand(HelloMaya.command, HelloMaya.creator)
    except:
        sys.stderr.write('register pyHello command failed')
        raise 
開發者ID:WendyAndAndy,項目名稱:MayaDev,代碼行數:9,代碼來源:pyHelloMaya.py

示例5: uninitializePlugin

# 需要導入模塊: from maya.api import OpenMaya [as 別名]
# 或者: from maya.api.OpenMaya import MFnPlugin [as 別名]
def uninitializePlugin(obj):
    plugin = om.MFnPlugin(obj, __VENDOR, __VERSION)
    try:
        plugin.deregisterCommand(HelloMaya.command)
    except:
        sys.stderr.write('deregister pyHello command failed')
        raise 
開發者ID:WendyAndAndy,項目名稱:MayaDev,代碼行數:9,代碼來源:pyHelloMaya.py

示例6: uninitializePlugin

# 需要導入模塊: from maya.api import OpenMaya [as 別名]
# 或者: from maya.api.OpenMaya import MFnPlugin [as 別名]
def uninitializePlugin(mobject):
    """Uninitialize the plug-in and delete menu"""
    plugin = om.MFnPlugin(mobject)
    try:
        plugin.deregisterCommand(kPluginCmdName)
        removeMenu(menuName=kPluginCmdName)
        # removeShelf(shelfName=kPluginCmdName)
    except:
        sys.stderr.write('Failed to unregister command: %s\n' % kPluginCmdName)
        raise 
開發者ID:WendyAndAndy,項目名稱:MayaDev,代碼行數:12,代碼來源:pyMyPlugin.py

示例7: initializePlugin

# 需要導入模塊: from maya.api import OpenMaya [as 別名]
# 或者: from maya.api.OpenMaya import MFnPlugin [as 別名]
def initializePlugin(mobject):
    """ Initialize the script plug-in

    Args:
        mobject (OpenMaya.MObject):

    """
    mplugin = OpenMaya.MFnPlugin(
        mobject, "Michitaka Inoue", PLUGIN_VERSION, "Any")
    try:
        mplugin.registerCommand(PLUGIN_COMMAND, Rush.cmdCreator, syntaxCreator)
    except Exception:
        sys.stderr.write("Failed to register command: %s\n" % PLUGIN_COMMAND)
        raise 
開發者ID:minoue,項目名稱:rush,代碼行數:16,代碼來源:Rush.py

示例8: uninitializePlugin

# 需要導入模塊: from maya.api import OpenMaya [as 別名]
# 或者: from maya.api.OpenMaya import MFnPlugin [as 別名]
def uninitializePlugin(mobject):
    """ Uninitialize the script plug-in

    Args:
        mobject (OpenMaya.MObject):

    """
    mplugin = OpenMaya.MFnPlugin(mobject)
    try:
        mplugin.deregisterCommand(PLUGIN_COMMAND)
    except Exception:
        sys.stderr.write("Failed to unregister command: %s\n" % PLUGIN_COMMAND)
        raise 
開發者ID:minoue,項目名稱:rush,代碼行數:15,代碼來源:Rush.py

示例9: initializePlugin

# 需要導入模塊: from maya.api import OpenMaya [as 別名]
# 或者: from maya.api.OpenMaya import MFnPlugin [as 別名]
def initializePlugin(plugin):
    fnPlugin = om.MFnPlugin(plugin, vendor = 'Mukai Lab.', version = 'v.2019.1.21')
    try:
        createUI()
    except: raise 
開發者ID:TomohikoMukai,項目名稱:ssds,代碼行數:7,代碼來源:mlSSDS.py

示例10: uninitializePlugin

# 需要導入模塊: from maya.api import OpenMaya [as 別名]
# 或者: from maya.api.OpenMaya import MFnPlugin [as 別名]
def uninitializePlugin(plugin):
    fnPlugin = om.MFnPlugin(plugin)
    try:
        deleteUI()
    except: raise 
開發者ID:TomohikoMukai,項目名稱:ssds,代碼行數:7,代碼來源:mlSSDS.py

示例11: initializePlugin

# 需要導入模塊: from maya.api import OpenMaya [as 別名]
# 或者: from maya.api.OpenMaya import MFnPlugin [as 別名]
def initializePlugin(plugin):
    om.MFnPlugin(plugin).registerCommand(
        command,
        _apiUndo
    ) 
開發者ID:mottosso,項目名稱:cmdx,代碼行數:7,代碼來源:cmdx.py

示例12: uninitialize2

# 需要導入模塊: from maya.api import OpenMaya [as 別名]
# 或者: from maya.api.OpenMaya import MFnPlugin [as 別名]
def uninitialize2(Plugin):
    def uninitializePlugin(obj):
        om.MFnPlugin(obj).deregisterNode(Plugin.typeid)

    return uninitializePlugin


# Plugins written with Maya Python API 1.0 
開發者ID:mottosso,項目名稱:cmdx,代碼行數:10,代碼來源:cmdx.py

示例13: initializeManipulator1

# 需要導入模塊: from maya.api import OpenMaya [as 別名]
# 或者: from maya.api.OpenMaya import MFnPlugin [as 別名]
def initializeManipulator1(Manipulator):
    def _manipulatorCreator():
        return ompx1.asMPxPtr(Manipulator())

    def _manipulatorInit():
        ompx1.MPxManipContainer.addToManipConnectTable(Manipulator.ownerid)
        ompx1.MPxManipContainer.initialize()

    def initializePlugin(obj):
        version = ".".join(map(str, Manipulator.version))
        plugin = ompx1.MFnPlugin(obj, "Cmdx", version, "Any")

        # NOTE(marcus): The name *must* end with Manip
        # See https://download.autodesk.com/us/maya/2011help
        #     /API/class_m_px_manip_container.html
        #     #e95527ff30ae53c8ae0419a1abde8b0c
        assert Manipulator.name.endswith("Manip"), (
            "Manipulator '%s' must have the name of a plug-in, "
            "and end with 'Manip'"
        )

        plugin.registerNode(
            Manipulator.name,
            Manipulator.typeid,
            _manipulatorCreator,
            _manipulatorInit,
            ompx1.MPxNode.kManipContainer
        )

    return initializePlugin 
開發者ID:mottosso,項目名稱:cmdx,代碼行數:32,代碼來源:cmdx.py

示例14: initializePlugin

# 需要導入模塊: from maya.api import OpenMaya [as 別名]
# 或者: from maya.api.OpenMaya import MFnPlugin [as 別名]
def initializePlugin(mobj):
    om.MFnPlugin(mobj, __author__, __version__, 'Any')

    try:
        global renderOverrideInstance
        renderOverrideInstance = DrawManipulatorOverride("DrawManipulatorDuringPlayback")
        omr.MRenderer.registerOverride(renderOverrideInstance)

    except Exception:
        sys.stderr.write("registerOverride\n")
        om.MGlobal.displayError("registerOverride")
        raise 
開發者ID:yamahigashi,項目名稱:MayaManipulatorDrawer,代碼行數:14,代碼來源:sceneRenderOverride.py

示例15: uninitializePlugin

# 需要導入模塊: from maya.api import OpenMaya [as 別名]
# 或者: from maya.api.OpenMaya import MFnPlugin [as 別名]
def uninitializePlugin(mobj):
    # plugin = om.MFnPlugin(mobj)
    # print(plugin)

    try:
        global renderOverrideInstance
        if renderOverrideInstance is not None:
            omr.MRenderer.deregisterOverride(renderOverrideInstance)
            renderOverrideInstance = None

    except Exception:
        sys.stderr.write("deregisterOverride\n")
        om.MGlobal.displayError("deregisterOverride")
        raise 
開發者ID:yamahigashi,項目名稱:MayaManipulatorDrawer,代碼行數:16,代碼來源:sceneRenderOverride.py


注:本文中的maya.api.OpenMaya.MFnPlugin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。