oops.    one more time.

Not sure if this is still relevant to the current gear version but at an
early version I made a plugin that concatenated the gear location to the
syspath.

Here's the script.  In my case I used a folder called modules in the
__sipath__ location.  Ideally gear could be on a network drive and this
plugin located in a workgroup.  It would save having to edit local files on
each machine.


-------------------


# gearPath Plug-in
# Initial code generated by Softimage SDK Wizard
# Executed Tue May 22 10:50:07 EDT 2012 by dbarosin
#
# Tip: To add a command to this plug-in, right-click in the
# script editor and choose Tools > Add Command.
import win32com.client
from win32com.client import constants
import siutils, os, sys, re
import platform

null = None
false = 0
true = 1

def XSILoadPlugin( in_reg ):
    in_reg.Author = "dbarosin"
    in_reg.Name = "gearPath Plug-in"
    in_reg.Major = 1
    in_reg.Minor = 0

    #RegistrationInsertionPoint - do not remove this line

    setupGear()

    return true

def XSIUnloadPlugin( in_reg ):
    strPluginName = in_reg.Name
    Application.LogMessage(str(strPluginName) + str(" has been
unloaded."),constants.siVerbose)
    return true


# Callback for the Activate event.

def setupGear():

    # add plugin path
    siutils.add_to_syspath( "%s\\modules" % __sipath__ )
    import gear

    #set platform 64 or 32
    #list eligible extension
    bit = platform.architecture()[0][:2]
    platSkip = ['32','64']
    platSkip.remove(bit)
    ext = ["py","pys","js","vb","vbs"]

    #add platform specific extension
    if sys.platform == "win32":
        ext.append("dll")
    else:
        ext.append("so")


    mList = os.listdir( "%s\\.." % __sipath__ )

    for i in mList:
        #look for delayed load folder
        if "DelayLoad" in i:
            rootdir = "%s\\..\\%s" % (__sipath__, i)

            #walk dir tree
            for root, subFolders, files in os.walk(rootdir):
                for file in files:
                    f = os.path.join(root,file)

                    #test for files with proper ext
                    if os.path.isfile(f):
                        fileExt = f.split(".")[-1]
                        if fileExt in ext:

                            #check for either 32 or 64 dll
                            pBit = re.search("\.(%s)\." % platSkip[0],file)
                            if not pBit:
                                print ("looking for %s in %s" %
(platSkip[0], file))
                                Application.LoadPlugin(f)

Reply via email to