Цитата
//main window
global proc ToVertex()
{
if ( `window -exists ToVertexMinip`)
deleteUI ToVertexMinip;
if ( `window -exists ToVertexUI`)
deleteUI ToVertexUI;
string $sel[] = `ls -sl -fl`;
if (`size $sel` == 0)
error "No object selected";
string $obj = `match "^[^\.]*" $sel[0]`;
int $vertexNum[] = `polyEvaluate -v $obj`;
window ToVertexUI;
columnLayout -adj 1;
button -w 256 -l "Create joints on selected vertecies" -c ("selV " + $obj);
button -w 256 -l "New Object" -c "ToVertex";
button -w 256 -l "Close" -c "deleteUI ToVertexUI";
window -edit -wh 271 122 -t ( "To Vertex : " + $obj )ToVertexUI;
showWindow ToVertexUI;
}
//create joints
global proc selV(string $obj)
{
string $sel[] = `ls -sl -fl`;
string $jointGroup = `group -em -n ( $obj + "_Joints" )`;
for ($each in $sel)
{
string $bone = `joint`;
float $pos[] = `pointPosition $each`;
move $pos[0] $pos[1] $pos[2] $bone;
parent -w;
string $sphere[] = `sphere -r 0.7`;
move $pos[0] $pos[1] $pos[2] $sphere[0];
parent $sphere[0] $jointGroup;
parent $bone $sphere[0]; //вот здесь проблема верхняя строка теряет силу
}
ToVertexMinip $obj $jointGroup;
}
//minipulate window
global proc ToVertexMinip (string $obj, string $group)
{
if ( `window -exists ToVertexUI`)
deleteUI ToVertexUI;
if ( `window -exists ToVertexMinip`)
deleteUI ToVertexMinip;
window ToVertexMinip;
columnLayout -adj 1;
floatSliderGrp
-l "joint size"
-en 1
-dc "jointDisplayScale #1"
-pre 3
-field 1
-cw3 102 50 50
-adj 3
-min 0.001
-max 2.000
-v 0.10
;
button -l "Bind" -c ("bindObj " + $group + " " + $obj);
button -l "New Object" -c "ToVertex";
button -l "Close" -c "deleteUI ToVertexMinip";
window -edit -wh 279 139 -t ( "To Vertex : " + $obj ) ToVertexMinip;
showWindow ToVertexMinip;
select -cl;
}
//bind options
global proc bindObj (string $group, string $obj)
{
string $joints[] = `listRelatives -c $group`;
select -r $joints $obj;
SmoothBindSkin -tsb -bcp -cj;
select -cl;
}
global proc ToVertex()
{
if ( `window -exists ToVertexMinip`)
deleteUI ToVertexMinip;
if ( `window -exists ToVertexUI`)
deleteUI ToVertexUI;
string $sel[] = `ls -sl -fl`;
if (`size $sel` == 0)
error "No object selected";
string $obj = `match "^[^\.]*" $sel[0]`;
int $vertexNum[] = `polyEvaluate -v $obj`;
window ToVertexUI;
columnLayout -adj 1;
button -w 256 -l "Create joints on selected vertecies" -c ("selV " + $obj);
button -w 256 -l "New Object" -c "ToVertex";
button -w 256 -l "Close" -c "deleteUI ToVertexUI";
window -edit -wh 271 122 -t ( "To Vertex : " + $obj )ToVertexUI;
showWindow ToVertexUI;
}
//create joints
global proc selV(string $obj)
{
string $sel[] = `ls -sl -fl`;
string $jointGroup = `group -em -n ( $obj + "_Joints" )`;
for ($each in $sel)
{
string $bone = `joint`;
float $pos[] = `pointPosition $each`;
move $pos[0] $pos[1] $pos[2] $bone;
parent -w;
string $sphere[] = `sphere -r 0.7`;
move $pos[0] $pos[1] $pos[2] $sphere[0];
parent $sphere[0] $jointGroup;
parent $bone $sphere[0]; //вот здесь проблема верхняя строка теряет силу
}
ToVertexMinip $obj $jointGroup;
}
//minipulate window
global proc ToVertexMinip (string $obj, string $group)
{
if ( `window -exists ToVertexUI`)
deleteUI ToVertexUI;
if ( `window -exists ToVertexMinip`)
deleteUI ToVertexMinip;
window ToVertexMinip;
columnLayout -adj 1;
floatSliderGrp
-l "joint size"
-en 1
-dc "jointDisplayScale #1"
-pre 3
-field 1
-cw3 102 50 50
-adj 3
-min 0.001
-max 2.000
-v 0.10
;
button -l "Bind" -c ("bindObj " + $group + " " + $obj);
button -l "New Object" -c "ToVertex";
button -l "Close" -c "deleteUI ToVertexMinip";
window -edit -wh 279 139 -t ( "To Vertex : " + $obj ) ToVertexMinip;
showWindow ToVertexMinip;
select -cl;
}
//bind options
global proc bindObj (string $group, string $obj)
{
string $joints[] = `listRelatives -c $group`;
select -r $joints $obj;
SmoothBindSkin -tsb -bcp -cj;
select -cl;
}