import win32com.client
from win32com.client import constants
def XSILoadPlugin( in_reg ):
in_reg.Author = ""
in_reg.Name = "myPlugin"
in_reg.Email = ""
in_reg.URL = ""
in_reg.Major = 1
in_reg.Minor = 0
print in_reg.Name, "has been loaded."
in_reg.RegisterMenu(constants.siMenuMainTopLevelID,"MenuTitle",0,0)
in_reg.RegisterCommand("MenuItem","MenuItem") #command, scriptname
return 1
def XSIUnloadPlugin( in_reg ):
print in_reg.Name, "has been unloaded."
return 1
def MenuTitle_Init( in_ctxt ):
oMenu = in_ctxt.Source
oMenu.AddCommandItem("MenuItem","MenuItem") #menuname, command
return 1
def MenuItem_Init( in_ctxt ):
oCmd = in_ctxt.Source
oCmd.Description = ""
oCmd.ReturnValue = 1
return 1
def MenuItem_Execute( ):
print "Command to Run"
return 1
Wednesday, March 16, 2011
XSI Plugin
Creating XSI plugins in python is extremely easy. This file will add a new menu and menuItem to the main toolbar. You can actually attach a menuItem to many other XSI widgets besides the main toolbar using the RegisterMenu command. Like most UI elements, they are not initialized until they are called the first time.
Labels:
XSI