#!/usr/bin/env python # -*- coding: utf-8 -*- ''' NexusLauncher Example Plugin Example plugin - demonstrates how to create a Maya plugin ''' import sys import maya.api.OpenMaya as om def maya_useNewAPI(): '''Tell Maya to use Maya Python API 2.0''' pass class NexusExampleCmd(om.MPxCommand): '''Example command''' kPluginCmdName = 'nexusExample' def __init__(self): om.MPxCommand.__init__(self) @staticmethod def cmdCreator(): return NexusExampleCmd() def doIt(self, args): print('[NexusLauncher] Example plugin command executed!') om.MGlobal.displayInfo('NexusLauncher Example Plugin is working!') def initializePlugin(plugin): '''Initialize plugin''' pluginFn = om.MFnPlugin(plugin, 'NexusLauncher', '1.0', 'Any') try: pluginFn.registerCommand( NexusExampleCmd.kPluginCmdName, NexusExampleCmd.cmdCreator ) print('[NexusLauncher] Example plugin loaded successfully') except: sys.stderr.write(f'Failed to register command: {NexusExampleCmd.kPluginCmdName}') raise def uninitializePlugin(plugin): '''Uninitialize plugin''' pluginFn = om.MFnPlugin(plugin) try: pluginFn.deregisterCommand(NexusExampleCmd.kPluginCmdName) print('[NexusLauncher] Example plugin unloaded') except: sys.stderr.write(f'Failed to deregister command: {NexusExampleCmd.kPluginCmdName}') raise