This repository was archived by the owner on Oct 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhtot_OnCreated.py
51 lines (41 loc) · 1.91 KB
/
htot_OnCreated.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:module: htot.htot_OnCreated
:platform: Windows
:description: HtoT node 'OnCreated' callback script
This file is just a copy of what's inside the HDA "Script" tab
:author: Valentin David <[email protected]>
:license: MIT License
"""
# --------------------------------------------------------------------------------------------------
# Python built-in modules import
# --------------------------------------------------------------------------------------------------
import os
import logging as log
# --------------------------------------------------------------------------------------------------
# Third-party modules import
# --------------------------------------------------------------------------------------------------
import hou
# --------------------------------------------------------------------------------------------------
# Globals
# --------------------------------------------------------------------------------------------------
log.basicConfig(level='DEBUG')
# --------------------------------------------------------------------------------------------------
# Definitions
# --------------------------------------------------------------------------------------------------
def onCreated():
"""HtoT node 'OnCreated' callback script
This will check if the current machine can import the tractor module
"""
try:
import tractor
except ImportError:
errorMsg = 'Could not import tractor module, you wont be able to use HtoT until this is fixed\n' \
'You can try adding the Tractor API path to your PYTHONPATH environment variable'
hou.ui.displayMessage(text=errorMsg, severity=hou.severityType.Error)
return
# Set Tractor url parm
engine = os.environ.get('TRACTOR_ENGINE') or 'tractor-engine'
kwargs.get('node').parm('tractorUrl').set('http://{}/tv/'.format(engine))
onCreated()