Skip to content

Instantly share code, notes, and snippets.

@KelSolaar
Last active December 16, 2015 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KelSolaar/5370212 to your computer and use it in GitHub Desktop.
Save KelSolaar/5370212 to your computer and use it in GitHub Desktop.
Persistence Ramblings Addon for Softimage
from win32com.client import constants as siConstants
class Runtime(object):
instance = None
class Foo(object):
def __init__(self, bar):
self.bar = bar
def XSILoadPlugin(pluginRegistrar):
pluginRegistrar.Author = "Nemo"
pluginRegistrar.Name = "Persistence"
pluginRegistrar.URL = ""
pluginRegistrar.Email = ""
pluginRegistrar.Major = "1"
pluginRegistrar.Minor = "0"
pluginRegistrar.RegisterEvent("Persistence_startupEvent", siConstants.siOnStartup)
pluginRegistrar.RegisterCommand("Persistence_checkPersistence", "Persistence_checkPersistence")
pluginRegistrar.RegisterMenu(siConstants.siMenuMainApplicationViewsID, "Persistence")
pluginRegistrar.RegisterProperty("Persistence_property");
Application.LogMessage("'{0}' has been loaded!".format(pluginRegistrar.Name))
return True
def XSIUnloadPlugin(pluginRegistrar):
Application.LogMessage("'{0}' has been unloaded!".format(pluginRegistrar.Name))
return True
def Persistence_startupEvent_OnEvent(context):
Application.LogMessage("checkPersistence'Persistence_startupEvent_OnEvent' called!", siConstants.siVerbose)
Runtime.instance = Foo()
Application.LogMessage(Runtime.instance)
Application.LogMessage(id(Runtime))
return True
def Persistence_checkPersistence_Init(context):
Application.LogMessage("checkPersistence'Persistence_start_Init' called!", siConstants.siVerbose)
return True
def Persistence_checkPersistence_Execute():
Application.LogMessage("checkPersistence'Persistence_start_Execute' called!", siConstants.siVerbose)
return True
def Persistence_Init(context):
menu = context.Source;
menu.AddCallbackItem("Persistence Preferences", "Persistence_Preferences_Clicked")
return True
def Persistence_Preferences_Clicked(context):
Application.SIAddProp("Persistence_property", "Scene_Root", siConstants.siDefaultPropagation)
Application.InspectObj("Persistence_property", "", "Persistence_property")
return True
def Persistence_property_Define(context):
return True
def Persistence_property_DefineLayout(context):
layout = context.Source
layout.Clear()
layout.AddRow()
layout.AddButton("Check_Persistence_button", "Check Persistence")
layout.EndRow()
return True
def Persistence_property_Check_Persistence_button_OnClicked():
Application.LogMessage(Runtime.instance)
Application.LogMessage(id(Runtime))
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment