def RB_POST_RESET_NODE(self): CLASS_MAX_UTIL.killMaxVray(self.G_DEBUG_LOG) time.sleep(3) self.G_DEBUG_LOG.info('DEBUG_TASKKILL_MAXADAPTER') try: os.system('taskkill /F /IM maxadapter.adp.exe /T') except Exception, e: self.G_DEBUG_LOG.info('taskkill maxadapter.adp.exe exeception') self.G_DEBUG_LOG.info(e)
def RB_CONFIG(self): self.format_log('渲染配置', 'start') self.G_DEBUG_LOG.info('[RenderMax.RB_CONFIG.start.....]') CLASS_MAX_UTIL.killMaxVray( self.G_DEBUG_LOG) #kill 3dsmax.exe,3dsmaxcmd.exe,vrayspawner*.exe #----------------start grab_service------------------- grabServer = r'C:/work/munu_client/grab_service/grab_service.exe' self.G_DEBUG_LOG.info(grabServer) if os.path.exists(grabServer) and CLASS_MAX_UTIL.checkProcess( 'grab_service'): self.G_DEBUG_LOG.info('start grab_service') os.system('start ' + grabServer) #----------------check config file------------------- if self.G_CG_VERSION == '3ds Max 2012' or self.G_CG_VERSION == '3ds Max 2011' or self.G_CG_VERSION == '3ds Max 2010' or self.G_CG_VERSION == '3ds Max 2009': self.G_MAX_SCRIPT_NAME = 'rendera1.3.ms' else: self.G_MAX_SCRIPT_NAME = 'renderu1.3.ms' self.G_DEBUG_LOG.info('maxscriptName------' + self.G_MAX_SCRIPT_NAME) custom_script_path = os.path.join(self.G_MAX_SCRIPT, 'user', self.G_USER_ID) custom_ms = os.path.join(custom_script_path, self.G_MAX_SCRIPT_NAME) custom_bat = os.path.join(custom_script_path, self.G_CUSTOM_BAT_NAME) max_ini = os.path.join(self.G_MAX_B, 'ini', '3dsmax', self.G_CG_VERSION, '3dsmax.ini') max_user_ini = os.path.join(self.G_MAX_B, 'ini', '3dsmax', self.G_USER_ID, self.G_CG_VERSION, '3dsmax.ini') user_host_file = os.path.join(custom_script_path, self.G_USER_HOST_NAME) net_render_txt = os.path.join(self.G_MAX_SCRIPT, 'user', self.G_USER_ID, 'netrender.txt') config_file_list = [ custom_script_path, custom_ms, custom_bat, max_ini, max_user_ini, user_host_file, net_render_txt ] self.check_config_file(config_file_list) #----------------load max plugin------------------- self.G_DEBUG_LOG.info('插件配置') max_plugin = MaxPlugin(self.G_CG_CONFIG_DICT, self.G_DEBUG_LOG) max_plugin.config() #----------------write vray_dr.cfg------------------- self.vray_distribute_root() #----------------subst path------------------ if not os.path.exists(net_render_txt): self.subst_path() #-----------render.ms-------- self.G_RAYVISION_MAX_MS = os.path.join(self.G_MAX_SCRIPT, self.G_MAX_SCRIPT_NAME).replace( '\\', '/') if os.path.exists(custom_ms): self.G_RAYVISION_MAX_MS = custom_ms #----------delete max log---------- user_profile = os.environ["userprofile"] max_enu = user_profile + '\\AppData\\Local\\Autodesk\\3dsMax\\' + self.G_CG_VERSION.replace( '3ds Max ', '') + ' - 64bit\\enu' max_log = max_enu + '\\Network\\Max.log' self.G_DEBUG_LOG.info(max_log) if os.path.exists(max_log): try: os.remove(max_log) except Exception, e: self.G_DEBUG_LOG.info(e)
def RB_CONFIG(self): self.format_log('渲染配置','start') self.G_DEBUG_LOG.info('[RenderMax.RB_CONFIG.start.....]') CLASS_MAX_UTIL.killMaxVray(self.G_DEBUG_LOG) #kill 3dsmax.exe,3dsmaxcmd.exe,vrayspawner*.exe #----------------start grab_service------------------- grabServer=r'C:/work/munu_client/grab_service/grab_service.exe' self.G_DEBUG_LOG.info(grabServer) if os.path.exists(grabServer) and CLASS_MAX_UTIL.checkProcess('grab_service'): self.G_DEBUG_LOG.info('start grab_service') os.system('start '+grabServer) #----------------check config file------------------- if self.G_CG_VERSION=='3ds Max 2012' or self.G_CG_VERSION=='3ds Max 2011' or self.G_CG_VERSION=='3ds Max 2010' or self.G_CG_VERSION=='3ds Max 2009': self.G_MAX_SCRIPT_NAME='rendera1.3.ms' else: self.G_MAX_SCRIPT_NAME='renderu1.3.ms' self.G_DEBUG_LOG.info('maxscriptName------'+self.G_MAX_SCRIPT_NAME) custom_script_path=os.path.join(self.G_MAX_SCRIPT,'user',self.G_USER_ID) custom_ms=os.path.join(custom_script_path,self.G_MAX_SCRIPT_NAME) custom_bat=os.path.join(custom_script_path,self.G_CUSTOM_BAT_NAME) max_ini=os.path.join(self.G_MAX_B,'ini','3dsmax',self.G_CG_VERSION,'3dsmax.ini') max_user_ini=os.path.join(self.G_MAX_B,'ini','3dsmax',self.G_USER_ID,self.G_CG_VERSION,'3dsmax.ini') user_host_file=os.path.join(custom_script_path,self.G_USER_HOST_NAME) net_render_txt=os.path.join(self.G_MAX_SCRIPT,'user',self.G_USER_ID,'netrender.txt') config_file_list=[custom_script_path,custom_ms,custom_bat,max_ini,max_user_ini,user_host_file,net_render_txt] self.check_config_file(config_file_list) #----------------load max plugin------------------- self.G_DEBUG_LOG.info('插件配置') max_plugin=MaxPlugin(self.G_CG_CONFIG_DICT,self.G_DEBUG_LOG) max_plugin.config() #----------------write vray_dr.cfg------------------- self.vray_distribute_root() #----------------subst path------------------ if not os.path.exists(net_render_txt): self.subst_path() #-----------render.ms-------- self.G_RAYVISION_MAX_MS=os.path.join(self.G_MAX_SCRIPT,self.G_MAX_SCRIPT_NAME).replace('\\','/') if os.path.exists(custom_ms): self.G_RAYVISION_MAX_MS=custom_ms #----------delete max log---------- user_profile=os.environ["userprofile"] max_enu=user_profile+'\\AppData\\Local\\Autodesk\\3dsMax\\'+self.G_CG_VERSION.replace('3ds Max ','')+' - 64bit\\enu' max_log=max_enu+'\\Network\\Max.log' self.G_DEBUG_LOG.info(max_log) if os.path.exists(max_log): try: os.remove(max_log) except Exception as e: self.G_DEBUG_LOG.info(e) #----------delete vary log---------- user_temp_file=os.environ["temp"] my_temp_vray_log=os.path.join(user_temp_file,'vraylog.txt').replace('\\','/') self.G_DEBUG_LOG.info(my_temp_vray_log) if os.path.exists(my_temp_vray_log): try: os.remove(my_temp_vray_log) except Exception as e: self.G_DEBUG_LOG.info(e) #----------Customer 3dsmax.ini---------- try: if os.path.exists(max_ini) and os.path.exists(max_enu) : copy_max_ini_cmd='xcopy /y /v /f "'+max_ini +'" "'+max_enu.replace('\\','/')+'/"' if os.path.exists(max_user_ini) and os.path.exists(max_enu) : copy_max_ini_cmd='xcopy /y /v /f "'+max_user_ini +'" "'+max_enu.replace('\\','/')+'/"' self.G_DEBUG_LOG.info(copy_max_ini_cmd) CLASS_COMMON_UTIL.cmd(copy_max_ini_cmd,my_log=self.G_DEBUG_LOG) except Exception as e: self.G_DEBUG_LOG.info('[err].3dsmaxIni Exception') self.G_DEBUG_LOG.info(e) #------------CurrentDefaults.ini---------- default_max=os.path.join(max_enu,'en-US/defaults/MAX').replace('\\','/')+'/' if self.G_CG_VERSION=='3ds Max 2010' or self.G_CG_VERSION=='3ds Max 2011' or self.G_CG_VERSION=='3ds Max 2012': default_max=os.path.join(max_enu,'defaults/MAX').replace('\\','/')+'/' if 'gamma' in self.G_TASK_JSON_DICT['scene_info_render']['common']: current_default_ini_gamma=os.path.join(self.G_MAX_B,'ini/3dsmaxDefault/gammaOn',self.G_CG_VERSION,'CurrentDefaults.ini').replace('\\','/') if self.G_TASK_JSON_DICT['scene_info_render']['common']['gamma'] == 'off': current_default_ini_gamma=os.path.join(self.G_MAX_B,'ini/3dsmaxDefault/gammaOff',self.G_CG_VERSION,'CurrentDefaults.ini').replace('\\','/') self.G_DEBUG_LOG.info('---current_default_ini_gamma---') self.G_DEBUG_LOG.info(current_default_ini_gamma) if os.path.exists(current_default_ini_gamma): copy_default_max_ini_cmd='xcopy /y /v /f "'+current_default_ini_gamma +'" "'+default_max+'"' self.G_DEBUG_LOG.info(copy_default_max_ini_cmd) CLASS_COMMON_UTIL.cmd(copy_default_max_ini_cmd,my_log=self.G_DEBUG_LOG) #------------custom.bat---------- if os.path.exists(custom_bat): custom_cmd=custom_bat+' "'+self.G_USER_ID+'" "'+self.G_TASK_ID+'" ' self.G_DEBUG_LOG.info('执行custom.bat定制脚本') CLASS_COMMON_UTIL.cmd(custom_cmd,my_log=self.G_DEBUG_LOG) #------------host---------- self.config_host(user_host_file) #------------red shift license---------- try: # self.G_DEBUG_LOG.info('environ redshift_license [email protected]') # os.environ['redshift_license']='[email protected]' self.G_DEBUG_LOG.info('environ redshift_license') license_env_path = os.path.join(self.G_MAX_B,'ini','config','license_env.json') with open(license_env_path,'r') as pl: pl_dict = json.load(pl) self.G_DEBUG_LOG.info(pl_dict) if 'plugins' in self.G_CG_CONFIG_DICT: for plugins_key in list(self.G_CG_CONFIG_DICT['plugins'].keys()): plugin_str = plugins_key + self.G_CG_CONFIG_DICT['plugins'][plugins_key] if plugin_str in pl_dict: env_name = pl_dict[plugin_str]["env_name"] env_value = pl_dict[plugin_str]["env_value"] os.environ[env_name]=env_value except Exception as e: self.G_DEBUG_LOG.info('[err].red shift license env') self.G_DEBUG_LOG.info(e) #------------max cmd render---------- # maxCmdTxt=os.path.join(self.G_MAXSCRIPT,'user',self.G_USERID,'maxcmd.txt').replace('\\','/') max_cmd_txt=os.path.join(self.G_MAX_SCRIPT,'user',self.G_USER_ID,'maxcmd.txt') if os.path.exists(max_cmd_txt): self.MAX_CMD_RENDER=True if 'render_type' in self.G_TASK_JSON_DICT['miscellaneous'] and self.G_TASK_JSON_DICT['miscellaneous']['render_type'] == 'maxcmd': self.MAX_CMD_RENDER=True # if self.MAX_CMD_RENDER: # self.G_CG_PROCESS_FLAG = 1 self.G_DEBUG_LOG.info('MAX_CMD_RENDER=' + str(self.MAX_CMD_RENDER)) #----------------------get max file----------------------- self.MAX_FILE = self.get_max_file(self.G_INPUT_CG_FILE) #maxlog.txt,vray.log #max plugin #host #3dsmax.ini,CurrentDefaults #red shift license #custom.bat self.G_DEBUG_LOG.info('[RenderMax.RB_CONFIG.end.....]') self.format_log('done','end')