-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsavepar.mel
More file actions
40 lines (38 loc) · 1.02 KB
/
savepar.mel
File metadata and controls
40 lines (38 loc) · 1.02 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
//v0.1a
global proc savepar(){
$at = "parentInfo";
for ($sel in `ls -sl`){
$ls_par = `listRelatives -p -f $sel`;
if (!size($ls_par))
contninue;
$plg = $sel + "." + $at;
if (!`objExists $plg`)
addAttr -dt "string" -ln $at $sel;
setAttr -typ "string" $plg $ls_par[0];
}
}
global proc repar(){
$at = "parentInfo";
string $sel;
for ($sel in `ls -sl`){
$plg = $sel + "." + $at;
if (!`objExists $plg`){
print {" parentInfo not exist: " + $sel};
continue;
}
// setAttr -typ "string" $plg $ls_par[0];
$par = `getAttr $plg`;
if (!`objExists $par`){
print {" parent not exist: \n:" + $par};
continue;
}
$ls_cur_par = `listRelatives -f -p $sel`;
if (size($ls_cur_par)){
if ($ls_cur_par[0] == $par){
print {" already there: \n:" + $sel};
continue;
}
}
parent $sel $par;
}
}