forked from sideeffects/HoudiniEngineForMaya
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhoudiniEngineUtils.mel
70 lines (54 loc) · 1.41 KB
/
houdiniEngineUtils.mel
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
64
65
66
67
68
69
70
global proc string[]
houdiniEngine_getSelectedAssetNodes()
{
string $selections[] = `ls -selection -long`;
string $assetNodes[];
for($selection in $selections)
{
string $current = $selection;
while(true)
{
if(`objectType -isAType "houdiniAsset" $current`)
{
$assetNodes[size($assetNodes)] = $current;
break;
}
// Search the parents
string $parents[] = `listRelatives -parent -fullPath $current`;
if(!size($parents))
{
break;
}
$current = $parents[0];
}
}
return $assetNodes;
}
global proc
houdiniEngine_run(string $cmds[])
{
int $isLinux = `about -linux`;
int $isWindows = `about -win`;
int $isMac = `about -mac`;
string $final_cmd;
if($isLinux || $isMac)
{
$final_cmd += "( ";
if($isLinux)
{
$final_cmd += "unset LD_LIBRARY_PATH; ";
}
$final_cmd += "PATH=\"$HFS/bin:$PATH\"; ";
$final_cmd += stringArrayToString($cmds, " ; ");
$final_cmd += " ) &";
}
else if($isWindows)
{
$final_cmd += "start cmd /c \"";
// PATH should already be set on Windows.
string $temp = stringArrayToString($cmds, " & ");
$final_cmd += $temp;
$final_cmd += "\"";
}
system($final_cmd);
}