当前位置: 首页>>代码示例>>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;未经允许,请勿转载。