本文整理汇总了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
#
# --------------------------------------------------------
示例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
示例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
# ----------------------------------------------------------------------
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例11: initializePlugin
# 需要导入模块: from maya.api import OpenMaya [as 别名]
# 或者: from maya.api.OpenMaya import MFnPlugin [as 别名]
def initializePlugin(plugin):
om.MFnPlugin(plugin).registerCommand(
command,
_apiUndo
)
示例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
示例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
示例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
示例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