Update
This commit is contained in:
58
2025/plug-ins/nexus_plugin.py
Normal file
58
2025/plug-ins/nexus_plugin.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Nexus Plugin
|
||||
Maya Python API 2.0 plugin
|
||||
"""
|
||||
|
||||
import sys
|
||||
import maya.api.OpenMaya as om
|
||||
|
||||
def maya_useNewAPI():
|
||||
"""Tell Maya to use Python API 2.0"""
|
||||
pass
|
||||
|
||||
|
||||
class NexusCmd(om.MPxCommand):
|
||||
"""Nexus command"""
|
||||
|
||||
kPluginCmdName = "nexusCmd"
|
||||
|
||||
def __init__(self):
|
||||
om.MPxCommand.__init__(self)
|
||||
|
||||
def doIt(self, args):
|
||||
"""Execute the command"""
|
||||
print("[Nexus] Nexus Plugin command executed!")
|
||||
om.MGlobal.displayInfo("Nexus Plugin is working!")
|
||||
|
||||
|
||||
def cmdCreator():
|
||||
"""Create command instance"""
|
||||
return NexusCmd()
|
||||
|
||||
|
||||
def initializePlugin(mobject):
|
||||
"""Initialize plugin"""
|
||||
mplugin = om.MFnPlugin(mobject, "Nexus", "1.0", "Any")
|
||||
try:
|
||||
mplugin.registerCommand(
|
||||
NexusCmd.kPluginCmdName,
|
||||
cmdCreator
|
||||
)
|
||||
print("[Nexus] Plugin initialized: nexus_plugin.py")
|
||||
except:
|
||||
sys.stderr.write(f"Failed to register command: {NexusCmd.kPluginCmdName}\n")
|
||||
raise
|
||||
|
||||
|
||||
def uninitializePlugin(mobject):
|
||||
"""Uninitialize plugin"""
|
||||
mplugin = om.MFnPlugin(mobject)
|
||||
try:
|
||||
mplugin.deregisterCommand(NexusCmd.kPluginCmdName)
|
||||
print("[Nexus] Plugin uninitialized: nexus_plugin.py")
|
||||
except:
|
||||
sys.stderr.write(f"Failed to deregister command: {NexusCmd.kPluginCmdName}\n")
|
||||
raise
|
||||
Reference in New Issue
Block a user