-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkitsu_task_launch.py
More file actions
63 lines (56 loc) · 1.81 KB
/
Copy pathkitsu_task_launch.py
File metadata and controls
63 lines (56 loc) · 1.81 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
# launch_kitsu_task_panel.py
# -*- coding: utf-8 -*-
# Launcher for Kitsu Task Panel.
# Works in Nuke, Maya, Houdini, Blender and standalone Python.
#
# Usage (shelf button / menu item — same for all DCCs):
#
# import sys
# sys.path.insert(0, "/path/to/kitsu_task_panel_folder")
# import launch_kitsu_task_panel, importlib
# importlib.reload(launch_kitsu_task_panel)
# launch_kitsu_task_panel.launch()
#
# The only hard requirement is that this file and kitsu_task_panel.py share
# the same folder, and that kitsu_task_panel_config.json is reachable
# (same folder or home directory).
import sys
import os
import importlib
def launch():
# Make sure the folder that contains this launcher is on sys.path
# so kitsu_task_panel.py can always be found.
_here = os.path.dirname(os.path.abspath(__file__))
if _here not in sys.path:
sys.path.insert(0, _here)
try:
import kitsu_task_context_detection
import kitsu_task_panel
importlib.reload(kitsu_task_context_detection)
importlib.reload(kitsu_task_panel)
except ImportError as e:
msg = "KitsuTaskPanel: could not import required module: " + str(e)
print(msg)
# Try to surface the error inside the active DCC
try:
import maya.cmds as cmds
cmds.confirmDialog(title="Import Error", message=msg)
return
except ImportError:
pass
try:
import hou
hou.ui.displayMessage(msg, severity=hou.severityType.Error)
return
except ImportError:
pass
try:
import bpy
print(msg) # Blender: error appears in console
return
except ImportError:
pass
return
kitsu_task_panel.show()
if __name__ == "__main__":
launch()