def __init__(self,clientInfo): # self.MyLog(clientInfo) #获取流程脚本传过来的信息 self.cgName = clientInfo['cgName'] self.cgVersion = clientInfo['cgVersion'] self.pluginName = clientInfo['pluginName'] self.pluginVersion = clientInfo['pluginVersion'] self.plugins = clientInfo['plugins'] #dict self.userId = clientInfo['userId'] self.taskId = clientInfo['taskId'] #import 公共使用的函数 PluginBase ,配置脚本(W2 B:/plugins/maya_new/envInfo.json)信息获取,清理目录,创建目录,找相同命名的压缩包,拷贝文件,拷贝目录,解压文件,编码转换,MD5值校验 self.Base = PluginBase() #获取本地D盘插件路径 self._PluginDir = os.path.join(self.Base.get_json_ini('Node_D'),self.pluginName,'software',self.cgName + self.cgVersion + '_' + self.pluginName + self.pluginVersion).replace('\\','/') #"solidangle_LICENSE":"[email protected];[email protected];[email protected]" self.solidangle_LICENSE = self.Base.get_json_ini('solidangle_LICENSE') self.MyLog(self._PluginDir)
def __init__(self, clientInfo): # self.MyLog(clientInfo) self.cgName = clientInfo['cgName'] self.cgVersion = clientInfo['cgVersion'] self.pluginName = clientInfo['pluginName'] self.pluginVersion = clientInfo['pluginVersion'] self.plugins = clientInfo['plugins'] #dict self.userId = clientInfo['userId'] self.taskId = clientInfo['taskId'] #import 公共使用的函数 PluginBase ,配置脚本(W2 B:/plugins/maya_new/envInfo.json)信息获取,清理目录,创建目录,找相同命名的压缩包,拷贝文件,拷贝目录,解压文件,编码转换,MD5值校验 self.Base = PluginBase() #获取本地D盘插件路径 self._PluginDir = os.path.join( self.Base.get_json_ini('Node_D'), 'miarmy', 'software', self.cgName + self.cgVersion + '_' + self.pluginName + self.pluginVersion).replace('\\', '/') self.MyLog(self._PluginDir)
def __init__(self, clientInfo): # self.MyLog(clientInfo) self.cgName = clientInfo['cgName'] self.cgVersion = clientInfo['cgVersion'] self.pluginName = clientInfo['pluginName'] self.pluginVersion = clientInfo['pluginVersion'] self.plugins = clientInfo['plugins'] #dict self.userId = clientInfo['userId'] self.taskId = clientInfo['taskId'] self.Base = PluginBase() #D盘插件路径 self._PluginDir = os.path.join( self.Base.get_json_ini('Node_D'), self.pluginName, 'software', self.cgName + self.cgVersion + '_' + self.pluginName + self.pluginVersion).replace('\\', '/') #获取变量名称 self.VRAY_FOR_MAYA_VERSION_PLUGINS_x64 = "VRAY_FOR_MAYA%s_PLUGINS_x64" % ( self.cgVersion) self.mentalrayForMayaVersion = "/mentalrayForMaya%s" % (self.cgVersion) self.MyLog(self._PluginDir)
def __init__(self, clientInfo): self.MyLog(clientInfo) self.cgName = clientInfo['cgName'] self.cgVersion = clientInfo['cgVersion'] self.pluginName = clientInfo['pluginName'] self.pluginVersion = clientInfo['pluginVersion'] self.plugins = clientInfo['plugins'] #dict self.userId = clientInfo['userId'] self.taskId = clientInfo['taskId'] self.pluginsPath = clientInfo['pluginsPath'] self.configPath = clientInfo['configPath'] self.messUpPath = clientInfo['messUpPath'] self.json_path = os.path.join(self.pluginsPath, "envInfo.json") self.Base = PluginBase() self._PluginDir = os.path.join( self.Base.get_json_ini('Node_D', self.json_path), self.pluginName, 'software', self.cgName + self.cgVersion + '_' + self.pluginName + self.pluginVersion).replace('\\', '/') self.solidangle_LICENSE = self.Base.get_json_ini( 'solidangle_LICENSE', self.json_path) self.MyLog(self._PluginDir)
class AlShadersConfig(): def __init__(self, clientInfo): # self.MyLog(clientInfo) #获取流程脚本传过来的信息 self.cgName = clientInfo['cgName'] self.cgVersion = clientInfo['cgVersion'] self.pluginName = clientInfo['pluginName'] self.pluginVersion = clientInfo['pluginVersion'] self.plugins = clientInfo['plugins'] #dict self.userId = clientInfo['userId'] self.taskId = clientInfo['taskId'] #import 公共使用的函数 PluginBase ,配置脚本(W2 B:/plugins/maya_new/envInfo.json)信息获取,清理目录,创建目录,找相同命名的压缩包,拷贝文件,拷贝目录,解压文件,编码转换,MD5值校验 self.Base = PluginBase() #获取本地D盘插件路径 self._PluginDir = os.path.join( self.Base.get_json_ini('Node_D'), 'alShaders', 'software', self.cgName + self.cgVersion + '_' + self.pluginName + self.pluginVersion).replace('\\', '/') self.MyLog(self._PluginDir) def MyLog(self, message, extr="AlShadersSetup"): if str(message).strip() != "": print("[%s] %s" % (extr, str(message))) def EnvSetup(self): #设置环境变量 _ARNOLD_PLUGIN_PATH = os.environ.get('ARNOLD_PLUGIN_PATH') _MTOA_TEMPLATES_PATH = os.environ.get('MTOA_TEMPLATES_PATH') os.environ['ARNOLD_PLUGIN_PATH'] = (_ARNOLD_PLUGIN_PATH + r";" if _ARNOLD_PLUGIN_PATH else "") + self._PluginDir + r"/bin" os.environ['MTOA_TEMPLATES_PATH'] = (_MTOA_TEMPLATES_PATH + r";" if _MTOA_TEMPLATES_PATH else "") + self._PluginDir + r"/ae" #如果此版本有aexml文件夹 添加多一条环境变量 aexml_path = self._PluginDir + r"/aexml" if os.path.exists(aexml_path): print "This alshder version has aexml_path" _MAYA_CUSTOM_TEMPLATE_PATH = os.environ.get( 'MAYA_CUSTOM_TEMPLATE_PATH') os.environ['MAYA_CUSTOM_TEMPLATE_PATH'] = ( _MAYA_CUSTOM_TEMPLATE_PATH + r";" if _MAYA_CUSTOM_TEMPLATE_PATH else "") + self._PluginDir + r"/aexml" print "set alShaders finished!!!"
class RealflowConfig(): def __init__(self, clientInfo): # self.MyLog(clientInfo) self.cgName = clientInfo['cgName'] self.cgVersion = clientInfo['cgVersion'] self.pluginName = clientInfo['pluginName'] self.pluginVersion = clientInfo['pluginVersion'] self.plugins = clientInfo['plugins'] #dict self.userId = clientInfo['userId'] self.taskId = clientInfo['taskId'] self.Base = PluginBase() self._PluginDir = os.path.join( self.Base.get_json_ini('Node_D'), self.pluginName, 'software', self.cgName + self.cgVersion + '_' + self.pluginName + self.pluginVersion).replace('\\', '/') self.mentalrayForMayaVersion = "/mentalrayForMaya%s" % (self.cgVersion) self.MyLog(self._PluginDir) def MyLog(self, message, extr="RealflowSetup"): if str(message).strip() != "": print("[%s] %s" % (extr, str(message))) def setEnv(self): #设置环境变量 _XBMLANGPATH = os.environ.get('XBMLANGPATH') os.environ['XBMLANGPATH'] = ( _XBMLANGPATH + r";" if _XBMLANGPATH else "") + self._PluginDir + r"/maya_root/icons" _MAYA_PLUG_IN_PATH = os.environ.get('MAYA_PLUG_IN_PATH') os.environ['MAYA_PLUG_IN_PATH'] = ( _MAYA_PLUG_IN_PATH + r";" if _MAYA_PLUG_IN_PATH else "") + self._PluginDir + r"/maya_root/bin/plug-ins" _MAYA_SCRIPT_PATH = os.environ.get('MAYA_SCRIPT_PATH') os.environ['MAYA_SCRIPT_PATH'] = ( _MAYA_SCRIPT_PATH + r";" if _MAYA_SCRIPT_PATH else "") + self._PluginDir + r"/maya_root/scripts" _mentalray_EXTENSIONS_PATH = os.environ.get( 'mentalray_EXTENSIONS_PATH') os.environ['mentalray_EXTENSIONS_PATH'] = ( _mentalray_EXTENSIONS_PATH + r";" if _mentalray_EXTENSIONS_PATH else "") + self._PluginDir + self.mentalrayForMayaVersion + r"/shaders"
class CryptomatteConfig(): def __init__(self, clientInfo): # self.MyLog(clientInfo) self.cgName = clientInfo['cgName'] self.cgVersion = clientInfo['cgVersion'] self.pluginName = clientInfo['pluginName'] self.pluginVersion = clientInfo['pluginVersion'] self.plugins = clientInfo['plugins'] #dict self.userId = clientInfo['userId'] self.taskId = clientInfo['taskId'] self.Base = PluginBase() self._PluginDir = os.path.join( self.Base.get_json_ini('Node_D'), 'Cryptomatte', 'software', self.cgName + self.cgVersion + '_' + self.pluginName + self.pluginVersion).replace('\\', '/') self.MyLog(self._PluginDir) def MyLog(self, message, extr="CryptomatteSetup"): if str(message).strip() != "": print("[%s] %s" % (extr, str(message))) #设置环境变量 def EnvSetup(self): _ARNOLD_PLUGIN_PATH = os.environ.get('ARNOLD_PLUGIN_PATH') _MTOA_TEMPLATES_PATH = os.environ.get('MTOA_TEMPLATES_PATH') os.environ['ARNOLD_PLUGIN_PATH'] = (_ARNOLD_PLUGIN_PATH + r";" if _ARNOLD_PLUGIN_PATH else "") + self._PluginDir + r"/bin" os.environ['MTOA_TEMPLATES_PATH'] = (_MTOA_TEMPLATES_PATH + r";" if _MTOA_TEMPLATES_PATH else "") + self._PluginDir + r"/ae" #如果有aexml文件夹 则添加多一条变量 aexml_path = self._PluginDir + r"/aexml" if os.path.exists(aexml_path): print "This alshder version has aexml_path" _MAYA_CUSTOM_TEMPLATE_PATH = os.environ.get( 'MAYA_CUSTOM_TEMPLATE_PATH') os.environ['MAYA_CUSTOM_TEMPLATE_PATH'] = ( _MAYA_CUSTOM_TEMPLATE_PATH + r";" if _MAYA_CUSTOM_TEMPLATE_PATH else "") + self._PluginDir + r"/aexml" print "set Cryptomatte finished!!!"
class FumefxConfig(): def __init__(self, clientInfo): # self.MyLog(clientInfo) self.cgName = clientInfo['cgName'] self.cgVersion = clientInfo['cgVersion'] self.pluginName = clientInfo['pluginName'] self.pluginVersion = clientInfo['pluginVersion'] self.plugins = clientInfo['plugins'] #dict self.userId = clientInfo['userId'] self.taskId = clientInfo['taskId'] self.Base = PluginBase() self._PluginDir = os.path.join( self.Base.get_json_ini('Node_D'), 'fumefx', 'software', self.cgName + self.cgVersion + '_' + self.pluginName + self.pluginVersion).replace('\\', '/') self.MyLog(self._PluginDir) def MyLog(self, message, extr="FumefxSetup"): if str(message).strip() != "": print("[%s] %s" % (extr, str(message))) def reCreateMod(self): DOME_ROOT_DIR = self._PluginDir MODULES_LOCAL = self._PluginDir + r"/maya_root/modules" FUMEFX_ROOT = self._PluginDir + r"/maya_fumefx" FUMEFX_ROOT_lOCAL = FUMEFX_ROOT.replace("/", "\\") #获取mod文件,并修改 MODULE_NAME = "FumeFX.mod" NEW_MODULE_FILE = MODULES_LOCAL + r"/" + MODULE_NAME line = "+ FumeFX %s %s" % (self.pluginVersion, FUMEFX_ROOT_lOCAL) if os.path.exists(NEW_MODULE_FILE): fp = open(NEW_MODULE_FILE, 'w') fp.writelines(line) fp.write('\n') fp.close() else: print("\n module file don't exist: \n" + elm) def EnvSetup(self): #run rlm >>>>>>>>>>> #检测进程并删除 os.system(r'wmic process where name="AfterFLICS.exe" delete') #拷贝rlm文件到C盘 AFLICS_PATH = self._PluginDir + r"\AFLICS" dstDir = r'"C:\Program Files (x86)\AFLICS"' os.system("robocopy /e /ns /nc /nfl /ndl /np %s %s" % (AFLICS_PATH, dstDir)) #创建服务 os.system( r'sc create "AfterFLICS V3" binPath= "C:\Program Files (x86)\AFLICS\AfterFLICS.exe" DisplayName= "AfterFLICS V3"' ) #开启服务 os.system(r'net start "AfterFLICS V3"') self.MyLog("FumeFX server :" + dstDir) #设置环境变量 _PATH_ENV = os.environ.get('PATH') os.environ['PATH'] = (_PATH_ENV + r";" if _PATH_ENV else "") + self._PluginDir + r"/maya_root/bin" # get maya env _MAYA_MODULE_PATH = os.environ.get('MAYA_MODULE_PATH') _MAYA_SCRIPT_PATH = os.environ.get('MAYA_SCRIPT_PATH') # get mr env _MI_LIBRARY_PATH = os.environ.get('MI_LIBRARY_PATH') _MI_CUSTOM_SHADER_PATH = os.environ.get('MI_CUSTOM_SHADER_PATH') _MENTALRAY_SHADERS_LOCATION = os.environ.get( 'MENTALRAY_SHADERS_LOCATION') _MENTALRAY_INCLUDE_LOCATION = os.environ.get( 'MENTALRAY_INCLUDE_LOCATION') # set maya env os.environ['MAYA_MODULE_PATH'] = ( _MAYA_MODULE_PATH + r";" if _MAYA_MODULE_PATH else "") + self._PluginDir + r"/maya_root/modules" os.environ['MAYA_SCRIPT_PATH'] = ( _MAYA_SCRIPT_PATH + r";" if _MAYA_SCRIPT_PATH else "") + self._PluginDir + r"/maya_root/scripts" #set mr env os.environ['MI_LIBRARY_PATH'] = ( _MI_LIBRARY_PATH + r";" if _MI_LIBRARY_PATH else "") + self._PluginDir + r"/mentalray_shader/shaders" os.environ['MI_CUSTOM_SHADER_PATH'] = ( _MI_CUSTOM_SHADER_PATH + r";" if _MI_CUSTOM_SHADER_PATH else "") + self._PluginDir + r"/mentalray_shader/shaders/include" os.environ['MENTALRAY_SHADERS_LOCATION'] = ( _MENTALRAY_SHADERS_LOCATION + r";" if _MENTALRAY_SHADERS_LOCATION else "") + os.environ.get('MI_LIBRARY_PATH') os.environ['MENTALRAY_INCLUDE_LOCATION'] = ( _MENTALRAY_INCLUDE_LOCATION + r";" if _MENTALRAY_INCLUDE_LOCATION else "") + os.environ.get('MI_CUSTOM_SHADER_PATH') #set others plugins's env >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> pluginList = self.plugins if pluginList: if 'mtoa' in pluginList: _ARNOLD_PLUGIN_PATH = os.environ.get('ARNOLD_PLUGIN_PATH ') _MTOA_EXTENSIONS_PATH = os.environ.get('MTOA_EXTENSIONS_PATH') os.environ['ARNOLD_PLUGIN_PATH'] = ( _ARNOLD_PLUGIN_PATH + r";" if _ARNOLD_PLUGIN_PATH else "") + self._PluginDir + r"/arnold_shader/shaders" os.environ['MTOA_EXTENSIONS_PATH'] = ( _MTOA_EXTENSIONS_PATH + r";" if _MTOA_EXTENSIONS_PATH else "") + self._PluginDir + r'/arnold_shader/extensions' print("arnold and Domemaster3D env set finish!!!") if 'vrayformaya' in pluginList: if clientInfo['plugins']["vrayformaya"] == "2016.5": maya_ver = "2016_5" else: maya_ver = clientInfo['plugins']["vrayformaya"] VRAY_FOR_MAYA_PLUGINS = "VRAY_FOR_MAYA%s_PLUGINS_x64" % ( maya_ver) _VRAY_FOR_MAYA_PLUGINS = os.environ.get( 'VRAY_FOR_MAYA_PLUGINS ') _VRAY_FOR_MAYA_SHADERS = os.environ.get( 'VRAY_FOR_MAYA_SHADERS ') os.environ['VRAY_FOR_MAYA_PLUGINS'] = ( _VRAY_FOR_MAYA_PLUGINS + r";" if _VRAY_FOR_MAYA_PLUGINS else "") + self._PluginDir + r"/vray3.0_shader/vrayplugins" os.environ['VRAY_FOR_MAYA_SHADERS'] = ( _VRAY_FOR_MAYA_SHADERS + r";" if _VRAY_FOR_MAYA_SHADERS else "") + self._PluginDir + r"/vray3.0_shader/shaders" print("vrayformaya and Domemaster3D env set finish!!!")
class MtoaConfig(): def __init__(self, clientInfo): self.MyLog(clientInfo) self.cgName = clientInfo['cgName'] self.cgVersion = clientInfo['cgVersion'] self.pluginName = clientInfo['pluginName'] self.pluginVersion = clientInfo['pluginVersion'] self.plugins = clientInfo['plugins'] #dict self.userId = clientInfo['userId'] self.taskId = clientInfo['taskId'] self.pluginsPath = clientInfo['pluginsPath'] self.configPath = clientInfo['configPath'] self.messUpPath = clientInfo['messUpPath'] self.json_path = os.path.join(self.pluginsPath, "envInfo.json") self.Base = PluginBase() self._PluginDir = os.path.join( self.Base.get_json_ini('Node_D', self.json_path), self.pluginName, 'software', self.cgName + self.cgVersion + '_' + self.pluginName + self.pluginVersion).replace('\\', '/') self.solidangle_LICENSE = self.Base.get_json_ini( 'solidangle_LICENSE', self.json_path) self.MyLog(self._PluginDir) def MyLog(self, message, extr="MtoaSetup"): if str(message).strip() != "": print("[%s] %s" % (extr, str(message))) def reCreateMod(self): MODULES_LOCAL = self._PluginDir + r"/maya_root/modules" if not os.path.exists(MODULES_LOCAL): os.makedirs(MODULES_LOCAL) module_file = self._PluginDir + r"/maya_root/modules/mtoa.mod" NEW_MAYAM_MTOA_PATH = self._PluginDir + r"/maya_mtoa" NEW_MAYAM_MTOA_PATH = NEW_MAYAM_MTOA_PATH.replace("\\", "/") ModulePathList = [] line1 = "+ mtoa any " + NEW_MAYAM_MTOA_PATH line2 = "PATH +:= bin" line3 = "MAYA_CUSTOM_TEMPLATE_PATH +:= scripts/mtoa/ui/templates" line4 = "MAYA_SCRIPT_PATH +:= scripts/mtoa/mel" ModulePathList = [line1, line2, line3, line4] if os.path.exists(module_file): fp = open(module_file, 'w') for line in ModulePathList: fp.writelines(line) fp.write('\n') fp.close() ORG_DESCRIPT_FILE = NEW_MAYAM_MTOA_PATH + r"/arnoldRenderer.xml" NEW_DESCRIPT_DIR = self._PluginDir + r"/maya_root/bin/rendererDesc" if not os.path.exists(NEW_DESCRIPT_DIR): os.makedirs(NEW_DESCRIPT_DIR) if os.path.exists(ORG_DESCRIPT_FILE): shutil.copy(ORG_DESCRIPT_FILE, NEW_DESCRIPT_DIR) def setEnv(self): os.environ['solidangle_LICENSE'] = self.solidangle_LICENSE self.MyLog("arnold license local :" + os.environ['solidangle_LICENSE']) _PATH_env = os.environ.get('PATH') _MAYA_RENDER_DESC_PATH = os.environ.get('MAYA_RENDER_DESC_PATH') _MAYA_MODULE_PATH = os.environ.get('MAYA_MODULE_PATH') _MAYA_SCRIPT_PATH = os.environ.get('MAYA_SCRIPT_PATH') os.environ['PATH'] = (_PATH_env + r";" if _PATH_env else "") + self._PluginDir + r'/maya_mtoa/bin' os.environ['MAYA_RENDER_DESC_PATH'] = ( _MAYA_RENDER_DESC_PATH + r";" if _MAYA_RENDER_DESC_PATH else "") + self._PluginDir + r"/maya_root/bin/rendererDesc" os.environ['MAYA_MODULE_PATH'] = ( _MAYA_MODULE_PATH + r";" if _MAYA_MODULE_PATH else "") + self._PluginDir + r"/maya_root/modules" os.environ['MAYA_SCRIPT_PATH'] = ( _MAYA_SCRIPT_PATH + r";" if _MAYA_SCRIPT_PATH else "") + self._PluginDir + r"/maya_mtoa/scripts"
class MiarmyConfig(): def __init__(self, clientInfo): # self.MyLog(clientInfo) self.cgName = clientInfo['cgName'] self.cgVersion = clientInfo['cgVersion'] self.pluginName = clientInfo['pluginName'] self.pluginVersion = clientInfo['pluginVersion'] self.plugins = clientInfo['plugins'] #dict self.userId = clientInfo['userId'] self.taskId = clientInfo['taskId'] #import 公共使用的函数 PluginBase ,配置脚本(W2 B:/plugins/maya_new/envInfo.json)信息获取,清理目录,创建目录,找相同命名的压缩包,拷贝文件,拷贝目录,解压文件,编码转换,MD5值校验 self.Base = PluginBase() #获取本地D盘插件路径 self._PluginDir = os.path.join( self.Base.get_json_ini('Node_D'), 'miarmy', 'software', self.cgName + self.cgVersion + '_' + self.pluginName + self.pluginVersion).replace('\\', '/') self.MyLog(self._PluginDir) def MyLog(self, message, extr="miarmySetup"): if str(message).strip() != "": print("[%s] %s" % (extr, str(message))) def reCreateMod(self): DOME_ROOT_DIR = self._PluginDir DOME_ROOT_DIR = DOME_ROOT_DIR.replace("/", "\\") #mod文件 MAYA_MODULES_FILE = self._PluginDir + r"/maya%s/maya_root/modules/MiarmyForMaya.txt" % ( self.cgVersion) PUBLIC_MODULES_FILE = self._PluginDir + r"/maya%s/maya_root/modules/MiarmyPublic.txt" % ( self.cgVersion) MODULES_LOCAL = self._PluginDir + r"/%s/maya_root/modules" % ( self.cgVersion) MODULES_LIST = [MAYA_MODULES_FILE, PUBLIC_MODULES_FILE] MODULES_KEY = "" for elm in MODULES_LIST: MODULE_NAME = os.path.basename(elm) if MODULE_NAME == "MiarmyForMaya.txt": MODULES_KEY = "Miarmy" elif MODULE_NAME == "MiarmyPublic.txt": MODULES_KEY = "MiarmyPublic" if os.path.exists(elm): fp = open(elm, 'r') lines = fp.readlines() fp.close() #路径是否有问题? lines[0] = "+ %s Any %s \n" % (MODULES_KEY, MODULES_LOCAL) fp = open(elm, 'r+') for s in lines: fp.writelines(s) fp.close() else: self.MyLog("\n module file don't exist: \n" + elm) def EnvSetup(self): # set miarmy aut_load use usersetup.mel _MAYA_SCRIPT_PATH = os.environ.get('MAYA_SCRIPT_PATH') #usersetup.mel 读这个有用? os.environ['MAYA_SCRIPT_PATH'] = (_MAYA_SCRIPT_PATH + r";" if _MAYA_SCRIPT_PATH else "") + self._PluginDir + "/usesetup/" #set autlode in plugins.mel #设置插件 开maya时 自动开启 hasPlugPrefs = False if self.cgVersion <= '2015': self.cgVersion = "%s-x64" % self.cgVersion pluginPrefsFile = r"C:\users\enfuzion\Documents\maya\%s\prefs\pluginPrefs.mel" % ( self.cgVersion) plug_load = ( r'evalDeferred("autoLoadPlugin(\"\", \"MiarmyPro\", \"MiarmyPro\")");' + '\n') self.MyLog("MiarmyProForMaya%s" % (self.cgVersion)) with open(pluginPrefsFile, "a+") as f: lines = f.readlines() for line in lines: if plug_load == line.strip(): self.MyLog("yes MiarmyProForMaya ") hasPlugPrefs = True if not hasPlugPrefs: self.MyLog("write MiarmyProForMaya") f.write(plug_load) #set others plugins's env >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> pluginList = self.plugins renderSoftware_ver = self.cgVersion if pluginList: if 'mtoa' in pluginList: #对应arnold版本的 dll srcDir = self._PluginDir + r"/maya_miarmy/bin/arnold" #C盘路径 dstDir = r'"C:/Program Files/Basefount/Miarmy/bin/arnold"' #拷贝过去 os.system("robocopy /S /NDL /NFL %s %s" % (srcDir, dstDir)) self.MyLog("arnold and miarmy env set finish!!!") if 'vrayformaya' in pluginList: self.MyLog( "**********************Set miarmy for vray dso env**************************************" ) #确认vray版本 vray_ver = pluginList['vrayformaya'][:3] #找到对应的 vray_geomMcdVRGeom2.dll 将路径添加进环境变量 #miarmy_root 没定义 vray_plug_path = miarmy_root + "\\maya_miarmy\\bin\\vray\\vray_" + vray_ver if float(vray_ver) == 2.4: vray_plug_path = vray_plug_path elif float(vray_ver) == 3.0: if int(renderSoftware_ver[:4]) <= 2014: vray_plug_path += "\Maya2014" else: vray_plug_path += "\Maya2015and2016" elif float(vray_ver) >= 3.1: vray_plug_path = miarmy_root + "\\maya_miarmy\\bin\\vray\\vray_3.1-3.5" if int(renderSoftware_ver[:4]) <= 2014: vray_plug_path += "\Maya2014" else: vray_plug_path += "\Maya2015-2017" else: pass self.MyLog(vray_plug_path) VRAY_FOR_Maya_env = "VRAY_FOR_Maya%s_PLUGINS_x64" % ( renderSoftware_ver) self.MyLog(VRAY_FOR_Maya_env) #应该写错了吧 if not os.environ.has_key('VRAY_FOR_Maya_env'): os.environ[VRAY_FOR_Maya_env] = vray_plug_path else: os.environ[VRAY_FOR_Maya_env] = os.environ.get( VRAY_FOR_Maya_env) + r";" + vray_plug_path self.MyLog(os.environ.get(VRAY_FOR_Maya_env)) #添加另一条变量 _MAYA_SCRIPT_PATH = os.environ.get('MAYA_SCRIPT_PATH') os.environ['MAYA_SCRIPT_PATH'] = ( _MAYA_SCRIPT_PATH + r";" if _MAYA_SCRIPT_PATH else "") + miarmy_root + "/usesetup/"
class MtoaConfig(): def __init__(self,clientInfo): # self.MyLog(clientInfo) #获取流程脚本传过来的信息 self.cgName = clientInfo['cgName'] self.cgVersion = clientInfo['cgVersion'] self.pluginName = clientInfo['pluginName'] self.pluginVersion = clientInfo['pluginVersion'] self.plugins = clientInfo['plugins'] #dict self.userId = clientInfo['userId'] self.taskId = clientInfo['taskId'] #import 公共使用的函数 PluginBase ,配置脚本(W2 B:/plugins/maya_new/envInfo.json)信息获取,清理目录,创建目录,找相同命名的压缩包,拷贝文件,拷贝目录,解压文件,编码转换,MD5值校验 self.Base = PluginBase() #获取本地D盘插件路径 self._PluginDir = os.path.join(self.Base.get_json_ini('Node_D'),self.pluginName,'software',self.cgName + self.cgVersion + '_' + self.pluginName + self.pluginVersion).replace('\\','/') #"solidangle_LICENSE":"[email protected];[email protected];[email protected]" self.solidangle_LICENSE = self.Base.get_json_ini('solidangle_LICENSE') self.MyLog(self._PluginDir) def MyLog(self,message,extr="MtoaSetup"): if str(message).strip() != "": print("[%s] %s"%(extr,str(message))) #修改或创建 mod文件 def reCreateMod(self): #本地modules路径 MODULES_LOCAL = self._PluginDir + r"/maya_root/modules" if not os.path.exists(MODULES_LOCAL): os.makedirs(MODULES_LOCAL) #本地mod文件路径 module_file = self._PluginDir + r"/maya_root/modules/mtoa.mod" NEW_MAYAM_MTOA_PATH = self._PluginDir +r"/maya_mtoa" #mod文件的内容 ModulePathList = [] line1 = "+ mtoa any " + NEW_MAYAM_MTOA_PATH line2 = "PATH +:= bin" line3 = "MAYA_CUSTOM_TEMPLATE_PATH +:= scripts/mtoa/ui/templates" line4 = "MAYA_SCRIPT_PATH +:= scripts/mtoa/mel" ModulePathList = [line1,line2,line3,line4] #写入内容 if os.path.exists(module_file): fp = open(module_file,'w') for line in ModulePathList: fp.writelines(line) fp.write('\n') fp.close() #拷贝xml到 rendererDesc文件夹 ORG_DESCRIPT_FILE = NEW_MAYAM_MTOA_PATH + r"/arnoldRenderer.xml" NEW_DESCRIPT_DIR = self._PluginDir + r"/maya_root/bin/rendererDesc" if not os.path.exists(NEW_DESCRIPT_DIR): os.makedirs(NEW_DESCRIPT_DIR) shutil.copy(ORG_DESCRIPT_FILE,NEW_DESCRIPT_DIR) #结束lic相关进程,设置环境变量 启动进程 def setEnv(self): AMPED_path = self._PluginDir + r"/AMPED" if os.path.exists(AMPED_path): #结束进程 os.system(r'wmic process where name="JGS_mtoa_licserver.exe" delete') os.system(r'wmic process where name="rlm.exe" delete') dstDir=r'"C:\AMPED"' #拷贝rlm文件到C盘 os.system ("robocopy /e /ns /nc /nfl /ndl /np %s %s" % (AMPED_path, dstDir)) os.system(r'start C:\AMPED\rlm.exe') #设置lic环境变量 os.environ['solidangle_LICENSE'] = self.solidangle_LICENSE self.MyLog("arnold license local :" + os.environ['solidangle_LICENSE'] ) #设置其他变量 _PATH_env=os.environ.get('PATH') _MAYA_RENDER_DESC_PATH=os.environ.get('MAYA_RENDER_DESC_PATH') _MAYA_MODULE_PATH=os.environ.get('MAYA_MODULE_PATH') _MAYA_SCRIPT_PATH=os.environ.get('MAYA_SCRIPT_PATH') os.environ['PATH'] = (_PATH_env + r";" if _PATH_env else "") + self._PluginDir + r'/maya_mtoa/bin' os.environ['MAYA_RENDER_DESC_PATH'] = (_MAYA_RENDER_DESC_PATH + r";" if _MAYA_RENDER_DESC_PATH else "") + self._PluginDir + r"/maya_root/bin/rendererDesc" os.environ['MAYA_MODULE_PATH'] = (_MAYA_MODULE_PATH + r";" if _MAYA_MODULE_PATH else "") + self._PluginDir + r"/maya_root/modules" os.environ['MAYA_SCRIPT_PATH'] = (_MAYA_SCRIPT_PATH + r";" if _MAYA_SCRIPT_PATH else "") + self._PluginDir + r"/maya_mtoa/scripts"
class ShaveNodeConfig(): def __init__(self, clientInfo): # self.MyLog(clientInfo) self.cgName = clientInfo['cgName'] self.cgVersion = clientInfo['cgVersion'] self.pluginName = clientInfo['pluginName'] self.pluginVersion = clientInfo['pluginVersion'] self.plugins = clientInfo['plugins'] #dict self.userId = clientInfo['userId'] self.taskId = clientInfo['taskId'] self.Base = PluginBase() #D盘插件路径 self._PluginDir = os.path.join( self.Base.get_json_ini('Node_D'), self.pluginName, 'software', self.cgName + self.cgVersion + '_' + self.pluginName + self.pluginVersion).replace('\\', '/') #获取变量名称 self.VRAY_FOR_MAYA_VERSION_PLUGINS_x64 = "VRAY_FOR_MAYA%s_PLUGINS_x64" % ( self.cgVersion) self.mentalrayForMayaVersion = "/mentalrayForMaya%s" % (self.cgVersion) self.MyLog(self._PluginDir) def MyLog(self, message, extr="shaveNodeSetup"): if str(message).strip() != "": print("[%s] %s" % (extr, str(message))) def reCreateMod(self): MODULES_LOCAL = self._PluginDir + r"/maya_root/modules/" if not os.path.exists(MODULES_LOCAL): os.makedirs(MODULES_LOCAL) module_file = self._PluginDir + r"/maya_root/modules/shaveHaircut.mod" #修改mod文件 NEW_MAYAM_MTOA_PATH = self._PluginDir + r"/maya_shave" ModulePathList = [] line1 = "+ shaveHaircut 1.1 " + NEW_MAYAM_MTOA_PATH ModulePathList = [line1] if os.path.exists(module_file): fp = open(module_file, 'w') for line in ModulePathList: fp.writelines(line) fp.write('\n') fp.close() def setEnv(self): #拷贝压缩包内的rlm到C盘 srcRlmDir = self._PluginDir + r"\rlm" dstRlmDir = r"C:\rlm" os.system("robocopy /e /ns /nc /nfl /ndl /np %s %s" % (srcRlmDir, dstRlmDir)) #拷贝lic文件夹到C盘 开启rlm RLMServer_path = self._PluginDir + r"\RLMServer" self.MyLog(RLMServer_path) if os.path.exists(RLMServer_path): srcRlmDir = self._PluginDir + r"\RLMServer" dstRlmDir = r"C:\RLMServer" os.system("robocopy /e /ns /nc /nfl /ndl /np %s %s" % (srcRlmDir, dstRlmDir)) #开启rlm os.system(r'start C:\RLMServer\rlm_shave.exe') #设置lic环境变量 if not os.environ.has_key('RLM_LICENSE'): os.environ['RLM_LICENSE'] = "[email protected]" else: os.environ['RLM_LICENSE'] = os.environ.get( 'RLM_LICENSE') + r';' + "[email protected]" self.MyLog("9.5v9 license") _PATH_ENV = os.environ.get('PATH') _MAYA_PLUG_IN_PATH = os.environ.get('MAYA_PLUG_IN_PATH') _MAYA_SCRIPT_PATH = os.environ.get('MAYA_SCRIPT_PATH ') _MAYA_MODULE_PATH = os.environ.get('MAYA_MODULE_PATH') _XBMLANGPATH = os.environ.get('XBMLANGPATH') #添加其余环境变量 os.environ['XBMLANGPATH'] = ( _XBMLANGPATH + r";" if _XBMLANGPATH else "") + self._PluginDir + r"/maya_root/icons" os.environ['PATH'] = (_PATH_ENV + r";" if _PATH_ENV else "") + self._PluginDir + r"/maya_root/bin" os.environ['MAYA_PLUG_IN_PATH'] = ( _MAYA_PLUG_IN_PATH + r";" if _MAYA_PLUG_IN_PATH else "") + self._PluginDir + r"/maya_shave/plug-ins" os.environ['MAYA_SCRIPT_PATH'] = ( _MAYA_SCRIPT_PATH + r";" if _MAYA_SCRIPT_PATH else "") + self._PluginDir + r"/maya_shave/scripts" os.environ['MAYA_MODULE_PATH'] = ( _MAYA_MODULE_PATH + r";" if _MAYA_MODULE_PATH else "") + self._PluginDir + r"/maya_root/modules" #以下这条多余 _XBMLANGPATH = os.environ.get('XBMLANGPATH') os.environ['XBMLANGPATH'] = ( _XBMLANGPATH + r";" if _XBMLANGPATH else "") + self._PluginDir + r"/maya_root/icons" _mentalray_EXTENSIONS_PATH = os.environ.get( 'mentalray_EXTENSIONS_PATH') os.environ['mentalray_EXTENSIONS_PATH'] = ( _mentalray_EXTENSIONS_PATH + r";" if _mentalray_EXTENSIONS_PATH else "") + self._PluginDir + self.mentalrayForMayaVersion + r"/shaders" if self.plugins: if 'vrayformaya' in self.plugins: if self.VRAY_FOR_MAYA_VERSION_PLUGINS_x64 not in os.environ: os.environ[ self. VRAY_FOR_MAYA_VERSION_PLUGINS_x64] = self._PluginDir + r"\maya_yeti\bin" else: os.environ[ self. VRAY_FOR_MAYA_VERSION_PLUGINS_x64] = os.environ.get( self.VRAY_FOR_MAYA_VERSION_PLUGINS_x64 ) + r';' + self._PluginDir + r"\maya_yeti\bin" if 'VRAY_PLUGINS_x64' not in os.environ: os.environ[ 'VRAY_PLUGINS_x64'] = self._PluginDir + r"\maya_yeti\bin" else: os.environ['VRAY_PLUGINS_x64'] = os.environ.get( 'VRAY_PLUGINS_x64' ) + r';' + self._PluginDir + r'\maya_yeti\bin' def CopyExtfile(self): D_ROOT = self.Base.get_json_ini('Node_D') EXT_ROOT = self.Base.get_json_ini('MAYA_Plugin_Dir') if self.plugins: if "mtoa" in self.plugins: self.MyLog( "<<<<<<Set arnold for shaveNode Extension file>>>>>>>") ARNOLD_VERSION = self.plugins['mtoa'] #获取arnold路径 ARNOLD_PATH = D_ROOT + r"/mtoa/software/maya%s_mtoa%s" % ( self.cgVersion, ARNOLD_VERSION) extlist = ["2.0.1"] #获取扩展包路径 if ARNOLD_VERSION in extlist: EXT_SHADERS = EXT_ROOT + r"/shaveNode/extensions_for_Mtoa/maya%s_mtoa%s/shaders" % ( self.cgVersion, ARNOLD_VERSION) EXT_FILE = EXT_ROOT + r"/shaveNode/extensions_for_Mtoa/maya%s_mtoa%s/extensions" % ( self.cgVersion, ARNOLD_VERSION) else: extlist.sort() ext_ver = extlist[-1] EXT_SHADERS = EXT_ROOT + r"/shaveNode/extensions_for_Mtoa/maya%s_mtoa%s/shaders" % ( self.cgVersion, ext_ver) EXT_FILE = EXT_ROOT + r"/shaveNode/extensions_for_Mtoa/maya%s_mtoa%s/extensions" % ( self.cgVersion, ext_ver) if not (os.path.exists(EXT_SHADERS) and os.path.exists(EXT_FILE)): self.MyLog( "Current this arnold or maya version don't have shave extsiontion file in B disk,please offer your own file...." ) #拷贝扩展包路径 if not (os.path.exists(ARNOLD_PATH + r"/maya_mtoa/shaders/shave_shaders.dll") and os.path.exists(ARNOLD_PATH + r"/maya_mtoa/extensions/shave.dll") and os.path.exists(ARNOLD_PATH + r"/maya_mtoa/extensions/shave.py")): Shaders_srcDir = EXT_SHADERS Shaders_dstDir = ARNOLD_PATH + r"/maya_mtoa/shaders" os.system("robocopy /s %s %s" % (Shaders_srcDir, Shaders_dstDir)) Ext_srcDir = EXT_FILE Ext_dstDir = ARNOLD_PATH + r"/maya_mtoa/extensions" os.system("robocopy /s %s %s" % (Ext_srcDir, Ext_dstDir)) else: self.MyLog( "This arnold vesion already has the shave extension file " ) self.MyLog( "<<<<<<<Set arnold for shaveNode Extension file env finsh!!!>>>>>>>" )
class RenderManConfig(): def __init__(self, clientInfo): #获取流程脚本传过来的信息 self.MyLog(clientInfo) self.cgName = clientInfo['cgName'] self.cgVersion = clientInfo['cgVersion'] self.pluginName = clientInfo['pluginName'] self.pluginVersion = clientInfo['pluginVersion'] self.plugins = clientInfo['plugins'] #dict self.userId = clientInfo['userId'] self.taskId = clientInfo['taskId'] #import 公共使用的函数 PluginBase ,配置脚本(W2 B:/plugins/maya_new/envInfo.json)信息获取,清理目录,创建目录,找相同命名的压缩包,拷贝文件,拷贝目录,解压文件,编码转换,MD5值校验 self.Base = PluginBase() #获取本地文件夹路径 self._PluginDir = os.path.join( self.Base.get_json_ini('Node_D'), 'renderman', 'software', self.cgName + self.cgVersion + '_' + self.pluginName + self.pluginVersion).replace('\\', '/') self._PluginLogDir = os.path.join(self.Base.get_json_ini('Node_D'), 'renderman', 'logs').replace('\\', '/') self.MyLog(self._PluginDir) def MyLog(self, message, extr="RendermanSetup"): if str(message).strip() != "": print("[%s] %s" % (extr, str(message))) def reCreateMod(self): #获取mod文件,并修改内容 MODULE_PLG_DIR = self._PluginDir + r"/ETC/RENDERMAN_FOR_MAYA.MODULE" MODULE_PLG_CONTENT = "+ RENDERMAN_FOR_MAYA " + self.pluginVersion + " " + self._PluginDir with open(MODULE_PLG_DIR, "w") as f: f.write(MODULE_PLG_CONTENT) def Copyrmps(self): #z7路径 TOOL_DIR = self.Base.get_json_ini('toolDir').replace('\\', '/') _PATH = os.environ.get('PATH') os.environ['PATH'] = (_PATH if _PATH else "") + r";" + TOOL_DIR #\\10.60.100.151\td\plugins\maya_new\renderman\RenderManProServer RMPS_PATH = os.path.join(self.Base.get_json_ini('MAYA_Plugin_Dir'), 'renderman', 'RenderManProServer').replace('\\', '/') RMPS_FILE = "RenderManProServer" + '_' + self.pluginVersion ZIP_FILE = RMPS_FILE + '.7z' #renderman工具包 #\\10.60.100.151\td\plugins\maya_new\renderman\RenderManProServer\RenderManProServer_20.4.7z SERVER_FILE = os.path.join(self.Base.get_json_ini('MAYA_Plugin_Dir'), 'renderman', 'RenderManProServer', RMPS_FILE + '.7z').replace('\\', '/') self.MyLog("server RenderManProServer file:" + SERVER_FILE) LOCAL7Z_PATH = os.path.join(self.Base.get_json_ini('Node_D'), 'renderman', 'source') #D盘插件路径 LOCAL_ROOT = os.path.join(self.Base.get_json_ini('Node_D'), 'renderman', 'software', RMPS_FILE).replace('\\', '/') #拷贝工具包z7到本地,并解压 if os.path.exists(SERVER_FILE): self.MyLog("Copy RenderManProServer !!!!") if not os.path.exists(LOCAL_ROOT): os.makedirs() self.MyLog("RenderManProServer copy : %s/RMPS_COPY.txt" % self._PluginLogDir) COPYPRMPS_CMD = "robocopy /S /NDL /NFL %s %s %s" % ( RMPS_PATH, LOCAL7Z_PATH, ZIP_FILE) LOG_ROOT = open("%s/RMPS_COPY.txt" % self._PluginLogDir, "wt") source_copy = subprocess.Popen(COPYPRMPS_CMD, stdout=LOG_ROOT, shell=True) source_copy.wait() LOG_ROOT.close() self.MyLog("RenderManProServer unzip : %s/RMPS_UNZIP.txt" % self._PluginLogDir) RMPSUNZIP_CMD = TOOL_DIR + r"/7z.exe x -y -aos " + LOCAL7Z_PATH + r"/" + ZIP_FILE + " -o" + LOCAL_ROOT LOG_ROOT = open("%s/RMPS_UNZIP.txt" % self._PluginLogDir, "wt") source_copy = subprocess.Popen(RMPSUNZIP_CMD, stdout=LOG_ROOT, shell=True) source_copy.wait() LOG_ROOT.close() # os.system ("robocopy /S /NDL /NFL %s %s %s" % (RMPS_PATH, LOCAL7Z_PATH,ZIP_FILE)) # subprocess.call(TOOL_DIR + r"/7z.exe x -y -aos " + LOCAL7Z_PATH + r"/" + ZIP_FILE + " -o" + LOCAL_ROOT) else: self.MyLog( "This renderman version dont't has the RenderManProServer file !!!" ) def setEnv(self): #D:\PLUGINS\MAYA\REDSHIFT\software\maya2017_renderman20.12 RMS_TREE = self._PluginDir #D:\PLUGINS\MAYA\REDSHIFT\software\RenderManProServer_20.12 RMPS_PATH = os.path.join( self.Base.get_json_ini('Node_D'), 'renderman', 'software', "RenderManProServer" + '_' + self.pluginVersion).replace( '\\', '/') __MAYA_MODULE_PATH = RMS_TREE + r"/etc" __MAYA_PLUG_IN_PATH = RMS_TREE + r"/plug-ins" __MAYA_SCRIPT_PATH = RMS_TREE + r"/scripts" + ";" __MAYA_RENDER_DESC_PATH = RMS_TREE + r"/etc" __XBMLANGPATH = RMS_TREE + r"/icons" __PATH = RMS_TREE + r"/bin;" + RMPS_PATH + "/bin" _MMP = os.environ.get('MAYA_MODULE_PATH') _MPIP = os.environ.get('MAYA_PLUG_IN_PATH') _MSP = os.environ.get('MAYA_SCRIPT_PATH') _MRDP = os.environ.get('MAYA_RENDER_DESC_PATH') _XBMP = os.environ.get('XBMLANGPATH') _PATH = os.environ.get('PATH') # add to system env self.MyLog("Set renderman license !!!") #拷贝B盘的lic文件夹到本地D盘 SERVER_PIXAR_LICENSE_PATH = os.path.join( self.Base.get_json_ini('MAYA_Plugin_Dir'), 'renderman', 'license', 'locknode').replace('\\', '/') LOCAL_PIXAR_LICENSE_PATH = os.path.join( self.Base.get_json_ini('Node_D'), 'renderman', 'license').replace('\\', '/') LICENSE_NAMEE = "pixar.license" LOCAL_lICENSE_FILE = LOCAL_PIXAR_LICENSE_PATH + r'/' + LICENSE_NAMEE os.system("robocopy /S /NDL /NFL %s %s %s" % (SERVER_PIXAR_LICENSE_PATH, LOCAL_PIXAR_LICENSE_PATH, LICENSE_NAMEE)) #设置lic的环境变量 os.environ['PIXAR_LICENSE_FILE'] = LOCAL_lICENSE_FILE self.MyLog("RenderMan license local :" + os.environ['PIXAR_LICENSE_FILE']) #设置其余环境变量 os.environ['RMSTREE'] = RMS_TREE os.environ['RMANTREE'] = RMPS_PATH os.environ['MAYA_MODULE_PATH'] = (_MMP if _MMP else "") + r";" + __MAYA_MODULE_PATH os.environ['MAYA_PLUG_IN_PATH'] = (_MPIP if _MPIP else "") + r";" + __MAYA_PLUG_IN_PATH os.environ['MAYA_SCRIPT_PATH'] = (_MSP if _MSP else "") + r";" + __MAYA_SCRIPT_PATH os.environ['MAYA_RENDER_DESC_PATH'] = ( _MRDP if _MRDP else "") + r";" + __MAYA_RENDER_DESC_PATH os.environ['XBMLANGPATH'] = (_XBMP if _XBMP else "") + r";" + __XBMLANGPATH os.environ['PATH'] = (_PATH if _PATH else "") + r";" + __PATH #以下是废话 _MMP = os.environ.get('MAYA_MODULE_PATH') _MPIP = os.environ.get('MAYA_PLUG_IN_PATH') _MSP = os.environ.get('MAYA_SCRIPT_PATH') _MRDP = os.environ.get('MAYA_RENDER_DESC_PATH') _XBMP = os.environ.get('XBMLANGPATH') _PATH = os.environ.get('PATH')
def main(*args): clientInfo = args[0] cgName = clientInfo['cgName'] #str cgVersion = clientInfo['cgVersion']#str plugins = clientInfo['plugins'] #dict userId = clientInfo['userId']#str taskId = clientInfo['taskId']#str #调用主的插件配置流程脚本 MayaPlugin.py,获取 插件在D盘的位置。 Base = PluginBase() mtoa_ver = plugins["mtoa"] mtoa_plugin_dir = os.path.join(Base.get_json_ini('Node_D'),"mtoa",'software',cgName + cgVersion + '_' + "mtoa" + mtoa_ver).replace('\\','/') #定制mklink if os.path.exists('D:/METRO'): os.system(r'rd /s/q "%s"' % "D:/METRO") os.system(r"mklink /d D:\METRO \\10.60.100.101\d\inputdata5\100016000\100016371\D\METRO") print("mklink \\10.60.100.101\d\inputdata5\100016000\100016371\D\METRO ---> D:\METRO ") #根据软件版本定制渲染层方式 if cgVersion=='2017': os.environ['MAYA_ENABLE_LEGACY_RENDER_LAYERS'] = '0' #定制rendersetup 方式 ,1 为renderlayer方式 print ("ENABLE_LEGACY_RENDER_LAYERS finis !!!") if cgVersion=='2015': srcDir=r"B:/custom_config/1840132/2015-x64/prefs" dstDir=r"C:/Users/enfuzion/Documents/maya/2015-x64/prefs" os.system ("robocopy /s %s %s" % (srcDir, dstDir)) #拷贝预设 print("set mentalRay batch option") if cgVersion=='2016.5': os.environ['MAYA_APP_DIR'] = r"B:/custom_config/1840132/MAYA_Home" #定制首选项 print ("Set maya 2016.5 prefer to B:/custom_config/1840132/MAYA_Home") print (os.environ.get('MAYA_APP_DIR')) #定制自定义插件 alshader if plugins: if 'alshader' not in plugins: _ARNOLD_PLUGIN_PATH=os.environ.get('ARNOLD_PLUGIN_PATH') _MTOA_TEMPLATES_PATH=os.environ.get('MTOA_TEMPLATES_PATH') _MAYA_CUSTOM_TEMPLATE_PATH=os.environ.get('MAYA_CUSTOM_TEMPLATE_PATH') os.environ['MAYA_CUSTOM_TEMPLATE_PATH'] = (_MAYA_CUSTOM_TEMPLATE_PATH if _MAYA_CUSTOM_TEMPLATE_PATH else "") + r";" + r"B:/custom_config/1840132/alShaders-win-1.0.0rc17-ai4.2.12.2/aexml" os.environ['ARNOLD_PLUGIN_PATH'] = (_ARNOLD_PLUGIN_PATH if _ARNOLD_PLUGIN_PATH else "") + r";" + r"B:/custom_config/1840132/alShaders-win-1.0.0rc17-ai4.2.12.2/bin" os.environ['MTOA_TEMPLATES_PATH'] = (_MTOA_TEMPLATES_PATH if _MTOA_TEMPLATES_PATH else "") + r";" + r"B:/custom_config/1840132/alShaders-win-1.0.0rc17-ai4.2.12.2/ae" print("SET custom alshader(rc17) env finish!!!") #定制自定义环境变量,做mklink,及映射 os.environ['upServerPath'] = "//nas/data/PipePrj" os.environ['cocoN'] = "//nas/outsource/nezha_out" os.environ['upLocalCachePath'] = "//10.60.200.102/d/inputdata5/1908000/1908106/d/PipePrjCache/" hostFile = r"C:/Windows/System32/drivers/etc/hosts" ip = "10.60.200.102" net = "nas" f= open(hostFile,'r') lines = f.readlines() f.close() for line in lines[:]: if line.strip(): if ip in line.strip() or net in line.strip() : lines.remove(line) else: lines.remove(line) lines.append("\n%s %s\n" %(ip, net)) print ("\nhost %s == %s\n" %(ip, net)) f= open(hostFile,'w') for line in lines: f.write(line) f.close() print ("maklin finished!!") print ("you can access \\nas") if not os.path.exists('N:'): os.system(r'net use N: \\10.60.200.102\d\inputdata5\1908000\1908106\N') print("maping N") if not os.path.exists('Y:'): os.system(r'net use Y: \\10.60.200.102\d\inputdata5\1908000\1908106\Y') print("mapping Y")
class GolaemCrowdConfig(): def __init__(self,clientInfo): # self.MyLog(clientInfo) self.cgName = clientInfo['cgName'] self.cgVersion = clientInfo['cgVersion'] self.pluginName = clientInfo['pluginName'] self.pluginVersion = clientInfo['pluginVersion'] self.plugins = clientInfo['plugins'] #dict self.userId = clientInfo['userId'] self.taskId = clientInfo['taskId'] self.Base = PluginBase() self._PluginDir = os.path.join(self.Base.get_json_ini('Node_D'),'GolaemCrowd','software',self.cgName + self.cgVersion + '_' + self.pluginName + self.pluginVersion).replace('\\','/') self.MyLog(self._PluginDir) def MyLog(self,message,extr="GolaemCrowdSetup"): if str(message).strip() != "": print("[%s] %s"%(extr,str(message))) def reCreateMod(self): #D盘mod文件夹路径 MODULES_LOCAL = self._PluginDir + r"/Golaem_init/Golaem-%s-Maya%s"%(self.pluginVersion,self.cgVersion) if not os.path.exists(MODULES_LOCAL): os.makedirs(MODULES_LOCAL) #D盘mod文件路径 module_file = self._PluginDir + r"/Golaem_init/Golaem-%s-Maya%s/glmCrowd.mod"%(self.pluginVersion,self.cgVersion) #专门存放mod的路径 NEW_MODULE_FILE = self._PluginDir +r"/Golaem_module/glmCrowd.mod" #拷贝mod if os.path.exists(module_file): shutil.copy(module_file,NEW_MODULE_FILE) #修改mod文件,只修改第一行 if os.path.exists(module_file): fp = open(module_file,'r') lines = fp.readlines() fp.close() lines[0] = "+ glmCrowd %s %s \n"%(self.pluginVersion,NEW_MODULE_FILE) fp = open(NEW_MODULE_FILE,'r+') for s in lines: fp.writelines(s) fp.close() def setEnv(self): #获取破解文件夹 AMPED_path = self._PluginDir + r"/Golaem_room/Golaem" if os.path.exists(AMPED_path): #结束进程,拷贝破解文件夹到C盘及启动rlm os.system(r'wmic process where name="rlm_golaem.exe" delete') dstDir=r'"C:\Golaem"' os.system ("robocopy /e /ns /nc /nfl /ndl /np %s %s" % (AMPED_path, dstDir)) os.system(r'start C:\Golaem\rlm_golaem.exe') #设置lic环境变量 _golaem_LICENSE = os.environ.get('golaem_LICENSE ') os.environ['golaem_LICENSE'] = (_golaem_LICENSE + r";" if _golaem_LICENSE else "") + r'[email protected]' self.MyLog("Golaem license local :" + os.environ['golaem_LICENSE'] ) #设置其他变量 _MAYA_MODULE_PATH = os.environ.get('MAYA_MODULE_PATH') os.environ['MAYA_MODULE_PATH'] = (_MAYA_MODULE_PATH + r";" if _MAYA_MODULE_PATH else "") + self._PluginDir + r"/Golaem_module" print os.environ.get('MAYA_MODULE_PATH') print("\n") pluginList = clientInfo['plugins'] if pluginList: if 'mtoa' in pluginList: _ARNOLD_PROCEDURAL_PATH = os.os.environ.get("ARNOLD_PROCEDURAL_PATH") _ARNOLD_PLUGIN_PATH = os.os.environ.get("ARNOLD_PLUGIN_PATH") os.environ['ARNOLD_PROCEDURAL_PATH'] = (_ARNOLD_PROCEDURAL_PATH + r";" if _ARNOLD_PROCEDURAL_PATH else "") + self._PluginDir + r"/Golaem_init/Golaem-%s-Maya%s/procedurals" % (self.cgVersion,self.pluginVersion) os.environ['ARNOLD_PLUGIN_PATH'] = (_ARNOLD_PLUGIN_PATH + r";" if _ARNOLD_PLUGIN_PATH else "") + self._PluginDir + r"/Golaem_init/Golaem-%s-Maya%s/shaders" % (self.cgVersion,self.pluginVersion) if 'vrayformaya' in pluginList: if self.cgVersion == "2016.5": maya_ver = "2016_5" else: maya_ver = self.cgVersion VRAY_FOR_MAYA_PLUGINS_x64 = "VRAY_FOR_MAYA%s_PLUGINS_x64" % (maya_ver) _VRAY_FOR_MAYA_PLUGINS_x64 = os.os.environ.get("VRAY_FOR_MAYA_PLUGINS_x64") _VRAY_FOR_MAYA_SHADERS = os.os.environ.get("VRAY_FOR_MAYA_SHADERS") os.environ['VRAY_FOR_MAYA_PLUGINS_x64'] = (_VRAY_FOR_MAYA_PLUGINS_x64 + r";" if _VRAY_FOR_MAYA_PLUGINS_x64 else "") + self._PluginDir + r"/Golaem_init/Golaem-%s-Maya%s/procedurals" % (self.cgVersion,self.pluginVersion) os.environ['VRAY_FOR_MAYA_SHADERS'] = (_VRAY_FOR_MAYA_SHADERS + r";" if _VRAY_FOR_MAYA_SHADERS else "") + self._PluginDir + r"/Golaem_init/Golaem-%s-Maya%s/shaders" % (self.cgVersion,self.pluginVersion)