Houdini autofinder

This commit is contained in:
Kuba Winnicki 2019-06-27 00:34:15 +02:00
parent 435b27961d
commit 9aabe09269
2 changed files with 43 additions and 12 deletions

View File

@ -41,6 +41,7 @@ def rop_redshift():
rop.parm('PrimaryGIEngine').set('RS_GIENGINE_BRUTE_FORCE')
rop.parm('SecondaryGIEngine').set('RS_GIENGINE_PHOTON_MAPPING')
rop.parm('UnifiedMaxSamples').set('1024')
rop.parm('UnifiedAdaptiveErrorThreshold').set('0.001')
rop.parm('RS_iprUpdateMeshDeform').set(True)
ipr = out.node('Redshift_IPR1')
if not ipr:

54
houy.py
View File

@ -1,27 +1,46 @@
#!/usr/bin/python3
from subprocess import call
from sys import argv, platform, exit, stderr
from os import environ, getenv, chdir
import shlex
import subprocess
from pathlib import Path
if __name__ == '__main__':
r = {environ.get('PATH')}
setup_path = getenv('HFS')
if not setup_path:
# Use static paths
setup = {
'darwin': '/Applications/Houdini/Houdini17.5.173/Frameworks/Houdini.framework/Versions/Current/Resources',
'linux': '/opt/hfs17.5.229',
'win32': r'C:\Program Files\Side Effects Software\Houdini 17.5.173'
def enter_hfs():
if '-hfs' not in argv:
print('__ HouY __')
hfs = getenv('HFS')
if not hfs:
print('Houdini Environment not yet initialized. Boostraping...', file=stderr)
hfsen = {
'darwin': Path('/Applications/Houdini').glob('Houdini*/Frameworks/Houdini.framework/Versions/Current/Resources'),
'linux': Path('/opt').glob('hfs*'),
'win32': Path(r'C:\Program Files\Side Effects Software').glob('Houdini *'),
}
if platform not in setup.keys():
if platform not in hfsen.keys():
print('Platform `{}` not supported... yet.'.format(platform), file=stderr)
exit(1)
setup_path = setup[platform]
chdir(setup_path)
if hfsen.get(platform):
h = list(hfsen[platform])
print('Found: ', ', '.join(f.name for f in h), '*', sep='')
hfs = h[-1]
else:
print("ERROR - couldn't find HFS")
exit(1)
if platform == 'win32' and '-hfs' not in argv:
argv.append('-hfs')
call([str(hfs/"bin/hcmd.exe"), '/c', *argv])
exit()
print('Current HFS:', hfs)
chdir(hfs)
return hfs
def welcome_redshift():
if platform == 'win32':
if '-rs3' in argv:
redshift_path = 'C:/ProgramData/Redshift3'
@ -32,6 +51,13 @@ if __name__ == '__main__':
redshift_path = '/opt/redshift3'
else:
redshift_path = '/opt/redshift'
return redshift_path
if __name__ == '__main__':
enter_hfs()
redshift_path = welcome_redshift()
if redshift_path:
print('Redshift:', redshift_path)
environ.update({
'HOUDINI_NO_SPLASH': '1',
@ -43,6 +69,10 @@ if __name__ == '__main__':
'HOUDINI_OCL_DEVICENUMBER': '0',
'HOUDINI_PATH': "{}/Plugins/Houdini/17.5.173;&".format(redshift_path),
})
if platform == 'win32':
print()
print('For OpenGL support remotely run this as an administrator:')
print(r'c:\Windows\System32\tscon.exe {} /dest:console'.format(getenv('SessionName')))
# Initialize env vars.
if platform != 'win32':