Files
tools/接口/RigTool.ms
T
2025-07-31 16:05:55 +08:00

408 lines
16 KiB
Plaintext

/*
编写代码注意事项:
1.控件移除后,不可访问任何属性以及数值
2.子栏目的高度固定为600,添加到子栏目后,原卷展栏的高度会失效
*/
if RigToolUI != undefined do (try(destroydialog RigToolUI)catch())
global L_rollout=#() --左侧子栏目
global R_rollout=#() --右侧子栏目
fn remove_L_rollout= --移除左侧子栏目
(
local ui_height=RigToolUI.height
for i=1 to L_rollout.count do removesubrollout RigToolUI.RTleft L_rollout[i]
free L_rollout
if (ui_height>=600) and (L_rollout.count==0) and (R_rollout.count==0) then RigToolUI.height -=600
)
fn remove_R_rollout= --移除右侧子栏目
(
local ui_height=RigToolUI.height
for i=1 to R_rollout.count do removesubrollout RigToolUI.RTright R_rollout[i]
free R_rollout
if (ui_height>=600) and (L_rollout.count==0) and (R_rollout.count==0) then RigToolUI.height -=600
)
rollout NewRig "新建绑定" width:300 height:600
(
--bitmap bmp1 "Bitmap" pos:[10,10] width:285 height:140 align:#center fileName:("C:\Users\ab\Desktop\RigTool\ctrlcolor\mainabout.png") --bitmap:(bitmap 285 140 color:[255,255,255])
label lab01 "请输入新绑定名称:"
edittext cus_rig_name "" width:250 align:#center
button apply_name "确定" width:50 height:30
)
rollout setupmodules "模块创建" width:318 height:300
(
GroupBox RTspline "条带样条线模块(脖子,脊椎)" width:290 height:120 pos:[10,10]
edittext pre_spline_name "名称" pos:[30,30] width:250
spinner spline_joints "关节数量" pos:[30,50] width:250 range:[0,100,3] type:#integer
radiobuttons spline_twisk "" labels:#("X轴扭曲","Y轴扭曲") pos:[30,70] columns:2
checkbox spline_mirror "镜像模块" pos:[210,70] checked:false
button creatspline "创建条带" pos:[80,90] width:150 height:30
button spline_help "说明" pos:[250,90] width:35 height:30
GroupBox RTarms "手臂模块" width:290 height:180 pos:[10,140]
edittext pre_arm_name "名称" pos:[30,160] width:250
spinner upperarm_twistjoints "上臂扭曲骨骼" pos:[30,180] width:250 range:[0,100,2] type:#integer
spinner lowerarm_twistjoints "下臂扭曲骨骼" pos:[30,200] width:250 range:[0,100,2] type:#integer
radiobuttons arm_elbow_joints "" labels:#("单肘部关节","双肘部关节") pos:[30,220] columns:2
spinner midarm_twistjoints "中部扭曲骨骼" pos:[30,240] width:250 range:[0,100,2] type:#integer enabled:false
radiobuttons arm_mirror "" labels:#("仅左臂","双臂","仅右臂") pos:[30,260] default:2 columns:3
button creatarm "创建手臂" pos:[80,280] width:150 height:30
button arm_help "说明" pos:[250,280] width:35 height:30
on arm_elbow_joints changed sel do
if sel==2 then midarm_twistjoints.enabled=true else midarm_twistjoints.enabled=false
GroupBox RTlegs "腿部模块" width:290 height:180 pos:[10,330]
edittext pre_leg_name "名称" pos:[30,350] width:250
spinner upperleg_twistjoints "大腿扭曲骨骼" pos:[30,370] width:250 range:[0,100,2] type:#integer
spinner lowerleg_twistjoints "小腿扭曲骨骼" pos:[30,390] width:250 range:[0,100,2] type:#integer
radiobuttons leg_elbow_joints "" labels:#("单膝盖关节","双膝盖关节") pos:[30,410] columns:2
spinner midleg_twistjoints "中部扭曲骨骼" pos:[30,430] width:250 range:[0,100,2] type:#integer enabled:false
radiobuttons leg_mirror "" labels:#("仅左腿","双腿","仅右腿") pos:[30,450] default:2 columns:3
button creatleg "创建腿部" pos:[80,470] width:150 height:30
button leg_help "说明" pos:[250,470] width:35 height:30
on leg_elbow_joints changed sel do
if sel==2 then midleg_twistjoints.enabled=true else midleg_twistjoints.enabled=false
GroupBox RTFKchains "FK链模块(手指,舌头,尾巴,触须等)" width:290 height:170 pos:[10,520]
edittext pre_fkchains_name "名称" pos:[30,540] width:250
spinner fkchains_num "链条数量" pos:[30,560] width:250 range:[0,100,1] type:#integer
spinner fkchains_joints "每条链关节数" pos:[30,580] width:250 range:[0,100,1] type:#integer
radiobuttons fkchains_outer "" labels:#("X朝前","Y朝前","Z朝前","X朝后","Y朝后","Z朝后") pos:[30,600] default:2 columns:3
checkbox fkchains_mirror "镜像模块" pos:[30,630] checked:true
button creatfkchains "创建FK链" pos:[80,650] width:150 height:30
button fkchains_help "说明" pos:[250,650] width:35 height:30
GroupBox RThead "头部模块" width:290 height:140 pos:[10,700]
edittext pre_head_name "名称" pos:[30,720] width:250
checkbox jaw "下巴" pos:[30,740] checked:true
radiobuttons head_twist "" labels:#("X轴扭曲","Y轴扭曲") pos:[30,760] default:1 columns:2
checkbox head_mirror "镜像模块" pos:[30,780] checked:true
button creathead "创建头部" pos:[80,800] width:150 height:30
button head_help "说明" pos:[250,800] width:35 height:30
GroupBox RTlookat "注视模块" width:290 height:150 pos:[10,850]
edittext pre_lookat_name "名称" pos:[30,870] width:250
spinner lookat_joints "关节数量" pos:[30,890] width:250 range:[0,100,1] type:#integer
radiobuttons lookat_outer "" labels:#("X朝前","Y朝前","Z朝前","X朝后","Y朝后","Z朝后") pos:[30,910] default:2 columns:3
checkbox lookat_mirror "镜像模块" pos:[30,940] checked:true
button creatlookat "创建注视" pos:[80,960] width:150 height:30
button lookat_help "说明" pos:[250,960] width:35 height:30
GroupBox RTauxiliary "辅助关节模块" width:290 height:100 pos:[10,1010]
edittext pre_auxiliary_name "名称" pos:[30,1030] width:250
checkbox auxiliary_mirror "镜像关节" pos:[30,1050] checked:true
button creatauxiliary "创建辅助关节" pos:[80,1070] width:150 height:30
button auxiliary_help "说明" pos:[250,1070] width:35 height:30
)
rollout editmodules "模块编辑" width:318 height:300
(
GroupBox RTspline "条带样条线模块(脖子,脊椎)" width:290 height:120 pos:[10,10]
edittext pre_spline_name "名称" pos:[30,30] width:250
spinner spline_joints "关节数量" pos:[30,50] width:250 range:[0,100,3] type:#integer
radiobuttons spline_twisk "" labels:#("X轴扭曲","Y轴扭曲") pos:[30,70] columns:2
button creatspline "应用条带" pos:[80,90] width:150 height:30
button spline_load "载入" pos:[20,90] width:35 height:30
button spline_help "说明" pos:[250,90] width:35 height:30
GroupBox RTarms "手臂模块" width:290 height:180 pos:[10,140]
edittext pre_arm_name "名称" pos:[30,160] width:250
spinner upperarm_twistjoints "上臂扭曲骨骼" pos:[30,180] width:250 range:[0,100,2] type:#integer
spinner lowerarm_twistjoints "下臂扭曲骨骼" pos:[30,200] width:250 range:[0,100,2] type:#integer
radiobuttons arm_elbow_joints "" labels:#("单肘部关节","双肘部关节") pos:[30,220] columns:2
spinner midarm_twistjoints "中部扭曲骨骼" pos:[30,240] width:250 range:[0,100,2] type:#integer enabled:false
label arm_label01 "" pos:[30,260]
button creatarm "应用手臂" pos:[80,280] width:150 height:30
button arm_load "载入" pos:[20,280] width:35 height:30
button arm_help "说明" pos:[250,280] width:35 height:30
on arm_elbow_joints changed sel do
if sel==2 then midarm_twistjoints.enabled=true else midarm_twistjoints.enabled=false
GroupBox RTlegs "腿部模块" width:290 height:180 pos:[10,330]
edittext pre_leg_name "名称" pos:[30,350] width:250
spinner upperleg_twistjoints "大腿扭曲骨骼" pos:[30,370] width:250 range:[0,100,2] type:#integer
spinner lowerleg_twistjoints "小腿扭曲骨骼" pos:[30,390] width:250 range:[0,100,2] type:#integer
radiobuttons leg_elbow_joints "" labels:#("单膝盖关节","双膝盖关节") pos:[30,410] columns:2
spinner midleg_twistjoints "中部扭曲骨骼" pos:[30,430] width:250 range:[0,100,2] type:#integer enabled:false
label leg_label01 "" pos:[30,450]
button creatleg "应用腿部" pos:[80,470] width:150 height:30
button leg_load "载入" pos:[20,470] width:35 height:30
button leg_help "说明" pos:[250,470] width:35 height:30
on leg_elbow_joints changed sel do
if sel==2 then midleg_twistjoints.enabled=true else midleg_twistjoints.enabled=false
GroupBox RTFKchains "FK链模块(手指,舌头,尾巴,触须等)" width:290 height:170 pos:[10,520]
edittext pre_fkchains_name "名称" pos:[30,540] width:250
spinner fkchains_num "链条数量" pos:[30,560] width:250 range:[0,100,1] type:#integer
spinner fkchains_joints "每条链关节数" pos:[30,580] width:250 range:[0,100,1] type:#integer
label fkchains_label01 "" pos:[30,600]
label fkchains_label02 "" pos:[30,620]
button creatfkchains "应用FK链" pos:[80,650] width:150 height:30
button fkchains_load "载入" pos:[20,650] width:35 height:30
button fkchains_help "说明" pos:[250,650] width:35 height:30
GroupBox RThead "头部模块" width:290 height:140 pos:[10,700]
edittext pre_head_name "名称" pos:[30,720] width:250
checkbox jaw "下巴" pos:[30,740] checked:true
radiobuttons head_twist "" labels:#("X轴扭曲","Y轴扭曲") pos:[30,760] default:1 columns:2
label head_label01 "" pos:[30,780]
button creathead "应用头部" pos:[80,800] width:150 height:30
button head_load "载入" pos:[20,800] width:35 height:30
button head_help "说明" pos:[250,800] width:35 height:30
GroupBox RTlookat "注视模块" width:290 height:150 pos:[10,850]
edittext pre_lookat_name "名称" pos:[30,870] width:250
spinner lookat_joints "关节数量" pos:[30,890] width:250 range:[0,100,1] type:#integer
label lookat_label01 "" pos:[30,910]
label lookat_label02 "" pos:[30,940]
button creatlookat "应用注视" pos:[80,960] width:150 height:30
button lookat_load "载入" pos:[20,960] width:35 height:30
button lookat_help "说明" pos:[250,960] width:35 height:30
)
rollout Advancedmodules "模块高级设置" width:300 height:600
(
local imagespath=#("","","","","","","","","","")
label label01 "----------------覆盖模块颜色------------------"
button ctrlcolor01 "1" width:50 height:20 across:5
button ctrlcolor02 "2" width:50 height:20
button ctrlcolor03 "3" width:50 height:20
button ctrlcolor04 "4" width:50 height:20
button ctrlcolor05 "5" width:50 height:20
button ctrlcolor06 "6" width:50 height:20 across:5
button ctrlcolor07 "7" width:50 height:20
button ctrlcolor08 "8" width:50 height:20
button ctrlcolor09 "9" width:50 height:20
button ctrlcolor10 "10" width:50 height:20
colorPicker thecolor "" color:[255,0,0] modal:false width:280 height:20
label label002 ""
label label003 ""
label label004 "----------------镜像模块------------------"
edittext mirror_modules_name "模块名称" width:240 align:#left across:2
button mirror_modules_load "载入" width:30 align:#right
radiobuttons mirror_LR "" labels:#("对齐左边","对齐右边") default:1 columns:2 align:#center
button mirror_modules_apply "应用模块镜像" width:150 align:#center height:30
label label02 ""
label label03 ""
label label04 "----------------重命名模块------------------"
edittext modules_name "模块新名称" width:240 align:#left across:2
button modules_name_load "载入" width:30 align:#right
button modules_name_apply "应用模块名称" width:150 align:#center height:30
label label05 ""
label label06 ""
label label07 "----------------模块父节点------------------"
edittext modules_parent "新链接模块" width:240 align:#left across:2
button modules_parent_load "载入" width:30 align:#right
button modules_parent_apply "将选定模块链接到新模块" width:150 align:#center height:30
label label08 ""
label label09 ""
label label10 "----------------删除模块------------------"
button modules_delete "删除选定模块" width:150 align:#center height:30
on Advancedmodules open do
(
for i =1 to 10 do imagespath[i]=("C:\Users\ab\Desktop\RigTool\ctrlcolor\\"+ i as string +".png")
ctrlcolor01.images=#(imagespath[1],(bitmap 50 20 color:[0,0,0]),1,1,1,1,1)
ctrlcolor02.images=#(imagespath[2],undefined,1,1,1,1,1)
ctrlcolor03.images=#(imagespath[3],undefined,1,1,1,1,1)
ctrlcolor04.images=#(imagespath[4],undefined,1,1,1,1,1)
ctrlcolor05.images=#(imagespath[5],undefined,1,1,1,1,1)
ctrlcolor06.images=#(imagespath[6],undefined,1,1,1,1,1)
ctrlcolor07.images=#(imagespath[7],undefined,1,1,1,1,1)
ctrlcolor08.images=#(imagespath[8],undefined,1,1,1,1,1)
ctrlcolor09.images=#(imagespath[9],undefined,1,1,1,1,1)
ctrlcolor10.images=#(imagespath[10],undefined,1,1,1,1,1)
)
)
rollout RTctrlrig "生成/删除绑定" width:300 height:600
(
GroupBox creat_ctrlrig "生成绑定" width:290 height:100 pos:[10,10]
checkbox custom_prefix "添加自定义前缀名称" pos:[30,30] checked:false
edittext custom_prefix_name "名称" pos:[30,50] width:250 enabled:false
button create_rig "生成绑定" pos:[80,70] width:150 height:30
GroupBox delete_ctrlrig "删除绑定" width:290 height:100 pos:[10,120]
checkbox delete_bones "是否删除骨骼" pos:[30,150] checked:false
button delete_rig "删除绑定" pos:[80,170] width:150 height:30
on custom_prefix changed thestate do
if custom_prefix.state==true then custom_prefix_name.enabled=true else custom_prefix_name.enabled=false
)
rollout RTctrlsetup "控制器设置" width:300 height:600
(
local imagespath=#("","","","","","","","","","")
label label01 "----------------控制器颜色------------------"
button ctrlcolor01 "1" width:50 height:20 across:5
button ctrlcolor02 "2" width:50 height:20
button ctrlcolor03 "3" width:50 height:20
button ctrlcolor04 "4" width:50 height:20
button ctrlcolor05 "5" width:50 height:20
button ctrlcolor06 "6" width:50 height:20 across:5
button ctrlcolor07 "7" width:50 height:20
button ctrlcolor08 "8" width:50 height:20
button ctrlcolor09 "9" width:50 height:20
button ctrlcolor10 "10" width:50 height:20
colorPicker thecolor "" color:[255,0,0] modal:false width:280 height:20
label label02 ""
label label03 ""
label label04 "----------------控制器缩放------------------"
checkbox x_scale "X轴局部" across:4 align:#left
checkbox y_scale "Y轴局部" align:#center
checkbox z_scale "Z轴局部" align:#center
checkbox mirror_scale "镜像" align:#right
slider scale_parmeter "" ticks:5 range:[0,100,50] type:#integer width:280 align:#center
label label05 "缩放比例:50%" align:#center
button apply_scale "应用缩放" width:150 height:30
on RTctrlsetup open do
(
for i =1 to 10 do imagespath[i]=("C:\Users\ab\Desktop\RigTool\ctrlcolor\\"+ i as string +".png")
ctrlcolor01.images=#(imagespath[1],(bitmap 50 20 color:[0,0,0]),1,1,1,1,1)
ctrlcolor02.images=#(imagespath[2],undefined,1,1,1,1,1)
ctrlcolor03.images=#(imagespath[3],undefined,1,1,1,1,1)
ctrlcolor04.images=#(imagespath[4],undefined,1,1,1,1,1)
ctrlcolor05.images=#(imagespath[5],undefined,1,1,1,1,1)
ctrlcolor06.images=#(imagespath[6],undefined,1,1,1,1,1)
ctrlcolor07.images=#(imagespath[7],undefined,1,1,1,1,1)
ctrlcolor08.images=#(imagespath[8],undefined,1,1,1,1,1)
ctrlcolor09.images=#(imagespath[9],undefined,1,1,1,1,1)
ctrlcolor10.images=#(imagespath[10],undefined,1,1,1,1,1)
)
on scale_parmeter changed val do
(
label05.text=("缩放比例:"+ val as string+"%")
)
on thecolor changed newcolor do selection.wirecolor = newcolor
)
rollout RTctrlselect "选择器" width:300 height:600
(
button btn1 "功能1"
)
rollout RigToolUI "绑定工具" width:700 height:60
(
checkbutton btnsub1 "创建Rig" width:50 height:20 across:5
button btnsub2 "移除左侧" width:70 height:20
button btnsub3 "移除右侧" width:70 height:20
button btnsub4 "打印" width:50 height:20
button btnsub5 "button" width:50 height:20
button btnsub6 "button" width:50 height:20 across:5
button btnsub7 "button" width:50 height:20
button btnsub8 "button" width:50 height:20
button btnsub9 "button" width:50 height:20
button btnsub10 "button" width:50 height:20
subrollout RTleft "" height:600 across:2
subrollout RTright "" height:600 across:2
on btnsub2 pressed do remove_L_rollout()
on btnsub3 pressed do remove_R_rollout()
on btnsub4 pressed do try (print RigToolUI.RTright.Advancedmodules.modules_name.text) catch()
on btnsub1 changed thestate do
if thestate then
(
remove_L_rollout()
remove_R_rollout()
RigToolUI.height +=600
addsubrollout RigToolUI.RTleft NewRig rolledup:false ; append L_rollout NewRig
addsubrollout RigToolUI.RTleft setupmodules rolledup:true ; append L_rollout setupmodules
addsubrollout RigToolUI.RTleft editmodules rolledup:true ; append L_rollout editmodules
addsubrollout RigToolUI.RTleft RTctrlrig rolledup:true ; append L_rollout RTctrlrig
addsubrollout RigToolUI.RTright Advancedmodules rolledup:false ; append R_rollout Advancedmodules
addsubrollout RigToolUI.RTright RTctrlsetup rolledup:true ; append R_rollout RTctrlsetup
)
else (remove_L_rollout() ;remove_R_rollout())
/*
(
removesubrollout RigToolUI.RTleft NewRig
removesubrollout RigToolUI.RTleft setupmodules
removesubrollout RigToolUI.RTleft editmodules
removesubrollout RigToolUI.RTleft RTctrlrig
removesubrollout RigToolUI.RTright Advancedmodules
removesubrollout RigToolUI.RTright RTctrlsetup
)
*/
)
createDialog RigToolUI