houdini环境变量配置代码

 

import hou
import os
import ctypes
from ctypes.wintypes import MAX_PATH

hou.pwd()

def xie():
dll = ctypes.windll.shell32#--------------------------查找 '我的文档' 地址
buf = ctypes.create_unicode_buffer(MAX_PATH + 1)

ban = int(hou.pwd().parm('banben').eval())
dict = {0:"houdini18.5",1:"houdini18.0",2:"houdini17.5",3:"houdini17.0",4:"houdini16.5"}
banb = str(dict.get(ban))
# print(banb)
if dll.SHGetSpecialFolderPathW(None,buf,0x0005,False):
dizhi = buf.value + '/' + banb
if os.path.exists(dizhi) == 0:
os.makedirs(dizhi)
else:
print('失败了!!!')

# hou.pwd().parm(lujing_2).set('X:\common\Eff\HDA\Python_Script')

a = []
cishu = hou.pwd().parm('shuliang').eval()
for i in range(cishu):
canshu = str('lujing_' + str(i + 1))
dizhii = hou.pwd().parm(canshu).eval()
a.append(dizhii)
lujing = str(';'.join(a))#把路径拼起来

bang = hou.pwd().parm('newparameter73').eval()
if bang:
bangkai = 'HOUDINI_EXTERNAL_HELP_BROWSER = 1'
else:
bangkai = ''

bianliang = '''#
# Houdini Environment Settings
#
# The contents of this file are read into the environment
# at startup. They will override any existing entries in
# the environment.
#
# The syntax is one entry per line as follows:
# VAR = VALUE
#
# Values may be quoted
# VAR = "VALUE"
#
# Values may be empty
# VAR =
#

# Example:
#
# HOUDINI_NO_SPLASH = 1

HOUDINI_OTLSCAN_PATH = "''' + lujing + ''';&"''' + bangkai

wenjian = open(dizhi + '/houdini.env','w')#-------------------读写文件
wenjian.write(bianliang)
wenjian.close

 

 

点赞

发表回复

昵称和uid可以选填一个,填邮箱必填(留言回复后将会发邮件给你)
tips:输入uid可以快速获得你的昵称和头像