MetaFusion/Reference/SuperRiggingEditor/scripts/SGRBFDeformerWindow.mel
2025-02-03 22:58:41 +08:00

111 lines
3.4 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//******************************************************************************
//
// 版权所有: 玉溪时光科技有限公司
// 联系邮箱: q.100@qq.com
// 开发日期: 2024/11/18
//
//******************************************************************************
global proc SGRBFDeformerWindow(){
if (!`window -ex SuperRiggingEditor`){
return;
}
if (`window -ex RBFDeformerWin`){
deleteUI -window RBFDeformerWin;
}
string $Load = "Load...";
string $Original = "Original";
string $Deformed = "Deformed";
string $Radius = "Radius";
string $Points = "Points";
string $Execute = "Execute";
if(`SGDescriptor -l` == "ZH"){
$Load = "加载...";
$Original = "原始模型:";
$Deformed = "变形模型:";
$Radius = "计算半径:";
$Points = "计算点数:";
$Execute = "开始执行";
}
window -p SuperRiggingEditor -w 310 -h 100 -t "RBF Deformer" -s true -tb true RBFDeformerWin;
columnLayout -adj 1 -columnAttach "both" 5 -rowSpacing 2 -columnWidth 150 ;
separator -height 10 -style "in";
textFieldButtonGrp -adj 2 -cw3 70 1 30 -l $Original -bl $Load -bc "SGRBFDeformerLoadOriginal;" RBFDeformer_Original;
textFieldButtonGrp -adj 2 -cw3 70 1 30 -l $Deformed -bl $Load -bc "SGRBFDeformerLoadDeformed;" RBFDeformer_Deformed;
separator -height 10 -style "in";
rowLayout -adj 3 -nc 3 -cw3 70 70 1 -ct3 "right" "left" "left";
text -l $Radius;
floatField -w 70 -max 2 -min 0.001 -v 0.1 -cc "SGSetRadiusSlider;" RBFDeformer_RadiusField;
floatSlider -max 2 -min 0.001 -v 0.1 -dc "SGSetRadiusField;" RBFDeformer_RadiusSlider;
setParent..;
rowLayout -adj 3 -nc 3 -cw3 70 70 1 -ct3 "right" "left" "left";
text -l $Points;
intField -w 70 -max 10000 -min 100 -v 2000 -cc "SGSetPointsSlider;" RBFDeformer_PointsField;
intSlider -max 10000 -min 100 -v 2000 -dc "SGSetPointsField;" RBFDeformer_PointsSlider;
setParent..;
separator -height 10 -style "in";
button -l $Execute -al "center" -c "SGRBFDeformerExecute;" RBFDeformer_Execute;
separator -height 10 -style "in";
showWindow RBFDeformerWin;
}
global proc SGRBFDeformerExecute(){
string $Original = `textFieldButtonGrp -q -tx RBFDeformer_Original`;
string $Deformed = `textFieldButtonGrp -q -tx RBFDeformer_Deformed`;
float $Radius = `floatField -q -v RBFDeformer_RadiusField`;
int $Points = `intField -q -v RBFDeformer_PointsField`;
int $OrgVtx[] = `polyEvaluate -v $Original`;
int $DefVtx[] = `polyEvaluate -v $Deformed`;
if($OrgVtx[0] != $DefVtx[0]){
error -n "The topology of the two models is inconsistent...";
return ;
}
string $sel[] = `ls -sl`;
SGRBFDeformer -r $Radius -np $Points -rbf 1 -m $Original $Deformed -t $sel;
}
global proc SGRBFDeformerLoadOriginal(){
string $sel[] = `ls -sl`;
textFieldButtonGrp -e -tx $sel[0] RBFDeformer_Original;
}
global proc SGRBFDeformerLoadDeformed(){
string $sel[] = `ls -sl`;
textFieldButtonGrp -e -tx $sel[0] RBFDeformer_Deformed;
}
global proc SGSetRadiusField(){
float $v = `floatSlider -q -v RBFDeformer_RadiusSlider`;
floatField -e -v $v RBFDeformer_RadiusField;
}
global proc SGSetRadiusSlider(){
float $v = `floatField -q -v RBFDeformer_RadiusField`;
floatSlider -e -v $v RBFDeformer_RadiusSlider;
}
global proc SGSetPointsField(){
int $v = `intSlider -q -v RBFDeformer_PointsSlider`;
intField -e -v $v RBFDeformer_PointsField;
}
global proc SGSetPointsSlider(){
int $v = `intField -q -v RBFDeformer_PointsField`;
intSlider -e -v $v RBFDeformer_PointsSlider;
}