-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcpshadingsets.mel
More file actions
33 lines (33 loc) · 833 Bytes
/
cpshadingsets.mel
File metadata and controls
33 lines (33 loc) · 833 Bytes
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
// select two objs
global proc string[] cpshadingsets(){
string $lssl[] = `ls -sl`;
string $tmpls[] = ls("-type","shadingEngine", `listHistory -f 1 $lssl[0]`);
string $sg[] = stringArrayRemove ({"initialShadingGroup"}, $tmpls);
for ($set in $sg){
$tmpls = `selbySG $set $lssl[0] $lssl[1]`;
if (size($tmpls))
sets -e -fe $set $tmpls; // -fe very importanto!
}
return $sg;
}
//rdy to tearoff
global proc string[] selbySG(string $se, string $sobj, string $tobj){
if (!`objectType -i shadingEngine $se`)
return {};
$lsse = `sets -q $se`;
if ($sobj!=""){
string $newls[];
int $h=0;
string $ho;
for ($ho in $lsse)
if (gmatch((string)$ho,($sobj+"*")))
$newls[$h++]=$ho;
if ($tobj!=""){
$h=0;
for ($ho in $newls)
$newls[$h++]=substitute($sobj,$ho,$tobj);
}
return $newls;
}
return $lsse;
}